public void Doc_Close()
        {
            //На складе есть Папаверин в количестве 5шт.
            Assert.AreEqual(stock.Quantity, 5);

            //добавляем строку на 3 упаковки
            var line = new CheckLine(stock, 3);

            model.Lines.Add(line);
            model.checkType = CheckType.SaleBuyer;
            // Оплата по чеку
            var result = model.Close().GetEnumerator();

            result.MoveNext();
            var dialog = ((Checkout)((DialogResult)result.Current).Model);

            dialog.Amount.Value = 10;
            result.MoveNext();

            // после оплаты на складе остается 2
            var check     = session.Query <Check>().First();
            var loadstock = session.Query <Stock>().Where(x => x.Id == stock.Id).First();

            Assert.AreEqual(loadstock.Quantity, 2);
            Assert.AreEqual(check.Sum, 3);
            Assert.AreEqual(check.Status, Status.Closed);
        }
        public void Unpack()
        {
            stock = new OrderedStock()
            {
                Product          = "Папаверин",
                Status           = StockStatus.Available,
                Address          = address,
                RetailCost       = 1,
                Quantity         = 10,
                ReservedQuantity = 0,
                Barcode          = "10",
                ProductId        = 1,
                CatalogId        = 1,
                Exp = SystemTime.Now()
            };
            session.Save("AnalitF.Net.Client.Models.Inventory.Stock", stock);
            session.Flush();
            //добавляем строку на 3 упаковки
            var line = new CheckLine(stock, 3, CheckType.SaleBuyer);

            model.Lines.Add(line);
            model.CurrentLine.Value = line;

            var result = model.Unpack().GetEnumerator();

            result.MoveNext();
            var dialog = ((InputQuantity)((DialogResult)result.Current).Model);

            dialog.Quantity.Value     = 2;
            dialog.Multiplicity.Value = 6;
            dialog.OK();
            result.MoveNext();

            // из них две в чеке
            Assert.AreEqual(model.CurrentLine.Value.Quantity, 2);
            var dstStock = model.CurrentLine.Value.Stock;

            result = model.Close().GetEnumerator();
            result.MoveNext();
            var dialog1 = ((Checkout)((DialogResult)result.Current).Model);

            dialog1.Amount.Value = 10;
            result.MoveNext();

            session.Clear();
            var loadstock = session.Query <Stock>().Where(x => x.Id == dstStock.Id).First();

            Assert.AreEqual(loadstock.Quantity, 6 - 2);
            Assert.AreEqual(loadstock.Multiplicity, 6);
        }