示例#1
0
        public async Task NewShipmentsQuantityLessThanQuantityAvailable()
        {
            rule = new PrenotificationQuantityExceededRule(repo);

            var movements = A.CollectionOfFake <PrenotificationMovement>(1);

            var result = await rule.GetResult(movements.ToList(), notificationId);

            Assert.Equal(MessageLevel.Success.ToString(), result.MessageLevel.ToString());
        }
示例#2
0
        public async Task NewShipmentsQuantityMoreThanQuantityAvailable_ShippingNumbersEnteredInReverse()
        {
            rule = new PrenotificationQuantityExceededRule(repo);

            List <PrenotificationMovement> movements = new List <PrenotificationMovement>()
            {
                new PrenotificationMovement()
                {
                    ShipmentNumber = 7,
                    Quantity       = 25
                },
                new PrenotificationMovement()
                {
                    ShipmentNumber = 6,
                    Quantity       = 5
                }
            };

            var result = await rule.GetResult(movements.ToList(), notificationId);

            Assert.Equal(MessageLevel.Error.ToString(), result.MessageLevel.ToString());
            Assert.Equal("Shipment 7: the quantity of waste will exceed your permitted allowance and can't be prenotified.", result.ErrorMessage);
        }