Convert most tools service tests to nunit (#1037)

* Remove xunit dependency from testdriver

* swap expected/actual as needed

* Convert Test.Common to nunit

* port hosting unit tests to nunit

* port batchparser integration tests to nunit

* port testdriver.tests to nunit

* fix target to copy dependency

* port servicelayer unittests to nunit

* more unit test fixes

* port integration tests to nunit

* fix test method type

* try using latest windows build for PRs

* reduce test memory use
This commit is contained in:
David Shiflet
2020-08-05 13:43:14 -04:00
committed by GitHub
parent bf4911795f
commit 839acf67cd
205 changed files with 4146 additions and 4329 deletions

View File

@@ -5,22 +5,22 @@
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer;
using Xunit;
using NUnit.Framework;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
{
public class ServerVersionHelperTests
{
[Fact]
[Test]
public void GetValidForFlagShouldReturnAllGivenUnKnownVersion()
{
ValidForFlag validforFlag = ServerVersionHelper.GetValidForFlag(SqlServerType.Unknown);
ValidForFlag expected = ValidForFlag.All;
Assert.Equal(validforFlag, expected);
Assert.AreEqual(validforFlag, expected);
}
[Fact]
[Test]
public void GetValidForFlagShouldReturnTheFlagCorrectlyGivenValidVersion()
{
VerifyGetValidForFlag(SqlServerType.AzureV12, ValidForFlag.AzureV12);
@@ -33,16 +33,16 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyGetValidForFlag(SqlServerType.SqlOnDemand, ValidForFlag.SqlOnDemand);
}
[Fact]
[Test]
public void GetValidForFlagShouldReturnTheFlagIncludingSqlDwGivenSqlDwdatabase()
{
ValidForFlag validforFlag = ServerVersionHelper.GetValidForFlag(SqlServerType.AzureV12, true);
ValidForFlag expected = ValidForFlag.SqlDw;
Assert.Equal(validforFlag, expected);
Assert.AreEqual(validforFlag, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2005Given2005Version()
{
string serverVersion = "9.1.2.3";
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2008Given2008Version()
{
string serverVersion = "10.1.2.3";
@@ -59,7 +59,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyCalculateServerType(serverVersion, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2012Given2012Version()
{
string serverVersion = "11.1.2.3";
@@ -67,7 +67,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyCalculateServerType(serverVersion, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2014Given2014Version()
{
string serverVersion = "12.1.2.3";
@@ -75,7 +75,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyCalculateServerType(serverVersion, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2016Given2016Version()
{
string serverVersion = "13.1.2.3";
@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyCalculateServerType(serverVersion, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSql2017Given2017Version()
{
string serverVersion = "14.1.2.3";
@@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyCalculateServerType(serverVersion, expected);
}
[Fact]
[Test]
public void IsValidForShouldReturnTrueGivenSqlDwAndAll()
{
ValidForFlag serverValidFor = ValidForFlag.SqlDw;
@@ -100,7 +100,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyIsValidFor(serverValidFor, validFor, expected);
}
[Fact]
[Test]
public void IsValidForShouldReturnTrueGivenSqlDwAndNone()
{
ValidForFlag serverValidFor = ValidForFlag.SqlDw;
@@ -109,7 +109,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyIsValidFor(serverValidFor, validFor, expected);
}
[Fact]
[Test]
public void IsValidForShouldReturnTrueGivenSqlDwAndSqlDw()
{
ValidForFlag serverValidFor = ValidForFlag.SqlDw;
@@ -118,7 +118,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyIsValidFor(serverValidFor, validFor, expected);
}
[Fact]
[Test]
public void IsValidForShouldReturnTrueGivenSqlDwAndNotSqlDw()
{
ValidForFlag serverValidFor = ValidForFlag.SqlDw;
@@ -127,7 +127,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyIsValidFor(serverValidFor, validFor, expected);
}
[Fact]
[Test]
public void IsValidForShouldReturnTrueGivenSqlDwAndAllOnPrem()
{
ValidForFlag serverValidFor = ValidForFlag.SqlDw;
@@ -136,7 +136,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
VerifyIsValidFor(serverValidFor, validFor, expected);
}
[Fact]
[Test]
public void CalculateServerTypeShouldReturnSqlOnDemandGivenEngineEdition()
{
int engineEdition = 11;
@@ -147,7 +147,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
private void VerifyIsValidFor(ValidForFlag serverValidFor, ValidForFlag validFor, bool expected)
{
bool actual = ServerVersionHelper.IsValidFor(serverValidFor, validFor);
Assert.Equal(expected, actual);
Assert.AreEqual(expected, actual);
}
private void VerifyCalculateServerType(string serverVersion, SqlServerType expected)
@@ -157,7 +157,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
ServerVersion = serverVersion
};
SqlServerType actual = ServerVersionHelper.CalculateServerType(serverInfo);
Assert.Equal(expected, actual);
Assert.AreEqual(expected, actual);
}
private void VerifyCalculateServerTypeForEngineEdition(int engineEdition, SqlServerType expected)
@@ -176,7 +176,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
ValidForFlag validforFlag = ServerVersionHelper.GetValidForFlag(serverType);
ValidForFlag expected = validForFlag;
Assert.Equal(validforFlag, expected);
Assert.AreEqual(validforFlag, expected);
}
}
}