Esempio n. 1
0
        public void Should_Skip_Last_Invalid_Chars()
        {
            var result   = ParseInt.Parse("123ABC");
            var expected = 123;

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public void Should_Parse_String()
        {
            var result   = ParseInt.Parse("123");
            var expected = 123;

            Assert.AreEqual(expected, result);
        }
Esempio n. 3
0
        public void Should_Parse_String_As_Negative()
        {
            var result   = ParseInt.Parse("-123");
            var expected = -123;

            Assert.AreEqual(expected, result);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            DelTest1 test = new DelTest1();
            ParseInt p    = new ParseInt(test.convertInt);

            Console.WriteLine(p("123"));
            ParseInt p2 = test.convertInt;
        }
Esempio n. 5
0
        public void Should_Throw_On_Invalid_Input()
        {
            var invalidArgument = "ABC123";

            Assert.Throws <ArgumentException>(() => ParseInt.Parse(invalidArgument));
        }