public void Generate_Return_Success() { // var department = new UnitDepartmentId(1); var id = Guid.NewGuid(); var garmentFinishingOut = new GarmentFinishingOut(Guid.NewGuid(), "finishingPrinting", new UnitDepartmentId(1), "unitToCode", "unitToCode", "finishingTo", DateTimeOffset.Now, "roNo", "Article", new UnitDepartmentId(1), "unitCode", "unitName", new GarmentComodityId(1), "comodityCode", "comodityName", false); GarmentFinishingOutDto dto = new GarmentFinishingOutDto(garmentFinishingOut) { CreatedBy = "CreatedBy", }; var finishingOutItem = new GarmentFinishingOutItemDto(new GarmentFinishingOutItem(id, id, id, id, new ProductId(1), "productCode", "productName", "designColor", new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit", "color", 1, 1, 1)); finishingOutItem.Details = new List <GarmentFinishingOutDetailDto>() { new GarmentFinishingOutDetailDto(new GarmentFinishingOutDetail(id, id, new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit")) }; var items = new List <GarmentFinishingOutItemDto>() { finishingOutItem }; dto.GetType().GetProperty("Items").SetValue(dto, items); var result = GarmentFinishingOutPDFTemplate.Generate(dto, "Buyer"); Assert.NotNull(result); }
public void should_Success_Instantiate() { var id = Guid.NewGuid(); var department = new UnitDepartmentId(1); var garmentFinishingOut = new GarmentFinishingOut(id, "finishingPrinting", new UnitDepartmentId(1), "unitToCode", "unitToCode", "FinishingTo", DateTimeOffset.Now, "roNo", "Article", new UnitDepartmentId(1), "unitCode", "unitName", new GarmentComodityId(1), "comodityCode", "comodityName", true); GarmentFinishingOutDto dto = new GarmentFinishingOutDto(garmentFinishingOut); Assert.Equal("FinishingTo", dto.FinishingTo); Assert.NotNull(dto.Unit); Assert.NotNull(dto.UnitTo); Assert.NotNull(dto.Comodity); }
public GarmentFinishingOutListDto(GarmentFinishingOut garmentFinishingOutList) { Id = garmentFinishingOutList.Identity; FinishingOutNo = garmentFinishingOutList.FinishingOutNo; UnitTo = new UnitDepartment(garmentFinishingOutList.UnitToId.Value, garmentFinishingOutList.UnitToCode, garmentFinishingOutList.UnitToName); Unit = new UnitDepartment(garmentFinishingOutList.UnitId.Value, garmentFinishingOutList.UnitCode, garmentFinishingOutList.UnitName); RONo = garmentFinishingOutList.RONo; Article = garmentFinishingOutList.Article; FinishingOutDate = garmentFinishingOutList.FinishingOutDate; FinishingTo = garmentFinishingOutList.FinishingTo; CreatedBy = garmentFinishingOutList.AuditTrail.CreatedBy; Items = new List <GarmentFinishingOutItemDto>(); }
public GarmentFinishingOutDto(GarmentFinishingOut garmentFinishingOutList) { Id = garmentFinishingOutList.Identity; FinishingOutNo = garmentFinishingOutList.FinishingOutNo; UnitTo = new UnitDepartment(garmentFinishingOutList.UnitToId.Value, garmentFinishingOutList.UnitToCode, garmentFinishingOutList.UnitToName); Unit = new UnitDepartment(garmentFinishingOutList.UnitId.Value, garmentFinishingOutList.UnitCode, garmentFinishingOutList.UnitName); RONo = garmentFinishingOutList.RONo; Article = garmentFinishingOutList.Article; FinishingOutDate = garmentFinishingOutList.FinishingOutDate; FinishingTo = garmentFinishingOutList.FinishingTo; Comodity = new GarmentComodity(garmentFinishingOutList.ComodityId.Value, garmentFinishingOutList.ComodityCode, garmentFinishingOutList.ComodityName); IsDifferentSize = garmentFinishingOutList.IsDifferentSize; Items = new List <GarmentFinishingOutItemDto>(); }
public async Task Handle_StateUnderTest_ExpectedBehavior_GUDANGJADI() { // Arrange Guid finishingInItemGuid = Guid.NewGuid(); Guid finishingOutGuid = Guid.NewGuid(); Guid finishingOutItemGuid = Guid.NewGuid(); Guid finishingOutDetailGuid = Guid.NewGuid(); RemoveGarmentFinishingOutCommandHandler unitUnderTest = CreateRemoveGarmentFinishingOutCommandHandler(); CancellationToken cancellationToken = CancellationToken.None; RemoveGarmentFinishingOutCommand RemoveGarmentFinishingOutCommand = new RemoveGarmentFinishingOutCommand(finishingOutGuid); GarmentFinishingOut garmentFinishingOut = new GarmentFinishingOut( finishingOutGuid, "no", new UnitDepartmentId(1), "uCode", "Uname", "GUDANG JADI", DateTimeOffset.Now, "ro", "article", new UnitDepartmentId(1), "uCode", "Uname", new GarmentComodityId(1), "cCode", "cName", false); _mockFinishingOutRepository .Setup(s => s.Query) .Returns(new List <GarmentFinishingOutReadModel>() { garmentFinishingOut.GetReadModel() }.AsQueryable()); _mockFinishingOutItemRepository .Setup(s => s.Find(It.IsAny <Expression <Func <GarmentFinishingOutItemReadModel, bool> > >())) .Returns(new List <GarmentFinishingOutItem>() { new GarmentFinishingOutItem(finishingOutItemGuid, finishingOutGuid, Guid.Empty, finishingInItemGuid, new ProductId(1), null, null, null, new SizeId(1), null, 1, new UomId(1), null, null, 1, 1, 1) }); //_mockFinishingOutDetailRepository // .Setup(s => s.Find(It.IsAny<Expression<Func<GarmentFinishingOutDetailReadModel, bool>>>())) // .Returns(new List<GarmentFinishingOutDetail>() // { // new GarmentFinishingOutDetail(Guid.Empty, Guid.Empty,new SizeId(1), null, 1, new UomId(1),null ) // }); _mockFinishingInItemRepository .Setup(s => s.Query) .Returns(new List <GarmentFinishingInItemReadModel> { new GarmentFinishingInItemReadModel(finishingInItemGuid) }.AsQueryable()); GarmentFinishedGoodStock garmentFinishedGoodStock = new GarmentFinishedGoodStock(Guid.NewGuid(), "no", "ro", "article", garmentFinishingOut.UnitId, garmentFinishingOut.UnitCode, garmentFinishingOut.UnitName, garmentFinishingOut.ComodityId, garmentFinishingOut.ComodityCode, garmentFinishingOut.ComodityName, new SizeId(1), null, new UomId(1), null, 1, 1, 1); _mockFinishedGoodStockRepository .Setup(s => s.Query) .Returns(new List <GarmentFinishedGoodStockReadModel> { garmentFinishedGoodStock.GetReadModel() }.AsQueryable()); GarmentFinishedGoodStockHistory garmentFinishedGoodStockHistory = new GarmentFinishedGoodStockHistory(Guid.NewGuid(), garmentFinishedGoodStock.Identity, finishingOutItemGuid, Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, null, "ro", "article", garmentFinishingOut.UnitId, garmentFinishingOut.UnitCode, garmentFinishingOut.UnitName, garmentFinishingOut.ComodityId, garmentFinishingOut.ComodityCode, garmentFinishingOut.ComodityName, new SizeId(1), null, new UomId(1), null, 1, 1, 1); _mockFinishedGoodStockHistoryRepository .Setup(s => s.Query) .Returns(new List <GarmentFinishedGoodStockHistoryReadModel> { garmentFinishedGoodStockHistory.GetReadModel() }.AsQueryable()); GarmentComodityPrice garmentComodity = new GarmentComodityPrice( Guid.NewGuid(), true, DateTimeOffset.Now, garmentFinishingOut.UnitId, garmentFinishingOut.UnitCode, garmentFinishingOut.UnitName, garmentFinishingOut.ComodityId, garmentFinishingOut.ComodityCode, garmentFinishingOut.ComodityName, 1000 ); _mockComodityPriceRepository .Setup(s => s.Query) .Returns(new List <GarmentComodityPriceReadModel> { garmentComodity.GetReadModel() }.AsQueryable()); _mockFinishingOutRepository .Setup(s => s.Update(It.IsAny <GarmentFinishingOut>())) .Returns(Task.FromResult(It.IsAny <GarmentFinishingOut>())); _mockFinishingOutItemRepository .Setup(s => s.Update(It.IsAny <GarmentFinishingOutItem>())) .Returns(Task.FromResult(It.IsAny <GarmentFinishingOutItem>())); //_mockFinishingOutDetailRepository // .Setup(s => s.Update(It.IsAny<GarmentFinishingOutDetail>())) // .Returns(Task.FromResult(It.IsAny<GarmentFinishingOutDetail>())); _mockFinishingInItemRepository .Setup(s => s.Update(It.IsAny <GarmentFinishingInItem>())) .Returns(Task.FromResult(It.IsAny <GarmentFinishingInItem>())); _mockFinishedGoodStockRepository .Setup(s => s.Update(It.IsAny <GarmentFinishedGoodStock>())) .Returns(Task.FromResult(It.IsAny <GarmentFinishedGoodStock>())); _mockFinishedGoodStockHistoryRepository .Setup(s => s.Update(It.IsAny <GarmentFinishedGoodStockHistory>())) .Returns(Task.FromResult(It.IsAny <GarmentFinishedGoodStockHistory>())); _MockStorage .Setup(x => x.Save()) .Verifiable(); // Act var result = await unitUnderTest.Handle(RemoveGarmentFinishingOutCommand, cancellationToken); // Assert result.Should().NotBeNull(); }