예제 #1
0
        public void SaveSalesOrderTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            ISalesOrder salesOrder = target.CreateSalesOrderInstance(); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;

            //salesOrder.CreatedBy = "Unit test";

            salesOrder.CustomerName = "marceria";
            salesOrder.ItemDiscount = 29;
            salesOrder.OrderDate = DateTime.Now;
            salesOrder.OrderNo = "34dsABEawbRHsa";
            //salesOrder.OrderStatus = "NW";
            salesOrder.Quantity = 3;
            salesOrder.SalesDiscount = null;
            salesOrder.SubTotal = 3435.62m;
            salesOrder.TableNo = 24;
            salesOrder.Tax = 34.43m;
            salesOrder.Total = 3203.56m;

            ISalesOrderItem item1 = target.CreateSalesOrderItemInstance();
            item1.Discount = 3.43m;
            item1.MenuCode = "MFD";
            item1.MenuID = 5;
            item1.MenuName = "wahdsa";
            item1.Notes = "dfsafsda";
            //item1.OrderItemStatus = "NW";
            item1.Price = 421.42m;
            item1.QtyIssued = 3;
            item1.QtyOrdered = 3;
            item1.QtyPaid = 0;
            item1.Subtotal = 345.43m;
            item1.Total = 533.66m;

            salesOrder.SalesOrderItemList.Add(item1);

            actual = target.SaveSalesOrder(salesOrder, "unit test");
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #2
0
        public void GetSalesOrderByIdTest()
        {
            SalesOrderLinqBroker target = new SalesOrderLinqBroker(); // TODO: Initialize to an appropriate value
            int salesOrderId = 3; // TODO: Initialize to an appropriate value
            ISalesOrder expected = Context.SalesOrderHeads.SingleOrDefault(s => s.SalesOrderID == salesOrderId) as ISalesOrder; // TODO: Initialize to an appropriate value
            ISalesOrder actual;
            actual = target.GetSalesOrderById(salesOrderId);

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

            Assert.AreEqual(actual.IsDeleted, expected.IsDeleted);
            Assert.AreEqual(actual.ItemDiscount, expected.ItemDiscount);

            Assert.AreEqual(actual.OrderDate, expected.OrderDate);
            Assert.AreEqual(actual.OrderNo, expected.OrderNo);
            Assert.AreEqual(actual.OrderStatus, expected.OrderStatus);
            Assert.AreEqual(actual.Quantity, expected.Quantity);
            Assert.AreEqual(actual.RowGuid, expected.RowGuid);

            Assert.AreEqual(actual.SalesDiscount, expected.SalesDiscount);
            Assert.AreEqual(actual.SalesOrderID, expected.SalesOrderID);
            Assert.AreEqual(actual.SubTotal, expected.SubTotal);
            Assert.AreEqual(actual.TableNo, expected.TableNo);
            Assert.AreEqual(actual.Tax, expected.Tax);
            Assert.AreEqual(actual.Total, expected.Total);

            ISalesOrderItem item1 = target.CreateSalesOrderItemInstance();
            item1.Discount = 3.43m;
            item1.MenuCode = "MFD";
            item1.MenuID = 5;
            item1.MenuName = "wahdsa";
            item1.Notes = "dfsafsda";
            //item1.OrderItemStatus = "NW";
            item1.Price = 421.42m;
            item1.QtyIssued = 3;
            item1.QtyOrdered = 3;
            item1.QtyPaid = 0;
            item1.Subtotal = 345.43m;
            item1.Total = 533.66m;

            ISalesOrderItem item3 = target.CreateSalesOrderItemInstance();
            item3.Discount = 3.43m;
            item3.MenuCode = "KLDLD";
            item3.MenuID = 5;
            item3.MenuName = "miwau";
            item3.Notes = "wahaha";
            //item3.OrderItemStatus = "NW";
            item3.Price = 421.42m;
            item3.QtyIssued = 3;
            item3.QtyOrdered = 3;
            item3.QtyPaid = 0;
            item3.Subtotal = 345.43m;
            item3.Total = 533.66m;

            ISalesOrderItem item2 = actual.SalesOrderItemList.SingleOrDefault(s => s.SalesOrderItemID == 23);
            item2.MenuCode = "HEEH";
            item2.MenuName = "Powerfull PC";
            item2.QtyOrdered = 23;
            item2.Total = 5675000m;

            actual.RemoveSalesOrderItem(4);
            actual.RemoveSalesOrderItem(4);
            actual.AddSalesOrderItem(item1);
            actual.AddSalesOrderItem(item3);

            target.SaveSalesOrder(actual, "unit test");

            target = new SalesOrderLinqBroker();
            ISalesOrder test = target.GetSalesOrderById(salesOrderId);

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