public void CategoriesControllerAddActionShouldRenderProperView() { var categoriesServicesMock = new Mock<ICategoriesServices>(); categoriesServicesMock.Setup(x => x.Add(new Category { Name = "Delete me" })); var controller = new CategoriesController(categoriesServicesMock.Object); controller.WithCallTo(x => x.Add()).ShouldRenderView("Add"); }
public void CategoriesControllerEditActionShouldRenderProperView() { var categoriesServicesMock = new Mock<ICategoriesServices>(); var newCategory = new Category { Name = "Delete me" }; categoriesServicesMock.Setup(x => x.Update(It.IsAny<int>(), newCategory)) .Returns(newCategory); var controller = new CategoriesController(categoriesServicesMock.Object); controller.WithCallTo(x => x.Edit(123)) .ShouldRenderView("Edit"); }