Commit 9073e65f authored by Nick Craver's avatar Nick Craver

Tests: replace AssertNearlyEqual - xUnit has this

parent f635ba75
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace StackExchange.Redis.Tests.Booksleeve namespace StackExchange.Redis.Tests.Booksleeve
...@@ -10,6 +9,7 @@ namespace StackExchange.Redis.Tests.Booksleeve ...@@ -10,6 +9,7 @@ namespace StackExchange.Redis.Tests.Booksleeve
public class BookSleeveTestBase public class BookSleeveTestBase
{ {
public ITestOutputHelper Output { get; } public ITestOutputHelper Output { get; }
public BookSleeveTestBase(ITestOutputHelper output) public BookSleeveTestBase(ITestOutputHelper output)
{ {
Output = output; Output = output;
...@@ -70,12 +70,5 @@ internal static ConnectionMultiplexer GetSecuredConnection() ...@@ -70,12 +70,5 @@ internal static ConnectionMultiplexer GetSecuredConnection()
conn.InternalError += (s, args) => Trace.WriteLine(args.Exception.Message, args.Origin); conn.InternalError += (s, args) => Trace.WriteLine(args.Exception.Message, args.Origin);
return conn; return conn;
} }
internal static RedisFeatures GetFeatures(ConnectionMultiplexer muxer) => GetServer(muxer).Features;
internal static void AssertNearlyEqual(double x, double y)
{
if (Math.Abs(x - y) > 0.00001) Assert.Equal(x, y);
}
} }
} }
...@@ -158,13 +158,13 @@ public void IncrDecrFloat() ...@@ -158,13 +158,13 @@ public void IncrDecrFloat()
var s = conn.StringGetAsync("incr"); var s = conn.StringGetAsync("incr");
AssertNearlyEqual(3.1, conn.Wait(v1)); Assert.Equal(3.1, conn.Wait(v1), 5);
AssertNearlyEqual(8.1, conn.Wait(v2)); Assert.Equal(8.1, conn.Wait(v2), 5);
AssertNearlyEqual(6.1, conn.Wait(v3)); Assert.Equal(6.1, conn.Wait(v3), 5);
AssertNearlyEqual(5.1, conn.Wait(v4)); Assert.Equal(5.1, conn.Wait(v4), 5);
AssertNearlyEqual(0.1, conn.Wait(v5)); Assert.Equal(0.1, conn.Wait(v5), 5);
AssertNearlyEqual(2.1, conn.Wait(v6)); Assert.Equal(2.1, conn.Wait(v6), 5);
AssertNearlyEqual(2.1, (double)conn.Wait(s)); Assert.Equal(2.1, (double)conn.Wait(s), 5);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment