示例#1
0
文件: DALTests.cs 项目: evgen10/TASK8
        public void GetOrderNomenclature()
        {
            OrderNomenclature expectedOrderNom = new OrderNomenclature()
            {
                CustomerID     = "VINET",
                Discount       = 0,
                EmployeeID     = 5,
                Freight        = (decimal)32.3800,
                OrderDate      = DateTime.Parse("7/4/1996 12:00:00 AM"),
                OrderID        = 10248,
                ProductID      = 11,
                ProductName    = "Queso Cabrales",
                Quantity       = 12,
                RequiredDate   = DateTime.Parse("8/1/1996 12:00:00 AM"),
                ShipAddress    = "59 rue de l'Abbaye",
                ShipCity       = "Reims",
                ShipCountry    = "France",
                ShipName       = "Vins et alcools Chevalier",
                ShipPostalCode = "51100",
                ShipRegion     = null,
                ShipVia        = 3,
                ShippedDate    = DateTime.Parse("7/16/1996 12:00:00 AM"),
                UnitPrice      = (decimal)14.0000,
            };


            OrderNomenclature resultOrderNom;

            using (UnitOfWork uw = new UnitOfWork(connectionString, providerName))
            {
                resultOrderNom = uw.Orders.GetOrderNomenclature(10248);

                Assert.IsTrue(new OrderNomenclatureComparator().Comparer(expectedOrderNom, resultOrderNom));
            }
        }
示例#2
0
文件: DALTests.cs 项目: evgen10/TASK8
        public void FidnOrderTest()
        {
            OrderNomenclature expectedOrder = new OrderNomenclature()
            {
                CustomerID     = "VINET",
                EmployeeID     = 5,
                Freight        = (decimal)32.3800,
                OrderDate      = DateTime.Parse("7/4/1996 12:00:00 AM"),
                OrderID        = 10248,
                RequiredDate   = DateTime.Parse("8/1/1996 12:00:00 AM"),
                ShipAddress    = "59 rue de l'Abbaye",
                ShipCity       = "Reims",
                ShipCountry    = "France",
                ShipName       = "Vins et alcools Chevalier",
                ShipPostalCode = "51100",
                ShipRegion     = null,
                ShipVia        = 3,
                ShippedDate    = DateTime.Parse("7/16/1996 12:00:00 AM"),
            };


            using (UnitOfWork uw = new UnitOfWork(connectionString, providerName))
            {
                Order resultOrder = uw.Orders.Find(expectedOrder);

                Assert.IsTrue(new OrderComparator().Compare(expectedOrder, resultOrder));
            }
        }
 public bool Comparer(OrderNomenclature orderNum1, OrderNomenclature orderNum2)
 {
     return(orderNum1.CustomerID == orderNum2.CustomerID &&
            orderNum1.EmployeeID == orderNum2.EmployeeID &&
            orderNum1.Freight == orderNum2.Freight &&
            orderNum1.OrderDate == orderNum2.OrderDate &&
            orderNum1.OrderID == orderNum2.OrderID &&
            orderNum1.OrderStatus == orderNum2.OrderStatus &&
            orderNum1.RequiredDate == orderNum2.RequiredDate &&
            orderNum1.ShipAddress == orderNum2.ShipAddress &&
            orderNum1.ShipCity == orderNum2.ShipCity &&
            orderNum1.ShipCountry == orderNum2.ShipCountry &&
            orderNum1.ShipName == orderNum2.ShipName &&
            orderNum1.ShippedDate == orderNum2.ShippedDate &&
            orderNum1.ShipPostalCode == orderNum2.ShipPostalCode &&
            orderNum1.ShipRegion == orderNum2.ShipRegion &&
            orderNum1.ShipVia == orderNum2.ShipVia &&
            orderNum1.ProductID == orderNum2.ProductID &&
            orderNum1.ProductName == orderNum2.ProductName &&
            orderNum1.UnitPrice == orderNum2.UnitPrice &&
            orderNum1.Quantity == orderNum2.Quantity &&
            orderNum1.Discount == orderNum2.Discount);
 }