Beispiel #1
0
        public void OrderFromCheckoutViewData_should_calculate_the_correct_postage()
        {
            var postage = new PostageResult();

            postageService.Stub(x => x.CalculatePostageFor(basket)).Return(postage);

            var order = checkoutService.OrderFromCheckoutViewData(checkoutViewData, new ModelStateDictionary());

            order.Postage.ShouldBeTheSameAs(postage);
        }
        public void Index_should_return_postage_view()
        {
            const int basketId = 89;

            var basket = BasketTests.Create350GramBasket();

            basketRepository.Stub(b => b.GetById(basketId)).Return(basket);

            var postageResult = PostageResult.WithPrice(new Money(34.56M), "postage description");

            postageService.Stub(p => p.CalculatePostageFor(basket)).Return(postageResult);

            postageDetailController.Index(basketId)
            .ReturnsViewResult()
            .ForView("Index")
            .WithModel <PostageResultViewData>()
            .AssertAreEqual("�.56", vd => vd.PostageTotal)
            .AssertAreEqual("postage description", vd => vd.Description)
            .AssertAreEqual("�5.58", vd => vd.TotalWithPostage)
            .AssertAreSame(basket.Country, vd => vd.Country);
        }