You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mm...@apache.org on 2021/06/01 18:08:14 UTC
[geode-dotnet-core-client] branch develop updated: Switch to xUnit
This is an automated email from the ASF dual-hosted git repository.
mmartell pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-dotnet-core-client.git
The following commit(s) were added to refs/heads/develop by this push:
new 69ef33f Switch to xUnit
69ef33f is described below
commit 69ef33fbe95786221b2453d5152eff6140e1da91
Author: Mike Martell <mm...@pivotal.io>
AuthorDate: Tue Jun 1 11:07:57 2021 -0700
Switch to xUnit
---
NetCore.Test/CacheFactoryUnitTest.cs | 57 +++++++-------------
NetCore.Test/CacheUnitTest.cs | 63 ++++++++--------------
NetCore.Test/NetCore.Test.csproj | 10 +++-
NetCore.Test/ObjectLeakUnitTest.cs | 9 +---
NetCore.Test/PoolFactoryUnitTest.cs | 16 ++----
NetCore.Test/PoolManagerUnitTest.cs | 10 +---
NetCore.Test/RegionFactoryUnitTest.cs | 21 +++-----
NetCore.Test/xunit.runner.json | 5 ++
.../NetCore.Session.IntegrationTests.csproj | 7 ++-
.../SessionStateIntegrationTests.cs | 2 +-
10 files changed, 76 insertions(+), 124 deletions(-)
diff --git a/NetCore.Test/CacheFactoryUnitTest.cs b/NetCore.Test/CacheFactoryUnitTest.cs
index 20b246a..54ea95b 100644
--- a/NetCore.Test/CacheFactoryUnitTest.cs
+++ b/NetCore.Test/CacheFactoryUnitTest.cs
@@ -1,60 +1,51 @@
using System;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
-namespace GemfireDotNetTest
+namespace GemfireDotNetFact
{
- public class CacheFactoryUnitTests
+ public class CacheFactoryUnitFacts
{
- [SetUp]
- public void Setup()
- {
- }
-
- [Test]
- public void TestCreateFactory()
+ [Fact]
+ public void FactCreateFactory()
{
using (var client = new Client())
{
using (var cacheFactory = CacheFactory.Create())
{
- Assert.IsNotNull(cacheFactory);
+ Assert.NotNull(cacheFactory);
}
}
}
- [Test]
- public void TestCacheFactoryGetVersion()
+ [Fact]
+ public void FactCacheFactoryGetVersion()
{
using (var client = new Client())
{
using (var cacheFactory = CacheFactory.Create())
{
var version = cacheFactory.Version;
- Assert.AreNotEqual(version, String.Empty);
+ Assert.NotEqual(version, String.Empty);
}
-
- Assert.Pass();
}
}
- [Test]
- public void TestCacheFactoryGetProductDescription()
+ [Fact]
+ public void FactCacheFactoryGetProductDescription()
{
using (var client = new Client())
{
using (var cacheFactory = CacheFactory.Create())
{
var description = cacheFactory.ProductDescription;
- Assert.AreNotEqual(description, String.Empty);
+ Assert.NotEqual(description, String.Empty);
}
-
- Assert.Pass();
}
}
- [Test]
- public void TestCacheFactorySetPdxIgnoreUnreadFields()
+ [Fact]
+ public void FactCacheFactorySetPdxIgnoreUnreadFields()
{
using (var client = new Client())
{
@@ -63,13 +54,11 @@ namespace GemfireDotNetTest
cacheFactory.PdxIgnoreUnreadFields = true;
cacheFactory.PdxIgnoreUnreadFields = false;
}
-
- Assert.Pass();
}
}
- [Test]
- public void TestCacheFactorySetPdxReadSerialized()
+ [Fact]
+ public void FactCacheFactorySetPdxReadSerialized()
{
using (var client = new Client())
{
@@ -78,13 +67,11 @@ namespace GemfireDotNetTest
cacheFactory.PdxReadSerialized = true;
cacheFactory.PdxReadSerialized = false;
}
-
- Assert.Pass();
}
}
- [Test]
- public void TestCacheFactoryCreateCache()
+ [Fact]
+ public void FactCacheFactoryCreateCache()
{
using (var client = new Client())
{
@@ -95,13 +82,11 @@ namespace GemfireDotNetTest
;
}
}
-
- Assert.Pass();
}
}
- [Test]
- public void TestCacheFactorySetProperty()
+ [Fact]
+ public void FactCacheFactorySetProperty()
{
using (var client = new Client())
{
@@ -110,8 +95,6 @@ namespace GemfireDotNetTest
cacheFactory.SetProperty("log-level", "none")
.SetProperty("log-file", "geode_native.log");
}
-
- Assert.Pass();
}
}
}
diff --git a/NetCore.Test/CacheUnitTest.cs b/NetCore.Test/CacheUnitTest.cs
index f13680a..e19ccb3 100644
--- a/NetCore.Test/CacheUnitTest.cs
+++ b/NetCore.Test/CacheUnitTest.cs
@@ -1,18 +1,13 @@
using System;
using System.Net.Cache;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
namespace GemfireDotNetTest
{
public class CacheUnitTests
{
- [SetUp]
- public void Setup()
- {
- }
-
- [Test]
+ [Fact]
public void TestClientCacheGetPdxReadSerialized()
{
using (var client = new Client())
@@ -26,13 +21,13 @@ namespace GemfireDotNetTest
cacheFactory.PdxReadSerialized = true;
using (var cache = cacheFactory.CreateCache())
{
- Assert.AreEqual(cache.GetPdxReadSerialized(), true);
+ Assert.True(cache.GetPdxReadSerialized());
}
cacheFactory.PdxReadSerialized = false;
using (var otherCache = cacheFactory.CreateCache())
{
- Assert.AreEqual(otherCache.GetPdxReadSerialized(), false);
+ Assert.False(otherCache.GetPdxReadSerialized());
}
}
catch (Exception e)
@@ -41,12 +36,10 @@ namespace GemfireDotNetTest
throw;
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheGetPdxIgnoreUnreadFields()
{
using (var client = new Client())
@@ -58,21 +51,19 @@ namespace GemfireDotNetTest
cacheFactory.PdxIgnoreUnreadFields = true;
using (var cache = cacheFactory.CreateCache())
{
- Assert.AreEqual(cache.GetPdxIgnoreUnreadFields(), true);
+ Assert.True(cache.GetPdxIgnoreUnreadFields());
}
cacheFactory.PdxIgnoreUnreadFields = false;
using (var otherCache = cacheFactory.CreateCache())
{
- Assert.AreEqual(otherCache.GetPdxIgnoreUnreadFields(), false);
+ Assert.False(otherCache.GetPdxIgnoreUnreadFields());
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheGetPoolManager()
{
using (var client = new Client())
@@ -88,12 +79,10 @@ namespace GemfireDotNetTest
poolManager.Dispose();
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheCreateRegionFactory()
{
using (var client = new Client())
@@ -111,12 +100,10 @@ namespace GemfireDotNetTest
}
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheGetName()
{
using (var client = new Client())
@@ -128,15 +115,13 @@ namespace GemfireDotNetTest
using (var cache = cacheFactory.CreateCache())
{
var cacheName = cache.Name;
- Assert.AreNotEqual(cacheName, String.Empty);
+ Assert.NotEqual(cacheName, String.Empty);
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheClose()
{
using (var client = new Client())
@@ -147,17 +132,15 @@ namespace GemfireDotNetTest
cacheFactory.PdxIgnoreUnreadFields = true;
using (var cache = cacheFactory.CreateCache())
{
- Assert.IsFalse(cache.Closed);
- Assert.DoesNotThrow(delegate { cache.Close(); });
- Assert.IsTrue(cache.Closed);
+ Assert.False(cache.Closed);
+ cache.Close();
+ Assert.True(cache.Closed);
}
}
-
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestClientCacheCloseWithKeepalive()
{
using (var client = new Client())
@@ -168,21 +151,19 @@ namespace GemfireDotNetTest
cacheFactory.PdxIgnoreUnreadFields = true;
using (var cache = cacheFactory.CreateCache())
{
- Assert.IsFalse(cache.Closed);
- Assert.DoesNotThrow(delegate() { cache.Close(true); });
- Assert.IsTrue(cache.Closed);
+ Assert.False(cache.Closed);
+ cache.Close(true);
+ Assert.True(cache.Closed);
}
using (var otherCache = cacheFactory.CreateCache())
{
- Assert.IsFalse(otherCache.Closed);
- Assert.DoesNotThrow(delegate() { otherCache.Close(false); });
- Assert.IsTrue(otherCache.Closed);
+ Assert.False(otherCache.Closed);
+ otherCache.Close(false);
+ Assert.True(otherCache.Closed);
}
}
-
- Assert.Pass();
}
}
}
diff --git a/NetCore.Test/NetCore.Test.csproj b/NetCore.Test/NetCore.Test.csproj
index 099a074..9b701e7 100644
--- a/NetCore.Test/NetCore.Test.csproj
+++ b/NetCore.Test/NetCore.Test.csproj
@@ -10,8 +10,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
- <PackageReference Include="nunit" Version="3.12.0" />
- <PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
+ <PackageReference Include="xunit" Version="2.4.1" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
@@ -21,4 +21,10 @@
<ProjectReference Include="..\NetCore\NetCore.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <None Update="xunit.runner.json">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+
</Project>
diff --git a/NetCore.Test/ObjectLeakUnitTest.cs b/NetCore.Test/ObjectLeakUnitTest.cs
index a266d6e..acfa131 100644
--- a/NetCore.Test/ObjectLeakUnitTest.cs
+++ b/NetCore.Test/ObjectLeakUnitTest.cs
@@ -1,17 +1,12 @@
using System;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
namespace GemfireDotNetTest
{
public class ObjectLeakUnitTests
{
- [SetUp]
- public void Setup()
- {
- }
-
- [Test]
+ [Fact]
public void TestLeakCacheFactory()
{
var client = new Client();
diff --git a/NetCore.Test/PoolFactoryUnitTest.cs b/NetCore.Test/PoolFactoryUnitTest.cs
index 1910206..766fb40 100644
--- a/NetCore.Test/PoolFactoryUnitTest.cs
+++ b/NetCore.Test/PoolFactoryUnitTest.cs
@@ -1,17 +1,12 @@
using System.Net.Cache;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
namespace GemfireDotNetTest
{
public class PoolFactoryUnitTests
{
- [SetUp]
- public void Setup()
- {
- }
-
- [Test]
+ [Fact]
public void TestPoolFactoryAddLocator()
{
using (var client = new Client())
@@ -32,10 +27,9 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
- [Test]
+ [Fact]
public void TestPoolFactoryCreatePool()
{
using (var client = new Client())
@@ -59,11 +53,10 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
}
- [Test]
+ [Fact]
public void TestCreatePoolWithoutPoolManager()
{
using (var client = new Client())
@@ -81,7 +74,6 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
}
}
diff --git a/NetCore.Test/PoolManagerUnitTest.cs b/NetCore.Test/PoolManagerUnitTest.cs
index 9c1799e..5dfec19 100644
--- a/NetCore.Test/PoolManagerUnitTest.cs
+++ b/NetCore.Test/PoolManagerUnitTest.cs
@@ -1,17 +1,12 @@
using System.Net.Cache;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
namespace GemfireDotNetTest
{
public class PoolManagerUnitTests
{
- [SetUp]
- public void Setup()
- {
- }
-
- [Test]
+ [Fact]
public void TestPoolManagerCreatePoolFactory()
{
using (var client = new Client())
@@ -29,7 +24,6 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
}
}
diff --git a/NetCore.Test/RegionFactoryUnitTest.cs b/NetCore.Test/RegionFactoryUnitTest.cs
index 36f4d38..e998931 100644
--- a/NetCore.Test/RegionFactoryUnitTest.cs
+++ b/NetCore.Test/RegionFactoryUnitTest.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Net.Cache;
using Apache.Geode.NetCore;
-using NUnit.Framework;
+using Xunit;
namespace GemfireDotNetTest
{
@@ -25,11 +25,6 @@ namespace GemfireDotNetTest
public class RegionFactoryUnitTests
{
- [SetUp]
- public void Setup()
- {
- }
-
private const string Username1 = "rtimmons";
private const string Username2 = "scharles";
@@ -59,8 +54,8 @@ namespace GemfireDotNetTest
var user1 = region.GetString(Username1);
var user2 = region.GetString(Username2);
- Assert.AreEqual(user1, fullname1);
- Assert.AreEqual(user2, fullname2);
+ Assert.Equal(user1, fullname1);
+ Assert.Equal(user2, fullname2);
}
private void DoRemoves(Region region)
@@ -71,8 +66,8 @@ namespace GemfireDotNetTest
var hasUser1 = region.ContainsValueForKey(Username1);
var hasUser2 = region.ContainsValueForKey(Username2);
- Assert.AreEqual(hasUser1, false);
- Assert.AreEqual(hasUser2, false);
+ Assert.False(hasUser1);
+ Assert.False(hasUser2);
}
private void CreateRegionAndDoWork(IGeodeCache cache, string regionName, RegionShortcut regionType)
@@ -87,7 +82,7 @@ namespace GemfireDotNetTest
}
}
- [Test]
+ [Fact]
public void TestRegionFactoryCreateProxyRegion()
{
using (var client = new Client())
@@ -103,10 +98,9 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
- [Test]
+ [Fact]
public void TestRegionFactoryCreateRegionWithAuthentication()
{
using (var client = new Client())
@@ -123,7 +117,6 @@ namespace GemfireDotNetTest
}
}
}
- Assert.Pass();
}
}
}
diff --git a/NetCore.Test/xunit.runner.json b/NetCore.Test/xunit.runner.json
new file mode 100644
index 0000000..c977ea0
--- /dev/null
+++ b/NetCore.Test/xunit.runner.json
@@ -0,0 +1,5 @@
+{
+ "methodDisplay": "classAndMethod",
+ "parallelizeAssembly": true,
+ "parallelizeTestCollections": false
+}
diff --git a/Session.IntegrationTests/NetCore.Session.IntegrationTests.csproj b/Session.IntegrationTests/NetCore.Session.IntegrationTests.csproj
index c026325..827f260 100644
--- a/Session.IntegrationTests/NetCore.Session.IntegrationTests.csproj
+++ b/Session.IntegrationTests/NetCore.Session.IntegrationTests.csproj
@@ -10,8 +10,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
- <PackageReference Include="xunit" Version="2.4.0" />
- <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
+ <PackageReference Include="xunit" Version="2.4.1" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
diff --git a/Session.IntegrationTests/SessionStateIntegrationTests.cs b/Session.IntegrationTests/SessionStateIntegrationTests.cs
index 6f8e200..52538df 100644
--- a/Session.IntegrationTests/SessionStateIntegrationTests.cs
+++ b/Session.IntegrationTests/SessionStateIntegrationTests.cs
@@ -17,7 +17,7 @@ namespace Apache.Geode.Session.IntegrationTests
{
using var client = new Client();
using var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "error");
+ .SetProperty("log-level", "none");
using var cache = (Cache)cacheFactory.CreateCache();