Exemple #1
0
        public void IdentityBaseTest()
        {
            SimpleIdentity id = new SimpleIdentity();
            const int count = 3;
            for (int i = 0; i < count; i++)
            {
                // Default contentless implementation instances are all equal
                SimpleIdentity idNew = new SimpleIdentity();
                Assert.AreEqual(id, idNew);
                Assert.AreEqual(0, idNew.GetHashCode());
                // Global index always incrementing
                Assert.AreEqual(id.GlobalIndex + i + 1, idNew.GlobalIndex);
            }

            for (int i = 0; i < count; i++)
            {
                // Default contentless implementation instances are all equal
                NumericIdentity idNew = new NumericIdentity(i);
                Assert.AreNotEqual(id, idNew);
                if (i > 0)
                    Assert.AreNotEqual(0, idNew.GetHashCode());
                // Global index always incrementing
                Assert.AreEqual(id.GlobalIndex + count + i + 1, idNew.GlobalIndex);
            }
        }
Exemple #2
0
        public void IdentityBaseTest()
        {
            SimpleIdentity id    = new SimpleIdentity();
            const int      count = 3;

            for (int i = 0; i < count; i++)
            {
                // Default contentless implementation instances are all equal
                SimpleIdentity idNew = new SimpleIdentity();
                Assert.AreEqual(id, idNew);
                Assert.AreEqual(0, idNew.GetHashCode());
                // Global index always incrementing
                Assert.AreEqual(id.GlobalIndex + i + 1, idNew.GlobalIndex);
            }

            for (int i = 0; i < count; i++)
            {
                // Default contentless implementation instances are all equal
                NumericIdentity idNew = new NumericIdentity(i);
                Assert.AreNotEqual(id, idNew);
                if (i > 0)
                {
                    Assert.AreNotEqual(0, idNew.GetHashCode());
                }
                // Global index always incrementing
                Assert.AreEqual(id.GlobalIndex + count + i + 1, idNew.GlobalIndex);
            }
        }
Exemple #3
0
 private bool Equals(NumericIdentity obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(base.Equals(obj) && obj.Value == Value);
 }
Exemple #4
0
 private bool Equals(NumericIdentity obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     return base.Equals(obj) && obj.Value == Value;
 }