This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --------------------------------------------------------------------------- | |
| # Prerequisites: | |
| # - .NET 8 SDK @ https://dotnet.microsoft.com/en-us/download/dotnet/8.0 | |
| # - NodeJS @ https://nodejs.org/en/download/package-manager | |
| # - Angular 18 CLI @ https://angular.dev/tools/cli/setup-local | |
| # --------------------------------------------------------------------------- | |
| # Download and install the template pack first | |
| dotnet new install OidcProxy.Net.Templates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --------------------------------------------------------------------------- | |
| # Prerequisites: | |
| # - .NET 8 SDK @ https://dotnet.microsoft.com/en-us/download/dotnet/8.0 | |
| # --------------------------------------------------------------------------- | |
| # Download and install the template pack first | |
| dotnet new install OidcProxy.Net.Templates | |
| # Scaffold the proxy | |
| dotnet new OidcProxy.Net --backend "https://api.myapp.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Threading.Tasks; | |
| using DotNet.Testcontainers.Builders; | |
| using DotNet.Testcontainers.Containers; | |
| using FluentAssertions; | |
| using Foo.Data; | |
| using Foo.Data.QueryHandlers; | |
| using Microsoft.EntityFrameworkCore; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var connectionString = "Server=127.0.0.1;Database=test;User Id=sa;Password=nunajabeezwax;TrustServerCertificate=True"; | |
| var options = new DbContextOptionsBuilder<BookContext>() | |
| .UseSqlServer(connectionString) | |
| .Options; | |
| using var context = new BookContext(options); | |
| context.Database.MigrateAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading.Tasks; | |
| namespace Foo.Tests; | |
| public class MyUnitTestWithTestContainers : IAsyncLifetime | |
| { | |
| public async Task InitializeAsync() | |
| { | |
| // This is your async setup. You can start your testcontainer here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dockerContainer = new ContainerBuilder() | |
| .WithName(Guid.NewGuid().ToString("D")) | |
| .WithImage("mcr.microsoft.com/mssql/server:2022-latest") | |
| .WithPortBinding(1433, 1433) | |
| .WithEnvironment(new Dictionary<string, string>() | |
| { | |
| { "ACCEPT_EULA", "Y" }, | |
| { "MSSQL_SA_PASSWORD", "nunnajabeezwax" } | |
| }) | |
| .Build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction; | |
| namespace CS; | |
| public class ImageClassifier | |
| { | |
| private readonly string _endpoint; | |
| private readonly string _key; | |
| public ImageClassifier(string endpoint, string key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Azure.CognitiveServices.Vision.ComputerVision; | |
| using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models; | |
| namespace Foo; | |
| public class ImageClassifier | |
| { | |
| private readonly string _endpoint; | |
| private readonly string _key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DriveCustomerToTrainStationFailedHandler : IHandleMessages<DriveCustomerToTrainStationFailed> | |
| { | |
| public IBus _messageBus; | |
| public IMap<DriveCustomerToTrainStationFailed, ArrangeAlternativeTransport> _arrangeAlternativeTransportMapper; | |
| public IMap<DriveCustomerToTrainStationFailed, UpdateCabRideQueryModel> _updateCabRideQueryModelMapper; | |
| public DriveCustomerToTrainStationFailedHandler(IBus messageBus, | |
| IMap<DriveCustomerToTrainStationFailed, ArrangeAlternativeTransport> arrangeAlternativeTransport, | |
| IMap<DriveCustomerToTrainStationFailed, UpdateCabRideQueryModel> updateCabRideQueryModel) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task Handle(DriveCustomerToTrainStation command) | |
| { | |
| var location = _commandMapper.MapLocation(command.Location); | |
| var customerId = _commandMapper.MapCustomerId(command.CustomerId); | |
| try | |
| { | |
| var cabRide = await _cabRideService.BringCustomerToTheTrainStation(customerId); | |
| DroveCustomerToTrainStation @event = _commandMapper.MapSuccessEvent(cabRide); | |
| await _messageBus.Publish(@event); |
NewerOlder