public async Task Handle_StateUnderTest_ExpectedBehavior_FINISHING()
        {
            // Arrange
            Guid SewingInGuid      = Guid.NewGuid();
            Guid preparingItemGuid = Guid.NewGuid();
            RemoveGarmentSewingInCommandHandler unitUnderTest         = CreateRemoveGarmentSewingInCommandHandler();
            CancellationToken            cancellationToken            = CancellationToken.None;
            RemoveGarmentSewingInCommand RemoveGarmentSewingInCommand = new RemoveGarmentSewingInCommand(SewingInGuid);
            Guid loadingItemGuid         = Guid.NewGuid();
            Guid finishingOutOutItemGuid = Guid.NewGuid();

            GarmentSewingIn garmentSewingIn = new GarmentSewingIn(
                SewingInGuid, null, "FINISHING", Guid.Empty, null, new UnitDepartmentId(1), null, null,
                new UnitDepartmentId(1), null, null, null, null, new GarmentComodityId(1), null, null, DateTimeOffset.Now);

            _mockSewingInRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentSewingInReadModel>()
            {
                garmentSewingIn.GetReadModel()
            }.AsQueryable());
            _mockSewingInItemRepository
            .Setup(s => s.Find(It.IsAny <Expression <Func <GarmentSewingInItemReadModel, bool> > >()))
            .Returns(new List <GarmentSewingInItem>()
            {
                new GarmentSewingInItem(Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, loadingItemGuid, finishingOutOutItemGuid, Guid.Empty, new ProductId(1), null, null, null, new SizeId(1), null, 0, new UomId(1), null, null, 0, 1, 1)
            });

            _mockFinishingOutItemRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentFinishingOutItemReadModel>
            {
                new GarmentFinishingOutItemReadModel(finishingOutOutItemGuid)
            }.AsQueryable());

            _mockSewingInRepository
            .Setup(s => s.Update(It.IsAny <GarmentSewingIn>()))
            .Returns(Task.FromResult(It.IsAny <GarmentSewingIn>()));
            _mockSewingInItemRepository
            .Setup(s => s.Update(It.IsAny <GarmentSewingInItem>()))
            .Returns(Task.FromResult(It.IsAny <GarmentSewingInItem>()));
            //_mockLoadingItemRepository
            //    .Setup(s => s.Update(It.IsAny<GarmentLoadingItem>()))
            //    .Returns(Task.FromResult(It.IsAny<GarmentLoadingItem>()));
            _mockFinishingOutItemRepository
            .Setup(s => s.Update(It.IsAny <GarmentFinishingOutItem>()))
            .Returns(Task.FromResult(It.IsAny <GarmentFinishingOutItem>()));

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

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

            // Assert
            result.Should().NotBeNull();
        }
示例#2
0
 public GarmentSewingInListDto(GarmentSewingIn garmentSewingInList)
 {
     Id           = garmentSewingInList.Identity;
     SewingInNo   = garmentSewingInList.SewingInNo;
     SewingFrom   = garmentSewingInList.SewingFrom;
     LoadingId    = garmentSewingInList.LoadingId;
     LoadingNo    = garmentSewingInList.LoadingNo;
     UnitFrom     = new UnitDepartment(garmentSewingInList.UnitFromId.Value, garmentSewingInList.UnitFromCode, garmentSewingInList.UnitFromName);
     Unit         = new UnitDepartment(garmentSewingInList.UnitId.Value, garmentSewingInList.UnitCode, garmentSewingInList.UnitName);
     RONo         = garmentSewingInList.RONo;
     Article      = garmentSewingInList.Article;
     Comodity     = new GarmentComodity(garmentSewingInList.ComodityId.Value, garmentSewingInList.ComodityCode, garmentSewingInList.ComodityName);
     SewingInDate = garmentSewingInList.SewingInDate;
     CreatedBy    = garmentSewingInList.AuditTrail.CreatedBy;
     Items        = new List <GarmentSewingInItemDto>();
 }
        public GarmentSewingInDto(GarmentSewingIn garmentSewingIn)
        {
            Id           = garmentSewingIn.Identity;
            SewingInNo   = garmentSewingIn.SewingInNo;
            SewingFrom   = garmentSewingIn.SewingFrom;
            LoadingId    = garmentSewingIn.LoadingId;
            LoadingNo    = garmentSewingIn.LoadingNo;
            UnitFrom     = new UnitDepartment(garmentSewingIn.UnitFromId.Value, garmentSewingIn.UnitFromCode, garmentSewingIn.UnitFromName);
            Unit         = new UnitDepartment(garmentSewingIn.UnitId.Value, garmentSewingIn.UnitCode, garmentSewingIn.UnitName);
            RONo         = garmentSewingIn.RONo;
            Article      = garmentSewingIn.Article;
            Comodity     = new GarmentComodity(garmentSewingIn.ComodityId.Value, garmentSewingIn.ComodityCode, garmentSewingIn.ComodityName);
            SewingInDate = garmentSewingIn.SewingInDate;

            Items = new List <GarmentSewingInItemDto>();
        }