Ejemplo n.º 1
0
        public void Rendering_When_BasketModel_IsNotNull_Should_Return_View_With_Non_Empty_Model()
        {
            // Arrange
            _transactionLibraryInternal.GetBasket(false).Returns(new Basket(new PurchaseOrder
            {
                BillingCurrency = new Currency
                {
                    ISOCode = "USD"
                }
            }));


            // Act
            var result = _controller.Rendering();

            // Assert
            var viewResult = result as ViewResult;
            var model      = viewResult != null ? viewResult.Model as BasketRenderingViewModel : null;

            Assert.NotNull(viewResult);
            Assert.NotNull(model);
            Assert.NotEmpty(model.RefreshUrl);
            Assert.NotEmpty(model.RemoveOrderlineUrl);

            Assert.NotNull(model.OrderTotal);
            Assert.NotNull(model.DiscountTotal);
            Assert.NotNull(model.TaxTotal);
            Assert.NotNull(model.SubTotal);
        }
Ejemplo n.º 2
0
        public virtual MiniBasketRefreshViewModel Refresh()
        {
            var viewModel = new MiniBasketRefreshViewModel
            {
                IsEmpty = true
            };

            if (!_transactionLibraryInternal.HasBasket())
            {
                return(viewModel);
            }

            var purchaseOrder = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;

            var quantity = purchaseOrder.OrderLines.Sum(x => x.Quantity);

            var total = purchaseOrder.OrderTotal.HasValue
                ? new Money(purchaseOrder.OrderTotal.Value, purchaseOrder.BillingCurrency)
                : new Money(0, purchaseOrder.BillingCurrency);

            viewModel.NumberOfItems = quantity.ToString();
            viewModel.IsEmpty       = quantity == 0;
            viewModel.Total         = total.ToString();

            return(viewModel);
        }
        public ActionResult Rendering()
        {
            var purchaseOrder          = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;
            var basketPreviewViewModel = new BasketPreviewViewModel();

            basketPreviewViewModel = MapPurchaseOrderToViewModel(purchaseOrder, basketPreviewViewModel);

            return(View(basketPreviewViewModel));
        }
        public virtual BasketPreviewViewModel GetViewModel()
        {
            var purchaseOrder          = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;
            var basketPreviewViewModel = new BasketPreviewViewModel();

            basketPreviewViewModel.BillingAddress  = purchaseOrder.BillingAddress ?? new OrderAddress();
            basketPreviewViewModel.ShipmentAddress = purchaseOrder.GetShippingAddress(UCommerce.Constants.DefaultShipmentAddressName) ?? new OrderAddress();

            foreach (var orderLine in purchaseOrder.OrderLines)
            {
                var orderLineModel = new PreviewOrderLine
                {
                    ProductName       = orderLine.ProductName,
                    Sku               = orderLine.Sku,
                    VariantSku        = orderLine.VariantSku,
                    Total             = new Money(orderLine.Total.GetValueOrDefault(), orderLine.PurchaseOrder.BillingCurrency).ToString(),
                    Tax               = new Money(orderLine.VAT, purchaseOrder.BillingCurrency).ToString(),
                    Price             = new Money(orderLine.Price, purchaseOrder.BillingCurrency).ToString(),
                    PriceWithDiscount = new Money(orderLine.Price - orderLine.UnitDiscount.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString(),
                    Quantity          = orderLine.Quantity,
                    Discount          = orderLine.Discount
                };

                basketPreviewViewModel.OrderLines.Add(orderLineModel);
            }

            basketPreviewViewModel.DiscountTotal  = new Money(purchaseOrder.DiscountTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();
            basketPreviewViewModel.DiscountAmount = purchaseOrder.DiscountTotal.GetValueOrDefault();
            basketPreviewViewModel.SubTotal       = new Money(purchaseOrder.SubTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();
            basketPreviewViewModel.OrderTotal     = new Money(purchaseOrder.OrderTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();
            basketPreviewViewModel.TaxTotal       = new Money(purchaseOrder.TaxTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();
            basketPreviewViewModel.ShippingTotal  = new Money(purchaseOrder.ShippingTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();
            basketPreviewViewModel.PaymentTotal   = new Money(purchaseOrder.PaymentTotal.GetValueOrDefault(), purchaseOrder.BillingCurrency).ToString();

            var shipment = purchaseOrder.Shipments.FirstOrDefault();

            if (shipment != null)
            {
                basketPreviewViewModel.ShipmentName   = shipment.ShipmentName;
                basketPreviewViewModel.ShipmentAmount = purchaseOrder.ShippingTotal.GetValueOrDefault();
            }

            var payment = purchaseOrder.Payments.FirstOrDefault();

            if (payment != null)
            {
                basketPreviewViewModel.PaymentName   = payment.PaymentMethodName;
                basketPreviewViewModel.PaymentAmount = purchaseOrder.PaymentTotal.GetValueOrDefault();
            }
            basketPreviewViewModel.NextStepUrl     = GetNextStepUrl(nextStepId, purchaseOrder.OrderGuid);
            basketPreviewViewModel.PreviousStepUrl = GetPreviousStepUrl(previousStepId);

            return(basketPreviewViewModel);
        }
        public ActionResult Rendering()
        {
            var shipmentPickerViewModel = new ShippingPickerViewModel();

            var basket          = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;
            var shippingCountry = basket.GetAddress(Constants.DefaultShipmentAddressName).Country;

            shipmentPickerViewModel.ShippingCountry = shippingCountry.Name;
            var availableShippingMethods = _transactionLibraryInternal.GetShippingMethods(shippingCountry);

            shipmentPickerViewModel.SelectedShippingMethodId = basket.Shipments.FirstOrDefault() != null
                                ? basket.Shipments.FirstOrDefault().ShippingMethod.ShippingMethodId : -1;

            foreach (var availableShippingMethod in availableShippingMethods)
            {
                var price          = availableShippingMethod.GetPriceForCurrency(basket.BillingCurrency);
                var formattedprice = new Money((price == null ? 0 : price.Price), basket.BillingCurrency);

                shipmentPickerViewModel.AvailableShippingMethods.Add(new SelectListItem()
                {
                    Selected = shipmentPickerViewModel.SelectedShippingMethodId == availableShippingMethod.ShippingMethodId,
                    Text     = String.Format(" {0} ({1})", availableShippingMethod.Name, formattedprice),
                    Value    = availableShippingMethod.ShippingMethodId.ToString()
                });
            }

            return(View(shipmentPickerViewModel));
        }
        public ActionResult Rendering()
        {
            var paymentPickerViewModel = new PaymentPickerViewModel();

            var basket          = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;
            var shippingCountry = basket.GetShippingAddress(Constants.DefaultShipmentAddressName).Country;

            paymentPickerViewModel.ShippingCountry = shippingCountry.Name;

            var availablePaymentMethods = _transactionLibraryInternal.GetPaymentMethods(shippingCountry);

            var existingPayment = basket.Payments.FirstOrDefault();

            paymentPickerViewModel.SelectedPaymentMethodId = existingPayment != null
                                ? existingPayment.PaymentMethod.PaymentMethodId
                                : -1;

            foreach (var availablePaymentMethod in availablePaymentMethods)
            {
                var     option       = new SelectListItem();
                decimal feePercent   = availablePaymentMethod.FeePercent;
                var     fee          = availablePaymentMethod.GetFeeForCurrency(basket.BillingCurrency);
                var     formattedFee = new Money((fee == null ? 0 : fee.Fee), basket.BillingCurrency);

                option.Text = String.Format(" {0} ({1} + {2}%)", availablePaymentMethod.Name, formattedFee,
                                            feePercent.ToString("0.00"));
                option.Value    = availablePaymentMethod.PaymentMethodId.ToString();
                option.Selected = availablePaymentMethod.PaymentMethodId == paymentPickerViewModel.SelectedPaymentMethodId;

                paymentPickerViewModel.AvailablePaymentMethods.Add(option);
            }

            return(View(paymentPickerViewModel));
        }
        public virtual AddressRenderingViewModel GetViewModel()
        {
            var viewModel = new AddressRenderingViewModel();

            var shippingInformation = _transactionLibraryInternal.GetBasket().PurchaseOrder.GetShippingAddress(UCommerce.Constants.DefaultShipmentAddressName) ?? new OrderAddress();
            var billingInformation  = _transactionLibraryInternal.GetBasket().PurchaseOrder.BillingAddress ?? new OrderAddress();

            viewModel.BillingAddress.FirstName         = billingInformation.FirstName;
            viewModel.BillingAddress.LastName          = billingInformation.LastName;
            viewModel.BillingAddress.EmailAddress      = billingInformation.EmailAddress;
            viewModel.BillingAddress.PhoneNumber       = billingInformation.PhoneNumber;
            viewModel.BillingAddress.MobilePhoneNumber = billingInformation.MobilePhoneNumber;
            viewModel.BillingAddress.Line1             = billingInformation.Line1;
            viewModel.BillingAddress.Line2             = billingInformation.Line2;
            viewModel.BillingAddress.PostalCode        = billingInformation.PostalCode;
            viewModel.BillingAddress.City        = billingInformation.City;
            viewModel.BillingAddress.State       = billingInformation.State;
            viewModel.BillingAddress.Attention   = billingInformation.Attention;
            viewModel.BillingAddress.CompanyName = billingInformation.CompanyName;
            viewModel.BillingAddress.CountryId   = billingInformation.Country != null ? billingInformation.Country.CountryId : -1;

            viewModel.ShippingAddress.FirstName         = shippingInformation.FirstName;
            viewModel.ShippingAddress.LastName          = shippingInformation.LastName;
            viewModel.ShippingAddress.EmailAddress      = shippingInformation.EmailAddress;
            viewModel.ShippingAddress.PhoneNumber       = shippingInformation.PhoneNumber;
            viewModel.ShippingAddress.MobilePhoneNumber = shippingInformation.MobilePhoneNumber;
            viewModel.ShippingAddress.Line1             = shippingInformation.Line1;
            viewModel.ShippingAddress.Line2             = shippingInformation.Line2;
            viewModel.ShippingAddress.PostalCode        = shippingInformation.PostalCode;
            viewModel.ShippingAddress.City        = shippingInformation.City;
            viewModel.ShippingAddress.State       = shippingInformation.State;
            viewModel.ShippingAddress.Attention   = shippingInformation.Attention;
            viewModel.ShippingAddress.CompanyName = shippingInformation.CompanyName;
            viewModel.ShippingAddress.CountryId   = shippingInformation.Country != null ? shippingInformation.Country.CountryId : -1;

            viewModel.AvailableCountries = _countries.ToList().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.CountryId.ToString()
            }).ToList();

            viewModel.NextStepUrl     = GetNextStepUrl(nextStepId);
            viewModel.PreviousStepUrl = GetPreviousStepUrl(previousStepId);

            return(viewModel);
        }
Ejemplo n.º 8
0
        public ActionResult Rendering()
        {
            var viewModel = new AddressRenderingViewModel();

            var shippingInformation = _transactionLibraryInternal.GetBasket().PurchaseOrder.GetShippingAddress(Constants.DefaultShipmentAddressName) ?? new OrderAddress();
            var billingInformation  = _transactionLibraryInternal.GetBasket().PurchaseOrder.BillingAddress ?? new OrderAddress();

            viewModel.BillingAddress.FirstName         = billingInformation.FirstName;
            viewModel.BillingAddress.LastName          = billingInformation.LastName;
            viewModel.BillingAddress.EmailAddress      = billingInformation.EmailAddress;
            viewModel.BillingAddress.PhoneNumber       = billingInformation.PhoneNumber;
            viewModel.BillingAddress.MobilePhoneNumber = billingInformation.MobilePhoneNumber;
            viewModel.BillingAddress.Line1             = billingInformation.Line1;
            viewModel.BillingAddress.Line2             = billingInformation.Line2;
            viewModel.BillingAddress.PostalCode        = billingInformation.PostalCode;
            viewModel.BillingAddress.City        = billingInformation.City;
            viewModel.BillingAddress.State       = billingInformation.State;
            viewModel.BillingAddress.Attention   = billingInformation.Attention;
            viewModel.BillingAddress.CompanyName = billingInformation.CompanyName;
            viewModel.BillingAddress.CountryId   = billingInformation.Country != null ? billingInformation.Country.CountryId : -1;

            viewModel.ShippingAddress.FirstName         = shippingInformation.FirstName;
            viewModel.ShippingAddress.LastName          = shippingInformation.LastName;
            viewModel.ShippingAddress.EmailAddress      = shippingInformation.EmailAddress;
            viewModel.ShippingAddress.PhoneNumber       = shippingInformation.PhoneNumber;
            viewModel.ShippingAddress.MobilePhoneNumber = shippingInformation.MobilePhoneNumber;
            viewModel.ShippingAddress.Line1             = shippingInformation.Line1;
            viewModel.ShippingAddress.Line2             = shippingInformation.Line2;
            viewModel.ShippingAddress.PostalCode        = shippingInformation.PostalCode;
            viewModel.ShippingAddress.City        = shippingInformation.City;
            viewModel.ShippingAddress.State       = shippingInformation.State;
            viewModel.ShippingAddress.Attention   = shippingInformation.Attention;
            viewModel.ShippingAddress.CompanyName = shippingInformation.CompanyName;
            viewModel.ShippingAddress.CountryId   = shippingInformation.Country != null ? shippingInformation.Country.CountryId : -1;

            viewModel.AvailableCountries = _countries.Select().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.CountryId.ToString()
            }).ToList();

            viewModel.SaveAddressUrl = Url.Action("Save");

            return(View("/Views/Address/Rendering.cshtml", viewModel));
        }
Ejemplo n.º 9
0
        public virtual CartRenderingViewModel GetViewModel(string refreshUrl, string removeOrderLineUrl)
        {
            var basketVM = new CartRenderingViewModel();

            if (!_transactionLibraryInternal.HasBasket())
            {
                return(basketVM);
            }

            PurchaseOrder basket = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;

            foreach (var orderLine in basket.OrderLines)
            {
                var orderLineViewModel = new OrderlineViewModel
                {
                    Quantity          = orderLine.Quantity,
                    ProductName       = orderLine.ProductName,
                    Sku               = orderLine.Sku,
                    VariantSku        = orderLine.VariantSku,
                    Total             = new Money(orderLine.Total.GetValueOrDefault(), basket.BillingCurrency).ToString(),
                    Discount          = orderLine.Discount,
                    Tax               = new Money(orderLine.VAT, basket.BillingCurrency).ToString(),
                    Price             = new Money(orderLine.Price, basket.BillingCurrency).ToString(),
                    ProductUrl        = GetProductUrl(CatalogLibrary.GetProduct(orderLine.Sku), this.productDetailsPageId),
                    PriceWithDiscount = new Money(orderLine.Price - orderLine.UnitDiscount.GetValueOrDefault(), basket.BillingCurrency).ToString(),
                    OrderLineId       = orderLine.OrderLineId
                };
                basketVM.OrderLines.Add(orderLineViewModel);
            }

            basketVM.OrderTotal    = new Money(basket.OrderTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketVM.DiscountTotal = new Money(basket.DiscountTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketVM.TaxTotal      = new Money(basket.TaxTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketVM.SubTotal      = new Money(basket.SubTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketVM.NextStepUrl   = GetNextStepUrl(nextStepId);

            basketVM.RefreshUrl         = refreshUrl;
            basketVM.RemoveOrderlineUrl = removeOrderLineUrl;

            return(basketVM);
        }
Ejemplo n.º 10
0
        public ActionResult Rendering()
        {
            var basketModel = new BasketRenderingViewModel();

            if (!_transactionLibraryInternal.HasBasket())
            {
                return(View(basketModel));
            }

            PurchaseOrder basket = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;

            foreach (var orderLine in basket.OrderLines)
            {
                var orderLineViewModel = new BasketRenderingViewModel.OrderlineViewModel();

                orderLineViewModel.Quantity          = orderLine.Quantity;
                orderLineViewModel.ProductName       = orderLine.ProductName;
                orderLineViewModel.Sku               = orderLine.Sku;
                orderLineViewModel.VariantSku        = orderLine.VariantSku;
                orderLineViewModel.Total             = new Money(orderLine.Total.GetValueOrDefault(), basket.BillingCurrency).ToString();
                orderLineViewModel.Discount          = orderLine.Discount;
                orderLineViewModel.Tax               = new Money(orderLine.VAT, basket.BillingCurrency).ToString();
                orderLineViewModel.Price             = new Money(orderLine.Price, basket.BillingCurrency).ToString();
                orderLineViewModel.ProductUrl        = CatalogLibrary.GetNiceUrlForProduct(CatalogLibrary.GetProduct(orderLine.Sku));
                orderLineViewModel.PriceWithDiscount = new Money(orderLine.Price - orderLine.UnitDiscount.GetValueOrDefault(), basket.BillingCurrency).ToString();
                orderLineViewModel.OrderLineId       = orderLine.OrderLineId;

                basketModel.OrderLines.Add(orderLineViewModel);
            }

            basketModel.OrderTotal    = new Money(basket.OrderTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.DiscountTotal = new Money(basket.DiscountTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.TaxTotal      = new Money(basket.TaxTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.SubTotal      = new Money(basket.SubTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();

            basketModel.RefreshUrl         = Url.Action("UpdateBasket");
            basketModel.RemoveOrderlineUrl = Url.Action("RemoveOrderline");

            return(View(basketModel));
        }
        public virtual bool CanProcessRequest(Dictionary <string, object> parameters, out string message)
        {
            if (Telerik.Sitefinity.Services.SystemManager.IsDesignMode)
            {
                message = "The widget is in Page Edit mode.";
                return(false);
            }

            var basket  = _transactionLibraryInternal.GetBasket().PurchaseOrder;
            var address = basket.GetAddress(UCommerce.Constants.DefaultShipmentAddressName);

            if (address == null)
            {
                message = "Address must be specified";
                return(false);
            }
            else
            {
                message = null;
                return(true);
            }
        }
        public void Rendering_When_Basket_Is_Not_Empty_Should_Return_View_With_Non_Empty_Model()
        {
            //Arrange
            _transactionLibraryInternal.HasBasket().Returns(true);
            _transactionLibraryInternal.GetBasket(false).Returns(new Basket(new PurchaseOrder
            {
                BillingCurrency = new Currency()
            }));

            //Act
            var result = _controller.Rendering();

            //Assert
            var viewResult = result as ViewResult;
            var model      = viewResult != null ? viewResult.Model as MiniBasketRenderingViewModel : null;

            Assert.NotNull(viewResult);
            Assert.NotNull(model);
            Assert.True(model.IsEmpty);
            Assert.Equal(0, model.NumberOfItems);
            Assert.Equal(0, model.Total.Value);
            Assert.NotEmpty(model.RefreshUrl);
        }
        public void Rendering_Returns_View_With_Valid_Model()
        {
            // Arrange
            var purchaseOrder = Substitute.For <PurchaseOrder>();

            purchaseOrder.GetShippingAddress(Constants.DefaultShipmentAddressName).Returns(new OrderAddress()
            {
                Country = new Country()
                {
                    Name = "Denmark"
                }
            });

            var paymentMethods = new List <PaymentMethod>();

            paymentMethods.Add(new PaymentMethod()
            {
                Name = "PayPal"
            });

            _transactionLibraryInternal.GetPaymentMethods(
                purchaseOrder.GetShippingAddress(Constants.DefaultShipmentAddressName).Country)
            .Returns(paymentMethods);


            var basket = Substitute.For <Basket>(purchaseOrder);

            _transactionLibraryInternal.GetBasket(false).Returns(basket);

            // Act
            var result = _controller.Rendering();

            // Assert
            var viewResult = result as ViewResult;
            var model      = viewResult != null ? viewResult.Model as PaymentPickerViewModel : null;

            Assert.NotNull(model);
            Assert.NotNull(viewResult);
            Assert.NotNull(model.SelectedPaymentMethodId);
            Assert.True(model.AvailablePaymentMethods.Count == 1);

            _transactionLibraryInternal.Received().GetPaymentMethods(purchaseOrder.GetShippingAddress(Constants.DefaultShipmentAddressName).Country);
        }
        public void Rendering_When_Basket_Has_Shipping_And_Billing_Information_Should_Return_View_With_Non_Empty_Model()
        {
            //Arrange
            _countries.Add(new Country());
            _transactionLibraryInternal.GetBasket().Returns(new Basket(new PurchaseOrder()));

            //Act
            var result = _controller.Rendering();

            //Assert
            var viewResult = result as ViewResult;
            var model      = viewResult != null ? viewResult.Model as AddressRenderingViewModel : null;

            Assert.NotNull(viewResult);
            Assert.NotNull(model);
            Assert.NotNull(model.BillingAddress);
            Assert.NotNull(model.ShippingAddress);
            Assert.NotEmpty(model.AvailableCountries);
        }
Ejemplo n.º 15
0
        public ActionResult Rendering()
        {
            var miniBasketViewModel = new MiniBasketRenderingViewModel
            {
                IsEmpty    = true,
                RefreshUrl = Url.Action("Refresh")
            };

            if (!_transactionLibraryInternal.HasBasket())
            {
                return(View(miniBasketViewModel));
            }

            var purchaseOrder = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;

            miniBasketViewModel.NumberOfItems = purchaseOrder.OrderLines.Sum(x => x.Quantity);
            miniBasketViewModel.IsEmpty       = miniBasketViewModel.NumberOfItems == 0;
            miniBasketViewModel.Total         = purchaseOrder.OrderTotal.HasValue ? new Money(purchaseOrder.OrderTotal.Value, purchaseOrder.BillingCurrency) : new Money(0, purchaseOrder.BillingCurrency);

            return(View(miniBasketViewModel));
        }
        public virtual PaymentPickerViewModel GetViewModel()
        {
            var paymentPickerViewModel = new PaymentPickerViewModel();

            var basket          = _transactionLibraryInternal.GetBasket().PurchaseOrder;
            var shippingCountry = UCommerce.Api.TransactionLibrary.GetCountries().SingleOrDefault(x => x.Name == "Germany");

            paymentPickerViewModel.ShippingCountry = shippingCountry.Name;

            var availablePaymentMethods = _transactionLibraryInternal.GetPaymentMethods(shippingCountry);

            var existingPayment = basket.Payments.FirstOrDefault();

            paymentPickerViewModel.SelectedPaymentMethodId = existingPayment != null
                ? existingPayment.PaymentMethod.PaymentMethodId
                : -1;
            var priceGroup = SiteContext.Current.CatalogContext.CurrentPriceGroup;

            foreach (var availablePaymentMethod in availablePaymentMethods)
            {
                var     option       = new SelectListItem();
                decimal feePercent   = availablePaymentMethod.FeePercent;
                var     fee          = availablePaymentMethod.GetFeeForPriceGroup(priceGroup);
                var     formattedFee = new Money(fee == null ? 0 : fee.Fee, basket.BillingCurrency);

                option.Text = String.Format(" {0} ({1} + {2}%)", availablePaymentMethod.Name, formattedFee,
                                            feePercent.ToString("0.00"));
                option.Value    = availablePaymentMethod.PaymentMethodId.ToString();
                option.Selected = availablePaymentMethod.PaymentMethodId == paymentPickerViewModel.SelectedPaymentMethodId;

                paymentPickerViewModel.AvailablePaymentMethods.Add(option);
            }
            _transactionLibraryInternal.ExecuteBasketPipeline();

            paymentPickerViewModel.NextStepUrl     = GetNextStepUrl(nextStepId);
            paymentPickerViewModel.PreviousStepUrl = GetPreviousStepUrl(previousStepId);

            return(paymentPickerViewModel);
        }
        public void Rendering_When_Shipping_Has_New_Model()
        {
            //Arrange
            var purchaseOrder = new PurchaseOrder();
            var orderaddress  = new OrderAddress {
                AddressName = Constants.DefaultShipmentAddressName, Country = new Country()
            };

            purchaseOrder.OrderAddresses.Add(orderaddress);
            purchaseOrder.OrderStatus = new OrderStatus();
            _transactionLibraryInternal.GetBasket(false).Returns(new Basket(purchaseOrder));

            //Act
            var result = _controller.Rendering();

            //Assert
            var viewResult = result as ViewResult;
            var model      = viewResult != null ? viewResult.Model as ShippingPickerViewModel : null;

            Assert.NotNull(viewResult);
            Assert.NotNull(model);
            Assert.Equal(-1, model.SelectedShippingMethodId);
        }