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