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

@@ -4,14 +4,20 @@
//
using Microsoft.SqlTools.ServiceLayer.Formatter;
using Xunit;
using NUnit.Framework;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
{
public class CreateTableFormatterTests : FormatterUnitTestsBase
{
[Fact]
[SetUp]
public void Init()
{
InitFormatterUnitTestsBase();
}
[Test]
public void CreateTable()
{
LoadAndFormatAndCompare("CreateTable", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable.sql"), new FormatOptions(), true);
@@ -20,7 +26,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
/**
* The test contains a timestamp column, which is the shortest (1 token) possible length for a column item.
*/
[Fact]
[Test]
public void CreateTable_Timestamp()
{
FormatOptions options = new FormatOptions();
@@ -28,7 +34,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_Timestamp", GetInputFile("CreateTable_Timestamp.sql"), GetBaselineFile("CreateTable_Timestamp.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_CommasBeforeDefinition()
{
FormatOptions options = new FormatOptions();
@@ -38,7 +44,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_CommasBeforeDefinition", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_CommasBeforeDefinition.sql"), options, false);
}
[Fact]
[Test]
public void CreateTable_UseTabs()
{
FormatOptions options = new FormatOptions();
@@ -46,7 +52,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_UseTabs", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_UseTabs.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_20Spaces()
{
FormatOptions options = new FormatOptions();
@@ -54,7 +60,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_20Spaces", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_20Spaces.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_UpperCaseKeywords()
{
FormatOptions options = new FormatOptions();
@@ -62,7 +68,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_UpperCaseKeywords", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_UpperCaseKeywords.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_LowerCaseKeywords()
{
FormatOptions options = new FormatOptions();
@@ -70,7 +76,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_LowerCaseKeywords", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_LowerCaseKeywords.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_UpperCaseDataTypes()
{
FormatOptions options = new FormatOptions();
@@ -78,7 +84,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_UpperCaseDataTypes", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_UpperCaseDataTypes.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_LowerCaseDataTypes()
{
FormatOptions options = new FormatOptions();
@@ -86,14 +92,14 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_LowerCaseDataTypes", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_LowerCaseDataTypes.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_AlignInColumns()
{
FormatOptions options = new FormatOptions() { AlignColumnDefinitionsInColumns = true };
LoadAndFormatAndCompare("CreateTable_AlignInColumns", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_AlignInColumns.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_AlignInColumnsUseTabs()
{
FormatOptions options = new FormatOptions();
@@ -102,19 +108,19 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_AlignInColumnsUseTabs", GetInputFile("CreateTable.sql"), GetBaselineFile("CreateTable_AlignInColumnsUseTabs.sql"), options, true);
}
[Fact]
[Test]
public void CreateTable_On()
{
LoadAndFormatAndCompare("CreateTableOn", GetInputFile("CreateTableFull.sql"), GetBaselineFile("CreateTableOn.sql"), new FormatOptions(), true);
}
[Fact]
[Test]
public void CreateTable_Formatted()
{
LoadAndFormatAndCompare("CreateTable_Formatted", GetInputFile("CreateTable_Formatted.sql"), GetBaselineFile("CreateTable_Formatted.sql"), new FormatOptions(), true);
}
[Fact]
[Test]
public void CreateTable_CommentsBeforeComma()
{
FormatOptions options = new FormatOptions();
@@ -124,7 +130,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTable_CommentsBeforeComma", GetInputFile("CreateTable_CommentBeforeComma.sql"), GetBaselineFile("CreateTable_CommentBeforeComma.sql"), options, true);
}
[Fact]
[Test]
public void CreateTableAddress_AlignInColumns()
{
FormatOptions options = new FormatOptions();
@@ -132,7 +138,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
LoadAndFormatAndCompare("CreateTableAddress_AlignInColumns", GetInputFile("Address.sql"), GetBaselineFile("CreateTableAddress_AlignInColumns.sql"), options, true);
}
[Fact]
[Test]
public void CreateTableAddress_AlignInColumnsUseTabs()
{
FormatOptions options = new FormatOptions();