Exemple #1
0
        public void TestIsNumberValidTrue()
        {
            bool expected = true;

            string[] testData =
            {
                "1.457896",
                "1000.541",
                "57",
                "0.57",
                "7.555555"
            };

            foreach (string data in testData)
            {
                var actual = RegexLib.IsNumberValid(data);
                Assert.AreEqual(expected, actual);
            }
        }
Exemple #2
0
        public void TestIsNumberValidFalse()
        {
            bool expected = false;

            string[] testData =
            {
                "1.457.896",
                "abc",
                "ABC",
                "A.B",
                "-10",
                "-1.45",
                ".14.15",
                "",
                " ",
                "."
            };

            foreach (string data in testData)
            {
                var actual = RegexLib.IsNumberValid(data);
                Assert.AreEqual(expected, actual);
            }
        }