public void ParseNullOrEmptyValue()
        {
            NumberFormatter fmt = new NumberFormatter();

            Assert.AreEqual(0, fmt.Parse(null));
            Assert.IsTrue(fmt.Parse("") is double);
        }
        public void ParseUsingDefaults()
        {
            NumberFormatter fmt = new NumberFormatter("en-US");
            Assert.AreEqual(1234, fmt.Parse("1,234.00"));
            Assert.AreEqual(1234.56, fmt.Parse("1,234.56"));
            Assert.AreEqual(-1234, fmt.Parse("-1,234.00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1,234.56"));

            fmt = new NumberFormatter("sr-SP-Latn");
            Assert.AreEqual(1234, fmt.Parse("1.234,00"));
            Assert.AreEqual(1234.56, fmt.Parse("1.234,56"));
            Assert.AreEqual(-1234, fmt.Parse("-1.234,00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56"));
        }
        public void ParseUsingDefaults()
        {
            NumberFormatter fmt = new NumberFormatter("en-US");

            Assert.AreEqual(1234, fmt.Parse("1,234.00"));
            Assert.AreEqual(1234.56, fmt.Parse("1,234.56"));
            Assert.AreEqual(-1234, fmt.Parse("-1,234.00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1,234.56"));

            fmt = new NumberFormatter("sr-SP-Latn");
            Assert.AreEqual(1234, fmt.Parse("1.234,00"));
            Assert.AreEqual(1234.56, fmt.Parse("1.234,56"));
            Assert.AreEqual(-1234, fmt.Parse("-1.234,00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1.234,56"));
        }
        public void ParseUsingCustomSettings()
        {
            NumberFormatter fmt = new NumberFormatter("en-US");

            fmt.DecimalDigits   = 0;
            fmt.NegativePattern = 0;
            Assert.AreEqual(1234, fmt.Parse("1,234"));
            Assert.AreEqual(1234.56, fmt.Parse("1,234.56"));
            Assert.AreEqual(-1234, fmt.Parse("(1,234)"));
            Assert.AreEqual(-1234.56, fmt.Parse("(1,234.56)"));

            fmt                = new NumberFormatter("sr-SP-Cyrl");
            fmt.GroupSizes     = new int[] { 1, 2 };
            fmt.GroupSeparator = "'";
            Assert.AreEqual(1234, fmt.Parse("1'23'4,00"));
            Assert.AreEqual(1234.56, fmt.Parse("1'23'4,56"));
            Assert.AreEqual(-1234, fmt.Parse("-1'23'4,00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1'23'4,56"));
        }
 public void ParseNullOrEmptyValue()
 {
     NumberFormatter fmt = new NumberFormatter();
     Assert.AreEqual(0, fmt.Parse(null));
     Assert.IsTrue(fmt.Parse("") is double);
 }
        public void ParseUsingCustomSettings()
        {
            NumberFormatter fmt = new NumberFormatter("en-US");
            fmt.DecimalDigits = 0;
            fmt.NegativePattern = 0;
            Assert.AreEqual(1234, fmt.Parse("1,234"));
            Assert.AreEqual(1234.56, fmt.Parse("1,234.56"));
            Assert.AreEqual(-1234, fmt.Parse("(1,234)"));
            Assert.AreEqual(-1234.56, fmt.Parse("(1,234.56)"));

            fmt = new NumberFormatter("sr-SP-Cyrl");
            fmt.GroupSizes = new int[] {1, 2};
            fmt.GroupSeparator = "'";
            Assert.AreEqual(1234, fmt.Parse("1'23'4,00"));
            Assert.AreEqual(1234.56, fmt.Parse("1'23'4,56"));
            Assert.AreEqual(-1234, fmt.Parse("-1'23'4,00"));
            Assert.AreEqual(-1234.56, fmt.Parse("-1'23'4,56"));
        }