コード例 #1
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(int first, double second)
        public virtual void test_sizeElements(int first, double second)
        {
            IntDoublePair test = IntDoublePair.of(first, second);

            assertEquals(test.size(), 2);
            assertEquals(test.elements(), ImmutableList.of(first, second));
        }
コード例 #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_of_getters(int first, double second)
        public virtual void test_of_getters(int first, double second)
        {
            IntDoublePair test = IntDoublePair.of(first, second);

            assertEquals(test.First, first);
            assertEquals(test.Second, second, TOLERANCE);
        }
コード例 #3
0
        public virtual void test_hashCode()
        {
            IntDoublePair a1 = IntDoublePair.of(1, 1.7d);
            IntDoublePair a2 = IntDoublePair.of(1, 1.7d);

            assertEquals(a1.GetHashCode(), a2.GetHashCode());
        }
コード例 #4
0
        //-------------------------------------------------------------------------
        public virtual void test_equals()
        {
            IntDoublePair a  = IntDoublePair.of(1, 2.0d);
            IntDoublePair a2 = IntDoublePair.of(1, 2.0d);
            IntDoublePair b  = IntDoublePair.of(1, 3.0d);
            IntDoublePair c  = IntDoublePair.of(2, 2.0d);
            IntDoublePair d  = IntDoublePair.of(2, 3.0d);

            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);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "parseGood") public void test_parse_good(String text, int first, double second)
        public virtual void test_parse_good(string text, int first, double second)
        {
            IntDoublePair test = IntDoublePair.parse(text);

            assertEquals(test.First, first, TOLERANCE);
            assertEquals(test.Second, second, TOLERANCE);
        }
コード例 #6
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(int first, double second)
        public virtual void test_toString(int first, double second)
        {
            IntDoublePair test = IntDoublePair.of(first, second);
            string        str  = "[" + first + ", " + second + "]";

            assertEquals(test.ToString(), str);
            assertEquals(IntDoublePair.parse(str), test);
        }
コード例 #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);
        }
コード例 #8
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);
        }
コード例 #9
0
        //-------------------------------------------------------------------------
        public virtual void test_compareTo()
        {
            IntDoublePair p12 = IntDoublePair.of(1, 2d);
            IntDoublePair p13 = IntDoublePair.of(1, 3d);
            IntDoublePair p21 = IntDoublePair.of(2, 1d);

            assertTrue(p12.CompareTo(p12) == 0);
            assertTrue(p12.CompareTo(p13) < 0);
            assertTrue(p12.CompareTo(p21) < 0);

            assertTrue(p13.CompareTo(p12) > 0);
            assertTrue(p13.CompareTo(p13) == 0);
            assertTrue(p13.CompareTo(p21) < 0);

            assertTrue(p21.CompareTo(p12) > 0);
            assertTrue(p21.CompareTo(p13) > 0);
            assertTrue(p21.CompareTo(p21) == 0);
        }
コード例 #10
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));
        }
コード例 #11
0
 public virtual void test_jodaConvert()
 {
     assertJodaConvert(typeof(IntDoublePair), IntDoublePair.of(1, 1.7d));
 }
コード例 #12
0
 public virtual void test_serialization()
 {
     assertSerialization(IntDoublePair.of(1, 1.7d));
 }
コード例 #13
0
        public virtual void coverage()
        {
            IntDoublePair test = IntDoublePair.of(1, 1.7d);

            TestHelper.coverImmutableBean(test);
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "parseBad", expectedExceptions = IllegalArgumentException.class) public void test_parse_bad(String text)
        public virtual void test_parse_bad(string text)
        {
            IntDoublePair.parse(text);
        }