コード例 #1
0
		public void Test_NotEqual_ValueType()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(1);
			Assert.IsFalse(s.Test(1).Success);
			Assert.IsTrue(s.Test(0).Success);
			Assert.IsTrue(s.Test(null).Success);
		}
コード例 #2
0
		public void Test_NotEqual_Null()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(null);

			Assert.IsFalse(s.Test(null).Success);
			Assert.IsTrue(s.Test(new object()).Success);
			Assert.IsTrue(s.Test(1).Success);
		}
コード例 #3
0
		public void Test_NotEqual_ReferenceType()
		{
			object x = new object();
			object y = new object();

			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(x);

			Assert.IsFalse(s.Test(x).Success);
			Assert.IsTrue(s.Test(y).Success);
			Assert.IsTrue(s.Test(null).Success);
		}
コード例 #4
0
        private static void Test_NotEqual_CoerceTypes()
        {
            NotEqualSpecification s = new NotEqualSpecification();

            s.RefValueExpression = new ConstantExpression("1.0");

            Assert.IsFalse(s.Test(1.0).Success);
            Assert.IsFalse(s.Test("1.0").Success);

            Assert.IsTrue(s.Test(null).Success);
            Assert.IsTrue(s.Test(0.0).Success);
            Assert.IsTrue(s.Test("0.0").Success);
        }
コード例 #5
0
		public void Test_NotEqual_Strict()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(1.0);
			s.Strict = true;

			// this should pass because in strict mode we don't do type coercion,
			// and Object.Equals(x, y) returns false when comparing different types
			Assert.IsTrue(s.Test(1).Success);
		}
コード例 #6
0
		public void Test_NotEqual_Strict()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(1.0);
			s.Strict = true;

			// this should pass because in strict mode we don't do type coercion,
			// and Object.Equals(x, y) returns false when comparing different types
			Assert.IsTrue(s.Test(1).Success);
		}
コード例 #7
0
		// This test is currently failing because coercion code hasn't been merged to trunk yet
		public void Test_NotEqual_CoerceTypes()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression("1");

			Assert.IsFalse(s.Test(1).Success);
			Assert.IsFalse(s.Test(1.0).Success);
			Assert.IsFalse(s.Test("1").Success);

			Assert.IsTrue(s.Test(null).Success);
			Assert.IsTrue(s.Test(0).Success);
			Assert.IsTrue(s.Test(0.0).Success);
			Assert.IsTrue(s.Test("0").Success);
		}
コード例 #8
0
		public void Test_NotEqual_Null()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(null);

			Assert.IsFalse(s.Test(null).Success);
			Assert.IsTrue(s.Test(new object()).Success);
			Assert.IsTrue(s.Test(1).Success);
		}
コード例 #9
0
		public void Test_NotEqual_ReferenceType()
		{
			object x = new object();
			object y = new object();

			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(x);

			Assert.IsFalse(s.Test(x).Success);
			Assert.IsTrue(s.Test(y).Success);
			Assert.IsTrue(s.Test(null).Success);
		}
コード例 #10
0
		public void Test_NotEqual_ValueType()
		{
			NotEqualSpecification s = new NotEqualSpecification();
			s.RefValueExpression = new ConstantExpression(1);
			Assert.IsFalse(s.Test(1).Success);
			Assert.IsTrue(s.Test(0).Success);
			Assert.IsTrue(s.Test(null).Success);
		}