Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save samueleresca/8bcc68857041f9c7d2b4bbb4beb9d5f7 to your computer and use it in GitHub Desktop.
using System;
using System.Net.Http;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
namespace Blog.Turnmeup.API.Tests
{
public class TestFixture<TStartup> : IDisposable where TStartup : class
{
public readonly TestServer Server;
private readonly HttpClient Client;
public TestFixture()
{
var builder = new WebHostBuilder()
.UseContentRoot($"..\\..\\..\\..\\..\\src\\Blog.Turnmeup.API\\")
.UseStartup<TStartup>();
Server = new TestServer(builder);
Client = new HttpClient();
}
public void Dispose()
{
Client.Dispose();
Server.Dispose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment