CreateNewProduct() публичный Метод

public CreateNewProduct ( ) : System.Web.Mvc.ActionResult
Результат System.Web.Mvc.ActionResult
Пример #1
0
        public void CreateNewProductReturnsProductPresentation()
        {
            var controller = new ProductsController();
            SetUpProductServices();

            var fakePresentation = Isolate.Fake.Instance<IProductPresentation>();
            Isolate.NonPublic.WhenCalled(typeof(ProductsController), "GetProductPresentation").WillReturn(fakePresentation);

            var result = controller.CreateNewProduct();

            Assert.IsNotNull(ActionResultParser.GetValueFromActionResult<IProductPresentation>(result, "data"));
        }
Пример #2
0
        public void CreateNewProductCallsProductServicesNewProduct()
        {
            var controller = new ProductsController();
            IProductServices services = SetUpProductServices();

            try
            {
                controller.CreateNewProduct();
                Isolate.Verify.WasCalledWithAnyArguments(() => services.CreateProduct());
            }
            catch (VerifyException)
            {
                Assert.Fail("ProductsController did not call ProductsServices.CreateNewProduct");
            }
        }