public virtual void Init() { Customer = PreTestDataWorker.MakeExistingAnonymousCustomer(); Basket = Web.Workflow.Basket.GetBasket(MerchelloContext, Customer); var odd = true; for (var i = 0; i < ProductCount; i++) { var product = PreTestDataWorker.MakeExistingProduct(true, WeightPerProduct, PricePerProduct); product.AddToCatalogInventory(PreTestDataWorker.WarehouseCatalog); product.CatalogInventories.First().Count = 10; product.TrackInventory = true; PreTestDataWorker.ProductService.Save(product); Basket.AddItem(product, 2); odd = !odd; } BillingAddress = new Address() { Name = "Out there", Address1 = "some street", Locality = "some city", Region = "ST", PostalCode = "98225", CountryCode = "US" }; var origin = new Address() { Name = "Somewhere", Address1 = "origin street", Locality = "origin city", Region = "ST", PostalCode = "98225", CountryCode = "US" }; PreTestDataWorker.DeleteAllItemCaches(); PreTestDataWorker.DeleteAllInvoices(); Customer.ExtendedData.AddAddress(BillingAddress, AddressType.Billing); ItemCache = new Core.Models.ItemCache(Customer.EntityKey, ItemCacheType.Checkout); PreTestDataWorker.ItemCacheService.Save(ItemCache); foreach (var item in Basket.Items) { ItemCache.AddItem(item.AsLineItemOf<ItemCacheLineItem>()); } // setup the checkout SalePreparationMock = new SalePreparationMock(MerchelloContext, ItemCache, Customer); // add the shipment rate quote var shipment = Basket.PackageBasket(MerchelloContext, BillingAddress).First(); var shipRateQuote = shipment.ShipmentRateQuotes(MerchelloContext).FirstOrDefault(); //_checkoutMock.ItemCache.Items.Add(shipRateQuote.AsLineItemOf<InvoiceLineItem>()); SalePreparationMock.SaveShipmentRateQuote(shipRateQuote); }