示例#1
0
        public void TestEditCustomer()
        {
            CustomerController cc = new CustomerController();

            System.Web.Mvc.ViewResult result = cc.Index(null);

            Customer c = ((IPagedList <Customer>)result.ViewData.Model).First();

            Assert.NotNull(c);
            System.Web.Mvc.ActionResult customerEdition = cc.Edit(c.CustomerID);

            //post edited
            c.Address       = "Address dummy";
            c.City          = "City dummy";
            c.CompanyNumber = "23423424";
            c.CP            = "508000";
            c.Email         = "*****@*****.**";
            c.Fax           = "342343434";
            c.Name          = "Company name dummy";
            c.Phone1        = "3423423423";
            c.Phone2        = "234234232";

            //get
            System.Web.Mvc.ActionResult resultEditionView = cc.Edit(c.CustomerID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), resultEditionView);

            //post
            System.Web.Mvc.ActionResult resultEdition = cc.Edit(c);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.PartialViewResult), resultEdition);
        }
示例#2
0
        public ActionResult YetAnotherPage()
        {
            System.Web.Mvc.ActionResult a = new System.Web.Mvc.ViewResult();
            a = new RedirectResult("bar");

            return(new HttpNotFoundResult());
        }
        public void TestEditProvider()
        {
            ProviderController pc = new ProviderController();

            System.Web.Mvc.ViewResult result = pc.Index(null);

            Provider p = ((IPagedList <Provider>)result.ViewData.Model).First();

            System.Web.Mvc.ActionResult customerEdition = pc.Edit(p.ProviderID);

            //post edited
            p.Address       = "Address dummy";
            p.City          = "City dummy";
            p.CompanyNumber = "23423423424";
            p.CP            = "508000";
            p.Email         = "*****@*****.**";
            p.Fax           = "342343434";
            p.Name          = "Company name dummy";
            p.Phone1        = "3423423423";
            p.Phone2        = "234234232";

            System.Web.Mvc.ActionResult resultEditionView = pc.Edit(p.ProviderID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultEditionView);

            System.Web.Mvc.ActionResult resultEdition = pc.Edit(p);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultEdition);
        }
        public void FailedEndgame()
        {
            var controller = new MazeViewController();

            System.Web.Mvc.ViewResult result = (System.Web.Mvc.ViewResult)controller.FailedEndgame(MazeId);
            Assert.IsTrue(((MazeActionModel)result.Model).MazeId != Guid.Empty);
        }
        public void IndexTest()
        {
            var controller = new MazeViewController();

            System.Web.Mvc.ViewResult result = (System.Web.Mvc.ViewResult)controller.Index();
            Assert.IsTrue(result.ViewData.Count == 2);
        }
        public void JobsController_AvailableJobsPost()
        {
            //arrange
            Proposal _model = new Proposal()
            {
                Id               = 1,
                PriceEst         = 2.22M,
                Message          = "message",
                AvailabilityDate = DateTime.Now,
                UserJob_Id       = 1,
                Technician_Id    = 1,
                UserSeen         = false,
                TechSeen         = false
            };

            JobsController controller = new JobsController(new FakeJobRepository());

            //act
            System.Web.Mvc.ViewResult result = controller.AvailableJobs(_model) as System.Web.Mvc.ViewResult;

            //assert
            Assert.IsNotNull(result);

            List <UserJob> resultModel = result.Model as List <UserJob>;

            Assert.AreEqual(0, resultModel.Count);
            //Assert.IsInstanceOfType(resultModel, string);
        }
        public void TestListInvoices()
        {
            InvoiceController ic = new InvoiceController();

            System.Web.Mvc.ViewResult result = ic.Index(null);
            Assert.IsNotNull(result.ViewData.Model);
            Assert.IsInstanceOf(typeof(IPagedList <Invoice>), result.ViewData.Model);
        }
        public ProductSearchResultView GetProductsByCategory(int categoryId)
        {
            System.Web.Mvc.ViewResult viewResult = (System.Web.Mvc.ViewResult) this.productController.GetProductsByCategory(categoryId);

            ProductSearchResultView productSearchResultView = (ProductSearchResultView)viewResult.ViewData.Model;

            return(productSearchResultView);
        }
        public ProductDetailView Detail(int id)
        {
            System.Web.Mvc.ViewResult viewResult = (System.Web.Mvc.ViewResult) this.productController.Detail(id);

            ProductDetailView productSearchResultView = (ProductDetailView)viewResult.ViewData.Model;

            return(productSearchResultView);
        }
示例#10
0
        public HomePageView Index()
        {
            System.Web.Mvc.ViewResult viewResult = (System.Web.Mvc.ViewResult) this.homeController.Index();

            HomePageView homePageView = (HomePageView)viewResult.ViewData.Model;

            return(homePageView);
        }
        public void TestListProvider()
        {
            ProviderController pc = new ProviderController();

            System.Web.Mvc.ViewResult result = pc.Index(null);
            Assert.IsNotNull(result.ViewData.Model);
            Assert.IsInstanceOf(typeof(IPagedList <Provider>), result.ViewData.Model);
        }
示例#12
0
        public void TestListCustomers()
        {
            CustomerController c = new CustomerController();

            System.Web.Mvc.ViewResult result = c.Index(null);
            Assert.IsNotNull(result.ViewData.Model);
            Assert.IsInstanceOf(typeof(IPagedList <Customer>), result.ViewData.Model);
        }
        public void TestMethod_TechHome()
        {
            //arrange
            HomeController controller = new HomeController(new FakeHomeRepository());

            //act
            System.Web.Mvc.ViewResult result = controller.TechnicianHome() as System.Web.Mvc.ViewResult;
            //assert
            Assert.IsNotNull(result);
        }
        public void JobsController_CategoryJobs()
        {
            //arrange
            JobsController controller = new JobsController(new FakeJobRepository());

            //act
            System.Web.Mvc.ViewResult result = controller.CategoryJobs(1) as System.Web.Mvc.ViewResult;

            //assert
            Assert.IsNotNull(result);
        }
        public void JobsController_Details()
        {
            //arrrange
            JobsController controller = new JobsController(new FakeJobRepository());

            //act
            System.Web.Mvc.ViewResult result = controller.Details(1) as System.Web.Mvc.ViewResult;

            //assert
            Assert.IsNotNull(result);
            UserJob resultModel = result.Model as UserJob;

            Assert.AreEqual(1, resultModel.Id);
        }
        public void TestDeleteProvider()
        {
            ProviderController pc = new ProviderController();

            System.Web.Mvc.ViewResult result = pc.Index(null);

            Provider c = ((IPagedList <Provider>)result.ViewData.Model).First();

            Assert.NotNull(c);

            //ask deletion action
            System.Web.Mvc.ActionResult providerAskDeletion = pc.Delete(c.ProviderID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), providerAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult providerDeletion = pc.DeleteConfirmed(c.ProviderID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), providerDeletion);
        }
示例#17
0
        public void TestDeleteCustomer()
        {
            CustomerController cc = new CustomerController();

            System.Web.Mvc.ViewResult result = cc.Index(null);

            Customer c = ((IPagedList <Customer>)result.ViewData.Model).First();

            Assert.NotNull(c);

            //ask deletion action
            System.Web.Mvc.ActionResult customerAskDeletion = cc.Delete(c.CustomerID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), customerAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult customerDeletion = cc.DeleteConfirmed(c.CustomerID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), customerDeletion);
        }
示例#18
0
        public void TestDeleteInvoice()
        {
            InvoiceController ic = new InvoiceController();

            System.Web.Mvc.ViewResult result = ic.Index(null);

            Invoice i = ((IPagedList <Invoice>)result.ViewData.Model).First();

            Assert.NotNull(i);

            //ask deletion action
            System.Web.Mvc.ActionResult invoiceAskDeletion = ic.Delete(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), invoiceAskDeletion);

            //delete action
            System.Web.Mvc.ActionResult invoiceDeletion = ic.DeleteConfirmed(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), invoiceDeletion);
        }
示例#19
0
        public void TestEditInvoice()
        {
            InvoiceController ic = new InvoiceController();

            System.Web.Mvc.ViewResult result = ic.Index(null);
            Invoice i = ((IPagedList <Invoice>)result.ViewData.Model).First();

            System.Web.Mvc.ActionResult invoiceEdition = ic.Edit(i.InvoiceID);

            //post edited
            i.Name = "Change invoice name test";

            //get
            System.Web.Mvc.ActionResult resultEditionView = ic.Edit(i.InvoiceID);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.ViewResult), resultEditionView);

            //post
            System.Web.Mvc.ActionResult resultEdition = ic.Edit(i);
            Assert.IsInstanceOf(typeof(System.Web.Mvc.RedirectToRouteResult), resultEdition);
        }