public void RecursivelyCreatesUsingStatementForEachTypeInUnionReference() { NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference(union: new UnionTypeReference(new TypeReference[] { new TypeReference(collection: new CollectionTypeReference( CollectionKind.Array, new TypeReference(collection: new CollectionTypeReference( CollectionKind.Array, new TypeReference(primitive: PrimitiveType.Json) )) )), new TypeReference(primitive: PrimitiveType.Date), }))); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;", "using Newtonsoft.Json.Linq;", "using System;" ); }
public void CreatesUsingStatementForType() { EnumType type = new EnumType ( "myEnumFqn", "myModule", "myEnum", "myNamespace", new EnumMember[] { } ); Symbols.MapNamespace("myNamespace", "MyNamespace"); NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(type); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;", "using MyNamespace;" ); }
public void CreatesUsingStatementForJsonReference() { NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference(primitive: PrimitiveType.Json)); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;", "using Newtonsoft.Json.Linq;" ); }
public void DoesNotCreateUsingStatementForCurrentNamespace() { Symbols.MapTypeToNamespace("myFqn", "MyCurrentNamespace"); NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference("myFqn")); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;" ); }
public void SortsUsingStatementsAlphaNumerically() { Symbols.MapTypeToNamespace("myFqn", "AAA"); NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference("myFqn")); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using AAA;", "using Amazon.JSII.Runtime.Deputy;" ); }
public void DoesNotCreateUsingStatementForArrayReference() { NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference(collection: new CollectionTypeReference( CollectionKind.Array, new TypeReference(primitive: PrimitiveType.String) ))); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;" ); }
public void DoesNotCreateUsingStatementForSystemPrimitive() { NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference(primitive: PrimitiveType.Any)); namespaces.Add(new TypeReference(primitive: PrimitiveType.Boolean)); namespaces.Add(new TypeReference(primitive: PrimitiveType.Number)); namespaces.Add(new TypeReference(primitive: PrimitiveType.String)); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;" ); }
public void CreatesUsingStatementForMapReference() { NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace")); namespaces.Add(new TypeReference(collection: new CollectionTypeReference( kind: CollectionKind.Map, elementType: new TypeReference(primitive: PrimitiveType.String) ))); SyntaxList <UsingDirectiveSyntax> usings = namespaces.GetUsings(); AssertUsings ( usings, "using Amazon.JSII.Runtime.Deputy;", "using System.Collections.Generic;" ); }