Example #1
0
        //-------------------------------------------------------------------------
        public virtual void test_compareTo()
        {
            Pair <string, string> ab = Pair.of("A", "B");
            Pair <string, string> ad = Pair.of("A", "D");
            Pair <string, string> ba = Pair.of("B", "A");

            assertTrue(ab.CompareTo(ab) == 0);
            assertTrue(ab.CompareTo(ad) < 0);
            assertTrue(ab.CompareTo(ba) < 0);

            assertTrue(ad.CompareTo(ab) > 0);
            assertTrue(ad.CompareTo(ad) == 0);
            assertTrue(ad.CompareTo(ba) < 0);

            assertTrue(ba.CompareTo(ab) > 0);
            assertTrue(ba.CompareTo(ad) > 0);
            assertTrue(ba.CompareTo(ba) == 0);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = ClassCastException.class) public void test_compareTo_notComparable()
        public virtual void test_compareTo_notComparable()
        {
            ThreadStart notComparable = () =>
            {
            };
            Pair <ThreadStart, string> test1 = Pair.of(notComparable, "A");
            Pair <ThreadStart, string> test2 = Pair.of(notComparable, "B");

            test1.CompareTo(test2);
        }