コード例 #1
0
ファイル: OrderUnitTests.cs プロジェクト: jamesdrever/cpx
        public void ShouldUpdateQuantityAndEventDatesWhenAddingExistingEvent()
        {
            Order order = new Order();

            Product event1 = new Product { Title = "Test Event 1", ProductId = 1, StartDate = new DateTime(2014,08,1),FinishDate = new DateTime(2014,08,5), Price = 50 };
            order.Add(event1, 2, "F", 50);
            Assert.IsTrue(order.NumberOfItems == 2);
            Assert.IsTrue(order.ContainsProduct(event1));
            Assert.IsTrue(order.PaymentTotal == 100);
            Product event2 = new Product { Title = "Test Event 2", ProductId = 1, StartDate = new DateTime(2014,08,1),FinishDate = new DateTime(2014,08,4), Price = 50 };
            order.Add(event2, 3, "F", 50);
            Assert.IsTrue(order.NumberOfItems == 3);
            Assert.IsTrue(order.PaymentTotal == 150);
            Assert.IsTrue(order.ContainsProduct(event1));
            var eventInOrder = order.GetOrderLine(event1);
            Assert.IsTrue(eventInOrder.StartDate == new DateTime(2014, 08, 1));
            Assert.IsTrue(eventInOrder.FinishDate == new DateTime(2014, 08, 4));
        }