Equals() public méthode

public Equals ( object o ) : bool
o object
Résultat bool
Exemple #1
0
        public void CacheKeyTest()
        {
            CacheKey test1 = new CacheKey("hello", "this", "is", "a", "test");
            CacheKey test2 = new CacheKey("hello", "this", "is", "a", "test");
            CacheKey test3 = new CacheKey("hello", "this", "is", "not", "a", "test");
            CacheKey test4 = new CacheKey("hello", "this", "is", "a different", "test");

            Assert.AreEqual(test1.GetHashCode(), test2.GetHashCode(), "CacheKey Hashcode equality");
            Assert.AreEqual(test1, test2, "CacheKey equality");
            Assert.IsFalse(test1.Equals(test3), "CacheKey non-equality");
            Assert.IsFalse(test2.Equals(test3), "CacheKey non-equality");
            Assert.IsFalse(test1.Equals(test4), "CacheKey non-equality");
            Assert.IsFalse(test2.Equals(test4), "CacheKey non-equality");
            Assert.IsFalse(test3.Equals(test4), "CacheKey non-equality");
        }
Exemple #2
0
 public void CacheKeyTest() {
   CacheKey test1 = new CacheKey("hello", "this", "is", "a", "test");
   CacheKey test2 = new CacheKey("hello", "this", "is", "a", "test");
   CacheKey test3 = new CacheKey("hello", "this", "is", "not", "a", "test");
   CacheKey test4 = new CacheKey("hello", "this", "is", "a different", "test");
   Assert.AreEqual(test1.GetHashCode(), test2.GetHashCode(), "CacheKey Hashcode equality");
   Assert.AreEqual(test1, test2, "CacheKey equality");
   Assert.IsFalse(test1.Equals(test3), "CacheKey non-equality");
   Assert.IsFalse(test2.Equals(test3), "CacheKey non-equality");
   Assert.IsFalse(test1.Equals(test4), "CacheKey non-equality");
   Assert.IsFalse(test2.Equals(test4), "CacheKey non-equality");
   Assert.IsFalse(test3.Equals(test4), "CacheKey non-equality");
 }