コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            assertEquals(Convert.ToDouble(1), Convert.ToDouble(Z1.Real));
            assertEquals(Convert.ToDouble(2), Convert.ToDouble(Z1.Imaginary));
            assertEquals(Z1, Z2);
            assertEquals(Z1.GetHashCode(), Z2.GetHashCode());
            assertEquals("1.0 + 2.0i", Z1.ToString());
            assertEquals("1.0 + 0.0i", (new ComplexNumber(1, 0)).ToString());
            assertEquals("0.0 + 2.3i", (new ComplexNumber(0, 2.3)).ToString());
            assertEquals("-1.0 + 0.0i", (new ComplexNumber(-1, 0)).ToString());
            assertEquals("0.0 - 2.3i", (new ComplexNumber(0, -2.3)).ToString());
            assertFalse(Z1.Equals(Z3));
            assertFalse(Z1.Equals(Z4));
            assertFalse(Z1.Equals(Z5));
        }