Esempio n. 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"));
        }
Esempio n. 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");
            }
        }
 public void MyTestInitialize()
 {
     _productsController = new ProductsController();
     var dal = Isolate.Fake.Instance<IDal<Product, ICriteria>>();
     GenFormServiceProvider.Instance.RegisterInstanceOfType(dal);
 }