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

@@ -9,13 +9,13 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SqlTools.Utility;
using Xunit;
using NUnit.Framework;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
{
public class AsyncQueueTests
{
[Fact]
[Test]
public async Task AsyncQueueSynchronizesAccess()
{
ConcurrentBag<int> outputItems = new ConcurrentBag<int>();
@@ -53,10 +53,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
// At this point, numbers 0 through 299 should be in the outputItems
IEnumerable<int> expectedItems = Enumerable.Range(0, 300);
Assert.Equal(0, expectedItems.Except(outputItems).Count());
Assert.AreEqual(0, expectedItems.Except(outputItems).Count());
}
[Fact]
[Test]
public async Task AsyncQueueSkipsCancelledTasks()
{
AsyncQueue<int> inputQueue = new AsyncQueue<int>();
@@ -71,9 +71,9 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ServiceHost
await inputQueue.EnqueueAsync(1);
// Did the second task get the number?
Assert.Equal(TaskStatus.Canceled, taskOne.Status);
Assert.Equal(TaskStatus.RanToCompletion, taskTwo.Status);
Assert.Equal(1, taskTwo.Result);
Assert.AreEqual(TaskStatus.Canceled, taskOne.Status);
Assert.AreEqual(TaskStatus.RanToCompletion, taskTwo.Status);
Assert.AreEqual(1, taskTwo.Result);
}
private async Task ConsumeItems(