예제 #1
0
        public async static Task <ApiTestServer> StartNew(IStuffHolder stuffHolder)
        {
            var testServer = new ApiTestServer(stuffHolder);
            await testServer.Start();

            return(testServer);
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }