예제 #1
0
        public void Service_Should_Throw_For__Unsupported_Shipping_Method()
        {
            Assert.Throws <NotSupportedException>(() =>
            {
                var items          = 2;
                var shippingMethod = ShippingMethod.Dhl;

                var order       = this._context.CreateOrder(items, shippingMethod);
                var calcService = new SimpleShippingCostCalculatorService();

                var shippingCost = calcService.CalculateCost(order);
            });
        }
예제 #2
0
        public void Service_Should_Calculate_For_Speedy_Correctly()
        {
            var items          = 2;
            var shippingMethod = ShippingMethod.Speedy;

            var order       = this._context.CreateOrder(items, shippingMethod);
            var calcService = new SimpleShippingCostCalculatorService();

            var shippingCost = calcService.CalculateCost(order);
            var expectedCost = items * 5.0M;

            Assert.AreEqual(expectedCost, shippingCost);
        }