diff --git a/eng/Versions.props b/eng/Versions.props index 45c10e80b031..d3a51b00b0ce 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -133,6 +133,7 @@ $(MicrosoftTemplateEngineAbstractionsPackageVersion) $(MicrosoftTemplateEngineAbstractionsPackageVersion) + $(MicrosoftTemplateEngineAbstractionsPackageVersion) diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..70cab17a4b13 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonItemsCreate._.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "%TEMPLATE_NAME%" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..430a24c2acb9 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreateRestoreAndBuild._.verified/std-streams/stdout.txt @@ -0,0 +1,7 @@ +The template "%TEMPLATE_NAME%" was created successfully. + +Processing post-creation actions... +Restoring %PROJECT_NAME%: + Determining projects to restore... + Restored %PROJECT_NAME% (%DURATION%). +Restore succeeded. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..70cab17a4b13 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/AllCommonProjectsCreate_NoRestore._.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "%TEMPLATE_NAME%" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/editorconfig/.editorconfig b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/editorconfig/.editorconfig new file mode 100644 index 000000000000..6a5db887fd68 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/editorconfig/.editorconfig @@ -0,0 +1,2 @@ +root = true + diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..7d111cb75350 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty.editorconfig.--empty.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "EditorConfig file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/editorconfig/.editorconfig b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/editorconfig/.editorconfig new file mode 100644 index 000000000000..6a5db887fd68 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/editorconfig/.editorconfig @@ -0,0 +1,2 @@ +root = true + diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stdout.txt new file mode 100644 index 000000000000..7d111cb75350 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.received/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "EditorConfig file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/editorconfig/.editorconfig b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/editorconfig/.editorconfig new file mode 100644 index 000000000000..6a5db887fd68 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/editorconfig/.editorconfig @@ -0,0 +1,2 @@ +root = true + diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..7d111cb75350 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty2.editorconfig.--empty.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "EditorConfig file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/editorconfig/.editorconfig b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/editorconfig/.editorconfig new file mode 100644 index 000000000000..6a5db887fd68 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/editorconfig/.editorconfig @@ -0,0 +1,2 @@ +root = true + diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..7d111cb75350 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/EditorConfigTests_Empty_withWorkDir.editorconfig.--empty.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "EditorConfig file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..fc1265d5a13d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs @@ -0,0 +1,9 @@ +using System; + +namespace classlib +{ + public class Class1 + { + + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..39b7bff66866 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj @@ -0,0 +1,8 @@ + + + + %FRAMEWORK% + %LANG% + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..fc1265d5a13d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs @@ -0,0 +1,9 @@ +using System; + +namespace classlib +{ + public class Class1 + { + + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..072df2dcfb54 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-False#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj @@ -0,0 +1,7 @@ + + + + %FRAMEWORK% + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..fc1265d5a13d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs @@ -0,0 +1,9 @@ +using System; + +namespace classlib +{ + public class Class1 + { + + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..a968f1b07101 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj @@ -0,0 +1,9 @@ + + + + %FRAMEWORK% + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..fc1265d5a13d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/Class1.cs @@ -0,0 +1,9 @@ +using System; + +namespace classlib +{ + public class Class1 + { + + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..089bd557c90e --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False#NoLang.verified/MyProject/classlib.csproj @@ -0,0 +1,8 @@ + + + + %FRAMEWORK% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..fc1265d5a13d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Class1.cs @@ -0,0 +1,9 @@ +using System; + +namespace classlib +{ + public class Class1 + { + + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..a968f1b07101 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/classlib.csproj @@ -0,0 +1,9 @@ + + + + %FRAMEWORK% + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..ae5e51c9ff8d --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/Class1.cs @@ -0,0 +1,7 @@ +using System; + +namespace classlib; +public class Class1 +{ + +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..a968f1b07101 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-True.verified/MyProject/classlib.csproj @@ -0,0 +1,9 @@ + + + + %FRAMEWORK% + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..b080d4b67534 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Class1.cs @@ -0,0 +1,5 @@ +namespace classlib; +public class Class1 +{ + +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..9ec0fc5f2334 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/classlib.csproj @@ -0,0 +1,9 @@ + + + + %FRAMEWORK% + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Class1.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Class1.cs new file mode 100644 index 000000000000..b080d4b67534 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Class1.cs @@ -0,0 +1,5 @@ +namespace classlib; +public class Class1 +{ + +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/classlib.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/classlib.csproj new file mode 100644 index 000000000000..8af04e6e81c3 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.classlib.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/classlib.csproj @@ -0,0 +1,10 @@ + + + + %FRAMEWORK% + %LANG% + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs new file mode 100644 index 000000000000..eb556c611f8f --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace console +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj new file mode 100644 index 000000000000..77de492bfc70 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-False#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj @@ -0,0 +1,9 @@ + + + + Exe + %FRAMEWORK% + %LANG% + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs new file mode 100644 index 000000000000..eb556c611f8f --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace console +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj new file mode 100644 index 000000000000..2f468dfa8531 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-False#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj @@ -0,0 +1,10 @@ + + + + Exe + %FRAMEWORK% + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs new file mode 100644 index 000000000000..ea0a451f4903 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/Program.cs @@ -0,0 +1,4 @@ +// See https://aka.ms/new-console-template for more information +using System; + +Console.WriteLine("Hello, World!"); diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj new file mode 100644 index 000000000000..2f468dfa8531 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-False#FileScopedNs-False.verified/MyProject/console.csproj @@ -0,0 +1,10 @@ + + + + Exe + %FRAMEWORK% + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Program.cs new file mode 100644 index 000000000000..3751555cbd32 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/console.csproj new file mode 100644 index 000000000000..2259bce51317 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True#NoLang.verified/MyProject/console.csproj @@ -0,0 +1,10 @@ + + + + Exe + %FRAMEWORK% + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Program.cs new file mode 100644 index 000000000000..3751555cbd32 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/console.csproj new file mode 100644 index 000000000000..63f76841e653 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/FeaturesSupport.console.Nullable-True#TopLevel-True#ImplicitUsings-True#FileScopedNs-True.verified/MyProject/console.csproj @@ -0,0 +1,11 @@ + + + + Exe + %FRAMEWORK% + %LANG% + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/globaljson/global.json b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/globaljson/global.json new file mode 100644 index 000000000000..7730b087984a --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/globaljson/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "rollForward": "major", + "version": "5.0.200" + } +} \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..d8cf40e1cb6b --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200#--roll-forward#major.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "global.json file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/globaljson/global.json b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/globaljson/global.json new file mode 100644 index 000000000000..f65450fd2f28 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/globaljson/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "5.0.200" + } +} \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stderr.txt b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stderr.txt new file mode 100644 index 000000000000..5f282702bb03 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stderr.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stdout.txt b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stdout.txt new file mode 100644 index 000000000000..d8cf40e1cb6b --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/GlobalJsonTests.globaljson.--sdk-version#5.0.200.verified/std-streams/stdout.txt @@ -0,0 +1 @@ +The template "global.json file" was created successfully. \ No newline at end of file diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/Program.cs new file mode 100644 index 000000000000..32235d003676 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/Program.cs @@ -0,0 +1,8 @@ +namespace console; +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/console.csproj new file mode 100644 index 000000000000..780397f26459 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console.#NoLang.verified/MyProject/console.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/Program.cs new file mode 100644 index 000000000000..32235d003676 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/Program.cs @@ -0,0 +1,8 @@ +namespace console; +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/console.csproj new file mode 100644 index 000000000000..e8aab907fdf2 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled.console._.verified/MyProject/console.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + %LANG% + enable + enable + + + diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/Program.cs b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/Program.cs new file mode 100644 index 000000000000..eb556c611f8f --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace console +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} diff --git a/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/console.csproj b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/console.csproj new file mode 100644 index 000000000000..7dfb8ec8ba15 --- /dev/null +++ b/src/Tests/dotnet-new.Tests/Approvals/TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces._.verified/MyProject/console.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + %LANG% + enable + + + diff --git a/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs b/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs index cc11e8f53ba0..ad24b046c05d 100644 --- a/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs +++ b/src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs @@ -6,11 +6,16 @@ using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Xml.Linq; +using FluentAssertions; using Microsoft.DotNet.Cli.Utils; +using Microsoft.Extensions.Logging; +using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; using Microsoft.NET.TestFramework.Commands; +using Microsoft.TemplateEngine.Authoring.TemplateVerifier; using Microsoft.TemplateEngine.TestHelper; using Xunit.Abstractions; +using SdkCommandSpec = Microsoft.NET.TestFramework.Commands.SdkCommandSpec; namespace Microsoft.DotNet.Cli.New.IntegrationTests { @@ -18,11 +23,13 @@ public class CommonTemplatesTests : BaseIntegrationTest, IClassFixture "fsproj", "VB" => "vbproj", _ => "csproj" }; - string finalProjectName = Regex.Escape(Path.Combine(workingDir, $"{workingDirName}.{extension}")); + + string projectName = "sample-project-name"; + string projectDir = Path.Combine(workingDir, templateShortName); + string finalProjectName = Path.Combine(projectDir, $"{projectName}.{extension}"); Console.WriteLine($"Expected project location: {finalProjectName}"); - List args = new() { templateShortName }; + List args = new() { "-n", projectName }; if (!string.IsNullOrWhiteSpace(language)) { args.Add("--language"); @@ -78,24 +86,35 @@ public void AllCommonProjectsCreateRestoreAndBuild(string expectedTemplateName, args.Add(langVersion); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOutMatching( -$@"The template ""{expectedTemplateName}"" was created successfully\. - -Processing post-creation actions\.\.\. -Restoring {finalProjectName}: -.* -Restore succeeded\.", - RegexOptions.Singleline); + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName) + { + TemplateSpecificArgs = args, + SnapshotsDirectory = "Approvals", + OutputDirectory = workingDir, + VerifyCommandOutput = true, + VerificationExcludePatterns = new[] { "*.cs", "*.fs", "*.vb", "*.*proj" }, + DoNotPrependCallerMethodNameToScenarioName = false, + DoNotAppendTemplateArgsToScenarioName = true, + DoNotPrependTemplateNameToScenarioName = true, + } + .WithCustomScrubbers( + ScrubbersDefinition.Empty + .AddScrubber(sb => + { + const string projectPathTag = "%PROJECT_NAME%"; + sb.Replace(expectedTemplateName, "%TEMPLATE_NAME%").Replace(finalProjectName, projectPathTag); + string pattern = "(^ Restored " + Regex.Escape(projectPathTag) + " \\()(.*)(\\)\\.)"; + string res = sb.ToString(); + res = Regex.Replace(res, pattern, "$1%DURATION%$3", RegexOptions.Multiline); + sb.Clear(); + sb.Append(res); + })); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); new DotnetRestoreCommand(_log) - .WithWorkingDirectory(workingDir) + .WithWorkingDirectory(projectDir) .Execute() .Should() .ExitWith(0) @@ -103,7 +122,7 @@ Processing post-creation actions\.\.\. .NotHaveStdErr(); new DotnetBuildCommand(_log) - .WithWorkingDirectory(workingDir) + .WithWorkingDirectory(projectDir) .Execute() .Should() .ExitWith(0) @@ -147,11 +166,9 @@ Processing post-creation actions\.\.\. [InlineData("Class Library", "classlib", "C#", "netstandard2.0")] [InlineData("Class Library", "classlib", "VB", "netstandard2.0")] [InlineData("Class Library", "classlib", "F#", "netstandard2.0")] - public void AllCommonProjectsCreate_NoRestore(string expectedTemplateName, string templateShortName, string? language = null, string? framework = null) + public async void AllCommonProjectsCreate_NoRestore(string expectedTemplateName, string templateShortName, string? language = null, string? framework = null) { - string workingDir = CreateTemporaryFolder(folderName: $"{templateShortName}-{language?.Replace("#", "Sharp") ?? "null"}-{framework ?? "null"}"); - - List args = new() { templateShortName, "--no-restore" }; + List args = new() { "--no-restore" }; if (!string.IsNullOrWhiteSpace(language)) { args.Add("--language"); @@ -163,16 +180,23 @@ public void AllCommonProjectsCreate_NoRestore(string expectedTemplateName, strin args.Add(framework); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOut($@"The template ""{expectedTemplateName}"" was created successfully."); + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName) + { + TemplateSpecificArgs = args, + SnapshotsDirectory = "Approvals", + VerifyCommandOutput = true, + VerificationIncludePatterns = new[] { "*.txt" }, + DoNotAppendTemplateArgsToScenarioName = true, + SettingsDirectory = _fixture.HomeDirectory, + DoNotPrependTemplateNameToScenarioName = true, + } + .WithCustomScrubbers( + ScrubbersDefinition.Empty + .AddScrubber(sb => sb.Replace(expectedTemplateName, "%TEMPLATE_NAME%")) + ); - Directory.Delete(workingDir, true); + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } [Theory] @@ -183,24 +207,107 @@ public void AllCommonProjectsCreate_NoRestore(string expectedTemplateName, strin [InlineData("Solution File", "solution")] [InlineData("Dotnet local tool manifest file", "tool-manifest")] [InlineData("Web Config", "webconfig")] - public void AllCommonItemsCreate(string expectedTemplateName, string templateShortName) + public async void AllCommonItemsCreate(string expectedTemplateName, string templateShortName) { - string workingDir = CreateTemporaryFolder(folderName: $"{templateShortName}"); + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName) + { + SnapshotsDirectory = "Approvals", + VerifyCommandOutput = true, + VerificationIncludePatterns = new[] { "*.txt" }, + DoNotAppendTemplateArgsToScenarioName = true, + SettingsDirectory = _fixture.HomeDirectory, + DoNotPrependTemplateNameToScenarioName = true, + } + .WithCustomScrubbers( + ScrubbersDefinition.Empty + .AddScrubber((path, content) => + { + if (path.Replace(Path.DirectorySeparatorChar, '/') == "std-streams/stdout.txt") + { + content.Replace(expectedTemplateName, "%TEMPLATE_NAME%"); + } + }) + ); - new DotnetNewCommand(_log, templateShortName) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOutContaining($@"The template ""{expectedTemplateName}"" was created successfully."); + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + } - Directory.Delete(workingDir, true); + [Fact] + public async void EditorConfigTests_Empty() + { + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "editorconfig") + { + TemplateSpecificArgs = new[] { "--empty" }, + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + VerifyCommandOutput = true, + }; + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } [Fact] - public void EditorConfigTests() + public async void EditorConfigTests_Empty2() + { + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "editorconfig") + { + TemplateSpecificArgs = new[] { "--empty" }, + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + DisableDefaultVerificationExcludePatterns = true, + VerifyCommandOutput = true, + }; + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + } + + [Fact] + public async void EditorConfigTests_Empty_withWorkDir() + { + string workingDir = CreateTemporaryFolder(); + + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "editorconfig") + { + TemplateSpecificArgs = new[] { "--empty" }, + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + OutputDirectory = workingDir, + VerifyCommandOutput = true, + }; + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + } + + [Fact] + public async void EditorConfigTests_Empty_custom() + { + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "editorconfig") + { + TemplateSpecificArgs = new[] { "--empty" }, + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + } + .WithCustomDirectoryVerifier(async (content, contentFetcher) => + { + await foreach (var (filePath, scrubbedContent) in contentFetcher.Value) + { + filePath.Replace(Path.DirectorySeparatorChar, '/').Should().BeEquivalentTo(@"editorconfig/.editorconfig"); + scrubbedContent.Trim().Should().BeEquivalentTo("root = true"); + } + }); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + + Assert.Fail("Fail to get logs - as file is obviously created"); + } + + [Fact] + public void EditorConfigTests_orig() { string workingDir = CreateTemporaryFolder(); @@ -235,46 +342,171 @@ public void EditorConfigTests() Assert.DoesNotContain("dotnet_naming_symbols", editorConfigContent); Assert.Contains("root = true", editorConfigContent); Directory.Delete(workingDir, true); + + Assert.Fail("Fail to get logs"); + } + + [Fact] + public void EditorConfigTests() + { + string workingDir = CreateTemporaryFolder(); + string path = Path.Combine(workingDir, ".editorconfig"); + + new DotnetNewCommand(_log, "editorconfig", "--empty") + .WithCustomHive(_fixture.HomeDirectory) + .WithWorkingDirectory(workingDir) + .Execute() + .Should() + .ExitWith(0) + .And.NotHaveStdErr() + .And.HaveStdOut($@"The template ""EditorConfig file"" was created successfully."); + + string editorConfigContent = File.ReadAllText(path); + Assert.DoesNotContain("dotnet_naming_rule", editorConfigContent); + Assert.DoesNotContain("dotnet_style_", editorConfigContent); + Assert.DoesNotContain("dotnet_naming_symbols", editorConfigContent); + Assert.Contains("root = true", editorConfigContent); + Directory.Delete(workingDir, true); + + Assert.Fail("Fail to get logs"); + } + + [Fact] + public void EditorConfigTests__2() + { + string workingDir = CreateTemporaryFolder(); + string path = Path.Combine(workingDir, ".editorconfig"); + + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() + { + FileName = "dotnet", + Arguments = new[] { "new", "editorconfig", "--empty" }.ToList(), + WorkingDirectory = workingDir + }; + + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); + + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); + + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); + + if (!string.IsNullOrEmpty(result.StdErr)) + { + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); + } + + if (result.ExitCode != 0) + { + Log.WriteLine($"Exit Code: {result.ExitCode}"); + } + + string editorConfigContent = File.ReadAllText(path); + Assert.DoesNotContain("dotnet_naming_rule", editorConfigContent); + Assert.DoesNotContain("dotnet_style_", editorConfigContent); + Assert.DoesNotContain("dotnet_naming_symbols", editorConfigContent); + Assert.Contains("root = true", editorConfigContent); + Directory.Delete(workingDir, true); + + Assert.Fail("Fail to get logs"); + } + + [Fact] + public void EditorConfigTests__3() + { + string workingDir = CreateTemporaryFolder(); + string path = Path.Combine(workingDir, "editorconfig", ".editorconfig"); + + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() + { + FileName = "dotnet", + Arguments = new[] { "new", "editorconfig", "--empty", "-o", "editorconfig", "-n", "editorconfig" }.ToList(), + WorkingDirectory = workingDir + }; + + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); + + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); + + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); + + if (!string.IsNullOrEmpty(result.StdErr)) + { + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); + } + + if (result.ExitCode != 0) + { + Log.WriteLine($"Exit Code: {result.ExitCode}"); + } + + string editorConfigContent = File.ReadAllText(path); + Assert.DoesNotContain("dotnet_naming_rule", editorConfigContent); + Assert.DoesNotContain("dotnet_style_", editorConfigContent); + Assert.DoesNotContain("dotnet_naming_symbols", editorConfigContent); + Assert.Contains("root = true", editorConfigContent); + Directory.Delete(workingDir, true); + + Assert.Fail("Fail to get logs"); + } + + [Fact] + public async void EditorConfigTests_Default() + { + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "editorconfig") + { + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + } + .WithCustomDirectoryVerifier(async (content, contentFetcher) => + { + await foreach (var (filePath, scrubbedContent) in contentFetcher.Value) + { + filePath.Replace(Path.DirectorySeparatorChar, '/').Should().BeEquivalentTo(@"editorconfig/.editorconfig"); + scrubbedContent.Should().Contain("dotnet_naming_rule"); + scrubbedContent.Should().Contain("dotnet_style_"); + scrubbedContent.Should().Contain("dotnet_naming_symbols"); + } + }); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } [Theory] [InlineData( -@"{ - ""sdk"": { - ""version"": ""5.0.200"" - } -}", "globaljson", "--sdk-version", "5.0.200")] [InlineData( -@"{ - ""sdk"": { - ""rollForward"": ""major"", - ""version"": ""5.0.200"" - } -}", "globaljson", "--sdk-version", "5.0.200", "--roll-forward", "major")] - public void GlobalJsonTests(string expectedContent, params string[] parameters) + public async void GlobalJsonTests(params string[] parameters) { - string workingDir = CreateTemporaryFolder(); - - new DotnetNewCommand(_log, parameters) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOut($@"The template ""global.json file"" was created successfully."); + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: parameters[0]) + { + TemplateSpecificArgs = parameters[1..], + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + VerifyCommandOutput = true, + }; - string globalJsonConent = File.ReadAllText(Path.Combine(workingDir, "global.json")); - Assert.Equal(expectedContent.Replace("\r\n", "\n"), globalJsonConent.Replace("\r\n", "\n")); - Directory.Delete(workingDir, true); + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } [Fact] @@ -320,70 +552,91 @@ public void NuGetConfigPermissions() #region Project templates language features tests - /// - /// Creates all possible combinations for supported templates, language versions and frameworks. - /// - public static IEnumerable TopLevelProgramSupport_Data() + [Theory] + [InlineData("11.0")] + [InlineData("11")] + [InlineData("10.0")] + [InlineData("10")] + [InlineData("preview")] + [InlineData("latest")] + [InlineData("default")] + [InlineData("latestMajor")] + [InlineData(null)] + public async void TopLevelProgramSupport_WhenFlagIsEnabled(string? langVersion) { - var templatesToTest = new[] - { - new { Name = "console", Frameworks = new[] { null, "net7.0" } } - }; - - string[] unsupportedLanguageVersions = { "1", "ISO-1" }; - string?[] supportedLanguageVersions = { null, "ISO-2", "2", "3", "4", "5", "6", "7", "7.1", "7.2", "7.3", "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); - string?[] topLevelStatementSupport = { null, "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + List args = new() { "-o", "MyProject", "--use-program-main" }; + if (!string.IsNullOrEmpty(langVersion)) + { + args.Add("--langVersion"); + args.Add(langVersion); + } - foreach (var template in templatesToTest) + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "console") { - foreach (string langVersion in unsupportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] - { - template.Name, - false, //dotnet build should fail - framework, - langVersion, - topLevelStatementSupport.Contains(langVersion) - }; - } - } - foreach (string? langVersion in supportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] - { - template.Name, - true, //dotnet build should pass - framework, - langVersion, - topLevelStatementSupport.Contains(langVersion) - }; - } - } + TemplateSpecificArgs = args, + SnapshotsDirectory = "Approvals", + OutputDirectory = workingDir, + SettingsDirectory = _fixture.HomeDirectory, + // DoNotPrependTemplateNameToScenarioName = true, + DoNotAppendTemplateArgsToScenarioName = true, + ScenarioName = langVersion == null ? "#NoLang" : null, } + .WithCustomScrubbers( + ScrubbersDefinition.Empty + .AddScrubber(sb => sb.Replace($"{langVersion}", "%LANG%"), "csproj") + ); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + + new DotnetBuildCommand(_log, "MyProject") + .WithWorkingDirectory(workingDir) + .Execute() + .Should().ExitWith(0).And.NotHaveStdErr(); + Directory.Delete(workingDir, true); } [Theory] - //creates all possible combinations for supported templates, language versions and frameworks -#pragma warning disable CA1825 // Avoid zero-length array allocations. https://github.com/dotnet/sdk/issues/28672 - [MemberData(nameof(TopLevelProgramSupport_Data))] -#pragma warning restore CA1825 // Avoid zero-length array allocations. - public void TopLevelProgramSupport(string name, bool buildPass, string? framework, string? langVersion, bool supportsFeature) + [InlineData("9.0")] + [InlineData("9")] + public async void TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces(string? langVersion) { - string workingDir = CreateTemporaryFolder(folderName: $"{name}-{langVersion ?? "null"}-{framework ?? "null"}"); + List args = new() { "-o", "MyProject", "--use-program-main" }; + if (!string.IsNullOrEmpty(langVersion)) + { + args.Add("--langVersion"); + args.Add(langVersion); + } - List args = new() { name, "-o", "MyProject" }; - if (!string.IsNullOrWhiteSpace(framework)) + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: "console") { - args.Add("--framework"); - args.Add(framework); + TemplateSpecificArgs = args, + SnapshotsDirectory = "Approvals", + SettingsDirectory = _fixture.HomeDirectory, + // DoNotPrependTemplateNameToScenarioName = true, + DoNotAppendTemplateArgsToScenarioName = true, + DoNotPrependTemplateNameToScenarioName = true, } - if (!string.IsNullOrWhiteSpace(langVersion)) + .WithCustomScrubbers( + ScrubbersDefinition.Empty + .AddScrubber(sb => sb.Replace($"{langVersion}", "%LANG%"), "csproj") + ); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); + } + + [Theory] + [InlineData("9.0")] + [InlineData("9")] + public void TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces_orig(string? langVersion) + { + string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); + + List args = new() { "console", "-o", "MyProject", "--use-program-main" }; + if (!string.IsNullOrEmpty(langVersion)) { args.Add("--langVersion"); args.Add(langVersion); @@ -397,23 +650,84 @@ public void TopLevelProgramSupport(string name, bool buildPass, string? framewor .ExitWith(0) .And.NotHaveStdErr(); - CommandResult buildResult = new DotnetBuildCommand(_log, "MyProject") + new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) - .Execute(); + .Execute() + .Should().ExitWith(0).And.NotHaveStdErr(); - if (buildPass) + string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", "Program.cs")); + string expectedTopLevelContent = + @"namespace MyProject +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine(""Hello, World!""); + } + } +} +"; + Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); + Assert.Contains(expectedTopLevelContent, programFileContent); + + Assert.Fail("Fail to get logs"); + } + + [Theory] + [InlineData("9.0")] + [InlineData("9")] + public void TopLevelProgramSupport_WhenFlagIsEnabled_2_NoFileScopedNamespaces_orig__2(string? langVersion) + { + string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); + + List args = new() { "new", "console", "-o", "MyProject", "--use-program-main" }; + if (!string.IsNullOrEmpty(langVersion)) { - buildResult.Should().ExitWith(0).And.NotHaveStdErr(); + args.Add("--langVersion"); + args.Add(langVersion); } - else + + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() { - buildResult.Should().Fail(); - return; + FileName = "dotnet", + Arguments = args, + WorkingDirectory = workingDir + }; + + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); + + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); + + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); + + if (!string.IsNullOrEmpty(result.StdErr)) + { + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); + } + + if (result.ExitCode != 0) + { + Log.WriteLine($"Exit Code: {result.ExitCode}"); } + result.ExitCode.Should().Be(0, "Expected zero exit code"); + result.StdErr.Should().BeNullOrEmpty("Expected no stderr"); + + new DotnetBuildCommand(_log, "MyProject") + .WithWorkingDirectory(workingDir) + .Execute() + .Should().ExitWith(0).And.NotHaveStdErr(); + string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", "Program.cs")); - string unexpectedTopLevelContent = -@"namespace MyProject + string expectedTopLevelContent = + @"namespace MyProject { class Program { @@ -424,47 +738,57 @@ static void Main(string[] args) } } "; - if (supportsFeature) - { - Assert.Contains("Console.WriteLine(\"Hello, World!\")", programFileContent); - Assert.Contains("// See https://aka.ms/new-console-template for more information", programFileContent); - Assert.DoesNotContain(unexpectedTopLevelContent, programFileContent); - } - else - { - Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); - Assert.Contains(unexpectedTopLevelContent, programFileContent); - } + Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); + Assert.Contains(expectedTopLevelContent, programFileContent); + + Assert.Fail("Fail to get logs"); } [Theory] - [InlineData("11.0")] - [InlineData("11")] - [InlineData("10.0")] - [InlineData("10")] - [InlineData("preview")] - [InlineData("latest")] - [InlineData("default")] - [InlineData("latestMajor")] - [InlineData(null)] - public void TopLevelProgramSupport_WhenFlagIsEnabled(string? langVersion) + [InlineData("9.0")] + [InlineData("9")] + public void TopLevelProgramSupport_WhenFlagIsEnabled_X_NoFileScopedNamespaces_orig__X_DotnetDotnet(string? langVersion) { string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); - List args = new() { "console", "-o", "MyProject", "--use-program-main" }; + List args = new() { TestContext.Current.ToolsetUnderTest.DotNetHostPath, "new", "console", "-o", "MyProject", "--use-program-main" }; if (!string.IsNullOrEmpty(langVersion)) { args.Add("--langVersion"); args.Add(langVersion); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr(); + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() + { + FileName = "dotnet", + Arguments = args, + WorkingDirectory = workingDir + }; + + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); + + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); + + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); + + if (!string.IsNullOrEmpty(result.StdErr)) + { + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); + } + + if (result.ExitCode != 0) + { + Log.WriteLine($"Exit Code: {result.ExitCode}"); + } + + result.ExitCode.Should().Be(0, "Expected zero exit code"); + result.StdErr.Should().BeNullOrEmpty("Expected no stderr"); new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) @@ -473,40 +797,68 @@ public void TopLevelProgramSupport_WhenFlagIsEnabled(string? langVersion) string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", "Program.cs")); string expectedTopLevelContent = -@"namespace MyProject; -class Program + @"namespace MyProject { - static void Main(string[] args) + class Program { - Console.WriteLine(""Hello, World!""); + static void Main(string[] args) + { + Console.WriteLine(""Hello, World!""); + } } } "; Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); Assert.Contains(expectedTopLevelContent, programFileContent); + + Assert.Fail("Fail to get logs"); } [Theory] [InlineData("9.0")] [InlineData("9")] - public void TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces(string? langVersion) + public void TopLevelProgramSupport_WhenFlagIsEnabled_3_NoFileScopedNamespaces_orig__3(string? langVersion) { string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); - List args = new() { "console", "-o", "MyProject", "--use-program-main" }; + List args = new() { "new", "console", "-o", "MyProject", "--use-program-main" }; if (!string.IsNullOrEmpty(langVersion)) { args.Add("--langVersion"); args.Add(langVersion); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr(); + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() + { + FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath, + Arguments = args, + WorkingDirectory = workingDir + }; + + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); + + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); + + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); + + if (!string.IsNullOrEmpty(result.StdErr)) + { + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); + } + + if (result.ExitCode != 0) + { + Log.WriteLine($"Exit Code: {result.ExitCode}"); + } + + result.ExitCode.Should().Be(0, "Expected zero exit code"); + result.StdErr.Should().BeNullOrEmpty("Expected no stderr"); new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) @@ -515,7 +867,7 @@ public void TopLevelProgramSupport_WhenFlagIsEnabled_NoFileScopedNamespaces(stri string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", "Program.cs")); string expectedTopLevelContent = -@"namespace MyProject + @"namespace MyProject { class Program { @@ -528,134 +880,110 @@ static void Main(string[] args) "; Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); Assert.Contains(expectedTopLevelContent, programFileContent); + + Assert.Fail("Fail to get logs"); } - /// - /// Creates all possible combinations for supported templates, language versions and frameworks. - /// - public static IEnumerable NullableSupport_Data() + [Theory] + [InlineData("9.0")] + [InlineData("9")] + public void TopLevelProgramSupport_WhenFlagIsEnabled_4_NoFileScopedNamespaces_orig__4(string? langVersion) { - var templatesToTest = new[] + string workingDir = CreateTemporaryFolder(folderName: $"{langVersion ?? "null"}"); + + List args = new() { "new", "console", "-o", "MyProject", "--use-program-main" }; + if (!string.IsNullOrEmpty(langVersion)) { - new { Template = "console", Frameworks = new[] { null, "net7.0" } }, - new { Template = "classlib", Frameworks = new[] { null, "net7.0", "netstandard2.0", "netstandard2.1" } } + args.Add("--langVersion"); + args.Add(langVersion); + } + + //Theory - the missing env vars or dotnet full path is the culprit + SdkCommandSpec spec = new SdkCommandSpec() + { + FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath, + Arguments = args, + WorkingDirectory = workingDir }; - string[] unsupportedLanguageVersions = { "1", "ISO-1" }; - string?[] supportedLanguageVersions = { null, "ISO-2", "2", "3", "4", "5", "6", "7", "7.1", "7.2", "7.3", "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + TestContext.Current.AddTestEnvironmentVariables(spec); - string?[] supportedInFrameworkByDefault = { null, "net7.0", "netstandard2.1" }; - string?[] supportedInLanguageVersion = { "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + var command = spec.ToCommand() + .CaptureStdOut() + .CaptureStdErr(); - foreach (var template in templatesToTest) - { - foreach (string? langVersion in unsupportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] - { - template.Template, - false, //dotnet build should fail - framework, - langVersion, - supportedInLanguageVersion.Contains(langVersion) - || langVersion == null && supportedInFrameworkByDefault.Contains(framework) - }; - } - } - foreach (string? langVersion in supportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] - { - template.Template, - true, //dotnet build should pass - framework, - langVersion, - supportedInLanguageVersion.Contains(langVersion) - || langVersion == null && supportedInFrameworkByDefault.Contains(framework) - }; - } - } - } - } + var result = ((Microsoft.DotNet.Cli.Utils.Command)command).Execute(); - [Theory] - //creates all possible combinations for supported templates, language versions and frameworks -#pragma warning disable CA1825 // Avoid zero-length array allocations. https://github.com/dotnet/sdk/issues/28672 - [MemberData(nameof(NullableSupport_Data))] -#pragma warning restore CA1825 // Avoid zero-length array allocations. - public void NullableSupport(string name, bool buildPass, string? framework, string? langVersion, bool supportsFeature) - { - string workingDir = CreateTemporaryFolder(folderName: $"{name}-{langVersion ?? "null"}-{framework ?? "null"}"); + Log.WriteLine($"> {result.StartInfo.FileName} {result.StartInfo.Arguments}"); + Log.WriteLine(result.StdOut); - List args = new() { name, "-o", "MyProject" }; - if (!string.IsNullOrWhiteSpace(framework)) + if (!string.IsNullOrEmpty(result.StdErr)) { - args.Add("--framework"); - args.Add(framework); + Log.WriteLine(""); + Log.WriteLine("StdErr:"); + Log.WriteLine(result.StdErr); } - if (!string.IsNullOrWhiteSpace(langVersion)) + + if (result.ExitCode != 0) { - args.Add("--langVersion"); - args.Add(langVersion); + Log.WriteLine($"Exit Code: {result.ExitCode}"); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr(); + result.ExitCode.Should().Be(0, "Expected zero exit code"); + result.StdErr.Should().BeNullOrEmpty("Expected no stderr"); - CommandResult buildResult = new DotnetBuildCommand(_log, "MyProject") + new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) - .Execute(); + .Execute() + .Should().ExitWith(0).And.NotHaveStdErr(); - if (buildPass) - { - buildResult.Should().ExitWith(0).And.NotHaveStdErr(); - } - else - { - buildResult.Should().Fail(); - return; - } + string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", "Program.cs")); + string expectedTopLevelContent = + @"namespace MyProject +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine(""Hello, World!""); + } + } +} +"; + Assert.DoesNotContain("// See https://aka.ms/new-console-template for more information", programFileContent); + Assert.Contains(expectedTopLevelContent, programFileContent); - XDocument projectXml = XDocument.Load(Path.Combine(workingDir, "MyProject", "MyProject.csproj")); - XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); - if (supportsFeature) - { - Assert.Equal("enable", projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + "Nullable")?.Value); - } - else - { - Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + "Nullable")); - } + Assert.Fail("Fail to get logs"); } /// /// Creates all possible combinations for supported templates, language versions and frameworks. /// - public static IEnumerable ImplicitUsingsSupport_Data() + public static IEnumerable FeaturesSupport_Data() { var templatesToTest = new[] { new { Template = "console", Frameworks = new[] { null, "net7.0" } }, new { Template = "classlib", Frameworks = new[] { null, "net7.0", "netstandard2.0", "netstandard2.1" } } }; + + //features: top-level statements; nullables; implicit usings; filescoped namespaces + string[] unsupportedLanguageVersions = { "1", "ISO-1" }; string?[] supportedLanguageVersions = { null, "ISO-2", "2", "3", "4", "5", "6", "7", "7.1", "7.2", "7.3", "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; - string?[] supportedInFramework = { null, "net7.0" }; - string?[] supportedInLangVersion = { null, "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + string?[] nullableSupportedInFrameworkByDefault = { null, "net7.0", "netstandard2.1" }; + string?[] implicitUsingsSupportedInFramework = { null, "net7.0" }; + string?[] fileScopedNamespacesSupportedFrameworkByDefault = { null, "net7.0" }; + + string?[] nullableSupportedLanguages = { "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + string?[] topLevelStatementSupportedLanguages = { null, "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + string?[] implicitUsingsSupportedLanguages = { null, "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; + string?[] fileScopedNamespacesSupportedLanguages = { "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; foreach (var template in templatesToTest) { - foreach (string langVersion in unsupportedLanguageVersions) + foreach (string? langVersion in unsupportedLanguageVersions) { foreach (string? framework in template.Frameworks) { @@ -665,7 +993,12 @@ public void NullableSupport(string name, bool buildPass, string? framework, stri false, //dotnet build should fail framework, langVersion, - supportedInLangVersion.Contains(langVersion) && supportedInFramework.Contains(framework) + nullableSupportedLanguages.Contains(langVersion) + || langVersion == null && nullableSupportedInFrameworkByDefault.Contains(framework), + topLevelStatementSupportedLanguages.Contains(langVersion), + implicitUsingsSupportedLanguages.Contains(langVersion) && implicitUsingsSupportedInFramework.Contains(framework), + fileScopedNamespacesSupportedLanguages.Contains(langVersion) + || langVersion == null && fileScopedNamespacesSupportedFrameworkByDefault.Contains(framework), }; } } @@ -676,10 +1009,15 @@ public void NullableSupport(string name, bool buildPass, string? framework, stri yield return new object?[] { template.Template, - true, //dotnet build should pass + true, //dotnet build should pass framework, langVersion, - supportedInLangVersion.Contains(langVersion) && supportedInFramework.Contains(framework) + nullableSupportedLanguages.Contains(langVersion) + || langVersion == null && nullableSupportedInFrameworkByDefault.Contains(framework), + topLevelStatementSupportedLanguages.Contains(langVersion), + implicitUsingsSupportedLanguages.Contains(langVersion) && implicitUsingsSupportedInFramework.Contains(framework), + fileScopedNamespacesSupportedLanguages.Contains(langVersion) + || langVersion == null && fileScopedNamespacesSupportedFrameworkByDefault.Contains(framework), }; } } @@ -689,13 +1027,24 @@ public void NullableSupport(string name, bool buildPass, string? framework, stri [Theory] //creates all possible combinations for supported templates, language versions and frameworks #pragma warning disable CA1825 // Avoid zero-length array allocations. https://github.com/dotnet/sdk/issues/28672 - [MemberData(nameof(ImplicitUsingsSupport_Data))] + [MemberData(nameof(FeaturesSupport_Data))] #pragma warning restore CA1825 // Avoid zero-length array allocations. - public void ImplicitUsingsSupport(string name, bool buildPass, string? framework, string? langVersion, bool supportsFeature) + public async void FeaturesSupport( + string name, + bool buildPass, + string? framework, + string? langVersion, + bool supportsNullable, + bool supportsTopLevel, + bool supportsImplicitUsings, + bool supportsFileScopedNs) { + const string currentDefaultFramework = "net7.0"; + //string currentDefaultFramework = $"net{Environment.Version.Major}.{Environment.Version.Minor}"; + string workingDir = CreateTemporaryFolder(folderName: $"{name}-{langVersion ?? "null"}-{framework ?? "null"}"); - List args = new() { name, "-o", "MyProject" }; + List args = new() { "-o", "MyProject" }; if (!string.IsNullOrWhiteSpace(framework)) { args.Add("--framework"); @@ -707,145 +1056,44 @@ public void ImplicitUsingsSupport(string name, bool buildPass, string? framework args.Add(langVersion); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr(); - - CommandResult buildResult = new DotnetBuildCommand(_log, "MyProject") - .WithWorkingDirectory(workingDir) - .Execute(); - - if (buildPass) - { - buildResult.Should().ExitWith(0).And.NotHaveStdErr(); - } - else - { - buildResult.Should().Fail(); - return; - } - string codeFileName = name == "console" ? "Program.cs" : "Class1.cs"; - string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", codeFileName)); - XDocument projectXml = XDocument.Load(Path.Combine(workingDir, "MyProject", "MyProject.csproj")); - XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); - if (supportsFeature) - { - Assert.DoesNotContain("using System;", programFileContent); - Assert.Equal("enable", projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + "ImplicitUsings")?.Value); - } - else - { - Assert.Contains("using System;", programFileContent); - Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + "ImplicitUsings")); - } - } - - public static IEnumerable FileScopedNamespacesSupport_Data() - { - var templatesToTest = new[] - { - new { Template = "classlib", Frameworks = new[] { null, "net7.0", "netstandard2.0", "netstandard2.1" } } - }; - string[] unsupportedLanguageVersions = { "1", "ISO-1" }; - string?[] supportedLanguageVersions = { null, "ISO-2", "2", "3", "4", "5", "6", "7", "7.1", "7.2", "7.3", "8.0", "9.0", "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; - - string?[] supportedFrameworks = { null, "net7.0" }; - string?[] fileScopedNamespacesSupportedLanguages = { "10.0", "11.0", "latest", "latestMajor", "default", "preview" }; - - foreach (var template in templatesToTest) - { - foreach (string? langVersion in unsupportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] { template.Template, false, framework, langVersion, fileScopedNamespacesSupportedLanguages.Contains(langVersion) || langVersion == null && supportedFrameworks.Contains(framework) }; - } - } - foreach (string? langVersion in supportedLanguageVersions) - { - foreach (string? framework in template.Frameworks) - { - yield return new object?[] { template.Template, true, framework, langVersion, fileScopedNamespacesSupportedLanguages.Contains(langVersion) || langVersion == null && supportedFrameworks.Contains(framework) }; - } - } - } - } - - [Theory] - //creates all possible combinations for supported templates, language versions and frameworks -#pragma warning disable CA1825 // Avoid zero-length array allocations.https://github.com/dotnet/sdk/issues/28672 - [MemberData(nameof(FileScopedNamespacesSupport_Data))] -#pragma warning restore CA1825 // Avoid zero-length array allocations. - public void FileScopedNamespacesSupport(string name, bool pass, string? framework, string? langVersion, bool supportsFeature) - { - string workingDir = CreateTemporaryFolder(folderName: $"{name}-{langVersion ?? "null"}-{framework ?? "null"}"); - - List args = new() { name, "-o", "MyProject" }; - if (!string.IsNullOrWhiteSpace(framework)) - { - args.Add("--framework"); - args.Add(framework); - } - if (!string.IsNullOrWhiteSpace(langVersion)) + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: name) { - args.Add("--langVersion"); - args.Add(langVersion); + TemplateSpecificArgs = args, + SnapshotsDirectory = "Approvals", + OutputDirectory = workingDir, + SettingsDirectory = _fixture.HomeDirectory, + DoNotPrependTemplateNameToScenarioName = false, + DoNotAppendTemplateArgsToScenarioName = true, + ScenarioName = !buildPass ? + "OutOfSupport" : + $"Nullable-{supportsNullable}#TopLevel-{supportsTopLevel}#ImplicitUsings-{supportsImplicitUsings}#FileScopedNs-{supportsFileScopedNs}" + (langVersion == null ? "#NoLang" : null), + VerificationExcludePatterns = buildPass ? null : new[] { "*" }, } + .WithCustomScrubbers( + ScrubbersDefinition.Empty + //Todo: add extension here (once fixed in templating) + .AddScrubber(sb => sb.Replace($"{langVersion}", "%LANG%")) + .AddScrubber(sb => sb.Replace($"{framework ?? currentDefaultFramework}", "%FRAMEWORK%"), "csproj") + ); - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr(); + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); CommandResult buildResult = new DotnetBuildCommand(_log, "MyProject") .WithWorkingDirectory(workingDir) .Execute(); - if (pass) + if (buildPass) { buildResult.Should().ExitWith(0).And.NotHaveStdErr(); } else { buildResult.Should().Fail(); - return; - } - string codeFileName = name == "console" ? "Program.cs" : "Class1.cs"; - string programFileContent = File.ReadAllText(Path.Combine(workingDir, "MyProject", codeFileName)); - - string supportedContent = -@"namespace MyProject; -public class Class1 -{ - -}"; - string unsupportedContent = -@"namespace MyProject -{ - public class Class1 - { - - } -}"; - - if (supportsFeature) - { - Assert.DoesNotContain(unsupportedContent, programFileContent); - Assert.Contains(supportedContent, programFileContent); - } - else - { - Assert.DoesNotContain(supportedContent, programFileContent); - Assert.Contains(unsupportedContent, programFileContent); } + Directory.Delete(workingDir, true); } + #endregion [Theory] @@ -887,10 +1135,9 @@ public class Class1 [InlineData("TargetFramework", "net7.0", "Class Library", "classlib", "VB", null)] [InlineData("Nullable", null, "Class Library", "classlib", "VB", "netstandard2.0")] - public void SetPropertiesByDefault(string propertyName, string? propertyValue, string expectedTemplateName, string templateShortName, string? language, string? framework) + public async void SetPropertiesByDefault(string propertyName, string? propertyValue, string expectedTemplateName, string templateShortName, string? language, string? framework) { - string workingDir = CreateTemporaryFolder(folderName: $"{propertyName}-{templateShortName}-{templateShortName.Replace("#", "Sharp") ?? "null"}-{framework ?? "null"}"); - List args = new() { templateShortName, "--no-restore" }; + List args = new() { "--no-restore" }; if (!string.IsNullOrWhiteSpace(language)) { args.Add("--language"); @@ -902,34 +1149,44 @@ public void SetPropertiesByDefault(string propertyName, string? propertyValue, s args.Add(framework); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOut($@"The template ""{expectedTemplateName}"" was created successfully."); - - string expectedExtension = language switch - { - "C#" => "*.csproj", - "F#" => "*.fsproj", - "VB" => "*.vbproj", - _ => "*.csproj" - }; - string projectFile = Directory.GetFiles(workingDir, expectedExtension).Single(); - XDocument projectXml = XDocument.Load(projectFile); - XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); - if (propertyValue != null) + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName) { - Assert.Equal(propertyValue, projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)?.Value); + TemplateSpecificArgs = args, + SettingsDirectory = _fixture.HomeDirectory, + VerifyCommandOutput = true, + VerificationIncludePatterns = new[] { "**/*.*proj", "std-streams/stdout.txt", "**\\*.*proj", "std-streams\\stdout.txt" } } - else + .WithCustomDirectoryVerifier(async (directory, fetcher) => { - Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)); - } - Directory.Delete(workingDir, true); + int filesNum = 0; + await foreach (var (filePath, scrubbedContent) in fetcher.Value) + { + filesNum++; + if (filePath.EndsWith("stdout.txt", StringComparison.Ordinal)) + { + scrubbedContent.Should().BeEquivalentTo($@"The template ""{expectedTemplateName}"" was created successfully."); + } + + if (filePath.EndsWith("proj", StringComparison.OrdinalIgnoreCase)) + { + XDocument projectXml = XDocument.Parse(scrubbedContent); + XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); + if (propertyValue != null) + { + Assert.Equal(propertyValue, projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)?.Value); + } + else + { + Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)); + } + } + } + + filesNum.Should().Be(2); + }); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } [Theory] @@ -953,10 +1210,9 @@ public void SetPropertiesByDefault(string propertyName, string? propertyValue, s [InlineData("TargetFramework", "net5.0", "-f", "net5.0", "Class library", "classlib", null, null)] [InlineData("TargetFramework", "net5.0", "-f", "net5.0", "Class library", "classlib", "VB", null)] [InlineData("TargetFramework", "net5.0", "-f", "net5.0", "Class library", "classlib", "F#", null)] - public void CanSetProperty(string propertyName, string? propertyValue, string argName, string argValue, string expectedTemplateName, string templateShortName, string? language, string? framework) + public async void CanSetProperty(string propertyName, string? propertyValue, string argName, string argValue, string expectedTemplateName, string templateShortName, string? language, string? framework) { - string workingDir = CreateTemporaryFolder(folderName: $"{propertyName}-{templateShortName}-{templateShortName.Replace("#", "Sharp") ?? "null"}-{framework ?? "null"}"); - List args = new() { templateShortName, "--no-restore" }; + List args = new() { "--no-restore" }; if (!string.IsNullOrWhiteSpace(language)) { args.Add("--language"); @@ -973,34 +1229,44 @@ public void CanSetProperty(string propertyName, string? propertyValue, string ar args.Add(argValue); } - new DotnetNewCommand(_log, args.ToArray()) - .WithCustomHive(_fixture.HomeDirectory) - .WithWorkingDirectory(workingDir) - .Execute() - .Should() - .ExitWith(0) - .And.NotHaveStdErr() - .And.HaveStdOut($@"The template ""{expectedTemplateName}"" was created successfully."); - - string expectedExtension = language switch - { - "C#" => "*.csproj", - "F#" => "*.fsproj", - "VB" => "*.vbproj", - _ => "*.csproj" - }; - string projectFile = Directory.GetFiles(workingDir, expectedExtension).Single(); - XDocument projectXml = XDocument.Load(projectFile); - XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); - if (propertyValue != null) + TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName) { - Assert.Equal(propertyValue, projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)?.Value); + TemplateSpecificArgs = args, + SettingsDirectory = _fixture.HomeDirectory, + VerifyCommandOutput = true, + VerificationIncludePatterns = new[] { "**/*.*proj", "std-streams/stdout.txt", "**\\*.*proj", "std-streams\\stdout.txt" } } - else + .WithCustomDirectoryVerifier(async (directory, fetcher) => { - Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)); - } - Directory.Delete(workingDir, true); + int filesNum = 0; + await foreach (var (filePath, scrubbedContent) in fetcher.Value) + { + filesNum++; + if (filePath.EndsWith("stdout.txt", StringComparison.Ordinal)) + { + scrubbedContent.Should().BeEquivalentTo($@"The template ""{expectedTemplateName}"" was created successfully."); + } + + if (filePath.EndsWith("proj", StringComparison.OrdinalIgnoreCase)) + { + XDocument projectXml = XDocument.Parse(scrubbedContent); + XNamespace ns = projectXml.Root?.Name.Namespace ?? throw new Exception("Unexpected project file format"); + if (propertyValue != null) + { + Assert.Equal(propertyValue, projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)?.Value); + } + else + { + Assert.Null(projectXml.Root?.Element(ns + "PropertyGroup")?.Element(ns + propertyName)); + } + } + } + + filesNum.Should().Be(2); + }); + + VerificationEngine engine = new VerificationEngine(_logger); + await engine.Execute(options).ConfigureAwait(false); } } } diff --git a/src/Tests/dotnet-new.Tests/DotnetNewInstantiateTests.Approval.cs b/src/Tests/dotnet-new.Tests/DotnetNewInstantiateTests.Approval.cs index 1f55354da757..34d40da21e88 100644 --- a/src/Tests/dotnet-new.Tests/DotnetNewInstantiateTests.Approval.cs +++ b/src/Tests/dotnet-new.Tests/DotnetNewInstantiateTests.Approval.cs @@ -362,11 +362,10 @@ public Task CanInstantiateTemplate_ConditionalProcessing() string[] actualFiles = Directory.GetFiles(workingDirectory); return Task.WhenAll( - actualFiles.Select( + actualFiles.Where(f => Path.GetExtension(f).Equals(".txt")).Select( async (file) => await VerifyFile(file) .UseMethodName($"CanInstantiateTemplate_ConditionalProcessing_{Path.GetFileName(file)}") - .UseExtension("txt") )); } diff --git a/src/Tests/dotnet-new.Tests/VerifySettingsFixture.cs b/src/Tests/dotnet-new.Tests/VerifySettingsFixture.cs index 969efcb0f349..6a4c3807b9ac 100644 --- a/src/Tests/dotnet-new.Tests/VerifySettingsFixture.cs +++ b/src/Tests/dotnet-new.Tests/VerifySettingsFixture.cs @@ -8,7 +8,7 @@ public class VerifySettingsFixture : IDisposable { public VerifySettingsFixture() { - VerifierSettings.DerivePathInfo( + Verifier.DerivePathInfo( (_, _, type, method) => new( directory: "Approvals", typeName: type.Name, diff --git a/src/Tests/dotnet-new.Tests/dotnet-new.IntegrationTests.csproj b/src/Tests/dotnet-new.Tests/dotnet-new.IntegrationTests.csproj index d875c3ac63a3..2e6075e99c70 100644 --- a/src/Tests/dotnet-new.Tests/dotnet-new.IntegrationTests.csproj +++ b/src/Tests/dotnet-new.Tests/dotnet-new.IntegrationTests.csproj @@ -15,10 +15,11 @@ - + + @@ -66,4 +67,9 @@ namespace Microsoft.DotNet.Cli.New.IntegrationTests + + + + +