コード例 #1
0
        public async Task ReturnResultFromExpectedMethod()
        {
            var client = new WebApplicationFactory <Startup>().CreateClient();

            var postResponse = await client.SendJsonAsync("comments", HttpMethod.Post, new CommentCandidate
            {
                Result = CommentCandidate.Success
            });

            var putResponse = await client.SendJsonAsync("comments", HttpMethod.Put, new CommentCandidate
            {
                Result = CommentCandidate.Success
            });

            Assert.AreEqual("POST", (await postResponse.Content.ReadJsonAsync <Comment>()).From);
            Assert.AreEqual("PUT", (await putResponse.Content.ReadJsonAsync <Comment>()).From);
        }