public void Can_Rebuild_Order_Index()
        {
            //// Arrange
            PreTestDataWorker.DeleteAllOrders();
            var invoice1 = MockInvoiceDataMaker.InvoiceForInserting(_address, 100);
            var invoice2 = MockInvoiceDataMaker.InvoiceForInserting(_address, 200);

            PreTestDataWorker.InvoiceService.Save(invoice1);
            PreTestDataWorker.InvoiceService.Save(invoice2);

            var order1 = invoice1.PrepareOrder();
            var order2 = invoice2.PrepareOrder();

            PreTestDataWorker.OrderService.Save(order1);
            PreTestDataWorker.OrderService.Save(order2);

            //// Act
            var timer = new Stopwatch();

            timer.Start();
            ExamineManager.Instance.IndexProviderCollection["MerchelloOrderIndexer"].RebuildIndex();
            timer.Stop();
            Console.Write("Time to index: " + timer.Elapsed.ToString());

            //// Assert
            var searcher = ExamineManager.Instance.SearchProviderCollection["MerchelloOrderSearcher"];

            var criteria = searcher.CreateSearchCriteria(Merchello.Examine.IndexTypes.Order);

            criteria.Field("allDocs", "1");
            var results = searcher.Search(criteria);

            Assert.AreEqual(2, results.Count());
        }
        public override void Init()
        {
            base.Init();

            PreTestDataWorker.DeleteAllOrders();
            PreTestDataWorker.DeleteAllShipments();
            var invoice = SalePreparationMock.PrepareInvoice();

            PreTestDataWorker.InvoiceService.Save(invoice);
            _order = invoice.PrepareOrder(MerchelloContext);
            PreTestDataWorker.OrderService.Save(_order);
        }
        public override void Init()
        {
            base.Init();

            PreTestDataWorker.DeleteAllOrders();
            PreTestDataWorker.DeleteAllShipments();
            var invoice = SalePreparationMock.PrepareInvoice();

            PreTestDataWorker.InvoiceService.Save(invoice);
            _order = invoice.PrepareOrder(MerchelloContext.Current);
            PreTestDataWorker.OrderService.Save(_order);

            _shipMethodKey =
                invoice.ShippingLineItems().FirstOrDefault().ExtendedData.GetShipment <InvoiceLineItem>().ShipMethodKey;
        }