diff --git a/src/Scaffolding/VS.Web.CG.Core/MessageStrings.resx b/src/Scaffolding/VS.Web.CG.Core/MessageStrings.resx index 575498996..e5ccca29e 100644 --- a/src/Scaffolding/VS.Web.CG.Core/MessageStrings.resx +++ b/src/Scaffolding/VS.Web.CG.Core/MessageStrings.resx @@ -121,7 +121,7 @@ Adding dependency '{0}' version '{1}'. - There was an error creating the code generator instance: {0}\r\n{1} + There was an error creating the code generator instance: [{0}]\r\n{1} No code generators found with the name '{0}' @@ -139,22 +139,22 @@ The provided file '{0}' does not exist. This method expects a fully qualified path of an existing file. - A file matching the name {0} was not found within any of the folders: {1} + A file matching the name '{0}' was not found within any of the folders: [{1}] - {0} method with a model parameter is not found in class: {1} + [{0}] method with a model parameter is not found in class: [{1}] - There was an error attempting to create an instace of model for GenerateCode method: {0} + There was an error attempting to create an instace of model for GenerateCode method: [{0}] Multiple code generators found matching the name '{0}' - Multiple files with name {0} found within {1} + Multiple files with name '{0}' found within [{1}] - Multiple {0} methods with a model parameter are found in class: {1} + Multiple [{0}] methods with a model parameter are found in class: [{1}] Parameter '{0}' cannot be null or empty. @@ -163,10 +163,10 @@ Could not find a part of the path '{0}' - Template file {0} not found within search paths {1} + Template file '{0}' not found within search paths [{1}] - There was an error running the template {0}: {1} + There was an error running the template at '{0}': [{1}] Unable to run restore. @@ -174,4 +174,4 @@ Unexpected type of library information for template folders - \ No newline at end of file + diff --git a/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorActionsServiceTests.cs b/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorActionsServiceTests.cs index 49e5dae0c..0f2af9b35 100644 --- a/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorActionsServiceTests.cs +++ b/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorActionsServiceTests.cs @@ -28,7 +28,7 @@ await codeGeneratorActionService.AddFileFromTemplateAsync("Dummy", "Template", new[] { "TemplateFolder1", "TemplateFolder2" }, null)); - Assert.Equal("Template file Template not found within search paths TemplateFolder1;TemplateFolder2", ex.Message); + Assert.Equal("Template file 'Template' not found within search paths [TemplateFolder1;TemplateFolder2]", ex.Message); } [Fact] @@ -60,7 +60,7 @@ await codeGeneratorActionService.AddFileFromTemplateAsync("Dummy", templateName, new[] { "TemplateFolder1", "TemplateFolder2" }, null)); - Assert.Equal("There was an error running the template " + templatePath + ": Template Processing Failed:Error1", ex.Message); + Assert.Equal($"There was an error running the template at '{ templatePath }': [Template Processing Failed:Error1]", ex.Message); } [Fact] @@ -98,4 +98,4 @@ await codeGeneratorActionService.AddFileFromTemplateAsync(outputPath, Assert.Equal(generatedText, mockFileSystem.ReadAllText(outputPath)); } } -} \ No newline at end of file +} diff --git a/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorDescriptorTests.cs b/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorDescriptorTests.cs index 853fe36a8..ca98798e0 100644 --- a/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorDescriptorTests.cs +++ b/test/Scaffolding/VS.Web.CG.Core.Test/CodeGeneratorDescriptorTests.cs @@ -52,8 +52,8 @@ public void CodeGeneratorDescriptor_CodeGeneratorAction_Throws_When_No_GenerateC //Act var ex = Assert.Throws(() => descriptor.CodeGeneratorAction); - Assert.Equal("GenerateCode method with a model parameter is not found in class: " + - "Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+CodeGeneratorWithGenerateCodeNoParameters", + Assert.Equal("[GenerateCode] method with a model parameter is not found in class: " + + "[Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+CodeGeneratorWithGenerateCodeNoParameters]", ex.Message); } @@ -67,8 +67,8 @@ public void CodeGeneratorDescriptor_CodeGeneratorAction_Throws_When_Multiple_Gen //Act var ex = Assert.Throws(() => descriptor.CodeGeneratorAction); - Assert.Equal("Multiple GenerateCode methods with a model parameter are found in class: " + - "Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+ClassWithMultipleGenerateCodeMethods", + Assert.Equal("Multiple [GenerateCode] methods with a model parameter are found in class: " + + "[Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+ClassWithMultipleGenerateCodeMethods]", ex.Message); } @@ -120,7 +120,7 @@ public void CodeGeneratorDescriptor_CodeGeneratorInstance_Throws_When_Not_Able_T //Act & Assert var ex = Assert.Throws(() => descriptor.CodeGeneratorInstance); Assert.StartsWith("There was an error creating the code generator instance: " + - "Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+CodeGeneratorWithDependencies", ex.Message); + "[Microsoft.VisualStudio.Web.CodeGeneration.Core.Test.CodeGeneratorDescriptorTests+CodeGeneratorWithDependencies]", ex.Message); } [Alias("MyAlias")] @@ -166,4 +166,4 @@ public CodeGeneratorWithDependencies(IServiceProvider serviceProvider) public IServiceProvider ServiceProvider { get; private set; } } } -} \ No newline at end of file +} diff --git a/test/Scaffolding/VS.Web.CG.Core.Test/FilesLocatorTests.cs b/test/Scaffolding/VS.Web.CG.Core.Test/FilesLocatorTests.cs index a74bcc341..c7e0afdfc 100644 --- a/test/Scaffolding/VS.Web.CG.Core.Test/FilesLocatorTests.cs +++ b/test/Scaffolding/VS.Web.CG.Core.Test/FilesLocatorTests.cs @@ -37,7 +37,7 @@ public void FilesLocator_Throws_When_Multiple_Matches_In_OneSearchPath() FilesLocator locator = new FilesLocator(fs); var ex = Assert.Throws(() => locator.GetFilePath("template.cshtml", new[] { @"C:\One" })); - Assert.Equal(@"Multiple files with name template.cshtml found within C:\One", ex.Message); + Assert.Equal(@"Multiple files with name 'template.cshtml' found within [C:\One]", ex.Message); } [Fact] @@ -52,7 +52,7 @@ public void FilesLocator_Throws_When_No_Matches_In_SearchPaths() FilesLocator locator = new FilesLocator(fs); var ex = Assert.Throws(() => locator.GetFilePath("template.cshtml", folders)); - Assert.Equal(@"A file matching the name template.cshtml was not found within any of the folders: C:\One;C:\Two", ex.Message); + Assert.Equal(@"A file matching the name 'template.cshtml' was not found within any of the folders: [C:\One;C:\Two]", ex.Message); } [Fact] @@ -61,7 +61,7 @@ public void FilesLocator_Throws_When_No_SearchPaths_Does_Not_Exist() FilesLocator locator = new FilesLocator(new MockFileSystem()); var ex = Assert.Throws(() => locator.GetFilePath("template.cshtml", new[] { @"C:\One", @"C:\Two" })); - Assert.Equal(@"A file matching the name template.cshtml was not found within any of the folders: C:\One;C:\Two", ex.Message); + Assert.Equal(@"A file matching the name 'template.cshtml' was not found within any of the folders: [C:\One;C:\Two]", ex.Message); } } -} \ No newline at end of file +}