Exemplo n.º 1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            //Add test data (order specific)
            testDatabase = new TestDatabaseHelper();
            restaurant1 = testDatabase.AddRestaurant();
            table1 = testDatabase.AddTable(restaurant1);
            user1 = testDatabase.AddUser("*****@*****.**", table1, (int)SiteRoles.Admin);

            //Session
            db = new touch_for_foodEntities();
            target = new HomeController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            //Add test data (order specific)
            testDatabase = new TestDatabaseHelper();
            restaurant1 = testDatabase.AddRestaurant();
            table1 = testDatabase.AddTable(restaurant1);
            user1 = testDatabase.AddUser("*****@*****.**", table1, (int)SiteRoles.Customer);
            order1 = testDatabase.AddOrder(table1);
            item1 = testDatabase.AddItem();
            category1 = testDatabase.AddCategory();
            menu1 = testDatabase.AddMenu(restaurant1);
            menuCategory1 = testDatabase.AddMenuCategory(category1, menu1);
            menuItem1 = testDatabase.AddMenuItem(item1, menuCategory1);
            orderItem1 = testDatabase.AddOrderItem(order1, menuItem1);

            //Session
            db = new touch_for_foodEntities();
            ReviewController target = new ReviewController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 3
0
        public void MyTestInitialize()
        {
            //Add test data (order specific)
            order1 = testDatabase.AddOrder(table1);

            //Session
            db = new touch_for_foodEntities();
            target = new OrderController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 4
0
        public void EditViewTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            UserController target = new UserController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
            int expected = user1.id;

            //Act
            ViewResult actual = (ViewResult)target.Edit(user1.id);

            //Assert
            Assert.AreEqual(((user)actual.Model).id, expected);
        }
Exemplo n.º 5
0
        public void EditViewInvalidUserTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            UserController target = new UserController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);

            //Act
            var actualResult = target.Edit(user3.id) as RedirectToRouteResult;
            var actualResultURI = actualResult.RouteValues["controller"] + "/" + actualResult.RouteValues["action"];

            //Assertions
            Assert.AreEqual("Home/Index", actualResultURI);
        }
Exemplo n.º 6
0
        public void MyTestInitialize()
        {
            //Add test data (order specific)
            restaurant1 = testDatabase.AddRestaurant();
            restaurant2 = new restaurant();
            table1 = testDatabase.AddTable(restaurant1);
            user1 = testDatabase.AddUser("*****@*****.**", table1, (int)SiteRoles.Admin);
            restaurantUser1 = testDatabase.AddRestaurantUser(user1, restaurant1);
            menu1 = testDatabase.AddMenu(restaurant1);
            order1 = testDatabase.AddOrder(table1);
            review1 = testDatabase.AddReview(restaurant1, order1, user1);

            //Session
            db = new touch_for_foodEntities();
            target = new RestaurantController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 7
0
        public void MyTestInitialize()
        {
            //Add test data (order specific)
            item1 = testDatabase.AddItem(category1);
            menu1 = testDatabase.AddMenu(restaurant1);
            menuCategory1 = testDatabase.AddMenuCategory(category1, menu1);

            //Session
            db = new touch_for_foodEntities();
            target = new ItemController(db);
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 8
0
        public void MyTestInitialize()
        {
            //Add test data (order specific)
            restaurant1 = testDatabase.AddRestaurant();
            table1 = testDatabase.AddTable(restaurant1);
            table2 = new table();
            user1 = testDatabase.AddUser("*****@*****.**", table1, (int)SiteRoles.Restaurant);
            order1 = testDatabase.AddOrder(table1);
            request1 = testDatabase.AddServiceRequest(table1);
            restaurantUser1 = testDatabase.AddRestaurantUser(user1, restaurant1);

            //Session
            db = new touch_for_foodEntities();
            target = new TableController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }
Exemplo n.º 9
0
        public void MyTestInitialize()
        {
            request1 = testDatabase.AddServiceRequest(table1);

            //Session
            db = new touch_for_foodEntities();
            target = new ServiceRequestController();
            Session session = new Session(db, target);
            session.simulateLogin(user1.username, user1.password);
        }