Exemplo n.º 1
0
		public void NonEmptyNonOverridenGetHashCode ()
		{
			MyCustomAttribute a1 = new MyCustomAttribute (null);
			MyCustomAttribute a2 = new MyCustomAttribute (null);
			Assert.AreEqual (a1.GetHashCode (), a2.GetHashCode (), "identical arguments");
			Assert.AreEqual (a1.GetHashCode (), a1.TypeId.GetHashCode (), "TypeId");

			MyCustomAttribute a3 = new MyCustomAttribute ("a");
			MyCustomAttribute a4 = new MyCustomAttribute ("b");
			Assert.AreNotEqual (a3.GetHashCode (), a4.GetHashCode (), "non-identical-arguments");

			MyOwnCustomAttribute b1 = new MyOwnCustomAttribute (null);
			Assert.AreNotEqual (a1.GetHashCode (), b1.GetHashCode (), "non-identical-types");
		}
Exemplo n.º 2
0
		public void NonEmptyNonOverridenGetHashCode ()
		{
			MyCustomAttribute a1 = new MyCustomAttribute (null);
			MyCustomAttribute a2 = new MyCustomAttribute (null);
			Assert.AreEqual (a1.GetHashCode (), a2.GetHashCode (), "identical arguments");
			Assert.AreEqual (a1.GetHashCode (), a1.TypeId.GetHashCode (), "TypeId");

			MyCustomAttribute a3 = new MyCustomAttribute ("a");
			MyCustomAttribute a4 = new MyCustomAttribute ("b");
			Assert.AreNotEqual (a3.GetHashCode (), a4.GetHashCode (), "non-identical-arguments");

			MyOwnCustomAttribute b1 = new MyOwnCustomAttribute (null);
			Assert.AreNotEqual (a1.GetHashCode (), b1.GetHashCode (), "non-identical-types");
		}