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);
        }
Esempio n. 2
0
 public GetInternalMovementSummaryHandler(
     INotificationMovementsSummaryRepository repository, IMapper mapper, NotificationMovementsQuantity quantity)
 {
     this.repository = repository;
     this.mapper     = mapper;
     this.quantity   = quantity;
 }
        public MovementFactoryTests()
        {
            SystemTime.Freeze(Today);

            shipmentRepository = A.Fake<IShipmentInfoRepository>();
            movementRepository = A.Fake<IMovementRepository>();
            assessmentRepository = A.Fake<INotificationAssessmentRepository>();
            financialGuaranteeRepository = A.Fake<IFinancialGuaranteeRepository>();
            consentRepository = A.Fake<INotificationConsentRepository>();
            workingDayCalculator = A.Fake<IWorkingDayCalculator>();
            notificationApplicationRepository = A.Fake<INotificationApplicationRepository>();
            financialGuaranteeRepository = A.Fake<IFinancialGuaranteeRepository>();

            dateValidator = A.Fake<IMovementDateValidator>();

            var movementNumberGenerator = new MovementNumberGenerator(new NextAvailableMovementNumberGenerator(movementRepository), 
                movementRepository, 
                shipmentRepository);
            var numberOfMovements = new NumberOfMovements(movementRepository, shipmentRepository);
            var movementsQuatity = new NotificationMovementsQuantity(movementRepository, shipmentRepository);
            var numberOfActiveLoads = new NumberOfActiveLoads(movementRepository, financialGuaranteeRepository);
            var consentPeriod = new ConsentPeriod(consentRepository, workingDayCalculator, notificationApplicationRepository);

            factory = new MovementFactory(numberOfMovements,
                movementsQuatity,
                assessmentRepository,
                movementNumberGenerator,
                numberOfActiveLoads,
                consentPeriod,
                dateValidator,
                financialGuaranteeRepository,
                A.Fake<IUserContext>());
        }
        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);
        }
Esempio n. 5
0
        public MovementFactoryTests()
        {
            SystemTime.Freeze(Today);

            shipmentRepository                 = A.Fake <IShipmentInfoRepository>();
            movementRepository                 = A.Fake <IMovementRepository>();
            assessmentRepository               = A.Fake <INotificationAssessmentRepository>();
            financialGuaranteeRepository       = A.Fake <IFinancialGuaranteeRepository>();
            consentRepository                  = A.Fake <INotificationConsentRepository>();
            workingDayCalculator               = A.Fake <IWorkingDayCalculator>();
            notificationApplicationRepository  = A.Fake <INotificationApplicationRepository>();
            financialGuaranteeRepository       = A.Fake <IFinancialGuaranteeRepository>();
            movementPartialRejectionRepository = A.Fake <IMovementPartialRejectionRepository>();

            dateValidator = A.Fake <IMovementDateValidator>();

            var movementNumberGenerator = new MovementNumberGenerator(new NextAvailableMovementNumberGenerator(movementRepository),
                                                                      movementRepository,
                                                                      shipmentRepository);
            var numberOfMovements   = new NumberOfMovements(movementRepository, shipmentRepository);
            var movementsQuatity    = new NotificationMovementsQuantity(movementRepository, shipmentRepository, movementPartialRejectionRepository);
            var numberOfActiveLoads = new NumberOfActiveLoads(movementRepository, financialGuaranteeRepository);
            var consentPeriod       = new ConsentPeriod(consentRepository, workingDayCalculator, notificationApplicationRepository);

            factory = new MovementFactory(numberOfMovements,
                                          movementsQuatity,
                                          assessmentRepository,
                                          movementNumberGenerator,
                                          numberOfActiveLoads,
                                          consentPeriod,
                                          dateValidator,
                                          financialGuaranteeRepository,
                                          A.Fake <IUserContext>());
        }
Esempio n. 6
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);
        }
 public NotificationMovementsSummaryRepository(INotificationApplicationAuthorization notificationAuthorization,
     NotificationMovementsQuantity quantity,
     IwsContext context)
 {
     this.quantity = quantity;
     this.notificationAuthorization = notificationAuthorization;
     this.context = context;
 }
 public NotificationMovementsSummaryRepository(INotificationApplicationAuthorization notificationAuthorization,
                                               NotificationMovementsQuantity quantity,
                                               IwsContext context)
 {
     this.quantity = quantity;
     this.notificationAuthorization = notificationAuthorization;
     this.context = context;
 }
        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);
        }
 public HasExceededConsentedQuantityHandler(NotificationMovementsQuantity movementsQuantity)
 {
     this.movementsQuantity = movementsQuantity;
 }
 public TotalIntendedQuantityExceeded(NotificationMovementsQuantity movementsQuantity)
 {
     this.movementsQuantity = movementsQuantity;
 }
Esempio n. 12
0
 public TotalIntendedQuantityExceeded(NotificationMovementsQuantity movementsQuantity)
 {
     this.movementsQuantity = movementsQuantity;
 }