Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Switch to xUnit
  • Loading branch information
mmartell committed Jun 1, 2021
1 parent 65ab67f commit 69ef33fbe95786221b2453d5152eff6140e1da91
Showing 10 changed files with 76 additions and 124 deletions.
@@ -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 @@ public void TestCacheFactorySetPdxIgnoreUnreadFields()
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 @@ public void TestCacheFactorySetPdxReadSerialized()
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 @@ public void TestCacheFactoryCreateCache()
;
}
}

Assert.Pass();
}
}

[Test]
public void TestCacheFactorySetProperty()
[Fact]
public void FactCacheFactorySetProperty()
{
using (var client = new Client())
{
@@ -110,8 +95,6 @@ public void TestCacheFactorySetProperty()
cacheFactory.SetProperty("log-level", "none")
.SetProperty("log-file", "geode_native.log");
}

Assert.Pass();
}
}
}
@@ -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 @@ public void TestClientCacheGetPdxReadSerialized()
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 @@ public void TestClientCacheGetPdxReadSerialized()
throw;
}
}

Assert.Pass();
}
}

[Test]
[Fact]
public void TestClientCacheGetPdxIgnoreUnreadFields()
{
using (var client = new Client())
@@ -58,21 +51,19 @@ public void TestClientCacheGetPdxIgnoreUnreadFields()
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 @@ public void TestClientCacheGetPoolManager()
poolManager.Dispose();
}
}

Assert.Pass();
}
}

[Test]
[Fact]
public void TestClientCacheCreateRegionFactory()
{
using (var client = new Client())
@@ -111,12 +100,10 @@ public void TestClientCacheCreateRegionFactory()
}
}
}

Assert.Pass();
}
}

[Test]
[Fact]
public void TestClientCacheGetName()
{
using (var client = new Client())
@@ -128,15 +115,13 @@ public void TestClientCacheGetName()
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 @@ public void TestClientCacheClose()
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 @@ public void TestClientCacheCloseWithKeepalive()
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();
}
}
}
@@ -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>
@@ -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();
@@ -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 @@ public void TestPoolFactoryAddLocator()
}
}
}
Assert.Pass();
}

[Test]
[Fact]
public void TestPoolFactoryCreatePool()
{
using (var client = new Client())
@@ -59,11 +53,10 @@ public void TestPoolFactoryCreatePool()
}
}
}
Assert.Pass();
}
}

[Test]
[Fact]
public void TestCreatePoolWithoutPoolManager()
{
using (var client = new Client())
@@ -81,7 +74,6 @@ public void TestCreatePoolWithoutPoolManager()
}
}
}
Assert.Pass();
}
}
}

0 comments on commit 69ef33f

Please sign in to comment.