public void Process_OrderIsAlreadyShippinged_ThrowsAnException()
            {
                var orderProcessor = new OrderProcessor(new FakeShippingCalculator());
                var order          = new Order
                {
                    Shipment = new Shipment()
                };

                Assert.Throws <InvalidOperationException>(() => orderProcessor.Process(order));
            }
            public void Process_OrderIsNotShipped_ShouldSetTheShipmentPropertyOfTheOrder()
            {
                var orderProcessor = new OrderProcessor(new FakeShippingCalculator());
                var order          = new Order();

                orderProcessor.Process(order);
                Assert.IsTrue(order.IsShipped);
                Assert.AreEqual(1, order.Shipment.Cost);
                Assert.AreEqual(DateTime.Today.AddDays(1), order.Shipment.ShippingDate);
            }
Esempio n. 3
0
        public static void CreateOrder()
        {
            var orderProcessor = new OrderProcessor(new ShippingCalculator());
            var order          = new Order {
                DatePlaced = DateTime.Now, TotalPrice = 100f
            };

            orderProcessor.Process(order);

            OrderProcessorTests test = new OrderProcessorTests();

            test.Process_OrderIsAlreadyShippinged_ThrowsAnException();
        }
Esempio n. 4
0
 static void Main(string[] args)
 {
     var orderProcessor = new OrderProcessor();
     var order = new Order { DatePlaced = DateTime.Now, TotalPrice = 100f};
     orderProcessor.Process(order);
 }