public void T400_IdentitiesTest() { TcoObjectTest to = tc._tcoObjectTest_A; //to is the child of the tc TcoStateTest ts = to._tcoStateTest_A; //ts is the child of the to and grandchild of the tc TcoTaskTest tt = ts._tcoTaskTest_A; //tt is the child of the ts and great-grandchild of the tc tc._callMyPlcInstance.Synchron = true; //Switch on the cyclical execution of the tc instance Thread.Sleep(300); //Time of the cyclical execution of the test instance tc._callMyPlcInstance.Synchron = false; //Switch off the cyclical execution of the tc instance tc.ReadOutCycleCounters(); //Read out actual cycle counters values into the test instance Assert.Greater(tc._startCycles.Synchron, 0); //StartCycleCounter should be greather than zero as test instance was running at least 300ms. Assert.Greater(tc._endCycles.Synchron, 0); //EndCycleCounter should be greather than zero as test instance was running at least 300ms. to.ReadOutIdentities(); //Readout identities into the test instance ts.ReadOutIdentities(); //Readout identities into the test instance tt.ReadOutIdentities(); //Readout identities into the test instance Assert.AreEqual(tc._myIdentity.Synchron, to._myContextIdentity.Synchron); //Identity of the child's context (to) is the same as the identity of the parent(tc) Assert.AreEqual(tc._myIdentity.Synchron, ts._myContextIdentity.Synchron); //Identity of the grandchild's context (ts) is the same as the identity of the grandparent(tc) Assert.AreEqual(tc._myIdentity.Synchron, tt._myContextIdentity.Synchron); //Identity of the great-grandchild's context (tt) is the same as the identity of the great-grandparent(tc) Assert.AreNotEqual(tc._myIdentity.Synchron, to._myIdentity.Synchron); //Identity of the child(to) is different than the identity of its parent(tc), as they are both unique objects. Assert.AreNotEqual(tc._myIdentity.Synchron, ts._myIdentity.Synchron); //Identity of the grandchild(ts) is different than the identity of its grandparent(tc), as they are both unique objects. Assert.AreNotEqual(tc._myIdentity.Synchron, tt._myIdentity.Synchron); //Identity of the great-grandchild(tt) is different than the identity of its great-grandparent(tc), as they are both unique objects. Assert.AreNotEqual(to._myIdentity.Synchron, ts._myIdentity.Synchron); //Identity of the grandchild(ts) is different than the identity of its parent(to), as they are both unique objects. Assert.AreNotEqual(to._myIdentity.Synchron, tt._myIdentity.Synchron); //Identity of the great-grandchild(tt) is different than the identity of its grandparent(to), as they are both unique objects. }
public void T200_IdentitiesTest() { tc_A._CallMyPlcInstance.Synchron = true; //Switch on the cyclical execution of the _TcoContextTest_A instance tc_B._CallMyPlcInstance.Synchron = true; //Switch on the cyclical execution of the _TcoContextTest_B instance Thread.Sleep(300); //Time of the cyclical execution of the _TcoContextTest_A instance tc_A._CallMyPlcInstance.Synchron = false; //Switch off the cyclical execution of the _TcoContextTest_A instance Thread.Sleep(500); //Time of the cyclical execution of the _TcoContextTest_B instance tc_B._CallMyPlcInstance.Synchron = false; //Switch off the cyclical execution of the _TcoContextTest_B instance tc_A.ReadOutCycleCounters(); //Read out actual cycle counters values into the test instance tc_B.ReadOutCycleCounters(); //Read out actual cycle counters values into the test instance Assert.Greater(tc_A._startCycles.Synchron, 0); //_startCycleCount should be greather then 0, as by calling the Run() method, also the Open() method should be called internally Assert.Greater(tc_A._endCycles.Synchron, 0); //_endCycleCount should be greather then 0, as by calling the Run() method, also the Close() method should be called internally Assert.Greater(tc_B._startCycles.Synchron, 0); //_startCycleCount should be greather then 0, as by calling the Run() method, also the Open() method should be called internally Assert.Greater(tc_B._endCycles.Synchron, 0); //_endCycleCount should be greather then 0, as by calling the Run() method, also the Close() method should be called internally TcoObjectTest tc_A_to_A = tc_A._TcoObjectTest_A; TcoObjectTest tc_A_to_B = tc_A._TcoObjectTest_B; tc_A_to_A.ReadOutIdentities(); // Read out identities into the test instance tc_A_to_B.ReadOutIdentities(); // Read out identities into the test instance Assert.AreEqual(tc_A._MyIdentity.Synchron, tc_A_to_A._MyContextIdentity.Synchron); //Identity of the child's context (tc_A_to_A) is the same as the identity of the parent(tc_A) Assert.AreEqual(tc_A_to_A._MyContextIdentity.Synchron, tc_A_to_B._MyContextIdentity.Synchron); //Identity of the child's context (tc_A_to_A) is the same as the identity of the child's context (tc_A_to_B), as they have the same parent(tc_A) Assert.AreEqual(tc_A_to_A._MyParentIdentity.Synchron, tc_A_to_B._MyParentIdentity.Synchron); //Identity of the child's parent (tc_A_to_A) is the same as the identity of the child object's (tc_A_to_B), as they have the same parent(tc_A) Assert.AreEqual(tc_A_to_A._MyContextStartCount.Synchron, tc_A_to_B._MyContextStartCount.Synchron); //_startCycleCount of the child (tc_A_to_A) is the same as the _startCycleCount of the child (tc_A_to_B), as they have the same parent(tc_A) Assert.AreEqual(tc_A_to_A._MyContextEndCount.Synchron, tc_A_to_B._MyContextEndCount.Synchron); //_endCycleCount of the child (tc_A_to_A) is the same as the _endCycleCount of the child (tc_A_to_B), as they have the same parent(tc_A) Assert.AreNotEqual(tc_A._MyIdentity.Synchron, tc_A_to_A._MyIdentity.Synchron); //Identity of the child(tc_A_to_A) is different than the identity of the parent(tc_A), as they are both unique objects. Assert.AreNotEqual(tc_A._MyIdentity.Synchron, tc_A_to_B._MyIdentity.Synchron); //Identity of the child(tc_A_to_B) is different than the identity of the parent(tc_A), as they are both unique objects. TcoObjectTest tc_B_to_A = tc_B._TcoObjectTest_A; TcoObjectTest tc_B_to_B = tc_B._TcoObjectTest_B; tc_B_to_A.ReadOutIdentities(); // Read out identities into the test instance tc_B_to_B.ReadOutIdentities(); // Read out identities into the test instance Assert.AreEqual(tc_B._MyIdentity.Synchron, tc_B_to_A._MyContextIdentity.Synchron); //Identity of the child's context (tc_B_to_A) is the same as the identity of the parent(tc_B) Assert.AreEqual(tc_B_to_A._MyContextIdentity.Synchron, tc_B_to_B._MyContextIdentity.Synchron); //Identity of the child's context (tc_B_to_A) is the same as the identity of the child's context (tc_B_to_B), as they have the same parent(tc_B) Assert.AreEqual(tc_B_to_A._MyParentIdentity.Synchron, tc_B_to_B._MyParentIdentity.Synchron); //Identity of the child's parent (tc_B_to_A) is the same as the identity of the child object's (tc_B_to_B), as they have the same parent(tc_B) Assert.AreEqual(tc_B_to_A._MyContextStartCount.Synchron, tc_B_to_B._MyContextStartCount.Synchron); //_startCycleCount of the child (tc_B_to_A) is the same as the _startCycleCount of the child (tc_B_to_B), as they have the same parent(tc_B) Assert.AreEqual(tc_B_to_A._MyContextEndCount.Synchron, tc_B_to_B._MyContextEndCount.Synchron); //_endCycleCount of the child (tc_B_to_A) is the same as the _endCycleCount of the child (tc_B_to_B), as they have the same parent(tc_B) Assert.AreNotEqual(tc_B._MyIdentity.Synchron, tc_B_to_A._MyIdentity.Synchron); //Identity of the child(tc_B_to_A) is different as the identity of the parent(tc_B), as they are both unique objects. Assert.AreNotEqual(tc_B._MyIdentity.Synchron, tc_B_to_B._MyIdentity.Synchron); //Identity of the child(tc_B_to_B) is different as the identity of the parent(tc_B), as they are both unique objects. Assert.AreNotEqual(tc_A._MyIdentity.Synchron, tc_B._MyIdentity.Synchron);//Identity of the parent (tc_A) is different as the identity of the parent(tc_B), as they are both unique objects. }