コード例 #1
0
        public void Print_send_orders()
        {
            settings.PrintOrdersAfterSend = true;
            MakeOrderClean(address);

            var command = new SendOrders(address);

            Run(command);

            var results = command.Results.ToArray();

            Assert.AreEqual(1, results.Length);
            Assert.IsNotNull(((PrintResult)results[0]).Paginator);
        }
コード例 #2
0
        public void Make_order_correction()
        {
            revertToDefaults = true;

            var user = ServerUser();

            user.UseAdjustmentOrders = true;

            var changedOrder = MakeOrderClean();
            var orderLine    = changedOrder.Lines[0];
            var newCost      = Math.Max(
                Math.Round(orderLine.Cost + orderLine.Cost * (decimal)Generator.RandomDouble().First(), 2),
                orderLine.Cost + 0.01m);

            session.CreateSQLQuery("update Farm.CoreCosts set cost = :cost where Core_Id = :id")
            .SetParameter("id", orderLine.OfferId.OfferId)
            .SetParameter("cost", newCost)
            .ExecuteUpdate();
            var offer       = localSession.Query <Offer>().First(o => o.Price.Id.PriceId != changedOrder.Price.Id.PriceId);
            var normalOrder = MakeOrder(offer: offer);

            var command = new SendOrders(address);

            Run(command);

            localSession.Clear();
            normalOrder = localSession.Get <Order>(normalOrder.Id);
            Assert.IsNotNull(normalOrder);
            Assert.That(normalOrder.SendError, Is.Null.Or.Empty,
                        normalOrder.Lines.Implode(l => l.LongSendError));

            changedOrder = localSession.Get <Order>(changedOrder.Id);
            Assert.IsNotNull(changedOrder);
            Assert.AreEqual("В заказе обнаружены позиции с измененной ценой или количеством", changedOrder.SendError);
            var line = changedOrder.Lines[0];

            Assert.AreEqual("имеется различие в цене препарата", line.SendError);
            Assert.AreEqual(newCost, line.NewCost);
            Assert.AreEqual(LineResultStatus.CostChanged, line.SendResult);

            var dialog = command.Results.OfType <DialogResult>().First();

            Assert.IsInstanceOf <Correction>(dialog.Model);
        }
コード例 #3
0
        public void Reject_order_by_min_req()
        {
            var offer = localSession.Query <Offer>().First(o => o.Price.SupplierName.Contains("минимальный заказ"));
            var order = MakeOrderClean(address, offer);

            var command = new SendOrders(address);

            Run(command);

            var results = command.Results.ToArray();
            var text    = results
                          .OfType <DialogResult>()
                          .Select(d => d.Model)
                          .OfType <TextViewModel>()
                          .Select(t => t.Text)
                          .FirstOrDefault();
            var expected = $"прайс-лист {order.Price.Name} - Поставщик отказал в приеме заказа." +
                           " Сумма заказа меньше минимально допустимой." + $" Минимальный заказ {1500:0.00} заказано {order.Sum:0.00}.";

            Assert.AreEqual(expected, text, results.Implode());
        }