public void Edit_order_multi_address()
        {
            var address1 = new Address("тест1");
            var address2 = new Address("тест2");

            InitAddress(address1, address2);
            Activate(batch, address1, address2);

            var offer = new Offer(new Price("тест"), 50);
            var line  = address2.Order(offer, 5);

            batch.BuildLineViews(new List <BatchLine> {
                new BatchLine {
                    Address = address1
                }, new BatchLine(line)
            });

            batch.CurrentReportLine.Value = batch.Lines.Value[1];
            batch.UpdateOffers(new List <Offer> {
                offer
            });
            scheduler.AdvanceByMs(1000);

            Assert.AreEqual(5, batch.CurrentOffer.Value.OrderCount);
            Order(0);
            Order(10);

            Assert.AreEqual(0, address1.Orders.Count);
            Assert.AreEqual(1, address2.Orders.Count);
            Assert.AreEqual(500, address2.Orders[0].Sum);
        }
        private OrderLine MakeOrderLine()
        {
            var address = new Address("тест");

            InitAddress(address);
            offer = new Offer(new Price("тест"), 100)
            {
                ProductSynonym  = "Тестовый товар",
                ProducerSynonym = "Тестовый производитель",
                ProductId       = 105,
            };
            return(address.Order(offer, 1));
        }
        public void Filter_lines()
        {
            var address = new Address("тест");

            InitAddress(address);
            var offer = new Offer(new Price("тест"), 50);
            var line  = address.Order(offer, 5);

            line.ExportId = 562;
            Activate(batch, address);
            batch.BuildLineViews(new List <BatchLine> {
                new BatchLine(line), new BatchLine(new Catalog("тест"), address)
            });

            //заказано
            batch.CurrentFilter.Value = batch.Filter[1];
            Assert.AreEqual(1, batch.ReportLines.Value.Count);
            Assert.IsNotNull(batch.ReportLines.Value[0].OrderLine);
        }
        public void Load_order_lines()
        {
            var address1 = new Address("тест1");
            var address2 = new Address("тест2");

            InitAddress(address1, address2);

            var offer = new Offer(new Price("тест"), 50);
            var line  = address2.Order(offer, 5);

            line.ExportId = 562;
            Activate(batch, address1, address2);
            batch.BuildLineViews(new List <BatchLine> {
                new BatchLine(line)
            });

            Assert.IsTrue(batch.CanReload);
            Assert.IsTrue(batch.CanClear);
            Assert.AreEqual(line, batch.ReportLines.Value[0].OrderLine);
        }
        public void Delete_batch_line_on_delete_order_line()
        {
            var address = new Address("тест");

            InitAddress(address);
            var offer = new Offer(new Price("тест"), 50);
            var line  = address.Order(offer, 5);

            line.ExportId = 562;
            Activate(batch, address);
            batch.BuildLineViews(new List <BatchLine> {
                new BatchLine(line)
            });

            batch.CurrentReportLine.Value = batch.Lines.Value[0];
            batch.UpdateOffers(new List <Offer> {
                offer,
            });
            Assert.AreEqual(5, batch.CurrentOffer.Value.OrderCount);
            Order(0);
            Assert.AreEqual(0, batch.ReportLines.Value.Count);
            Assert.AreEqual(0, batch.Lines.Value.Count);
        }