예제 #1
0
        public void TwoFactorMainTest()
        {
            /*
             * Using parallel for multiple two factor tests
             */
            Parallel.For(1, Romano.MAX_VALUE + 1, i =>
            {
                var arabic = (ushort)i;
                var roman  = Romano.Romanize(arabic);

                /*
                 * Basic roman two factor tests, with strict options
                 * IV
                 */
                Assert.Equal(arabic, Romano.Humanize(roman));

                /*
                 * Four sequential digits tests
                 * IIII
                 */
                roman = Romano.Romanize(arabic, RomanizerOptions.ALLOW_FOUR_SEQUENTIAL_DIGITS);
                Assert.Equal(arabic, Romano.Humanize(roman, RomanizerOptions.ALLOW_FOUR_SEQUENTIAL_DIGITS));

                /*
                 * Multiple sequential digits tests
                 * IIIII
                 */
                roman = Romano.Romanize(arabic, RomanizerOptions.ALLOW_MULTIPLE_SEQUENTIAL_DIGITS);
                Assert.Equal(arabic, Romano.Humanize(roman, RomanizerOptions.ALLOW_MULTIPLE_SEQUENTIAL_DIGITS));
            });
        }
예제 #2
0
 public void InvalidRomanToHumanTest(string roman, Type @throw, RomanizerOptions options = RomanizerOptions.DEFAULT_STRICT)
 {
     Assert.Throws(@throw, () => Romano.Humanize(roman, options) as object);
     // Assert.False(Romano.IsValidRoman(roman));
 }
예제 #3
0
        private void HumanizeTester(string romanNumber, int expected)
        {
            int result = Romano.Humanize(romanNumber);

            Assert.Equal(expected, result);
        }
예제 #4
0
 public static int Humanize(this string str)
 {
     return(Romano.Humanize(str));
 }
예제 #5
0
 public static int Humanize(this char str)
 {
     return(Romano.Humanize(str));
 }
예제 #6
0
        private void HumanizeTester(string romanNumber, int expected)
        {
            var result = Romano.Humanize(romanNumber);//, RomanizerOptions.ALLOW_ALL_SUB);

            Assert.Equal(expected, result);
        }