private static void StopAndDispose(WireMockServer server)
 {
     if (server != null && server.IsStarted)
     {
         server.Stop();
     }
     server?.Dispose();
 }
Пример #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         mockServer.Stop();
         mockServer.Dispose();
     }
 }
        protected virtual void Dispose(bool disposing)
        {
            var memoryCache = _apiFixture.GetService <IMemoryCache>();

            memoryCache.Remove(_systemSettings.FilmesCacheKey);

            _wireMockServer.Dispose();
            _httpClient.Dispose();
        }
Пример #4
0
 public void Dispose()
 {
     _client?.Dispose();
     _factory?.Dispose();
     _apiPaises = null;
     _apiServer?.Dispose();
     _paisesLogger = null;
     _mockConfig?.Dispose();
 }
Пример #5
0
        public void Dispose()
        {
            var dbContext = _server.Services.GetRequiredService <SampleDbContext>();

            dbContext.Urls.RemoveRange(dbContext.Urls);
            dbContext.SaveChanges();

            _api.Dispose();

            _server.Dispose();
        }
Пример #6
0
        private static string _hashedAccountId = "LVX89V"; // Account ID 100

        static void Main(string[] args)
        {
            try
            {
                _fakeCommitmentsApi = WireMockServer.Start(new FluentMockServerSettings
                {
                    Urls = new[] { "http://*:6011" },
                    StartAdminInterface = true,
                });

                _fakeAccountsApi = WireMockServer.Start(new FluentMockServerSettings
                {
                    Urls = new[] { "http://*:6012" },
                    StartAdminInterface = true,
                });

                _fakeCustomerEngagementApi = WireMockServer.Start(new FluentMockServerSettings
                {
                    Urls = new[] { "http://*:6013" },
                    StartAdminInterface = true,
                });

                SetupHealthCheckResponse();
                SetupApprenticeshipSearchResponses();
                SetupGetApprenticeshipResponses();

                SetupGetLegalEntityResponse();

                SetupGetVendorDetailsResponse();
                SetupGetVendorCaseStatusResponse();

                Console.WriteLine(("Please RETURN to stop server"));
                Console.ReadLine();
            }
            finally
            {
                _fakeCommitmentsApi.Stop();
                _fakeCommitmentsApi.Dispose();

                _fakeAccountsApi.Stop();
                _fakeAccountsApi.Dispose();

                _fakeCustomerEngagementApi.Stop();
                _fakeCustomerEngagementApi.Dispose();
            }
        }
Пример #7
0
        protected virtual void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (_server != null && _server.IsStarted)
                {
                    _server.Stop();
                }

                _server?.Dispose();
            }

            _isDisposed = true;
        }
Пример #8
0
        static void Main(string[] args)
        {
            if (args.Contains("--h"))
            {
                Console.WriteLine("examples:");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis --h                 <-- shows this page");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis                     <-- runs Provider Courses API");

                return;
            }

            try
            {
                _fakeProviderCoursesApi = ProviderCoursesApiBuilder.Create(PortProviderCoursesApi)
                                          .WithPing()
                                          .WithHasPortableFlexiJobOption(PeterboroughCollege, CourseWithMultipleDeliveryModels)
                                          .WithHasPortableFlexiJobOptionFalse(PeterboroughCollege, CourseWithOnlyRegularDeliveryModel)
                                          .WithNoCoursesDeliveryModels404(PeterboroughCollege, CourseWithNoDeliveryModelsFound)
                                          .Build();

                Console.WriteLine("");
                Console.WriteLine($"Provider (Peterborough College) : {PeterboroughCollege}");
                Console.WriteLine($"Course (Course With Multiple Delivery Models) : {CourseWithMultipleDeliveryModels}");
                Console.WriteLine($"Course (Course With Only Regular Delivery Model) : {CourseWithOnlyRegularDeliveryModel}");
                Console.WriteLine($"Course (Course With No Delivery Model) : {CourseWithNoDeliveryModelsFound}");
                Console.WriteLine("");

                Console.WriteLine(("Please RETURN to stop server"));
                Console.ReadLine();
            }
            finally
            {
                _fakeProviderCoursesApi?.Stop();
                _fakeProviderCoursesApi?.Dispose();
            }
        }
Пример #9
0
 public void Dispose()
 {
     _server?.Stop();
     _server?.Dispose();
 }
Пример #10
0
 public void Dispose()
 {
     server.Dispose();
 }
Пример #11
0
 public void TearDown()
 {
     _driver.Dispose();
     _server.Dispose();
 }
 public void TearDown()
 {
     _server?.Dispose();
 }
 public void Dispose() => _server.Dispose();
Пример #14
0
 public void Dispose()
 {
     Server.Stop();
     Server.Dispose();
 }
Пример #15
0
 public void Dispose()
 {
     _server?.Dispose();
 }
 public void TearDown()
 {
     _wireMock.Dispose();
 }
Пример #17
0
        static void Main(string[] args)
        {
            if (args.Contains("--h"))
            {
                Console.WriteLine("Optional parameters (!inner, !accounts, !commitments, !login, !roatp, !courses) will exclude that fake API");
                Console.WriteLine("examples:");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis --h                 <-- shows this page");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis !inner              <-- excludes fake inner api");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis !inner !commitments <-- excludes fake inner and commitments api");
                Console.WriteLine("SFA.DAS.ApprenticeCommitments.MockApis !login !roatp       <-- excludes fake login and roatp api");

                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("Currently supported values");
                Console.WriteLine($"EmployerAccountId : {EmployerAccountId}");
                Console.WriteLine($"ApprenticeshipId : {ApprenticeshipId}");
                Console.WriteLine($"TrainingProviderId : {TrainingProviderId}");

                return;
            }

            try
            {
                if (!args.Contains("!inner", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeInnerApi = ApprenticeCommitmentsInnerApiBuilder.Create(PortInnerApi)
                                    .WithPing()
                                    .WithAnyNewApprenticeship()
                                    .WithRegistrationReminders()
                                    .WithReminderSent()
                                    .WithRegistrationSeen()
                                    .WithExistingApprenticeship()
                                    .WithHowApprenticeshipWillBeDelivered()
                                    .Build();
                }

                if (!args.Contains("!accounts", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeInnerApi = ApprenticeAccountsApiBuilder.Create(PortAccountsApi)
                                    .WithPing()
                                    .WithAnyApprentice()
                                    .Build();
                }

                if (!args.Contains("!commitments", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeCommitmentsV2Api = CommitmentsV2ApiBuilder.Create(PortCommitmentsApi)
                                            .WithPing()
                                            .WithAValidApprentice(EmployerAccountId, ApprenticeshipId, CourseId)
                                            //.WithAnyApprenticeship()
                                            .Build();
                }

                if (!args.Contains("!login", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeApprenticeLoginApi = ApprenticeLoginApiBuilder.Create(PortLoginApi)
                                              .WithPing()
                                              .WithAnyInvitation()
                                              .Build();
                }

                if (!args.Contains("!roatp", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeTrainingProviderApi = TrainingProviderApiBuilder.Create(PortRoatpApi)
                                               .WithPing()
                                               .WithValidSearch(TrainingProviderId)
                                               .Build();
                }

                if (!args.Contains("!courses", StringComparer.CurrentCultureIgnoreCase))
                {
                    _fakeCoursesApi = CoursesApiBuilder.Create(PortCoursesApi)
                                      .WithPing()
                                      .WithCourses(CourseId)
                                      .WithCoursesForStandardUIds()
                                      .Build();
                }

                Console.WriteLine(("Please RETURN to stop server"));
                Console.ReadLine();
            }
            finally
            {
                _fakeInnerApi?.Stop();
                _fakeInnerApi?.Dispose();

                _fakeCommitmentsV2Api?.Stop();
                _fakeCommitmentsV2Api?.Dispose();

                _fakeApprenticeLoginApi?.Stop();
                _fakeApprenticeLoginApi?.Dispose();

                _fakeTrainingProviderApi?.Stop();
                _fakeTrainingProviderApi?.Dispose();

                _fakeCoursesApi?.Stop();
                _fakeCoursesApi?.Dispose();
            }
        }
 public void Dispose()
 {
     _cts.Cancel();
     _mockServer.Stop();
     _mockServer.Dispose();
 }
Пример #19
0
 protected virtual void Dispose(bool disposing)
 {
     _wireMockServer.Dispose();
     _httpClient.Dispose();
 }
 public void Dispose()
 {
     _server?.Stop();
     _server?.Dispose();
     _httpClient?.Dispose();
 }