title: Running Kestrel for testing without using the TestServer included in Microsoft.AspNetCore.TestHost
body: <p>I'm using SoapCore for creating a WCF-ish kind of application using asp.net core 2.</p>
  
  <p>This works fine for me so for but I've somewhat hit a brickwall when it comes to integration testing my endpoints. </p>
  
  <p>Since SoapCore is a middleware and has no relation to any api controllers I'm not able to use an HttpClient for testing the endpoints, hence the TestServer is of no use to me.</p>
  
  <p>My question is how do I run kestrel side by side with my integration test without using the TestServer, or is there a way to utilize the TestServer in this case?</p>
  
  <p>I don't think any code here might be of any use but what I got so far is as follows.</p>
  
  <p>Startup.cs</p>
  
  <pre><code>public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddTransient&lt;IPaymentService&gt;(service =&gt; new Services.PaymentService());
          services.AddMvc();
      }
  
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseSoapEndpoint&lt;IPaymentService&gt;("/PaymentService.svc", new BasicHttpBinding());
          app.UseMvc();
      }
  }
  </code></pre>
  
  <p>PaymentService</p>
  
  <pre><code>[ServiceContract]
  public interface IPaymentService
  {
      [OperationContract]
      string ReadPaymentFiles(string caller);
  }
  
   public class PaymentService : IPaymentService
  {
      public string ReadPaymentFiles(string caller)
      {
          return caller;
      }
  }
  </code></pre>
  
  <p>One of my tests:</p>
  
  <pre><code>public void Should_Get_Soap_Response_From_PaymentService()
      {
          var testServerFixture = new TestServerFixture();
          var binding = new BasicHttpBinding();
          var endpoint = new EndpointAddress(new Uri("http://localhost:5000/PaymentService.svc"));
          var channelFactory = new ChannelFactory&lt;IPaymentService&gt;(binding, endpoint);
  
          var serviceClient = channelFactory.CreateChannel();
          var response = serviceClient.ReadPaymentFiles("Ping");
          channelFactory.Close();
      }
  </code></pre>
  
  <p>The test does'nt do anything right now since it is not calling any live endpoint, which is my problem...</p>