Skip to content

Commit

Permalink
added tests for different language versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vlada-shubina committed Jul 14, 2021
1 parent 456a9c2 commit 6875aa5
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions test/dotnet-new3.UnitTests/CommonTemplatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,23 @@ public CommonTemplatesTests(SharedHomeDirectory fixture, ITestOutputHelper log)
[InlineData("Class Library", "classlib", "C#", "netstandard2.0")]
[InlineData("Class Library", "classlib", "VB", "netstandard2.0")]
[InlineData("Class Library", "classlib", "F#", "netstandard2.0")]
public void AllCommonProjectsCreateRestoreAndBuild(string expectedTemplateName, string templateShortName, string? language = null, string? framework = null)

[InlineData("Class Library", "classlib", "C#", "net6.0", "10.0")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "9.0", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "8.0", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "7.3", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "7.2", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "7.1", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Class Library", "classlib", "C#", "net6.0", "7", Skip = "https://github.com/dotnet/templating/issues/3449")]

[InlineData("Console Application", "console", "C#", "net6.0", "10.0")]
[InlineData("Console Application", "console", "C#", "net6.0", "9.0", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Console Application", "console", "C#", "net6.0", "8.0", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Console Application", "console", "C#", "net6.0", "7.3", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Console Application", "console", "C#", "net6.0", "7.2", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Console Application", "console", "C#", "net6.0", "7.1", Skip = "https://github.com/dotnet/templating/issues/3449")]
[InlineData("Console Application", "console", "C#", "net6.0", "7", Skip = "https://github.com/dotnet/templating/issues/3449")]
public void AllCommonProjectsCreateRestoreAndBuild(string expectedTemplateName, string templateShortName, string? language = null, string? framework = null, string? langVersion = null)
{
string workingDir = TestUtils.CreateTemporaryFolder();
string workingDirName = Path.GetFileName(workingDir);
Expand Down Expand Up @@ -94,6 +110,11 @@ public void AllCommonProjectsCreateRestoreAndBuild(string expectedTemplateName,
args.Add("--framework");
args.Add(framework);
}
if (!string.IsNullOrWhiteSpace(langVersion))
{
args.Add("--langVersion");
args.Add(langVersion);
}

new DotnetNewCommand(_log, args.ToArray())
.WithCustomHive(_fixture.HomeDirectory)
Expand Down Expand Up @@ -230,6 +251,9 @@ public void AllCommonItemsCreate(string expectedTemplateName, string templateSho
[InlineData("Nullable", null, "Console Application", "console", null, "net5.0")]
[InlineData("Nullable", null, "Console Application", "console", null, "netcoreapp3.1")]
[InlineData("Nullable", null, "Console Application", "console", null, "netcoreapp2.1")]
[InlineData("Nullable", "enable", "Console Application", "console", null, null, "9.0")]
[InlineData("Nullable", "enable", "Console Application", "console", null, null, "8.0")]
[InlineData("Nullable", "enable", "Console Application", "console", null, null, "7.3")]

[InlineData("Nullable", null, "Console Application", "console", "F#", null)]
[InlineData("CheckForOverflowUnderflow", null, "Console Application", "console", "F#", null)]
Expand Down Expand Up @@ -262,7 +286,7 @@ public void AllCommonItemsCreate(string expectedTemplateName, string templateSho
[InlineData("TargetFramework", "net6.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 void SetPropertiesByDefault(string propertyName, string? propertyValue, string expectedTemplateName, string templateShortName, string? language, string? framework, string? langVersion = null)
{
string workingDir = TestUtils.CreateTemporaryFolder();
List<string> args = new List<string>() { templateShortName, "--no-restore" };
Expand All @@ -276,6 +300,11 @@ public void SetPropertiesByDefault(string propertyName, string? propertyValue, s
args.Add("--framework");
args.Add(framework);
}
if (!string.IsNullOrWhiteSpace(langVersion))
{
args.Add("--langVersion");
args.Add(langVersion);
}

new DotnetNewCommand(_log, args.ToArray())
.WithCustomHive(_fixture.HomeDirectory)
Expand Down

0 comments on commit 6875aa5

Please sign in to comment.