public IWork Work(DayTime dayTime, IHandleBigData bigData, string name) { if (CurrentWo == null) { if (Buffer.Count > 0) { CurrentWo = Buffer.Dequeue(); CurrentInspectionTime = _inspectionTime; } return(null); } IWork answer = null; CurrentInspectionTime--; if (CurrentInspectionTime == 0) { answer = CurrentWo; CurrentWo = null; answer.NonConformance = bigData.IsNonConformance(name); if (!answer.NonConformance) { answer.SetNextOp(); } } return(answer); }
protected void SetUp() { Test test = new Test("Default", 0, 0, 0, 0, 0); Configuration.Initialize(test); _workorder = Substitute.For <IWork>(); _workorder.CurrentOpType.Returns(Op.OpTypes.DrillOpType1); _workorder.CurrentOpSetupTime.Returns(0); _workorder.CurrentOpEstTimeToComplete.Returns(1); _workorder.Id.Returns(1); ISchedulePlants ps = Substitute.For <ISchedulePlants>(); ps.ValidateWoForMachines(Arg.Any <int>(), Arg.Any <string>()).Returns(x => x[0]); _plant = Substitute.For <IPlant>(); _plant.PlantScheduler.Returns(ps); _bigData = Substitute.For <IHandleBigData>(); _bigData.IsBreakdown(Arg.Any <string>(), Arg.Any <DayTime>()).Returns(x => x[1]); _bigData.IsNonConformance(Arg.Any <string>()).Returns(false); _mes = Substitute.For <IMes>(); _dayTime = new DayTime(); _subject = new Workcenter("TestWC", Machine.Types.BigDrill); _subject.SetMes(_mes); _subject.AddPlant(_plant); _subject.AddBigData(_bigData); }
protected void SetUp() { _subject = new Quality(); _dayTime = new DayTime(); List <Op> ops = new List <Op>() { new Op(Op.OpTypes.DrillOpType1), new Op(Op.OpTypes.DrillOpType2) }; _wo1 = Substitute.For <IWork>(); _wo1.Id.Returns(1); _wo1.Operations.Returns(ops); _bigData = Substitute.For <IHandleBigData>(); _bigData.IsBreakdown(Arg.Any <string>(), Arg.Any <DayTime>()).Returns(x => x[1]); _bigData.IsNonConformance(Arg.Any <string>()).Returns(false); }