Skip to content

Commit 9d9d337

Browse files
v1.1.1 (#7)
* Fix the Razor code behind file name in the header by adding a .cs at the end (fixes #4). * Removes the ".Tests" in the default exception message in the unit tests (fixes #6).
1 parent cae6338 commit 9d9d337

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/VisualStudio.Templates.Files/ExceptionUnitTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void Constructor()
1313
{
1414
var exception = new $classnameundertest$();
1515

16-
exception.Message.Should().Be("Exception of type '$rootnamespace$.$classnameundertest$' was thrown.");
16+
exception.Message.Should().Be("Exception of type '$namespaceundertest$.$classnameundertest$' was thrown.");
1717
exception.InnerException.Should().BeNull();
1818
}
1919

src/VisualStudio.Templates.Files/RazorComponent.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="$rootname$" company="$company$">
2+
// <copyright file="$rootname$.cs" company="$company$">
33
// Copyright (c) $company$. All rights reserved.
44
// </copyright>
55
//-----------------------------------------------------------------------

src/VisualStudio.Templates/CompanySelectionWizard.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ public void RunStarted(object automationObject,
8282

8383
replacementsDictionary.Add("$classnameundertest$", classNameUnderTest);
8484

85+
// For unit tests of the exception, add a setting without the "Tests" namespace suffix
86+
var rootnamespace = replacementsDictionary["$rootnamespace$"];
87+
var namespaceundertest = rootnamespace;
88+
89+
if (namespaceundertest.EndsWith("Tests"))
90+
{
91+
namespaceundertest = namespaceundertest.Substring(0, namespaceundertest.Length - ".Tests".Length);
92+
}
93+
94+
replacementsDictionary.Add("$namespaceundertest$", namespaceundertest);
95+
8596
this.shouldAddProjectItem = true;
8697
}
8798
}

0 commit comments

Comments
 (0)