public void Should_Be_Ok_When_Get_By_Id(int id) { var fakes = new FakeContext("EnvironmentControllerTest"); var fakeEnvironmentService = fakes.FakeEnvironmentService().Object; var expected = fakes.Mapper.Map <CentralErros.Models.Environment>(fakeEnvironmentService.FindById(id)); var contexto = new CentralErroContexto(fakes.FakeOptions); var controller = new EnvironmentController(fakeEnvironmentService, fakes.Mapper, contexto); var result = controller.FindAll(); Assert.IsType <OkObjectResult>(result.Result); var actual = (result.Result as OkObjectResult).Value as CentralErros.Models.Environment; Assert.NotNull(actual); Assert.Equal(expected, actual, new EnvironmentIdComparer()); }