diff --git a/AutoRest/AutoRest/AutoRest.json b/AutoRest/AutoRest/AutoRest.json index c4674f06132c3..f368702db7a63 100644 --- a/AutoRest/AutoRest/AutoRest.json +++ b/AutoRest/AutoRest/AutoRest.json @@ -31,7 +31,7 @@ "type": "AzurePythonCodeGenerator, AutoRest.Generator.Azure.Python" }, "AzureResourceSchema": { - "type": "AzureResourceSchema, AutoRest.Generator.AzureResourceSchema" + "type": "AzureResourceSchemaCodeGenerator, AutoRest.Generator.AzureResourceSchema" } }, "modelers": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AzureResourceSchemaCodeGeneratorTests.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AzureResourceSchemaCodeGeneratorTests.cs index 2791f0ca370b3..4591537496b3e 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AzureResourceSchemaCodeGeneratorTests.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/AzureResourceSchemaCodeGeneratorTests.cs @@ -13,53 +13,44 @@ public class AzureResourceSchemaCodeGeneratorTests [Fact] public void DescriptionThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - Assert.Throws(() => { string value = codeGen.Description; }); + Assert.Equal("Azure Resource Schema generator", CreateGenerator().Description); } [Fact] public void ImplementationFileExtensionThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - Assert.Throws(() => { string value = codeGen.ImplementationFileExtension; }); + Assert.Equal(".json", CreateGenerator().ImplementationFileExtension); } [Fact] public void NameThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - Assert.Throws(() => { string value = codeGen.Name; }); + Assert.Equal("AzureResourceSchema", CreateGenerator().Name); } [Fact] public void UsageInstructionsThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - Assert.Throws(() => { string value = codeGen.UsageInstructions; }); + Assert.Equal("MOCK USAGE INSTRUCTIONS", CreateGenerator().UsageInstructions); } [Fact] public void GenerateThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - ServiceClient serviceClient = new ServiceClient(); - Assert.Throws(() => { codeGen.Generate(serviceClient); }); + Assert.Throws(() => { CreateGenerator().Generate(serviceClient); }); } [Fact] public void NormalizeClientModelThrowsException() { - Settings settings = new Settings(); - AzureResourceSchemaCodeGenerator codeGen = new AzureResourceSchemaCodeGenerator(settings); - ServiceClient serviceClient = new ServiceClient(); - Assert.Throws(() => { codeGen.NormalizeClientModel(serviceClient); }); + Assert.Throws(() => { CreateGenerator().NormalizeClientModel(serviceClient); }); + } + + private static AzureResourceSchemaCodeGenerator CreateGenerator() + { + return new AzureResourceSchemaCodeGenerator(new Settings()); } } } diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/AzureResourceSchemaCodeGenerator.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/AzureResourceSchemaCodeGenerator.cs index 9a461a2fbc1da..e879d0b9bd2f6 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/AzureResourceSchemaCodeGenerator.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/AzureResourceSchemaCodeGenerator.cs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using Microsoft.Rest.Generator.ClientModel; using System; using System.Threading.Tasks; -using Microsoft.Rest.Generator.ClientModel; namespace Microsoft.Rest.Generator.AzureResourceSchema { @@ -16,34 +16,22 @@ public AzureResourceSchemaCodeGenerator(Settings settings) public override string Description { - get - { - throw new NotImplementedException(); - } + get { return "Azure Resource Schema generator"; } } public override string ImplementationFileExtension { - get - { - throw new NotImplementedException(); - } + get { return ".json"; } } public override string Name { - get - { - throw new NotImplementedException(); - } + get { return "AzureResourceSchema"; } } public override string UsageInstructions { - get - { - return "MOCK USAGE INSTRUCTIONS"; - } + get { return "MOCK USAGE INSTRUCTIONS"; } } public override Task Generate(ServiceClient serviceClient)