@@ -56,7 +56,9 @@ private static IEnumerable<string> ConvertXml(string name, IEnumerable<string> x
5656 CodeTypeReferenceOptions = generatorPrototype . CodeTypeReferenceOptions ,
5757 DoNotForceIsNullable = generatorPrototype . DoNotForceIsNullable ,
5858 CreateGeneratedCodeAttributeVersion = generatorPrototype . CreateGeneratedCodeAttributeVersion ,
59- NetCoreSpecificCode = generatorPrototype . NetCoreSpecificCode
59+ NetCoreSpecificCode = generatorPrototype . NetCoreSpecificCode ,
60+ GenerateCommandLineArgumentsComment = generatorPrototype . GenerateCommandLineArgumentsComment ,
61+ CommandLineArgumentsProvider = generatorPrototype . CommandLineArgumentsProvider ,
6062 } ;
6163
6264 gen . CommentLanguages . Clear ( ) ;
@@ -2388,5 +2390,64 @@ void UnknownAttributeHandler(object sender, XmlAttributeEventArgs e)
23882390 AssertEx . Equal ( deserializedObject , deserializedXml ) ;
23892391 }
23902392 }
2393+
2394+ [ Theory ]
2395+ [ InlineData ( "fake command line arguments" , "fake command line arguments" ) ]
2396+ [ InlineData ( null , "N/A" ) ]
2397+ public void IncludeCommandLineArguments ( string commandLineArguments , string expectedCommandLineArguments )
2398+ {
2399+ const string xsd = @"<?xml version=""1.0"" encoding=""UTF-8""?>
2400+ <xs:schema elementFormDefault=""qualified"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" targetNamespace=""http://local.none"" xmlns:l=""http://local.none"">
2401+ <xs:element name=""document"" type=""l:elem"" />
2402+ <xs:complexType name=""elem"">
2403+ <xs:attribute name=""Text"" type=""xs:string""/>
2404+ </xs:complexType>
2405+ </xs:schema>" ;
2406+
2407+ var generator = new Generator
2408+ {
2409+ GenerateInterfaces = false ,
2410+ NamespaceProvider = new NamespaceProvider
2411+ {
2412+ GenerateNamespace = key => "Test"
2413+ } ,
2414+ GenerateCommandLineArgumentsComment = true ,
2415+ CommandLineArgumentsProvider = new CommandLineArgumentsProvider ( commandLineArguments )
2416+ } ;
2417+
2418+ var contents = ConvertXml ( nameof ( IncludeCommandLineArguments ) , xsd , generator ) ;
2419+
2420+ var csharp = Assert . Single ( contents ) ;
2421+
2422+ CompareOutput (
2423+ $@ "//------------------------------------------------------------------------------
2424+ // <auto-generated>
2425+ // This code was generated by a tool.
2426+ //
2427+ // Changes to this file may cause incorrect behavior and will be lost if
2428+ // the code is regenerated.
2429+ // </auto-generated>
2430+ //------------------------------------------------------------------------------
2431+
2432+ // This code was generated by Tests version 1.0.0.1 using the following command:
2433+ // { expectedCommandLineArguments }
2434+ namespace Test
2435+ {{
2436+
2437+
2438+ [System.CodeDom.Compiler.GeneratedCodeAttribute(""Tests"", ""1.0.0.1"")]
2439+ [System.SerializableAttribute()]
2440+ [System.Xml.Serialization.XmlTypeAttribute(""elem"", Namespace=""http://local.none"")]
2441+ [System.ComponentModel.DesignerCategoryAttribute(""code"")]
2442+ [System.Xml.Serialization.XmlRootAttribute(""document"", Namespace=""http://local.none"")]
2443+ public partial class Elem
2444+ {{
2445+
2446+ [System.Xml.Serialization.XmlAttributeAttribute(""Text"")]
2447+ public string Text {{ get; set; }}
2448+ }}
2449+ }}
2450+ " , csharp ) ;
2451+ }
23912452 }
23922453}
0 commit comments