CompareTo() public method

public CompareTo ( SqlInt16 value ) : int
value SqlInt16
return int
Ejemplo n.º 1
0
		public void CompareTo ()
		{
			SqlInt16 TestInt4000 = new SqlInt16 (4000);
			SqlInt16 TestInt4000II = new SqlInt16 (4000);
			SqlInt16 TestInt10 = new SqlInt16 (10);
			SqlInt16 TestInt10000 = new SqlInt16 (10000);
			SqlString TestString = new SqlString ("This is a test");

			Assert.IsTrue (TestInt4000.CompareTo (TestInt10) > 0, "Test#1");
			Assert.IsTrue (TestInt10.CompareTo (TestInt4000) < 0, "Test#2");
			Assert.IsTrue (TestInt4000II.CompareTo (TestInt4000) == 0, "Test#3");
			Assert.IsTrue (TestInt4000II.CompareTo (SqlInt16.Null) > 0, "Test#4");

			try {
				TestInt10.CompareTo (TestString);
				Assert.Fail ("Test#5");
			} catch (ArgumentException e) {
				Assert.AreEqual (typeof (ArgumentException), e.GetType (), "Test#6");
			}
		}
Ejemplo n.º 2
0
                public void CompareTo()
                {
                        SqlInt16 TestInt4000 = new SqlInt16 (4000);
                        SqlInt16 TestInt4000II = new SqlInt16 (4000);
                        SqlInt16 TestInt10 = new SqlInt16 (10);
                        SqlInt16 TestInt10000 = new SqlInt16 (10000);
                        SqlString TestString = new SqlString ("This is a test");

                        Assert ("Test#1", TestInt4000.CompareTo (TestInt10) > 0);
                        Assert ("Test#2", TestInt10.CompareTo (TestInt4000) < 0);
                        Assert ("Test#3", TestInt4000II.CompareTo (TestInt4000) == 0);
                        Assert ("Test#4", TestInt4000II.CompareTo (SqlInt16.Null) > 0);

                        try {
                                TestInt10.CompareTo (TestString);
                                Fail ("Test#5");
                        } catch(Exception e) {
                                AssertEquals ("Test#6", typeof (ArgumentException), e.GetType ());
                        }
                }
Ejemplo n.º 3
0
        public void CompareTo()
        {
            SqlInt16 TestInt4000 = new SqlInt16(4000);
            SqlInt16 TestInt4000II = new SqlInt16(4000);
            SqlInt16 TestInt10 = new SqlInt16(10);
            SqlInt16 TestInt10000 = new SqlInt16(10000);
            SqlString TestString = new SqlString("This is a test");

            Assert.True(TestInt4000.CompareTo(TestInt10) > 0);
            Assert.True(TestInt10.CompareTo(TestInt4000) < 0);
            Assert.True(TestInt4000II.CompareTo(TestInt4000) == 0);
            Assert.True(TestInt4000II.CompareTo(SqlInt16.Null) > 0);

            try
            {
                TestInt10.CompareTo(TestString);
                Assert.False(true);
            }
            catch (ArgumentException e)
            {
                Assert.Equal(typeof(ArgumentException), e.GetType());
            }
        }