diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index db62000b3..7a643ff47 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -234,6 +234,12 @@ namespace EndToEnd.Tests //check if the template created files Assert.True(directory.Exists); Assert.True(directory.EnumerateFileSystemInfos().Any()); + + // delete test directory for some tests so we aren't leaving behind non-compliant nuget files + if (templateName.Equals("nugetconfig")) + { + directory.Delete(true); + } } [WindowsOnlyTheory] @@ -317,7 +323,7 @@ namespace EndToEnd.Tests public void ItCanCreateTemplateWithDefaultFramework(string templateName) { string framework = DetectExpectedDefaultFramework(templateName); - TestTemplateCreateAndBuild(templateName, build: false, framework: framework); + TestTemplateCreateAndBuild(templateName, build: false, framework: framework, deleteTestDirectory: true); } /// @@ -401,7 +407,7 @@ namespace EndToEnd.Tests throw new Exception("Unsupported version of SDK"); } - private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "") + private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "", bool deleteTestDirectory = false) { DirectoryInfo directory = TestAssets.CreateTestDirectory(identifier: string.IsNullOrWhiteSpace(language) ? templateName : $"{templateName}[{language}]"); string projectDirectory = directory.FullName; @@ -454,6 +460,12 @@ namespace EndToEnd.Tests .Execute(buildArgs) .Should().Pass(); } + + // delete test directory for some tests so we aren't leaving behind non-compliant package files + if (deleteTestDirectory) + { + directory.Delete(true); + } } } }