Ejemplo n.º 1
0
        public void CreateAndUpdateProcedure()
        {
            // Arrange
            Token temp = new Token(10, 15);

            ArrangementProcedure procedure1 = new ArrangementProcedure();

            procedure1.AddToken(temp, 0);
            procedure1.AddResorce(new WorkerResource());
            procedure1.AddResorce(new CadResource());
            procedure1.AddResorce(new TechincalSupportResource());
            procedure1.Update(new ModelingTime());

            ArrangementProcedure procedure2;

            // Act
            procedure2 = SaveTester <ArrangementProcedure> .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);
        }
Ejemplo n.º 2
0
        public void UpdateWithResTest()
        {
            // arrange
            ArrangementProcedure procedure = new ArrangementProcedure();

            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();
            }
        }