public void GetById_Notfound() { var context = _contextFake.GetContext("GetById_Notfound") .AddFakeEnvironments(); var repo = new EnvironmentRepository(context); var controller = new EnvironmentController(repo, _mapper); var result = controller.GetById(int.MaxValue); Assert.IsType <ActionResult <EnvironmentViewModel> >(result); Assert.IsType <NotFoundResult>(result.Result); }
public void GetById_ShouldWork() { var context = _contextFake.GetContext("GetById_ShouldWork") .AddFakeEnvironments(); var repo = new EnvironmentRepository(context); var controller = new EnvironmentController(repo, _mapper); var result = controller.GetById(1); Assert.IsType <ActionResult <EnvironmentViewModel> >(result); var actionResult = Assert.IsType <OkObjectResult>(result.Result); Assert.IsType <EnvironmentViewModel>(actionResult.Value); }