public void AssertDiscountTypeName()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            IMenu menu = target.GetMenuById(8); // TODO: Initialize to an appropriate value
            IMenu menu2 = target.GetMenuById(9); // TODO: Initialize to an appropriate value

            string expected1 = "Percentage"; // TODO: Initialize to an appropriate value
            string expected2 = "Exact Value";

            Assert.AreEqual(menu.DiscountTypeName, expected1);
            Assert.AreEqual(menu2.DiscountTypeName, expected2);

            menu.DiscountType = "EV";
            menu2.DiscountType = "PR";

            Assert.AreEqual(menu.DiscountTypeName, expected2);
            Assert.AreEqual(menu2.DiscountTypeName, expected1);
        }
 public void DeleteMenuTest()
 {
     SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
     //IMenu menu = Context.Menus.Where(m => m.MenuID == 7).FirstOrDefault(); // TODO: Initialize to an appropriate value
     IMenu menu = target.GetMenuById(7);
     bool expected = true; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.DeleteMenu(menu, "unit test");
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(menu.IsDeleted, true);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void GetMenuByIdTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            int menuId = 5; // TODO: Initialize to an appropriate value
            IMenu expected = Context.Menus.Where(m => m.MenuID == 5).SingleOrDefault(); // TODO: Initialize to an appropriate value
            IMenu actual;
            actual = target.GetMenuById(menuId);
            //Assert.AreEqual(expected, actual);

            Assert.AreEqual(expected.MenuID, actual.MenuID);
            Assert.AreEqual(expected.MenuCode, actual.MenuCode);
            Assert.AreEqual(expected.MenuName, actual.MenuName);
            Assert.AreEqual(expected.MenuTypeID, actual.MenuTypeID);
            Assert.AreEqual(expected.MenuDescription, actual.MenuDescription);
            Assert.AreEqual(expected.BasePrice, actual.BasePrice);
            Assert.AreEqual(expected.Price, actual.Price);
            Assert.AreEqual(expected.Discount, actual.Discount);
            Assert.AreEqual(expected.DiscountType, actual.DiscountType);
            Assert.AreEqual(expected.DiscountComment, actual.DiscountComment);
            Assert.AreEqual(expected.MenuImage, actual.MenuImage);
            Assert.AreEqual(expected.MenuOrder, actual.MenuOrder);
            Assert.AreEqual(expected.IsActive, actual.IsActive);
            Assert.AreEqual(expected.IsDeleted, actual.IsDeleted);
            Assert.AreEqual(expected.DiscountTypeName, actual.DiscountTypeName);
            Assert.AreEqual(expected.RowGuid, actual.RowGuid);

            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void TestChangeMenuCategory()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value

            //IMenu menu = Context.Menus.Where(m => m.MenuID == 5).FirstOrDefault(); // TODO: Initialize to an appropriate value
            IMenu menu = target.GetMenuById(5);

            menu.MenuCategoryList.Clear();

            MenuCategory mc = new MenuCategory();
            mc.MenuCategoryID = 2;

            MenuCategory mc2 = new MenuCategory();
            mc2.MenuCategoryID = 10;

            //MenuCategory mc3 = new MenuCategory();
            //mc3.MenuCategoryID = 5;

            //MenuCategory mc4 = new MenuCategory();
            //mc4.MenuCategoryID = 7;

            //MenuCategory mc5 = new MenuCategory();
            //mc5.MenuCategoryID = 6;

            menu.MenuCategoryList.Add(mc);
            menu.MenuCategoryList.Add(mc2);
            //menu.MenuCategoryList.Add(mc3);
            //menu.MenuCategoryList.Add(mc4);
            //menu.MenuCategoryList.Add(mc5);

            target.SaveMenu(menu, "unit test");

            IList<IMenuCategory> actual = menu.MenuCategoryList.OrderBy(o => o.MenuCategoryID).ToList();
            IList<IMenuCategory> expected = Context.MenuCategories.Cast<IMenuCategory>().OrderBy(o => o.MenuCategoryID).ToList();
            expected = expected.Where(o => o.MenuCategoryID == 2
                || o.MenuCategoryID == 10
                //|| o.MenuCategoryID == 5
                //|| o.MenuCategoryID == 7
                //|| o.MenuCategoryID == 6
                ).ToList();

            Assert.AreEqual(expected.Count, actual.Count);

            IEnumerator<IMenuCategory> e1 = actual.GetEnumerator();
            IEnumerator<IMenuCategory> e2 = expected.GetEnumerator();
            while (e1.MoveNext() && e2.MoveNext())
            {
                //Assert.AreEqual(e1.Current, e2.Current);

                Assert.AreEqual(e1.Current.MenuCategoryID, e2.Current.MenuCategoryID);
                Assert.AreEqual(e1.Current.MenuCategoryName, e2.Current.MenuCategoryName);
                Assert.AreEqual(e1.Current.MenuCategoryDescription, e2.Current.MenuCategoryDescription);
                Assert.AreEqual(e1.Current.MenuCategoryOrder, e2.Current.MenuCategoryOrder);
                Assert.AreEqual(e1.Current.IsDeleted, e2.Current.IsDeleted);

                Assert.AreEqual(e1.Current.RowGuid, e2.Current.RowGuid);

            }
        }
        public void SaveMenuTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            //IMenu menu = Context.Menus.Where(m => m.MenuID == 5).FirstOrDefault(); // TODO: Initialize to an appropriate value
            IMenu menu = target.GetMenuById(5);
            var price = new Random().Next(10000);
            menu.BasePrice = price;
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;

            actual = target.SaveMenu(menu, "unit test");
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(menu.BasePrice, price);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }