public void CreateReturnViewIsOk() { // var controller = new PozoController(null, null, null); // var view = controller.Create(); Assert.IsInstanceOf(typeof(ViewResult), view); Assert.AreEqual("Create", view.ViewName); }
public void PostCreateSaveNewPozo() { var pozo = new Pozo(); var mockRepository = new Mock<IPozoRepository>(); var mockValidator = new Mock<IPozoValidator>(); mockValidator.Setup(o => o.Pass(pozo)).Returns(true); var controller = new PozoController(mockRepository.Object, mockValidator.Object, null); var redirect = controller.Create(pozo); Assert.IsInstanceOf(typeof(RedirectToRouteResult), redirect); mockRepository.Verify(o => o.Save(pozo), Times.Once()); }