public void Numeric_enum_values_are_written_to_TypeScript_enum_definition() { var generator = new EnumModuleGenerator(); var extensions = Enumerable.Empty <TSExtendEnumAttribute>().ToLookup(x => default(Type)); generator.Write(new[] { typeof(Foo) }, false, null, extensions); var result = generator.GetResult(); TextAssert.ContainsLinesInCorrectOrder(result, "export enum Foo {", "A = 1,", "B = 3,"); }
public void String_enums_are_written_if_option_is_specified() { var generator = new EnumModuleGenerator(); var extensions = Enumerable.Empty <TSExtendEnumAttribute>().ToLookup(x => default(Type)); generator.Write(new[] { typeof(Foo) }, true, null, extensions); var result = generator.GetResult(); TextAssert.ContainsLinesInCorrectOrder(result, "export enum Foo {", "A = 'A',", "B = 'B',"); }
public void String_enums_are_written_if_option_is_specified() { var generator = new EnumModuleGenerator(); generator.Write( new[] { typeof(Foo) }, true, null, new Dictionary <Type, List <Func <string> > >(), new Dictionary <Type, TSEnumLocalizationAttributeBase>()); var result = generator.GetResult(); TextAssert.ContainsLinesInCorrectOrder(result, "export enum Foo {", "A = 'A',", "B = 'B',"); }
public void Should_write_static_members_for_enums_after_all_enums_declaration() { var generator = new EnumModuleGenerator(); generator.Write( new[] { typeof(Foo), typeof(Bar) }, false, "locale", new Dictionary <Type, List <Func <string> > > { { typeof(Foo), new List <Func <string> > { () => StaticMemberContents } } }, new Dictionary <Type, TSEnumLocalizationAttributeBase>()); var result = generator.GetResult(); TextAssert.ContainsLinesInCorrectOrder(result, "export enum Foo {", "export enum Bar {", "export namespace Foo {", StaticMemberContents); }