private static void CheckAndAddDefectString(ChileLot chileLot, DefectTypeEnum defectType, ref string defectString) { if (LotStatusHelper.LotHasUnresolvedDefects(chileLot.Lot, defectType)) { if (string.IsNullOrWhiteSpace(defectString)) { defectString += defectType.ToString(); } else { defectString += ", " + defectType.ToString(); } } }
private bool SetLotQualityStatus(LotStat?lotStat, Lot newLot, ref List <LotAttributeDefect> attributeDefects) { if (lotStat == LotStat.Rejected) { newLot.QualityStatus = LotQualityStatus.Rejected; return(true); } if (lotStat.IsCompleted()) { //todo: get employee from oldLot.TesterID attributeDefects.Where(d => d.LotDefect.Resolution == null).ForEach(d => d.LotDefect.ResolveDefect(LotMother.DefaultEmployee)); } if (lotStat.IsAcceptable()) { newLot.QualityStatus = LotQualityStatus.Released; return(true); } var unresolvedContaminated = LotStatusHelper.LotHasUnresolvedDefects(newLot, DefectTypeEnum.BacterialContamination); if (lotStat == LotStat.Contaminated || unresolvedContaminated) { newLot.QualityStatus = LotQualityStatus.Contaminated; return(true); } var unresolvedActionable = LotStatusHelper.LotHasUnresolvedDefects(newLot, DefectTypeEnum.ActionableDefect); if (lotStat.IsRequiresAttention() || (newLot.ProductSpecComplete && lotStat == LotStat.InProcess) || unresolvedActionable) { newLot.QualityStatus = LotQualityStatus.Pending; return(true); } if (newLot.ProductSpecComplete) { newLot.QualityStatus = LotQualityStatus.Released; return(true); } if (lotStat == LotStat.InProcess || lotStat == null) { newLot.QualityStatus = LotQualityStatus.Pending; return(true); } return(false); }
public void Returns_true_if_Lot_contains_BacterialContamination_defects_without_resolutions() { //Arrange var lot = new Lot { LotDefects = new[] { BuildLotDefect(DefectTypeEnum.BacterialContamination, false), BuildLotDefect(DefectTypeEnum.BacterialContamination, true) } }; //Act-Assert Assert.IsTrue(LotStatusHelper.LotHasUnresolvedDefects(lot, DefectTypeEnum.BacterialContamination)); }
public void Returns_false_if_Lot_contains_no_BacterialContamination_defects_without_resolutions() { //Arrange var lotWithNoDefects = new Lot { LotDefects = new LotDefect[0] }; var lotWithResolvedDefect = new Lot { LotDefects = new[] { BuildLotDefect(DefectTypeEnum.BacterialContamination, true) } }; //Act-Assert Assert.IsFalse(LotStatusHelper.LotHasUnresolvedDefects(lotWithNoDefects, DefectTypeEnum.BacterialContamination)); Assert.IsFalse(LotStatusHelper.LotHasUnresolvedDefects(lotWithResolvedDefect, DefectTypeEnum.BacterialContamination)); }