public void TypeScript_with_a_string_an_int_and_and_int_arrayproperty() { var result = new StringBuilder(); var io = new IntellisenseObject(new[] { new IntellisenseProperty(_stringType, "AString"), new IntellisenseProperty(_int32Type, "AnInt"), new IntellisenseProperty(_int32ArrayType, "AnIntArray") { Summary = "ASummary" }, new IntellisenseProperty(_simpleType, "TheSimple") }) { FullName = "Foo.Primitives", Name = "Primitives", Namespace = "server" }; IntellisenseWriter.WriteTypeScript(new[] { io }, result); result.ShouldBeCode(@" declare module server { interface Primitives { aString: string; anInt: number; /** ASummary */ anIntArray: number[]; theSimple: server.Simple; } }"); }
public void TypeScript_with_a_string_and_simple_dictionary_property() { var result = new StringBuilder(); var io = new IntellisenseObject(new[] { new IntellisenseProperty(_stringType, "AString"), new IntellisenseProperty(_stringDictionary, "ADictionary") }) { FullName = "Foo", Name = "Bar", Namespace = "server" }; IntellisenseWriter.WriteTypeScript(new[] { io }, result); result.ShouldBeCode(@" declare module server { interface Bar { aString: string; aDictionary: { [index: string]: string }; } }" ); }
public void TypeScript_with_on_string_property() { var result = new StringBuilder(); var io = new IntellisenseObject(new[] { new IntellisenseProperty(_stringType, "AString") }) { FullName = "Foo.Primitives", Name = "Primitives", Namespace = "server" }; IntellisenseWriter.WriteTypeScript(new[] { io }, result); result.ShouldBeCode(@" declare module server { interface Primitives { aString: string; } }"); }
public void JavaScript_with_a_string_an_int_and_and_int_arrayproperty() { var result = new StringBuilder(); var io = new IntellisenseObject(new[] { new IntellisenseProperty(_stringType, "AString"), new IntellisenseProperty(_int32Type, "AnInt"), new IntellisenseProperty(_int32ArrayType, "AnIntArray") { Summary = "ASummary" }, new IntellisenseProperty(_simpleType, "TheSimple") }) { FullName = "Foo.Primitives", Name = "Primitives", Namespace = "server" }; IntellisenseWriter.WriteJavaScript(new[] { io }, result); result.ShouldBeCode(@" var server = server || {}; /// <summary>The Primitives class as defined in Foo.Primitives</summary> server.Primitives = function() { /// <field name=""aString"" type=""String"">The AString property as defined in Foo.Primitives</field> this.aString = ''; /// <field name=""anInt"" type=""Number"">The AnInt property as defined in Foo.Primitives</field> this.anInt = 0; /// <field name=""anIntArray"" type=""Number[]"">ASummary</field> this.anIntArray = []; /// <field name=""theSimple"" type=""Object"">The TheSimple property as defined in Foo.Primitives</field> this.theSimple = { }; };"); }
public void JavaScript_with_on_string_property() { var result = new StringBuilder(); var io = new IntellisenseObject(new[] { new IntellisenseProperty(_stringType, "AString") }) { FullName = "Foo.Primitives", Name = "Primitives", Namespace = "server" }; IntellisenseWriter.WriteJavaScript(new[] { io }, result); result.ShouldBeCode(@" var server = server || {}; /// <summary>The Primitives class as defined in Foo.Primitives</summary> server.Primitives = function() { /// <field name=""aString"" type=""String"">The AString property as defined in Foo.Primitives</field> this.aString = ''; };"); }
public void Init() { _item = VSHost.EnsureSolution(@"CodeGen\CodeGen.sln").FindProjectItem("Simple.cs"); _theObject = IntellisenseParser.ProcessFile(_item).First(); }
public static IntellisenseObjectsAssertions Should(this IntellisenseObject @object) { return(new IntellisenseObjectsAssertions(@object)); }
public void Init() { item = VSHost.EnsureSolution(@"CodeGen\CodeGen.sln").FindProjectItem("CollectionModel.cs"); theObject = IntellisenseParser.ProcessFile(item).First(); }