Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
		public void Bool ()
		{
			DefaultValueAttribute dvat = new DefaultValueAttribute (true);
			Assert.IsTrue ((bool) dvat.Value, "Value");

			Assert.IsFalse (dvat.Equals (true), "Equals(true)");
			Assert.IsTrue (dvat.Equals (new DefaultValueAttribute (true)), "Equals(new)");

			Assert.AreEqual (true.GetHashCode (), dvat.GetHashCode (), "GetHashCode");
		}
		public void Null ()
		{
			DefaultValueAttribute dva = new DefaultValueAttribute (null);
			Assert.IsNull (dva.Value, "Value");

			Assert.IsFalse (dva.Equals (null), "Equals(null)");
			Assert.IsTrue (dva.Equals (new DefaultValueAttribute (null)), "Equals(new)");

			// != Value (null) GetHashCode
			Assert.IsTrue (dva.GetHashCode () != 0, "GetHashCode");
		}
Esempio n. 3
0
		public void Null ()
		{
			DefaultValueAttribute dva = new DefaultValueAttribute (null);
			Assert.IsNull (dva.Value, "Value");

			Assert.IsFalse (dva.Equals (null), "Equals(null)");

			DefaultValueAttribute dva2 = new DefaultValueAttribute (null);
			Assert.IsTrue (dva.Equals (dva2), "Equals(new)");

			Assert.AreEqual (dva.GetHashCode (), dva2.GetHashCode (), "GetHashCode");
		}