public void Create_ShouldWork() { var context = _contextFake.GetContext("Create_ShouldWork") .AddFakeEnvironments(); var repo = new EnvironmentRepository(context); var controller = new EnvironmentController(repo, _mapper); var newEnvironment = new EnvironmentCreateViewModel() { Description = "New Environment" }; var result = controller.Create(newEnvironment); Assert.IsType <ActionResult <EntityBase> >(result); var actionResult = Assert.IsType <CreatedResult>(result.Result); var valueResult = Assert.IsType <EntityBase>(actionResult.Value); var actual = context.Environments.SingleOrDefault(x => x.Id == valueResult.Id); Assert.Equal(newEnvironment.Description, actual.Description); }