public void ProcessCompareTestFalse() { // Arrange Process process1 = new Process(); TracingProcedure procedure1 = new TracingProcedure(); SampleTestingProcedure procedure2 = new SampleTestingProcedure(); process1.Blocks.Add(procedure1); process1.Blocks.Add(procedure2); process1.Connections.Connect(procedure1, 0, procedure2, 0); process1.StartBlock = procedure1; process1.EndBlock = procedure2; Process process2 = new Process(); SampleTestingProcedure procedure21 = new SampleTestingProcedure(); SampleTestingProcedure procedure22 = new SampleTestingProcedure(); process2.Blocks.Add(procedure21); process2.Blocks.Add(procedure22); process2.Connections.Connect(procedure21, 0, procedure22, 0); process2.StartBlock = procedure21; process2.EndBlock = procedure22; Assert.AreNotEqual(process1, process2); }
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 CreateEmptyProcedureAsIBlock() { // Arrange IBlock procedure1 = new TracingProcedure(); IBlock procedure2; // Act procedure2 = SaveTester <IBlock> .StartSaveTest(procedure1); // Asserts Assert.AreEqual((procedure1 as TracingProcedure).Description, (procedure2 as TracingProcedure).Description); Assert.AreEqual((procedure1 as TracingProcedure).InputQuantity, (procedure2 as TracingProcedure).InputQuantity); Assert.AreEqual((procedure1 as TracingProcedure).OutputQuantity, (procedure2 as TracingProcedure).OutputQuantity); Assert.AreEqual((procedure1 as TracingProcedure).ResourceCount, (procedure2 as TracingProcedure).ResourceCount); Assert.AreEqual((procedure1 as TracingProcedure).TokenCollector, (procedure2 as TracingProcedure).TokenCollector); }
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); }