예제 #1
0
        public virtual void test_parse_invalid()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            assertThatThrownBy(() => test.parse("unknown")).isInstanceOf(typeof(System.ArgumentException)).hasMessageContaining("Unknown enum name 'unknown' for type " + typeof(MockEnum).FullName);
        }
예제 #2
0
        public virtual void test_parse_one()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

            assertEquals(test.parse("One"), MockEnum.ONE);
            assertEquals(test.parse("ONE"), MockEnum.ONE);
            assertEquals(test.parse("one"), MockEnum.ONE);
        }
예제 #3
0
        public virtual void test_parse_fooBar()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

            assertEquals(test.parse("Foobar"), MockEnum.FooBar);
            assertEquals(test.parse("FOOBAR"), MockEnum.FooBar);
            assertEquals(test.parse("foobar"), MockEnum.FooBar);
            assertEquals(test.parse("FooBar"), MockEnum.FooBar);
        }
예제 #4
0
        public virtual void test_format()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

            assertEquals(test.format(MockEnum.ONE), "One");
            assertEquals(test.format(MockEnum.TWENTY_ONE), "TwentyOne");
            assertEquals(test.format(MockEnum.FooBar), "Foobar");
            assertEquals(test.format(MockEnum.WOO_BAR_WAA), "WooBarWaa");
        }
예제 #5
0
        public virtual void test_parse_wooBarWaa()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

            assertEquals(test.parse("WooBarWaa"), MockEnum.WOO_BAR_WAA);
            assertEquals(test.parse("WOOBARWAA"), MockEnum.WOO_BAR_WAA);
            assertEquals(test.parse("woobarwaa"), MockEnum.WOO_BAR_WAA);
            assertEquals(test.parse("WOO_BAR_WAA"), MockEnum.WOO_BAR_WAA);
            assertEquals(test.parse("woo_bar_waa"), MockEnum.WOO_BAR_WAA);
        }
예제 #6
0
        public virtual void test_parse_twentyOne()
        {
            EnumNames <MockEnum> test = EnumNames.of(typeof(MockEnum));

            assertEquals(test.parse("TwentyOne"), MockEnum.TWENTY_ONE);
            assertEquals(test.parse("TWENTYONE"), MockEnum.TWENTY_ONE);
            assertEquals(test.parse("twentyone"), MockEnum.TWENTY_ONE);
            assertEquals(test.parse("TWENTY_ONE"), MockEnum.TWENTY_ONE);
            assertEquals(test.parse("twenty_one"), MockEnum.TWENTY_ONE);
        }