mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 01:25:44 -05:00
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:
@@ -6,13 +6,14 @@
|
||||
using System;
|
||||
using Microsoft.SqlTools.Credentials.Win32;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
{
|
||||
[TestFixture]
|
||||
public class CredentialSetTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetCreate()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -21,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetCreateWithTarget()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -30,7 +31,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetShouldBeIDisposable()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -39,7 +40,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetLoad()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -56,7 +57,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
CredentialSet set = new CredentialSet();
|
||||
set.Load();
|
||||
Assert.NotNull(set);
|
||||
Assert.NotEmpty(set);
|
||||
Assert.That(set, Is.Not.Empty);
|
||||
|
||||
credential.Delete();
|
||||
|
||||
@@ -64,19 +65,19 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetLoadShouldReturnSelf()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
{
|
||||
CredentialSet set = new CredentialSet();
|
||||
Assert.IsType<CredentialSet>(set.Load());
|
||||
Assert.That(set.Load(), Is.SameAs(set));
|
||||
|
||||
set.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void CredentialSetLoadWithTargetFilter()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -90,7 +91,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
credential.Save();
|
||||
|
||||
CredentialSet set = new CredentialSet("filtertarget");
|
||||
Assert.Equal(1, set.Load().Count);
|
||||
Assert.AreEqual(1, set.Load().Count);
|
||||
set.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
using System;
|
||||
using Microsoft.SqlTools.Credentials.Win32;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Common;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
{
|
||||
[TestFixture]
|
||||
public class Win32CredentialTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Create_ShouldNotThrowNull()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -21,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Create_With_Username_ShouldNotThrowNull()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -30,7 +31,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Create_With_Username_And_Password_ShouldNotThrowNull()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -39,7 +40,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Create_With_Username_Password_Target_ShouldNotThrowNull()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -48,7 +49,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_ShouldBe_IDisposable()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -57,7 +58,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Dispose_ShouldNotThrowException()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -66,7 +67,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_ShouldThrowObjectDisposedException()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -77,7 +78,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Save()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -88,7 +89,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Delete()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -98,7 +99,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Delete_NullTerminator()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -109,7 +110,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Load()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
@@ -120,15 +121,15 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials.Win32
|
||||
Win32Credential credential = new Win32Credential { Target = "target", Type = CredentialType.Generic };
|
||||
Assert.True(credential.Load());
|
||||
|
||||
Assert.NotEmpty(credential.Username);
|
||||
Assert.That(credential.Username, Is.Not.Empty);
|
||||
Assert.NotNull(credential.Password);
|
||||
Assert.Equal("username", credential.Username);
|
||||
Assert.Equal("password", credential.Password);
|
||||
Assert.Equal("target", credential.Target);
|
||||
Assert.AreEqual("username", credential.Username);
|
||||
Assert.AreEqual("password", credential.Password);
|
||||
Assert.AreEqual("target", credential.Target);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Test]
|
||||
public void Credential_Exists_Target_ShouldNotBeNull()
|
||||
{
|
||||
RunIfWrapper.RunIfWindows(() =>
|
||||
|
||||
Reference in New Issue
Block a user