예제 #1
0
        public void OrderShouldSetItselfAsParentForOrderDetail()
        {
            var order = new Order();
            var detail = new OrderDetail();

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

            order.AddOrderDetail(detail);
            Assert.AreSame(detail, order.OrderDetail);
        }
예제 #3
0
파일: Order.cs 프로젝트: Mir4ik/TestRepo
 public virtual void AddOrderDetail(OrderDetail detail)
 {
     detail.Order = this;
     this.OrderDetail = detail;
 }
예제 #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;
        }