public async void Validate_RO_Garment_Error_Category_Mixed() { var dbContext = DbContext(GetCurrentMethod()); var serviceProvider = GetServiceProviderMock(dbContext).Object; CostCalculationGarmentFacade facade = new CostCalculationGarmentFacade(serviceProvider, dbContext); var dataCostCalculationGarment = await DataUtil(facade, serviceProvider, dbContext).GetTestData(); foreach (var material in dataCostCalculationGarment.CostCalculationGarment_Materials) { material.IsPRMaster = false; } dataCostCalculationGarment.CostCalculationGarment_Materials.Add(new CostCalculationGarment_Material { ProductId = "2", CategoryName = "PROCESS", IsPRMaster = false }); RO_Garment_ValidationFacade garmentValidationFacade = new RO_Garment_ValidationFacade(serviceProvider, dbContext); var productDict = dataCostCalculationGarment.CostCalculationGarment_Materials.ToDictionary(k => long.Parse(k.ProductId), v => v.ProductCode); Exception exception = await Assert.ThrowsAsync <Exception>(() => garmentValidationFacade.ValidateROGarment(dataCostCalculationGarment, productDict)); Assert.NotNull(exception); }
public async void Validate_RO_Garment_Success() { var dbContext = DbContext(GetCurrentMethod()); var serviceProvider = GetServiceProviderMock(dbContext).Object; CostCalculationGarmentFacade facade = new CostCalculationGarmentFacade(serviceProvider, dbContext); var dataCostCalculationGarment = await DataUtil(facade, serviceProvider, dbContext).GetTestData(); RO_Garment_ValidationFacade garmentValidationFacade = new RO_Garment_ValidationFacade(serviceProvider, dbContext); var productDict = dataCostCalculationGarment.CostCalculationGarment_Materials.ToDictionary(k => long.Parse(k.ProductId), v => v.ProductCode); var result = await garmentValidationFacade.ValidateROGarment(dataCostCalculationGarment, productDict); Assert.NotEqual(0, result); }