コード例 #1
0
        public void BeerController_AddAction()
        {
            BeersController controller = new BeersController(new FakeRepositories.FakeBeerRepository());
            Beer            beer       = new Beer()
            {
                BeerId    = 1,
                Name      = "Blue Brew",
                Type      = "Ale",
                UnitPrice = 69,
                ABV       = 69
            };

            System.Web.Mvc.RedirectToRouteResult result = controller.Create(beer) as System.Web.Mvc.RedirectToRouteResult;
            Assert.IsNotNull(result);
        }
コード例 #2
0
        public void BeerController_Edit()
        {
            BeersController controller = new BeersController(new FakeRepositories.FakeBeerRepository());
            Beer            beer       = new Beer()
            {
                BeerId    = 1,
                Name      = "GreasyKev",
                Type      = "Ale",
                UnitPrice = 1,
                ABV       = 1
            };

            System.Web.Mvc.RedirectToRouteResult createBeer = controller.Create(beer) as System.Web.Mvc.RedirectToRouteResult;
            System.Web.Mvc.RedirectToRouteResult result     = controller.Edit(beer) as System.Web.Mvc.RedirectToRouteResult;
            Assert.IsNotNull(createBeer);
            Assert.IsNotNull(result);
        }
コード例 #3
0
        public void BeerController_DeleteAction()
        {
            BeersController controller = new BeersController(new FakeRepositories.FakeBeerRepository());

            Beer beer = new Beer()
            {
                BeerId    = 1,
                Name      = "BeeBrew",
                Type      = "Ale",
                UnitPrice = 5,
                ABV       = 4
            };

            System.Web.Mvc.RedirectToRouteResult createBeer = controller.Create(beer) as System.Web.Mvc.RedirectToRouteResult;
            System.Web.Mvc.RedirectToRouteResult delete     = controller.DeleteConfirmed(1) as System.Web.Mvc.RedirectToRouteResult;
            System.Web.Mvc.RedirectToRouteResult result     = controller.Details(1) as System.Web.Mvc.RedirectToRouteResult;
            Assert.IsNull(result);
        }