public async static Task <ApiTestServer> StartNew(IStuffHolder stuffHolder) { var testServer = new ApiTestServer(stuffHolder); await testServer.Start(); return(testServer); }
public async Task CanGetRealStuffFromApi() { var realStuffHolder = new RealStuffHolder("real stuff", TimeSpan.Zero); var testServer = await ApiTestServer.StartNew(realStuffHolder); var responseBody = GetStuffFromApi(testServer.baseUrl); Assert.Contains("real stuff", responseBody); await testServer.Stop(); }
public async Task CanGetFakeStuffFromApi() { var fakeStuffHolder = new InMemoryStuffHolder(); var testServer = await ApiTestServer.StartNew(fakeStuffHolder); var responseBody = GetStuffFromApi(testServer.baseUrl); Assert.Contains("fake stuff", responseBody); await testServer.Stop(); }