示例#1
0
		public Face(int x, int y, int width, int height, string name, Age age)
		{
			_x = x;
			_y = y;
			_width = width;
			_height = height;
			_name = name;
			_age = age;
		}
示例#2
0
		public virtual void TestEqualsAndHashCode()
		{
			Age age1 = new Age(10, 11, 12, 13, 14, 15);
			Age age2 = new Age(10, 11, 12, 13, 14, 15);
			Age age3 = new Age(0, 0, 0, 0, 0, 0);
			Sharpen.Tests.AreEqual(age1, age1);
			Sharpen.Tests.AreEqual(age1, age2);
			Sharpen.Tests.AreEqual(age2, age1);
			Sharpen.Tests.IsTrue(age1.Equals(age1));
			Sharpen.Tests.IsTrue(age1.Equals(age2));
			Sharpen.Tests.IsFalse(age1.Equals(age3));
			Sharpen.Tests.IsFalse(age1.Equals(null));
			Sharpen.Tests.IsFalse(age1.Equals("Hello"));
			Sharpen.Tests.AreEqual(age1.GetHashCode(), age1.GetHashCode());
			Sharpen.Tests.AreEqual(age1.GetHashCode(), age2.GetHashCode());
			Sharpen.Tests.IsFalse(age1.GetHashCode() == age3.GetHashCode());
		}
示例#3
0
        public virtual void TestEqualsAndHashCode()
        {
            Age age1 = new Age(10, 11, 12, 13, 14, 15);
            Age age2 = new Age(10, 11, 12, 13, 14, 15);
            Age age3 = new Age(0, 0, 0, 0, 0, 0);

            Sharpen.Tests.AreEqual(age1, age1);
            Sharpen.Tests.AreEqual(age1, age2);
            Sharpen.Tests.AreEqual(age2, age1);
            Sharpen.Tests.IsTrue(age1.Equals(age1));
            Sharpen.Tests.IsTrue(age1.Equals(age2));
            Sharpen.Tests.IsFalse(age1.Equals(age3));
            Sharpen.Tests.IsFalse(age1.Equals(null));
            Sharpen.Tests.IsFalse(age1.Equals("Hello"));
            Sharpen.Tests.AreEqual(age1.GetHashCode(), age1.GetHashCode());
            Sharpen.Tests.AreEqual(age1.GetHashCode(), age2.GetHashCode());
            Sharpen.Tests.IsFalse(age1.GetHashCode() == age3.GetHashCode());
        }