public void CreateAndUpdateProcedure() { // Arrange Token temp = new Token(10, 15); TracingProcedure procedure1 = new TracingProcedure(); procedure1.AddToken(temp, 0); procedure1.AddResorce(new WorkerResource()); procedure1.AddResorce(new CadResource()); procedure1.AddResorce(new TechincalSupportResource()); procedure1.Update(new ModelingTime()); TracingProcedure procedure2; // Act procedure2 = SaveTester <TracingProcedure> .StartSaveTest(procedure1); // Asserts Assert.AreEqual((procedure1).Description, (procedure2).Description); Assert.AreEqual((procedure1).InputQuantity, (procedure2).InputQuantity); Assert.AreEqual((procedure1).OutputQuantity, (procedure2).OutputQuantity); Assert.AreEqual((procedure1).ResourceCount, (procedure2).ResourceCount); Assert.AreEqual((procedure1).TokenCollector, (procedure2).TokenCollector); }
public void SaveSubProcessTest() { Process process = new Process(); Process subprocess = new Process(); TracingProcedure procedure = new TracingProcedure(); procedure.AddResorce(new CadResource()); procedure.AddResorce(new WorkerResource()); procedure.AddResorce(new TechincalSupportResource()); ArrangementProcedure procedure2 = new ArrangementProcedure(); procedure2.AddResorce(new CadResource()); procedure2.AddResorce(new WorkerResource()); procedure2.AddResorce(new TechincalSupportResource()); subprocess.Blocks.Add(procedure); subprocess.Blocks.Add(procedure2); subprocess.Connections.Connect(procedure, 0, procedure2, 0); subprocess.StartBlock = procedure; subprocess.EndBlock = procedure2; process.Blocks.Add(subprocess); process.StartBlock = subprocess; process.EndBlock = subprocess; //act //добавляем на стартовый блок токен process.AddToken(new Token(0, complexity: 1), 0); //double i = 0; ModelingTime modelingTime = new ModelingTime() { Delta = 1, Now = 0 }; //цикл до тех пор, пока на выходе не появится токен for (modelingTime.Now = 0; modelingTime.Now < 1000 && !process.EndBlockHasOutputToken; modelingTime.Now += modelingTime.Delta) { process.Update(modelingTime); } Process process2 = SaveTester <Process> .StartSaveTest(process); // Asserts Assert.AreEqual(process, process2); }
public void UpdateWithResTest() { // arrange TracingProcedure procedure = new TracingProcedure(); procedure.AddResorce(new WorkerResource() { //Name = "Alleshka", //Position = "Работяга", WorkerQualification = Qualification.FirstCategory }); procedure.AddResorce(new CadResource() { }); procedure.AddResorce(new TechincalSupportResource() { Frequency = 1.5, Ram = 2, Vram = 1 }); procedure.AddToken(new Token(bornTime: 0, complexity: 1000), 0); Token token = null; // act ModelingTime modelingTime = new ModelingTime() { Delta = 1, Now = 0 }; for (modelingTime.Now = 0; modelingTime.Now < 40 && token == null; modelingTime.Now += modelingTime.Delta) { procedure.Update(modelingTime); token = procedure.GetOutputToken(0); procedure.ClearOutputs(); } // Asserts Assert.AreNotEqual(token, null); if (modelingTime.Now < 10 || modelingTime.Now > 11) { Assert.Fail(); } }
public void TracingProcedureTestFalse() { // Arrange TracingProcedure tracing1 = new TracingProcedure(); tracing1.AddResorce(new WorkerResource() { WorkerQualification = Qualification.SecondCategory, Description = "DahaYvolena" }); tracing1.AddResorce(new CadResource()); tracing1.AddResorce(new TechincalSupportResource()); TracingProcedure tracing21 = new TracingProcedure(); tracing21.AddResorce(new WorkerResource() { WorkerQualification = Qualification.SecondCategory, Description = "DahaJunior" }); tracing21.AddResorce(new CadResource()); tracing21.AddResorce(new TechincalSupportResource()); // Asserts Assert.AreNotEqual(tracing1, tracing21); }