public MovementsDetailsFactoryTests()
        {
            var movementRepository = A.Fake <IMovementRepository>();
            var shipmentRepository = A.Fake <IShipmentInfoRepository>();

            // Setup notification with 1000Kg intended quantity and 950Kg received

            movement = new TestableMovement
            {
                Id             = new Guid("B3A80B02-52BF-4051-9BE8-7AA9F7758E0E"),
                NotificationId = notificationId,
                Receipt        = new TestableMovementReceipt
                {
                    QuantityReceived = new ShipmentQuantity(950, ShipmentQuantityUnits.Kilograms)
                }
            };

            A.CallTo(() => movementRepository.GetMovementsByStatus(notificationId, MovementStatus.Received))
            .Returns(new[] { movement });

            var shipment = new TestableShipmentInfo
            {
                NotificationId = notificationId,
                Quantity       = 1000,
                Units          = ShipmentQuantityUnits.Kilograms
            };

            A.CallTo(() => shipmentRepository.GetByNotificationId(notificationId))
            .Returns(shipment);

            var movementQuantity = new NotificationMovementsQuantity(movementRepository, shipmentRepository);

            factory = new MovementDetailsFactory(movementQuantity);
        }
        public MovementsDetailsFactoryTests()
        {
            var movementRepository = A.Fake<IMovementRepository>();
            var shipmentRepository = A.Fake<IShipmentInfoRepository>();

            // Setup notification with 1000Kg intended quantity and 950Kg received

            movement = new TestableMovement
            {
                Id = new Guid("B3A80B02-52BF-4051-9BE8-7AA9F7758E0E"),
                NotificationId = notificationId,
                Receipt = new TestableMovementReceipt
                {
                    QuantityReceived = new ShipmentQuantity(950, ShipmentQuantityUnits.Kilograms)
                }
            };

            A.CallTo(() => movementRepository.GetMovementsByStatus(notificationId, MovementStatus.Received))
                .Returns(new[] { movement });

            var shipment = new TestableShipmentInfo
            {
                NotificationId = notificationId,
                Quantity = 1000,
                Units = ShipmentQuantityUnits.Kilograms
            };

            A.CallTo(() => shipmentRepository.GetByNotificationId(notificationId))
                .Returns(shipment);

            var movementQuantity = new NotificationMovementsQuantity(movementRepository, shipmentRepository);
            factory = new MovementDetailsFactory(movementQuantity);
        }
Example #3
0
        private void SetupMovements(int intendedQuantity, int quantityReceived)
        {
            var shipment = new TestableShipmentInfo
            {
                Id                = new Guid("2DA8E281-A6A4-459A-A38A-B4B0643E0726"),
                NotificationId    = NotificationId,
                NumberOfShipments = 10,
                Quantity          = intendedQuantity,
                Units             = ShipmentQuantityUnits.Tonnes
            };

            var existingMovement = new TestableMovement
            {
                Id             = new Guid("1584B5F6-4E33-441D-A9C9-17C1C3B28BA2"),
                NotificationId = NotificationId,
                Status         = MovementStatus.Received
            };

            var movementReceipt = new TestableMovementReceipt
            {
                Id = new Guid("28FFDD0B-1A1A-4CAC-B4E4-D232DA7B2AB8"),
                QuantityReceived = new ShipmentQuantity(quantityReceived, ShipmentQuantityUnits.Tonnes)
            };

            existingMovement.Receipt = movementReceipt;

            A.CallTo(() => shipmentRepository.GetByNotificationId(NotificationId)).Returns(shipment);
            A.CallTo(() => movementRepository.GetMovementsByStatus(NotificationId, MovementStatus.Received)).Returns(new[] { existingMovement });
            A.CallTo(() => assessmentRepository.GetByNotificationId(NotificationId)).Returns(new TestableNotificationAssessment {
                Status = NotificationStatus.Consented
            });
            A.CallTo(() => consentRepository.GetByNotificationId(NotificationId)).Returns(ValidConsent());
        }
Example #4
0
        public MovementQuantityTests()
        {
            movement = new TestableMovement
            {
                Status  = MovementStatus.Received,
                Receipt = new TestableMovementReceipt
                {
                    Date             = new DateTime(2015, 9, 1),
                    Decision         = Core.MovementReceipt.Decision.Accepted,
                    QuantityReceived = new ShipmentQuantity(5, ShipmentQuantityUnits.Kilograms)
                }
            };

            shipmentInfo = new TestableShipmentInfo
            {
                Quantity = 20,
                Units    = ShipmentQuantityUnits.Kilograms
            };

            movementRepository = A.Fake <IMovementRepository>();
            shipmentRepository = A.Fake <IShipmentInfoRepository>();
            movementPartialRejectionRepository = A.Fake <IMovementPartialRejectionRepository>();

            movementQuantity = new NotificationMovementsQuantity(movementRepository, shipmentRepository, movementPartialRejectionRepository);
        }
Example #5
0
        private void CreateShipmentInfo(int maxNumberOfShipments)
        {
            var shipment = new TestableShipmentInfo
            {
                Id                = new Guid("2DA8E281-A6A4-459A-A38A-B4B0643E0726"),
                NotificationId    = NotificationId,
                NumberOfShipments = maxNumberOfShipments,
                Quantity          = 1000,
                Units             = ShipmentQuantityUnits.Tonnes
            };

            A.CallTo(() => shipmentRepository.GetByNotificationId(NotificationId)).Returns(shipment);
        }
 public MovementViewModelTests()
 {
     notification = new TestableNotificationApplication
     {
         Id = new Guid("07FF7B1D-A3A9-4FB1-B10B-F00EEF8FB9F8")
     };
     movement = new TestableMovement
     {
         Id = new Guid("B20B7BBE-EA7C-45F7-B6DB-04F645E7375B")
     };
     movementDetails = new TestableMovementDetails
     {
         Id = new Guid("E5DF0706-F17C-49CC-8DB2-B6A524A4C372")
     };
     shipmentInfo = new TestableShipmentInfo
     {
         Id = new Guid("B2B2ADE7-34EF-468D-BB88-72D8B5394AE6")
     };
 }
Example #7
0
 public MovementViewModelTests()
 {
     notification = new TestableNotificationApplication
     {
         Id = new Guid("07FF7B1D-A3A9-4FB1-B10B-F00EEF8FB9F8"),
         CompetentAuthority = UKCompetentAuthority.England
     };
     movement = new TestableMovement
     {
         Id = new Guid("B20B7BBE-EA7C-45F7-B6DB-04F645E7375B")
     };
     movementDetails = new TestableMovementDetails
     {
         Id = new Guid("E5DF0706-F17C-49CC-8DB2-B6A524A4C372")
     };
     shipmentInfo = new TestableShipmentInfo
     {
         Id = new Guid("B2B2ADE7-34EF-468D-BB88-72D8B5394AE6")
     };
 }
Example #8
0
        public GetRemainingShipmentsHandlerTests()
        {
            SystemTime.Freeze(Today);

            movementRepository           = A.Fake <IMovementRepository>();
            shipmentRepository           = A.Fake <IShipmentInfoRepository>();
            financialGuaranteeRepository = A.Fake <IFinancialGuaranteeRepository>();

            var shipment = new TestableShipmentInfo
            {
                Id                = Guid.NewGuid(),
                NotificationId    = NotificationId,
                NumberOfShipments = MaxNumberOfShipments,
                Quantity          = 10m,
                Units             = ShipmentQuantityUnits.Tonnes
            };

            A.CallTo(() => shipmentRepository.GetByNotificationId(NotificationId)).Returns(shipment);
            A.CallTo(() => movementRepository.GetAllMovements(NotificationId)).Returns(GetShipments(TotalMovements, Today));
            A.CallTo(() => movementRepository.GetAllActiveMovements(NotificationId)).Returns(GetShipments(ActiveMovements, Today));

            handler = new GetRemainingShipmentsHandler(movementRepository, shipmentRepository, financialGuaranteeRepository);
        }
        public MovementQuantityTests()
        {
            movement = new TestableMovement
            {
                Status = MovementStatus.Received,
                Receipt = new TestableMovementReceipt
                {
                    Date = new DateTime(2015, 9, 1),
                    Decision = Core.MovementReceipt.Decision.Accepted,
                    QuantityReceived = new ShipmentQuantity(5, ShipmentQuantityUnits.Kilograms)
                }
            };

            shipmentInfo = new TestableShipmentInfo
            {
                Quantity = 20,
                Units = ShipmentQuantityUnits.Kilograms
            };

            movementRepository = A.Fake<IMovementRepository>();
            shipmentRepository = A.Fake<IShipmentInfoRepository>();

            movementQuantity = new NotificationMovementsQuantity(movementRepository, shipmentRepository);
        }
        private void CreateShipmentInfo(int maxNumberOfShipments)
        {
            var shipment = new TestableShipmentInfo
            {
                Id = new Guid("2DA8E281-A6A4-459A-A38A-B4B0643E0726"),
                NotificationId = NotificationId,
                NumberOfShipments = maxNumberOfShipments,
                Quantity = 1000,
                Units = ShipmentQuantityUnits.Tonnes
            };

            A.CallTo(() => shipmentRepository.GetByNotificationId(NotificationId)).Returns(shipment);
        }
        private void SetupMovements(int intendedQuantity, int quantityReceived)
        {
            var shipment = new TestableShipmentInfo
            {
                Id = new Guid("2DA8E281-A6A4-459A-A38A-B4B0643E0726"),
                NotificationId = NotificationId,
                NumberOfShipments = 10,
                Quantity = intendedQuantity,
                Units = ShipmentQuantityUnits.Tonnes
            };

            var existingMovement = new TestableMovement
            {
                Id = new Guid("1584B5F6-4E33-441D-A9C9-17C1C3B28BA2"),
                NotificationId = NotificationId,
                Status = MovementStatus.Received
            };

            var movementReceipt = new TestableMovementReceipt
            {
                Id = new Guid("28FFDD0B-1A1A-4CAC-B4E4-D232DA7B2AB8"),
                QuantityReceived = new ShipmentQuantity(quantityReceived, ShipmentQuantityUnits.Tonnes)
            };

            existingMovement.Receipt = movementReceipt;

            A.CallTo(() => shipmentRepository.GetByNotificationId(NotificationId)).Returns(shipment);
            A.CallTo(() => movementRepository.GetMovementsByStatus(NotificationId, MovementStatus.Received)).Returns(new[] { existingMovement });
            A.CallTo(() => assessmentRepository.GetByNotificationId(NotificationId)).Returns(new TestableNotificationAssessment { Status = NotificationStatus.Consented });
            A.CallTo(() => consentRepository.GetByNotificationId(NotificationId)).Returns(ValidConsent());
        }