public void LessThanOrEqual() { SqlInt32 x; SqlInt32 y; // Case 1: either is SqlInt32.Null x = SqlInt32.Null; y = new SqlInt32(5); Assert.Equal(x <= y, SqlBoolean.Null); Assert.Equal(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.Null); // Case 2: both are SqlInt32.Null y = SqlInt32.Null; Assert.Equal(x <= y, SqlBoolean.Null); Assert.Equal(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.Null); // Case 3: x > y x = new SqlInt32(5); y = new SqlInt32(4); Assert.Equal(x <= y, SqlBoolean.False); Assert.Equal(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.False); // Case 4: x < y x = new SqlInt32(5); y = new SqlInt32(6); Assert.Equal(x <= y, SqlBoolean.True); Assert.Equal(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.True); // Case 5: x == y x = new SqlInt32(5); y = new SqlInt32(5); Assert.Equal(x <= y, SqlBoolean.True); Assert.Equal(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.True); }
public void LessThanOrEqual() { SqlInt32 x; SqlInt32 y; // Case 1: either is SqlInt32.Null x = SqlInt32.Null; y = new SqlInt32(5); Assert.AreEqual(x <= y, SqlBoolean.Null, "Less Than Or Equal operator didn't return Null when one was Null."); Assert.AreEqual(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.Null, "Less Than Or Equal function didn't return Null when one was Null."); // Case 2: both are SqlInt32.Null y = SqlInt32.Null; Assert.AreEqual(x <= y, SqlBoolean.Null, "Less Than Or Equal operator didn't return Null when both were Null."); Assert.AreEqual(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.Null, "Less Than Or Equal function didn't return Null when both were Null."); // Case 3: x > y x = new SqlInt32(5); y = new SqlInt32(4); Assert.AreEqual(x <= y, SqlBoolean.False, "Less than or equal operator didn't return false when x > y."); Assert.AreEqual(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.False, "Less than or equal function didn't return false when x > y."); // Case 4: x < y x = new SqlInt32(5); y = new SqlInt32(6); Assert.AreEqual(x <= y, SqlBoolean.True, "Less than or equal operator didn't return true when x < y."); Assert.AreEqual(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.True, "Less than or equal function didn't return true when x < y."); // Case 5: x == y x = new SqlInt32(5); y = new SqlInt32(5); Assert.AreEqual(x <= y, SqlBoolean.True, "Less than or equal operator didn't return true when x == y."); Assert.AreEqual(SqlInt32.LessThanOrEqual(x, y), SqlBoolean.True, "Less than or equal function didn't return true when x == y."); }