示例#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(double first, double second)
        public virtual void test_sizeElements(double first, double second)
        {
            DoublesPair test = DoublesPair.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(double first, double second)
        public virtual void test_of_getters(double first, double second)
        {
            DoublesPair test = DoublesPair.of(first, second);

            assertEquals(test.First, first, TOLERANCE);
            assertEquals(test.Second, second, TOLERANCE);
        }
示例#3
0
        public virtual void test_hashCode()
        {
            DoublesPair a1 = DoublesPair.of(1d, 2.0d);
            DoublesPair a2 = DoublesPair.of(1d, 2.0d);

            assertEquals(a1.GetHashCode(), a2.GetHashCode());
        }
示例#4
0
        //-------------------------------------------------------------------------
        public virtual void test_equals()
        {
            DoublesPair a  = DoublesPair.of(1d, 2.0d);
            DoublesPair a2 = DoublesPair.of(1d, 2.0d);
            DoublesPair b  = DoublesPair.of(1d, 3.0d);
            DoublesPair c  = DoublesPair.of(2d, 2.0d);
            DoublesPair d  = DoublesPair.of(2d, 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, double first, double second)
        public virtual void test_parse_good(string text, double first, double second)
        {
            DoublesPair test = DoublesPair.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(double first, double second)
        public virtual void test_toString(double first, double second)
        {
            DoublesPair test = DoublesPair.of(first, second);
            string      str  = "[" + first + ", " + second + "]";

            assertEquals(test.ToString(), str);
            assertEquals(DoublesPair.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(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);
        }
示例#8
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);
        }
示例#9
0
        //-------------------------------------------------------------------------
        public virtual void test_compareTo()
        {
            DoublesPair p12 = DoublesPair.of(1d, 2d);
            DoublesPair p13 = DoublesPair.of(1d, 3d);
            DoublesPair p21 = DoublesPair.of(2d, 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(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));
        }
示例#11
0
 public virtual void test_jodaConvert()
 {
     assertJodaConvert(typeof(DoublesPair), DoublesPair.of(1d, 1.7d));
 }
示例#12
0
 public virtual void test_serialization()
 {
     assertSerialization(DoublesPair.of(1d, 1.7d));
 }
示例#13
0
        public virtual void coverage()
        {
            DoublesPair test = DoublesPair.of(1d, 2.0d);

            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)
        {
            DoublesPair.parse(text);
        }