public GarmentAdjustmentListDto(GarmentAdjustment garmentAdjustment)
 {
     Id             = garmentAdjustment.Identity;
     AdjustmentNo   = garmentAdjustment.AdjustmentNo;
     RONo           = garmentAdjustment.RONo;
     Article        = garmentAdjustment.Article;
     Unit           = new UnitDepartment(garmentAdjustment.UnitId.Value, garmentAdjustment.UnitCode, garmentAdjustment.UnitName);
     Comodity       = new GarmentComodity(garmentAdjustment.ComodityId.Value, garmentAdjustment.ComodityCode, garmentAdjustment.ComodityName);
     AdjustmentDate = garmentAdjustment.AdjustmentDate;
     CreatedBy      = garmentAdjustment.AuditTrail.CreatedBy;
 }
Exemple #2
0
        public GarmentAdjustmentDto(GarmentAdjustment garmentAdjustment)
        {
            Id             = garmentAdjustment.Identity;
            AdjustmentNo   = garmentAdjustment.AdjustmentNo;
            AdjustmentType = garmentAdjustment.AdjustmentType;
            RONo           = garmentAdjustment.RONo;
            Article        = garmentAdjustment.Article;
            Unit           = new UnitDepartment(garmentAdjustment.UnitId.Value, garmentAdjustment.UnitCode, garmentAdjustment.UnitName);
            Comodity       = new GarmentComodity(garmentAdjustment.ComodityId.Value, garmentAdjustment.ComodityCode, garmentAdjustment.ComodityName);
            AdjustmentDate = garmentAdjustment.AdjustmentDate;
            AdjustmentDesc = garmentAdjustment.AdjustmentDesc;

            Items = new List <GarmentAdjustmentItemDto>();
        }
Exemple #3
0
        public async Task Handle_StateUnderTest_ExpectedBehavior_LOADING()
        {
            // Arrange
            Guid adjustmentGuid   = Guid.NewGuid();
            Guid sewingDOItemGuid = Guid.NewGuid();
            Guid sewingInItemGuid = Guid.NewGuid();
            Guid sewingDOGuid     = Guid.NewGuid();
            RemoveGarmentAdjustmentCommandHandler unitUnderTest = CreateRemoveGarmentAdjustmentCommandHandler();
            CancellationToken cancellationToken = CancellationToken.None;
            RemoveGarmentAdjustmentCommand RemoveGarmentAdjustmentCommand = new RemoveGarmentAdjustmentCommand(adjustmentGuid);

            GarmentAdjustment garmentAdjustment = new GarmentAdjustment(
                adjustmentGuid, null, "LOADING", "roNo", null, new UnitDepartmentId(1), null, null, DateTimeOffset.Now,
                new GarmentComodityId(1), null, null, null);

            _mockAdjustmentRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentAdjustmentReadModel>()
            {
                garmentAdjustment.GetReadModel()
            }.AsQueryable());

            _mockAdjustmentItemRepository
            .Setup(s => s.Find(It.IsAny <Expression <Func <GarmentAdjustmentItemReadModel, bool> > >()))
            .Returns(new List <GarmentAdjustmentItem>()
            {
                new GarmentAdjustmentItem(Guid.Empty, Guid.Empty, sewingDOItemGuid, sewingInItemGuid, Guid.Empty, Guid.Empty, new SizeId(1), null, new ProductId(1), null, null, null, 1, 10, new UomId(1), null, null, 1)
            });


            _mockSewingDOItemRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentSewingDOItemReadModel>
            {
                new GarmentSewingDOItemReadModel(sewingDOItemGuid)
            }.AsQueryable());

            GarmentComodityPrice garmentComodity = new GarmentComodityPrice(
                Guid.NewGuid(),
                true,
                DateTimeOffset.Now,
                new UnitDepartmentId(garmentAdjustment.UnitId.Value),
                garmentAdjustment.UnitCode,
                garmentAdjustment.UnitName,
                new GarmentComodityId(garmentAdjustment.ComodityId.Value),
                garmentAdjustment.ComodityCode,
                garmentAdjustment.ComodityName,
                1000
                );

            _mockComodityPriceRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentComodityPriceReadModel>
            {
                garmentComodity.GetReadModel()
            }.AsQueryable());

            _mockAdjustmentRepository
            .Setup(s => s.Update(It.IsAny <GarmentAdjustment>()))
            .Returns(Task.FromResult(It.IsAny <GarmentAdjustment>()));
            _mockAdjustmentItemRepository
            .Setup(s => s.Update(It.IsAny <GarmentAdjustmentItem>()))
            .Returns(Task.FromResult(It.IsAny <GarmentAdjustmentItem>()));
            _mockSewingDOItemRepository
            .Setup(s => s.Update(It.IsAny <GarmentSewingDOItem>()))
            .Returns(Task.FromResult(It.IsAny <GarmentSewingDOItem>()));

            _MockStorage
            .Setup(x => x.Save())
            .Verifiable();

            // Act
            var result = await unitUnderTest.Handle(RemoveGarmentAdjustmentCommand, cancellationToken);

            // Assert
            result.Should().NotBeNull();
        }