Esempio n. 1
0
        public void GetData_UnknownIdPassed_ReturnsNoContent(int id)
        {
            var fakes       = new Fakes();
            var fakeService = fakes.FakeErrorLogDataService().Object;

            var controller = new ErrorLogDataController(fakeService, fakes.Mapper);
            var result     = controller.GetData(id);

            Assert.IsType <NoContentResult>(result.Result);
        }
Esempio n. 2
0
        public void GetData_ExistingIdPassed_ReturnsOkResult(int id)
        {
            var fakes       = new Fakes();
            var fakeService = fakes.FakeErrorLogDataService().Object;
            var expected    = fakes.Mapper.Map <ErrorLogDataDTO>(fakeService.FindById(id));

            var controller = new ErrorLogDataController(fakeService, fakes.Mapper);
            var result     = controller.GetData(id);

            Assert.IsType <OkObjectResult>(result.Result);
            var actual = (result.Result as OkObjectResult).Value as ErrorLogDataDTO;

            Assert.NotNull(actual);
            Assert.Equal(expected, actual, new ErrorLogDataDTOIdComparer());
        }