Exemplo n.º 1
0
        public virtual void test_equals_bad()
        {
            Pair <int, string> a = Pair.of(1, "Hello");

            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_sizeElements(Object first, Object second)
        public virtual void test_sizeElements(object first, object second)
        {
            Pair <object, object> test = Pair.of(first, second);

            assertEquals(test.size(), 2);
            assertEquals(test.elements(), ImmutableList.of(first, second));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_of_getters(Object first, Object second)
        public virtual void test_of_getters(object first, object second)
        {
            Pair <object, object> test = Pair.of(first, second);

            assertEquals(test.First, first);
            assertEquals(test.Second, second);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_toString(Object first, Object second)
        public virtual void test_toString(object first, object second)
        {
            Pair <object, object> test = Pair.of(first, second);
            string str = "[" + first + ", " + second + "]";

            assertEquals(test.ToString(), str);
        }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------
        public virtual void test_equals()
        {
            Pair <int, string> a  = Pair.of(1, "Hello");
            Pair <int, string> a2 = Pair.of(1, "Hello");
            Pair <int, string> b  = Pair.of(1, "Goodbye");
            Pair <int, string> c  = Pair.of(2, "Hello");
            Pair <int, string> d  = Pair.of(2, "Goodbye");

            assertEquals(a.Equals(a), true);
            assertEquals(a.Equals(b), false);
            assertEquals(a.Equals(c), false);
            assertEquals(a.Equals(d), false);
            assertEquals(a.Equals(a2), true);

            assertEquals(b.Equals(a), false);
            assertEquals(b.Equals(b), true);
            assertEquals(b.Equals(c), false);
            assertEquals(b.Equals(d), false);

            assertEquals(c.Equals(a), false);
            assertEquals(c.Equals(b), false);
            assertEquals(c.Equals(c), true);
            assertEquals(c.Equals(d), false);

            assertEquals(d.Equals(a), false);
            assertEquals(d.Equals(b), false);
            assertEquals(d.Equals(c), false);
            assertEquals(d.Equals(d), true);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_ofPair(long first, double second)
        public virtual void test_ofPair(long first, double second)
        {
            Pair <long, double> pair = Pair.of(first, second);
            LongDoublePair      test = LongDoublePair.ofPair(pair);

            assertEquals(test.First, first);
            assertEquals(test.Second, second, TOLERANCE);
        }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_ofPair(int first, double second)
        public virtual void test_ofPair(int first, double second)
        {
            Pair <int, double> pair = Pair.of(first, second);
            IntDoublePair      test = IntDoublePair.ofPair(pair);

            assertEquals(test.First, first);
            assertEquals(test.Second, second, TOLERANCE);
        }
Exemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_ofPair(String first, double second)
        public virtual void test_ofPair(string first, double second)
        {
            Pair <string, double>  pair = Pair.of(first, second);
            ObjDoublePair <string> test = ObjDoublePair.ofPair(pair);

            assertEquals(test.First, first);
            assertEquals(test.Second, second, TOLERANCE);
        }
Exemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_ofPair(double first, double second)
        public virtual void test_ofPair(double first, double second)
        {
            Pair <double, double> pair = Pair.of(first, second);
            DoublesPair           test = DoublesPair.ofPair(pair);

            assertEquals(test.First, first, TOLERANCE);
            assertEquals(test.Second, second, TOLERANCE);
        }
Exemplo n.º 10
0
        public virtual void test_equals_bad()
        {
            IntDoublePair a = IntDoublePair.of(1, 1.7d);

            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
            object unrelatdPair = Pair.of(Convert.ToInt32(1), Convert.ToDouble(1.7d));

            assertEquals(a.Equals(unrelatdPair), false);
        }
Exemplo n.º 11
0
        public virtual void test_equals_bad()
        {
            ObjDoublePair <string> a = ObjDoublePair.of("1", 1.7d);

            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
            object unrelatedType = Pair.of(Convert.ToInt32(1), Convert.ToDouble(1.7d));

            assertEquals(a.Equals(unrelatedType), false);
        }
Exemplo n.º 12
0
        public virtual void test_equals_bad()
        {
            DoublesPair a = DoublesPair.of(1.1d, 1.7d);

            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
            object unrelatedPair = Pair.of(Convert.ToDouble(1.1d), Convert.ToDouble(1.7d));

            assertEquals(a.Equals(unrelatedPair), false);
        }
Exemplo n.º 13
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);
        }
        public virtual void test_equals_bad()
        {
            LongDoublePair a = LongDoublePair.of(1L, 1.7d);

            assertEquals(a.Equals(null), false);
            assertEquals(a.Equals(ANOTHER_TYPE), false);
            object unrelatedType = Pair.of(Convert.ToInt64(1L), Convert.ToDouble(1.7d));

            assertEquals(a.Equals(unrelatedType), false);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Converts this pair to an object-based {@code Pair}.
 /// </summary>
 /// <returns> the object-based pair </returns>
 public Pair <A, int> toPair()
 {
     return(Pair.of(first, second));
 }
Exemplo n.º 17
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Converts this pair to an object-based {@code Pair}.
 /// </summary>
 /// <returns> the object-based pair </returns>
 public Pair <long, double> toPair()
 {
     return(Pair.of(first, second));
 }
Exemplo n.º 18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factoryNull", expectedExceptions = IllegalArgumentException.class) public void test_of_null(Object first, Object second)
        public virtual void test_of_null(object first, object second)
        {
            Pair.of(first, second);
        }
Exemplo n.º 19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_toPair(double first, double second)
        public virtual void test_toPair(double first, double second)
        {
            DoublesPair test = DoublesPair.of(first, second);

            assertEquals(test.toPair(), Pair.of(first, second));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_toPair(long first, double second)
        public virtual void test_toPair(long first, double second)
        {
            LongDoublePair test = LongDoublePair.of(first, second);

            assertEquals(test.toPair(), Pair.of(first, second));
        }
Exemplo n.º 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_toPair(String first, double second)
        public virtual void test_toPair(string first, double second)
        {
            ObjDoublePair <string> test = ObjDoublePair.of(first, second);

            assertEquals(test.toPair(), Pair.of(first, second));
        }
Exemplo n.º 22
0
        public virtual void coverage()
        {
            Pair <string, string> test = Pair.of("A", "B");

            TestHelper.coverImmutableBean(test);
        }
Exemplo n.º 23
0
        public virtual void test_toString()
        {
            Pair <string, string> test = Pair.of("A", "B");

            assertEquals("[A, B]", test.ToString());
        }
Exemplo n.º 24
0
        public virtual void test_hashCode()
        {
            Pair <int, string> a = Pair.of(1, "Hello");

            assertEquals(a.GetHashCode(), a.GetHashCode());
        }
Exemplo n.º 25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "factory") public void test_toPair(int first, double second)
        public virtual void test_toPair(int first, double second)
        {
            IntDoublePair test = IntDoublePair.of(first, second);

            assertEquals(test.toPair(), Pair.of(first, second));
        }