public async Task StartContainersForScenarioRun(String scenarioName)
        {
            String testFolder = scenarioName;

            Logging.Enabled();

            Guid testGuid = Guid.NewGuid();

            this.TestId = testGuid;
            // Setup the container names
            this.ManagementAPIContainerName       = $"rest{testGuid:N}";
            this.EventStoreContainerName          = $"eventstore{testGuid:N}";
            this.SecurityServiceContainerName     = $"auth{testGuid:N}";
            this.SubscriberServiceId              = testGuid;
            this.SubscriptionServiceContainerName = $"subService{testGuid:N}";
            this.MessagingServiceContainerName    = $"messaging{testGuid:N}";

            this.EventStoreConnectionString =
                $"EventStoreSettings:ConnectionString=ConnectTo=tcp://admin:changeit@{this.EventStoreContainerName}:1113;VerboseLogging=true;";
            this.SecurityServiceAddress = $"AppSettings:SecurityService=http://{this.SecurityServiceContainerName}:5001";
            this.AuthorityAddress       = $"SecurityConfiguration:Authority=http://{this.SecurityServiceContainerName}:5001";
            this.SubscriptionServiceConnectionString =
                $"\"ConnectionStrings:SubscriptionServiceConfigurationContext={Setup.GetConnectionString("SubscriptionServiceConfiguration")}\"";
            this.ManagementAPIReadModelConnectionString = $"\"ConnectionStrings:ManagementAPIReadModel={Setup.GetConnectionString($"ManagementAPIReadModel{testGuid:N}")}\"";
            this.ManagementAPISeedingType = "SeedingType=IntegrationTest";
            this.MessagingServiceAddress  = $"ServiceAddresses:MessagingService=http://{this.MessagingServiceContainerName}:5002";

            this.SetupTestNetwork();
            this.SetupManagementAPIContainer(testFolder);
            this.SetupSecurityServiceContainer(testFolder);
            this.SetupEventStoreContainer(testFolder);
            this.SetupSubscriptionServiceContainer(testFolder);
            this.SetupMessagingService(testFolder);

            // Cache the ports
            this.ManagementApiPort    = this.ManagementAPIContainer.ToHostExposedEndpoint("5000/tcp").Port;
            this.EventStorePort       = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port;
            this.SecurityServicePort  = this.SecurityServiceContainer.ToHostExposedEndpoint("5001/tcp").Port;
            this.MessagingServicePort = this.MessagingServiceContainer.ToHostExposedEndpoint("5002/tcp").Port;

            await this.SetupSubscriptionServiceConfig(CancellationToken.None).ConfigureAwait(false);

            await this.SetupSecurityServiceConfig(CancellationToken.None).ConfigureAwait(false);

            // Setup the base address resolver
            Func <String, String> baseAddressResolver = api => $"http://127.0.0.1:{this.ManagementApiPort}";

            HttpClient httpClient = new HttpClient();


            this.GolfClubAdministratorClient = new GolfClubAdministratorClient(baseAddressResolver, httpClient);
            this.GolfClubClient         = new Service.Client.v2.GolfClubClient(baseAddressResolver, httpClient);
            this.PlayerClient           = new Service.Client.v2.PlayerClient(baseAddressResolver, httpClient);
            this.ReportingClient        = new Service.Client.v2.ReportingClient(baseAddressResolver, httpClient);
            this.HttpClient             = new HttpClient();
            this.HttpClient.BaseAddress = new Uri(baseAddressResolver(String.Empty));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiClient" /> class.
 /// </summary>
 /// <param name="golfClubClient">The golf club client.</param>
 /// <param name="tournamentClient">The tournament client.</param>
 /// <param name="reportingClient">The reporting client.</param>
 /// <param name="modelFactory">The model factory.</param>
 public ApiClient(IGolfClubClient golfClubClient,
                  ITournamentClient tournamentClient,
                  IReportingClient reportingClient,
                  IModelFactory modelFactory)
 {
     this.GolfClubClient   = golfClubClient;
     this.TournamentClient = tournamentClient;
     this.ReportingClient  = reportingClient;
     this.ModelFactory     = modelFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiClient" /> class.
 /// </summary>
 /// <param name="playerClient">The player client.</param>
 /// <param name="golfClubClient">The golf club client.</param>
 /// <param name="tournamentClient">The tournament client.</param>
 /// <param name="reportingClient">The reporting client.</param>
 public ApiClient(IPlayerClient playerClient,
                  IGolfClubClient golfClubClient,
                  ITournamentClient tournamentClient,
                  IReportingClient reportingClient)
 {
     this.PlayerClient     = playerClient;
     this.GolfClubClient   = golfClubClient;
     this.TournamentClient = tournamentClient;
     this.ReportingClient  = reportingClient;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignupPresenter" /> class.
 /// </summary>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="signupPage1">The signup page1.</param>
 /// <param name="signupPageGolfClubAdministrator1">The signup page golf club administrator1.</param>
 /// <param name="signupPageGolfClubAdministrator1ViewModel">The signup page golf club administrator1 view model.</param>
 /// <param name="golfClubClient">The golf club client.</param>
 public SignupPresenter(INavigationService navigationService, ISignupPage1 signupPage1,
                        ISignupPageGolfClubAdministrator1 signupPageGolfClubAdministrator1,
                        SignupPageGolfClubAdministrator1ViewModel signupPageGolfClubAdministrator1ViewModel,
                        IGolfClubClient golfClubClient)
 {
     this.NavigationService = navigationService;
     this.SignupPage1       = signupPage1;
     this.SignupPageGolfClubAdministrator1          = signupPageGolfClubAdministrator1;
     this.SignupPageGolfClubAdministrator1ViewModel = signupPageGolfClubAdministrator1ViewModel;
     this.GolfClubClient = golfClubClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TestDataGenerator"/> class.
 /// </summary>
 /// <param name="golfClubClient">The golf club client.</param>
 /// <param name="playerClient">The player client.</param>
 /// <param name="tournamentClient">The tournament client.</param>
 /// <param name="addressResolver">The address resolver.</param>
 public TestDataGenerator(IGolfClubClient golfClubClient,
                          IPlayerClient playerClient,
                          ITournamentClient tournamentClient,
                          Func <String, String> addressResolver)
 {
     this.GolfClubClient   = golfClubClient;
     this.PlayerClient     = playerClient;
     this.TournamentClient = tournamentClient;
     this.HttpClient       = new HttpClient();
     this.AddressResolver  = addressResolver;
     this.AccessTokens     = new Dictionary <String, TokenResponse>();
 }