예제 #1
0
        public void GetMenuListTest1()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value

            int[] categoryId = new int[] { 3, 7, 11 }; // TODO: Initialize to an appropriate value
            Nullable<int> typeId = 3; // TODO: Initialize to an appropriate value
            string sortExp = string.Empty; // TODO: Initialize to an appropriate value
            bool sortDesc = false; // TODO: Initialize to an appropriate value
            int startIndex = 0; // TODO: Initialize to an appropriate value
            int pageSize = 999; // TODO: Initialize to an appropriate value
            string filter = "MenuName.Contains(\"matahari\")";

            List<IMenu> temp = new List<IMenu>();
            temp = Context.Menus.Where(m => m.MenuCode == "MTB").Cast<IMenu>().ToList();
            IList<IMenu> expected = ((IList<IMenu>)temp); // TODO: Initialize to an appropriate value

            IList<IMenu> actual;
            actual = target.GetMenuList(categoryId, typeId, sortExp, sortDesc, startIndex, pageSize, filter);

            //Assert.AreEqual(expected, actual);
            IEnumerator<IMenu> e1 = actual.GetEnumerator();
            IEnumerator<IMenu> e2 = expected.GetEnumerator();
            while (e1.MoveNext() && e2.MoveNext())
            {
                //Assert.AreEqual(e1.Current, e2.Current);
                Assert.AreEqual(e1.Current.MenuID, e2.Current.MenuID);
                Assert.AreEqual(e1.Current.MenuCode, e2.Current.MenuCode);
                Assert.AreEqual(e1.Current.MenuName, e2.Current.MenuName);
                Assert.AreEqual(e1.Current.MenuTypeID, e2.Current.MenuTypeID);
                Assert.AreEqual(e1.Current.MenuDescription, e2.Current.MenuDescription);
                Assert.AreEqual(e1.Current.BasePrice, e2.Current.BasePrice);
                Assert.AreEqual(e1.Current.Price, e2.Current.Price);
                Assert.AreEqual(e1.Current.Discount, e2.Current.Discount);
                Assert.AreEqual(e1.Current.DiscountType, e2.Current.DiscountType);
                Assert.AreEqual(e1.Current.DiscountComment, e2.Current.DiscountComment);
                Assert.AreEqual(e1.Current.MenuImage, e2.Current.MenuImage);
                Assert.AreEqual(e1.Current.MenuOrder, e2.Current.MenuOrder);
                Assert.AreEqual(e1.Current.IsActive, e2.Current.IsActive);
                Assert.AreEqual(e1.Current.IsDeleted, e2.Current.IsDeleted);
                Assert.AreEqual(e1.Current.DiscountTypeName, e2.Current.DiscountTypeName);
                Assert.AreEqual(e1.Current.RowGuid, e2.Current.RowGuid);
            }

            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #2
0
        public void GetMenuListTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            IList<IMenu> expected = Context.Menus.Where(m => !m.IsDeleted).Select(m => (IMenu)m).ToList(); // TODO: Initialize to an appropriate value

            IList<IMenu> actual;
            actual = target.GetMenuList();

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

            IEnumerator<IMenu> e1 = actual.GetEnumerator();
            IEnumerator<IMenu> e2 = expected.GetEnumerator();
            while (e1.MoveNext() && e2.MoveNext())
            {
                //Assert.AreEqual(e1.Current, e2.Current);
                Assert.AreEqual(e1.Current.MenuID, e2.Current.MenuID);
                Assert.AreEqual(e1.Current.MenuCode, e2.Current.MenuCode);
                Assert.AreEqual(e1.Current.MenuName, e2.Current.MenuName);
                Assert.AreEqual(e1.Current.MenuTypeID, e2.Current.MenuTypeID);
                Assert.AreEqual(e1.Current.MenuDescription, e2.Current.MenuDescription);
                Assert.AreEqual(e1.Current.BasePrice, e2.Current.BasePrice);
                Assert.AreEqual(e1.Current.Price, e2.Current.Price);
                Assert.AreEqual(e1.Current.Discount, e2.Current.Discount);
                Assert.AreEqual(e1.Current.DiscountType, e2.Current.DiscountType);
                Assert.AreEqual(e1.Current.DiscountComment, e2.Current.DiscountComment);
                Assert.AreEqual(e1.Current.MenuImage, e2.Current.MenuImage);
                Assert.AreEqual(e1.Current.MenuOrder, e2.Current.MenuOrder);
                Assert.AreEqual(e1.Current.IsActive, e2.Current.IsActive);
                Assert.AreEqual(e1.Current.IsDeleted, e2.Current.IsDeleted);
                Assert.AreEqual(e1.Current.DiscountTypeName, e2.Current.DiscountTypeName);
                Assert.AreEqual(e1.Current.RowGuid, e2.Current.RowGuid);
            }

            //Assert.Inconclusive("Verify the correctness of this test method.");
        }