Skip to content

Commit d0dfd01

Browse files
committed
Forgot WithVirtualHive for ItDoesNotIncludeWindowsOnlyProjectTemplates. Fixed ItCanCreateItemTemplateWithProjectRestriction by allowing an itemName to be passed as part of the identifier for InstantiateProjectTemplate.
1 parent 84c8ad4 commit d0dfd01

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/EndToEnd.Tests/GivenUnixPlatform.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public void ItDoesNotIncludeWindowsOnlyProjectTemplates(string template)
1313
var directory = _testAssetsManager.CreateTestDirectory(identifier: template);
1414

1515
new DotnetNewCommand(Log)
16+
.WithVirtualHive()
1617
.WithWorkingDirectory(directory.Path)
1718
.Execute(template).Should().Fail()
1819
.And.HaveStdErrContaining($": {template}.");

test/EndToEnd.Tests/ProjectBuildTests.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public void ItCanCreateItemTemplateWithProjectRestriction(string templateName, s
263263
{ "VB", ".vb" }
264264
};
265265

266-
var directory = InstantiateProjectTemplate(templateName, language, withNoRestore: false);
266+
var directory = InstantiateProjectTemplate("classlib", language, withNoRestore: false, itemName: templateName);
267267
string projectDirectory = directory.Path;
268268
string expectedItemName = $"TestItem_{templateName}";
269269

@@ -457,9 +457,17 @@ private void TestTemplateCreateAndBuild(string templateName, bool build = true,
457457
}
458458
}
459459

460-
private TestDirectory InstantiateProjectTemplate(string templateName, string language = "", bool withNoRestore = true)
460+
private TestDirectory InstantiateProjectTemplate(string templateName, string language = "", bool withNoRestore = true, string itemName = "")
461461
{
462-
var identifier = string.IsNullOrWhiteSpace(language) ? templateName : $"{templateName}[{language}]";
462+
var identifier = templateName;
463+
if (!string.IsNullOrWhiteSpace(language))
464+
{
465+
identifier += $"[{language}]";
466+
}
467+
if (!string.IsNullOrWhiteSpace(itemName))
468+
{
469+
identifier += $"({itemName})";
470+
}
463471
var directory = _testAssetsManager.CreateTestDirectory(identifier: identifier);
464472
string projectDirectory = directory.Path;
465473

0 commit comments

Comments
 (0)