public void Can_Rebuild_Invoice_Index() { //// Arrange PreTestDataWorker.DeleteAllInvoices(); var invoice1 = MockInvoiceDataMaker.InvoiceForInserting(_address, 100); var invoice2 = MockInvoiceDataMaker.InvoiceForInserting(_address, 200); PreTestDataWorker.InvoiceService.Save(invoice1); PreTestDataWorker.InvoiceService.Save(invoice2); //// Act var timer = new Stopwatch(); timer.Start(); ExamineManager.Instance.IndexProviderCollection["MerchelloInvoiceIndexer"].RebuildIndex(); timer.Stop(); Console.Write("Time to index: " + timer.Elapsed.ToString()); //// Assert var searcher = ExamineManager.Instance.SearchProviderCollection["MerchelloInvoiceSearcher"]; var criteria = searcher.CreateSearchCriteria(Merchello.Examine.IndexTypes.Invoice); criteria.Field("allDocs", "1"); var results = searcher.Search(criteria); Assert.AreEqual(2, results.Count()); }
public void Init() { _destination = new Address() { Name = "Mindfly Web Design Studio", Address1 = "114 W. Magnolia St. Suite 504", Locality = "Bellingham", Region = "WA", PostalCode = "98225", CountryCode = "US" }; PreTestDataWorker.DeleteAllItemCaches(); PreTestDataWorker.DeleteAllInvoices(); _customer = PreTestDataWorker.MakeExistingAnonymousCustomer(); _basket = Basket.GetBasket(MerchelloContext, _customer); for (var i = 0; i < ProductCount; i++) { _basket.AddItem(PreTestDataWorker.MakeExistingProduct(true, WeightPerProduct, PricePerProduct)); } Basket.Save(MerchelloContext, _basket); _shipCountry = ShipCountryService.GetShipCountryByCountryCode(Catalog.Key, "US"); }
public void Init() { PreTestDataWorker.DeleteAllInvoices(); _invoice = MockInvoiceDataMaker.InvoiceForInserting(_address, 150); PreTestDataWorker.InvoiceService.Save(_invoice); }
public void init() { PreTestDataWorker.DeleteAllInvoices(); }
public virtual void Init() { Customer = PreTestDataWorker.MakeExistingAnonymousCustomer(); Basket = Web.Workflow.Basket.GetBasket(MerchelloContext.Current, 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.Key, ItemCacheType.Checkout); PreTestDataWorker.ItemCacheService.Save(ItemCache); foreach (var item in Basket.Items) { ItemCache.AddItem(item.AsLineItemOf <ItemCacheLineItem>()); } // setup the checkout SalePreparationMock = new SalePreparationMock(MerchelloContext.Current, ItemCache, Customer); // add the shipment rate quote var shipment = Basket.PackageBasket(MerchelloContext.Current, BillingAddress).First(); var shipRateQuote = shipment.ShipmentRateQuotes(MerchelloContext.Current).FirstOrDefault(); //_checkoutMock.ItemCache.Items.Add(shipRateQuote.AsLineItemOf<InvoiceLineItem>()); SalePreparationMock.SaveShipmentRateQuote(shipRateQuote); }
public void init() { PreTestDataWorker.DeleteAllAnonymousCustomers(); PreTestDataWorker.DeleteAllInvoices(); }