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

@@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.SqlTools.ServiceLayer.Utility;
using Xunit;
using NUnit.Framework;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
{
@@ -17,7 +17,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
/// The purpose of this test is for code coverage. It's probably better to just
/// exclude string resources in the code coverage report than maintain this test.
/// </summary>
[Fact]
[Test]
public void SrStringsTest()
{
var culture = SR.Culture;
@@ -208,46 +208,46 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
var schemaHierarchyColumnEncryptionKeys = SR.SchemaHierarchy_ColumnEncryptionKeys;
}
[Fact]
[Test]
public void SrStringsTestWithEnLocalization()
{
string locale = "en";
var args = new string[] { "--locale", locale };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.Equal(SR.Culture.Name, options.Locale);
Assert.Equal(options.Locale, locale);
Assert.AreEqual(SR.Culture.Name, options.Locale);
Assert.AreEqual(options.Locale, locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.Equal(TestLocalizationConstant, "test");
Assert.AreEqual("test", TestLocalizationConstant);
}
// [Fact]
// [Test]
public void SrStringsTestWithEsLocalization()
{
string locale = "es";
var args = new string[] { "--locale", locale };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.Equal(SR.Culture.Name, options.Locale);
Assert.Equal(options.Locale, locale);
Assert.AreEqual(SR.Culture.Name, options.Locale);
Assert.AreEqual(options.Locale, locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.Equal(TestLocalizationConstant, "prueba");
Assert.AreEqual("prueba", TestLocalizationConstant);
// Reset the locale
SrStringsTestWithEnLocalization();
}
[Fact]
[Test]
public void SrStringsTestWithNullLocalization()
{
SR.Culture = null;
var args = new string[] { "" };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.Null(SR.Culture);
Assert.Equal(options.Locale, "");
Assert.AreEqual("", options.Locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.Equal(TestLocalizationConstant, "test");
Assert.AreEqual("test", TestLocalizationConstant);
}
}
}