Exemplo n.º 1
0
        public void CompareTo()
        {
            SqlInt64  testInt4000   = new SqlInt64(4000);
            SqlInt64  testInt4000II = new SqlInt64(4000);
            SqlInt64  testInt10     = new SqlInt64(10);
            SqlInt64  testInt10000  = new SqlInt64(10000);
            SqlString testString    = new SqlString("This is a test");

            Assert.True(testInt4000.CompareTo(testInt10) > 0);
            Assert.True(testInt10.CompareTo(testInt4000) < 0);
            Assert.Equal(0, testInt4000II.CompareTo(testInt4000));
            Assert.True(testInt4000II.CompareTo(SqlInt64.Null) > 0);

            Assert.Throws <ArgumentException>(() => testInt10.CompareTo(testString));
        }
Exemplo n.º 2
0
        public void CompareTo()
        {
            SqlInt64  TestInt4000   = new SqlInt64(4000);
            SqlInt64  TestInt4000II = new SqlInt64(4000);
            SqlInt64  TestInt10     = new SqlInt64(10);
            SqlInt64  TestInt10000  = new SqlInt64(10000);
            SqlString TestString    = new SqlString("This is a test");

            Assert.IsTrue(TestInt4000.CompareTo(TestInt10) > 0, "#F01");
            Assert.IsTrue(TestInt10.CompareTo(TestInt4000) < 0, "#F02");
            Assert.IsTrue(TestInt4000II.CompareTo(TestInt4000) == 0, "#F03");
            Assert.IsTrue(TestInt4000II.CompareTo(SqlInt64.Null) > 0, "#F04");

            try {
                TestInt10.CompareTo(TestString);
                Assert.Fail("#F05");
            } catch (ArgumentException e) {
                Assert.AreEqual(typeof(ArgumentException), e.GetType(), "#F06");
            }
        }
Exemplo n.º 3
0
        public void CompareTo()
        {
            SqlInt64  TestInt4000   = new SqlInt64(4000);
            SqlInt64  TestInt4000II = new SqlInt64(4000);
            SqlInt64  TestInt10     = new SqlInt64(10);
            SqlInt64  TestInt10000  = new SqlInt64(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(SqlInt64.Null) > 0);

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