コード例 #1
0
        public void TestEquals_Nullable()
        {
            NullableStruct f1 = new NullableStruct {
                f = 5
            };
            NullableStruct f2 = new NullableStruct {
                f = 5
            };

            Assert.IsTrue(f1.Equals(f2));

            f1 = new NullableStruct {
                f = null
            };
            f2 = new NullableStruct {
                f = null
            };
            Assert.IsTrue(f1.Equals(f2));

            f1 = new NullableStruct {
                f = 1
            };
            f2 = new NullableStruct {
                f = 2
            };
            Assert.IsFalse(f1.Equals(f2));

            f1 = new NullableStruct {
                f = 1
            };
            f2 = new NullableStruct {
                f = null
            };
            Assert.IsFalse(f1.Equals(f2));
        }
コード例 #2
0
ファイル: ValueTypeTest.cs プロジェクト: nlhepler/mono
		public void TestEquals_Nullable ()
		{
			NullableStruct f1 = new NullableStruct { f = 5 };
			NullableStruct f2 = new NullableStruct { f = 5 };
			Assert.IsTrue (f1.Equals (f2));

			f1 = new NullableStruct { f = null };
			f2 = new NullableStruct { f = null };
			Assert.IsTrue (f1.Equals (f2));

			f1 = new NullableStruct { f = 1 };
			f2 = new NullableStruct { f = 2 };
			Assert.IsFalse (f1.Equals (f2));

			f1 = new NullableStruct { f = 1 };
			f2 = new NullableStruct { f = null };
			Assert.IsFalse (f1.Equals (f2));
		}