Beispiel #1
0
        public async Task Test1()
        {
            var factory = new TestWebApplicationFactory <Startup>();
            var client  = factory.CreateClient();

            var respone = await client.GetAsync("api/values");

            Assert.Equal(HttpStatusCode.OK, respone.StatusCode);
        }
Beispiel #2
0
        public async Task Test2()
        {
            var factory = new TestWebApplicationFactory <Startup>();
            var client  = factory.CreateClient();

            var req = new SendMessageRequest {
                Message = "a message"
            };

            var dd    = JsonConvert.SerializeObject(req);
            var input = new StringContent(dd, Encoding.UTF8, "application/json");

            var respone = await client.PostAsync("api/values", input);

            Assert.Equal(HttpStatusCode.OK, respone.StatusCode);
        }