Esempio n. 1
0
        public void OrderShouldSetItselfAsParentForOrderDetail()
        {
            var order = new Order();
            var detail = new OrderDetail();

            order.AddOrderDetail(detail);
            Assert.AreSame(order, detail.Order);
        }
Esempio n. 2
0
        public void OrderShouldAddOrderDetail()
        {
            var order = new Order();
            var detail = new OrderDetail();

            order.AddOrderDetail(detail);
            Assert.AreSame(detail, order.OrderDetail);
        }
Esempio n. 3
0
 public virtual void AddOrderDetail(OrderDetail detail)
 {
     detail.Order = this;
     this.OrderDetail = detail;
 }
Esempio n. 4
0
        private Customer GetCustomer()
        {
            var customer = new Customer
            {
                ContactName = "johnny",
                Email = "*****@*****.**",
                Country = "Italy"
            };

            var order1 = new Order
            {
                ShipName = "fjh rty",
                ShipAddress = "374 drgiaeroiu",
                ShipCity = "rtuket",
                ShipRegion = "reag qae",
                ShipPostalCode = "34573",
                ShipCountry = "tyjtwere"
            };

            var order2 = new Order
            {
                ShipName = "ghdgh",
                ShipAddress = "fjsr4 4545 fghsf",
                ShipCity = "fyjshrk",
                ShipRegion = "tdguyket",
                ShipPostalCode = "9345672",
                ShipCountry = "ryjsytr"
            };

            var detail = new OrderDetail
            {
                UnitPrice = 90.4m,
                Quantity = 28,
                Discount = 67.66m
            };

            order1.AddOrderDetail(detail);
            customer.AddOrder(order1);
            customer.AddOrder(order2);

            return customer;
        }