Exemplo n.º 1
0
        public void SalesOrderListTest1()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            string orderStatus = string.Empty; // TODO: Initialize to an appropriate value
            Nullable<DateTime> periodFrom = new DateTime(2010, 6, 1); // TODO: Initialize to an appropriate value
            Nullable<DateTime> periodTo = new DateTime(2010, 6, 30); // 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 = 90; // TODO: Initialize to an appropriate value
            string filter = string.Empty; // TODO: Initialize to an appropriate value
            IList<ISalesOrder> expected = Context.SalesOrderHeads.Where(o => o.CreatedDate.CompareTo(periodFrom) > 0 && o.CreatedDate.CompareTo(periodTo) < 0).Cast<ISalesOrder>().ToList(); // TODO: Initialize to an appropriate value
            IList<ISalesOrder> actual;
            actual = target.GetSalesOrderList(orderStatus, periodFrom, periodTo, sortExp, sortDesc, startIndex, pageSize, filter);

            IEnumerator<ISalesOrder> e1 = expected.GetEnumerator();
            IEnumerator<ISalesOrder> e2 = actual.GetEnumerator();

            while (e1.MoveNext() && e2.MoveNext())
            {
                Assert.AreEqual(e1.Current.CustomerName, e2.Current.CustomerName);

                Assert.AreEqual(e1.Current.IsDeleted, e2.Current.IsDeleted);
                Assert.AreEqual(e1.Current.TotalItemDiscount, e2.Current.TotalItemDiscount);
                Assert.AreEqual(e1.Current.OrderDate, e2.Current.OrderDate);
                Assert.AreEqual(e1.Current.OrderNo, e2.Current.OrderNo);
                Assert.AreEqual(e1.Current.OrderStatus, e2.Current.OrderStatus);
                Assert.AreEqual(e1.Current.TotalQuantity, e2.Current.TotalQuantity);
                Assert.AreEqual(e1.Current.RowGuid, e2.Current.RowGuid);

                Assert.AreEqual(e1.Current.AdditionalDiscount, e2.Current.AdditionalDiscount);
                Assert.AreEqual(e1.Current.SalesOrderID, e2.Current.SalesOrderID);
                Assert.AreEqual(e1.Current.OrderSubTotal, e2.Current.OrderSubTotal);
                Assert.AreEqual(e1.Current.TableNo, e2.Current.TableNo);
                Assert.AreEqual(e1.Current.Tax, e2.Current.Tax);
                Assert.AreEqual(e1.Current.OrderTotal, e2.Current.OrderTotal);

            }

            //Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 2
0
        public void SalesOrderListTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            IList<ISalesOrder> expected = Context.SalesOrderHeads.Cast<ISalesOrder>().ToList(); // TODO: Initialize to an appropriate value
            IList<ISalesOrder> actual;
            actual = target.GetSalesOrderList();

            IEnumerator<ISalesOrder> e1 = expected.GetEnumerator();
            IEnumerator<ISalesOrder> e2 = actual.GetEnumerator();

            while (e1.MoveNext() && e2.MoveNext())
            {
                Assert.AreEqual(e1.Current.CustomerName, e2.Current.CustomerName);
                Assert.AreEqual(e1.Current.IsDeleted, e2.Current.IsDeleted);
                Assert.AreEqual(e1.Current.ItemDiscount, e2.Current.ItemDiscount);
                Assert.AreEqual(e1.Current.OrderDate, e2.Current.OrderDate);
                Assert.AreEqual(e1.Current.OrderNo, e2.Current.OrderNo);
                Assert.AreEqual(e1.Current.OrderStatus, e2.Current.OrderStatus);
                Assert.AreEqual(e1.Current.Quantity, e2.Current.Quantity);
                Assert.AreEqual(e1.Current.RowGuid, e2.Current.RowGuid);

                Assert.AreEqual(e1.Current.SalesDiscount, e2.Current.SalesDiscount);
                Assert.AreEqual(e1.Current.SalesOrderID, e2.Current.SalesOrderID);
                Assert.AreEqual(e1.Current.SubTotal, e2.Current.SubTotal);
                Assert.AreEqual(e1.Current.TableNo, e2.Current.TableNo);
                Assert.AreEqual(e1.Current.Tax, e2.Current.Tax);
                Assert.AreEqual(e1.Current.Total, e2.Current.Total);

            }

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