Exemplo n.º 1
0
        public void PutShouldReturnResponseWithStatusCode405()
        {
            var controller = new GreetRequestController(_peopleModel);
            var result     = controller.Put("fake_body");

            Assert.Equal(405, result.StatusCode);
        }
Exemplo n.º 2
0
        public void DeleteShouldReturnResponseWithStatusCode405()
        {
            var controller = new GreetRequestController(_peopleModel);
            var result     = controller.Delete();

            Assert.Equal(405, result.StatusCode);
        }
Exemplo n.º 3
0
        public void ShouldReturnCorrectResponseWhenExecuted_GetRequest()
        {
            var controller = new GreetRequestController(_peopleModel);

            var result       = controller.Get();
            var responseBody =
                $"Hello David, Michael, Will - the time on the server is {DateTime.Now.ToShortTimeString()} on " +
                $"{DateTime.Now.ToLongDateString()}";
            var expected = new Response(200, responseBody);

            var resultJson   = JsonConvert.SerializeObject(result);
            var expectedJson = JsonConvert.SerializeObject(expected);

            Assert.Equal(expectedJson, resultJson);
        }