コード例 #1
0
 private static void ConfigureWireMockService(IServiceCollection services)
 {
     services.AddSingleton <IWireMockHttpService>(provider =>
     {
         var opts       = provider.GetService <IOptions <ApiStubOptions> >().Value;
         var repo       = provider.GetService <IDataRepository>();
         var httpClient = new WireMockHttpClient {
             BaseAddress = new Uri(opts.WireMockServiceApiBaseUrl)
         };
         return(new WireMockHttpService(httpClient, repo));
     });
 }
コード例 #2
0
 public WireMockHttpService(WireMockHttpClient client, IDataRepository repository)
 {
     _client     = client;
     _repository = repository;
     try
     {
         _mockServer = WireMockServer.Start(Guid.NewGuid().ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine("FAILED TO START WIREMOCK SERVICE");
         Console.WriteLine(e);
         throw;
     }
 }