CompareTo() public method

public CompareTo ( SqlByte value ) : int
value SqlByte
return int
Beispiel #1
0
		public void CompareTo()
		{

			SqlByte TestByte13 = new SqlByte(13);
			SqlByte TestByte10 = new SqlByte(10);
			SqlByte TestByte10II = new SqlByte(10);

			SqlString TestString = new SqlString("This is a test");
			
			Assert.IsTrue (TestByte13.CompareTo(TestByte10) > 0, "CompareTo method 1" + Error);
			Assert.IsTrue (TestByte10.CompareTo(TestByte13) < 0, "CompareTo method 2" + Error);
			Assert.IsTrue (TestByte10.CompareTo(TestByte10II) == 0, "CompareTo method 3" + Error);
			
			try {
				TestByte13.CompareTo(TestString);
				Assert.Fail("CompareTo method 4" + Error);
			} catch(Exception e) {
				Assert.AreEqual(typeof(ArgumentException), e.GetType(), "Parse method 5" + Error);
			}
			
		}
Beispiel #2
0
        public void CompareTo()
        {
            SqlByte TestByte13 = new SqlByte(13);
            SqlByte TestByte10 = new SqlByte(10);
            SqlByte TestByte10II = new SqlByte(10);

            SqlString TestString = new SqlString("This is a test");

            Assert.True(TestByte13.CompareTo(TestByte10) > 0);
            Assert.True(TestByte10.CompareTo(TestByte13) < 0);
            Assert.True(TestByte10.CompareTo(TestByte10II) == 0);

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