System.Numerics.Tests.ComplexTests.ToString C# (CSharp) Метод

ToString() приватный Метод

private ToString ( double real, double imaginary ) : void
real double
imaginary double
Результат void
        public static void ToString(double real, double imaginary)
        {
            var complex = new Complex(real, imaginary);

            string expected = "(" + real.ToString() + ", " + imaginary.ToString() + ")";
            string actual = complex.ToString();
            Assert.Equal(expected, actual);

            NumberFormatInfo numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat;
            expected = "(" + real.ToString(numberFormatInfo) + ", " + imaginary.ToString(numberFormatInfo) + ")";
            actual = complex.ToString(numberFormatInfo);
            Assert.Equal(expected, complex.ToString(numberFormatInfo));

            foreach (string format in s_supportedStandardNumericFormats)
            {
                expected = "(" + real.ToString(format) + ", " + imaginary.ToString(format) + ")";
                actual = complex.ToString(format);
                Assert.Equal(expected, actual);

                expected = "(" + real.ToString(format, numberFormatInfo) + ", " + imaginary.ToString(format, numberFormatInfo) + ")";
                actual = complex.ToString(format, numberFormatInfo);
                Assert.Equal(expected, actual);
            }
        }
ComplexTests