From d139aadae4652a58542d7e6bded5b53f8ce86b43 Mon Sep 17 00:00:00 2001 From: Nick Craver Date: Tue, 8 Aug 2023 21:12:50 -0400 Subject: [PATCH 1/2] [Tests] Remove Moq as a dependency This is a test-only change. I don't want to risk an upgrade and harvesting PII from anyone who works on our project, so I'm removing Moq immediately. See https://github.com/moq/moq/issues/1372 for details/discussion. --- Directory.Packages.props | 3 +- .../KeyPrefixedBatchTests.cs | 14 +- .../KeyPrefixedDatabaseTests.cs | 413 +++---- .../KeyPrefixedTests.cs | 1079 +++++++++-------- .../KeyPrefixedTransactionTests.cs | 42 +- .../StackExchange.Redis.Tests.csproj | 1 - 6 files changed, 776 insertions(+), 776 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 309672642..91a4646c0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,10 +15,9 @@ - - + diff --git a/tests/StackExchange.Redis.Tests/KeyPrefixedBatchTests.cs b/tests/StackExchange.Redis.Tests/KeyPrefixedBatchTests.cs index 4d0700eb0..0a38766af 100644 --- a/tests/StackExchange.Redis.Tests/KeyPrefixedBatchTests.cs +++ b/tests/StackExchange.Redis.Tests/KeyPrefixedBatchTests.cs @@ -1,26 +1,26 @@ -using Moq; -using StackExchange.Redis.KeyspaceIsolation; +using StackExchange.Redis.KeyspaceIsolation; using System.Text; +using NSubstitute; using Xunit; namespace StackExchange.Redis.Tests; -[Collection(nameof(MoqDependentCollection))] +[Collection(nameof(SubstituteDependentCollection))] public sealed class KeyPrefixedBatchTests { - private readonly Mock mock; + private readonly IBatch mock; private readonly KeyPrefixedBatch prefixed; public KeyPrefixedBatchTests() { - mock = new Mock(); - prefixed = new KeyPrefixedBatch(mock.Object, Encoding.UTF8.GetBytes("prefix:")); + mock = Substitute.For(); + prefixed = new KeyPrefixedBatch(mock, Encoding.UTF8.GetBytes("prefix:")); } [Fact] public void Execute() { prefixed.Execute(); - mock.Verify(_ => _.Execute(), Times.Once()); + mock.Received(1).Execute(); } } diff --git a/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs b/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs index b4eff605a..25cc58cf8 100644 --- a/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs +++ b/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs @@ -3,35 +3,35 @@ using System.Linq.Expressions; using System.Net; using System.Text; -using Moq; +using NSubstitute; using StackExchange.Redis.KeyspaceIsolation; using Xunit; namespace StackExchange.Redis.Tests; -[CollectionDefinition(nameof(MoqDependentCollection), DisableParallelization = true)] -public class MoqDependentCollection { } +[CollectionDefinition(nameof(SubstituteDependentCollection), DisableParallelization = true)] +public class SubstituteDependentCollection { } -[Collection(nameof(MoqDependentCollection))] +[Collection(nameof(SubstituteDependentCollection))] public sealed class KeyPrefixedDatabaseTests { - private readonly Mock mock; + private readonly IDatabase mock; private readonly IDatabase prefixed; public KeyPrefixedDatabaseTests() { - mock = new Mock(); - prefixed = new KeyPrefixedDatabase(mock.Object, Encoding.UTF8.GetBytes("prefix:")); + mock = Substitute.For(); + prefixed = new KeyPrefixedDatabase(mock, Encoding.UTF8.GetBytes("prefix:")); } [Fact] public void CreateBatch() { object asyncState = new(); - IBatch innerBatch = new Mock().Object; - mock.Setup(_ => _.CreateBatch(asyncState)).Returns(innerBatch); + IBatch innerBatch = Substitute.For(); + mock.CreateBatch(asyncState).Returns(innerBatch); IBatch wrappedBatch = prefixed.CreateBatch(asyncState); - mock.Verify(_ => _.CreateBatch(asyncState)); + mock.CreateBatch(asyncState); Assert.IsType(wrappedBatch); Assert.Same(innerBatch, ((KeyPrefixedBatch)wrappedBatch).Inner); } @@ -40,10 +40,10 @@ public void CreateBatch() public void CreateTransaction() { object asyncState = new(); - ITransaction innerTransaction = new Mock().Object; - mock.Setup(_ => _.CreateTransaction(asyncState)).Returns(innerTransaction); + ITransaction innerTransaction = Substitute.For(); + mock.CreateTransaction(asyncState).Returns(innerTransaction); ITransaction wrappedTransaction = prefixed.CreateTransaction(asyncState); - mock.Verify(_ => _.CreateTransaction(asyncState)); + mock.Received().CreateTransaction(asyncState); Assert.IsType(wrappedTransaction); Assert.Same(innerTransaction, ((KeyPrefixedTransaction)wrappedTransaction).Inner); } @@ -52,13 +52,13 @@ public void CreateTransaction() public void DebugObject() { prefixed.DebugObject("key", CommandFlags.None); - mock.Verify(_ => _.DebugObject("prefix:key", CommandFlags.None)); + mock.Received().DebugObject("prefix:key", CommandFlags.None); } [Fact] public void Get_Database() { - mock.SetupGet(_ => _.Database).Returns(123); + mock.Database.Returns(123); Assert.Equal(123, prefixed.Database); } @@ -66,21 +66,21 @@ public void Get_Database() public void HashDecrement_1() { prefixed.HashDecrement("key", "hashField", 123, CommandFlags.None); - mock.Verify(_ => _.HashDecrement("prefix:key", "hashField", 123, CommandFlags.None)); + mock.Received().HashDecrement("prefix:key", "hashField", 123, CommandFlags.None); } [Fact] public void HashDecrement_2() { prefixed.HashDecrement("key", "hashField", 1.23, CommandFlags.None); - mock.Verify(_ => _.HashDecrement("prefix:key", "hashField", 1.23, CommandFlags.None)); + mock.Received().HashDecrement("prefix:key", "hashField", 1.23, CommandFlags.None); } [Fact] public void HashDelete_1() { prefixed.HashDelete("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashDelete("prefix:key", "hashField", CommandFlags.None)); + mock.Received().HashDelete("prefix:key", "hashField", CommandFlags.None); } [Fact] @@ -88,21 +88,21 @@ public void HashDelete_2() { RedisValue[] hashFields = Array.Empty(); prefixed.HashDelete("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashDelete("prefix:key", hashFields, CommandFlags.None)); + mock.Received().HashDelete("prefix:key", hashFields, CommandFlags.None); } [Fact] public void HashExists() { prefixed.HashExists("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashExists("prefix:key", "hashField", CommandFlags.None)); + mock.Received().HashExists("prefix:key", "hashField", CommandFlags.None); } [Fact] public void HashGet_1() { prefixed.HashGet("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashGet("prefix:key", "hashField", CommandFlags.None)); + mock.Received().HashGet("prefix:key", "hashField", CommandFlags.None); } [Fact] @@ -110,56 +110,56 @@ public void HashGet_2() { RedisValue[] hashFields = Array.Empty(); prefixed.HashGet("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashGet("prefix:key", hashFields, CommandFlags.None)); + mock.Received().HashGet("prefix:key", hashFields, CommandFlags.None); } [Fact] public void HashGetAll() { prefixed.HashGetAll("key", CommandFlags.None); - mock.Verify(_ => _.HashGetAll("prefix:key", CommandFlags.None)); + mock.Received().HashGetAll("prefix:key", CommandFlags.None); } [Fact] public void HashIncrement_1() { prefixed.HashIncrement("key", "hashField", 123, CommandFlags.None); - mock.Verify(_ => _.HashIncrement("prefix:key", "hashField", 123, CommandFlags.None)); + mock.Received().HashIncrement("prefix:key", "hashField", 123, CommandFlags.None); } [Fact] public void HashIncrement_2() { prefixed.HashIncrement("key", "hashField", 1.23, CommandFlags.None); - mock.Verify(_ => _.HashIncrement("prefix:key", "hashField", 1.23, CommandFlags.None)); + mock.Received().HashIncrement("prefix:key", "hashField", 1.23, CommandFlags.None); } [Fact] public void HashKeys() { prefixed.HashKeys("key", CommandFlags.None); - mock.Verify(_ => _.HashKeys("prefix:key", CommandFlags.None)); + mock.Received().HashKeys("prefix:key", CommandFlags.None); } [Fact] public void HashLength() { prefixed.HashLength("key", CommandFlags.None); - mock.Verify(_ => _.HashLength("prefix:key", CommandFlags.None)); + mock.Received().HashLength("prefix:key", CommandFlags.None); } [Fact] public void HashScan() { prefixed.HashScan("key", "pattern", 123, flags: CommandFlags.None); - mock.Verify(_ => _.HashScan("prefix:key", "pattern", 123, CommandFlags.None)); + mock.Received().HashScan("prefix:key", "pattern", 123, CommandFlags.None); } [Fact] public void HashScan_Full() { prefixed.HashScan("key", "pattern", 123, 42, 64, flags: CommandFlags.None); - mock.Verify(_ => _.HashScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None)); + mock.Received().HashScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None); } [Fact] @@ -167,35 +167,35 @@ public void HashSet_1() { HashEntry[] hashFields = Array.Empty(); prefixed.HashSet("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashSet("prefix:key", hashFields, CommandFlags.None)); + mock.Received().HashSet("prefix:key", hashFields, CommandFlags.None); } [Fact] public void HashSet_2() { prefixed.HashSet("key", "hashField", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.HashSet("prefix:key", "hashField", "value", When.Exists, CommandFlags.None)); + mock.Received().HashSet("prefix:key", "hashField", "value", When.Exists, CommandFlags.None); } [Fact] public void HashStringLength() { prefixed.HashStringLength("key", "field", CommandFlags.None); - mock.Verify(_ => _.HashStringLength("prefix:key", "field", CommandFlags.None)); + mock.Received().HashStringLength("prefix:key", "field", CommandFlags.None); } [Fact] public void HashValues() { prefixed.HashValues("key", CommandFlags.None); - mock.Verify(_ => _.HashValues("prefix:key", CommandFlags.None)); + mock.Received().HashValues("prefix:key", CommandFlags.None); } [Fact] public void HyperLogLogAdd_1() { prefixed.HyperLogLogAdd("key", "value", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogAdd("prefix:key", "value", CommandFlags.None)); + mock.Received().HyperLogLogAdd("prefix:key", "value", CommandFlags.None); } [Fact] @@ -203,81 +203,81 @@ public void HyperLogLogAdd_2() { RedisValue[] values = Array.Empty(); prefixed.HyperLogLogAdd("key", values, CommandFlags.None); - mock.Verify(_ => _.HyperLogLogAdd("prefix:key", values, CommandFlags.None)); + mock.Received().HyperLogLogAdd("prefix:key", values, CommandFlags.None); } [Fact] public void HyperLogLogLength() { prefixed.HyperLogLogLength("key", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogLength("prefix:key", CommandFlags.None)); + mock.Received().HyperLogLogLength("prefix:key", CommandFlags.None); } [Fact] public void HyperLogLogMerge_1() { prefixed.HyperLogLogMerge("destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogMerge("prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + mock.Received().HyperLogLogMerge("prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] public void HyperLogLogMerge_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.HyperLogLogMerge("destination", keys, CommandFlags.None); - mock.Verify(_ => _.HyperLogLogMerge("prefix:destination", It.Is(valid), CommandFlags.None)); + mock.Received().HyperLogLogMerge("prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] public void IdentifyEndpoint() { prefixed.IdentifyEndpoint("key", CommandFlags.None); - mock.Verify(_ => _.IdentifyEndpoint("prefix:key", CommandFlags.None)); + mock.Received().IdentifyEndpoint("prefix:key", CommandFlags.None); } [Fact] public void KeyCopy() { prefixed.KeyCopy("key", "destination", flags: CommandFlags.None); - mock.Verify(_ => _.KeyCopy("prefix:key", "prefix:destination", -1, false, CommandFlags.None)); + mock.Received().KeyCopy("prefix:key", "prefix:destination", -1, false, CommandFlags.None); } [Fact] public void KeyDelete_1() { prefixed.KeyDelete("key", CommandFlags.None); - mock.Verify(_ => _.KeyDelete("prefix:key", CommandFlags.None)); + mock.Received().KeyDelete("prefix:key", CommandFlags.None); } [Fact] public void KeyDelete_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.KeyDelete(keys, CommandFlags.None); - mock.Verify(_ => _.KeyDelete(It.Is(valid), CommandFlags.None)); + mock.Received().KeyDelete(Arg.Is(valid), CommandFlags.None); } [Fact] public void KeyDump() { prefixed.KeyDump("key", CommandFlags.None); - mock.Verify(_ => _.KeyDump("prefix:key", CommandFlags.None)); + mock.Received().KeyDump("prefix:key", CommandFlags.None); } [Fact] public void KeyEncoding() { prefixed.KeyEncoding("key", CommandFlags.None); - mock.Verify(_ => _.KeyEncoding("prefix:key", CommandFlags.None)); + mock.Received().KeyEncoding("prefix:key", CommandFlags.None); } [Fact] public void KeyExists() { prefixed.KeyExists("key", CommandFlags.None); - mock.Verify(_ => _.KeyExists("prefix:key", CommandFlags.None)); + mock.Received().KeyExists("prefix:key", CommandFlags.None); } [Fact] @@ -285,7 +285,7 @@ public void KeyExpire_1() { TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.KeyExpire("key", expiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpire("prefix:key", expiry, CommandFlags.None)); + mock.Received().KeyExpire("prefix:key", expiry, CommandFlags.None); } [Fact] @@ -293,7 +293,7 @@ public void KeyExpire_2() { DateTime expiry = DateTime.Now; prefixed.KeyExpire("key", expiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpire("prefix:key", expiry, CommandFlags.None)); + mock.Received().KeyExpire("prefix:key", expiry, CommandFlags.None); } [Fact] @@ -301,7 +301,7 @@ public void KeyExpire_3() { TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.KeyExpire("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpire("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None)); + mock.Received().KeyExpire("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); } [Fact] @@ -309,21 +309,21 @@ public void KeyExpire_4() { DateTime expiry = DateTime.Now; prefixed.KeyExpire("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpire("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None)); + mock.Received().KeyExpire("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); } [Fact] public void KeyExpireTime() { prefixed.KeyExpireTime("key", CommandFlags.None); - mock.Verify(_ => _.KeyExpireTime("prefix:key", CommandFlags.None)); + mock.Received().KeyExpireTime("prefix:key", CommandFlags.None); } [Fact] public void KeyFrequency() { prefixed.KeyFrequency("key", CommandFlags.None); - mock.Verify(_ => _.KeyFrequency("prefix:key", CommandFlags.None)); + mock.Received().KeyFrequency("prefix:key", CommandFlags.None); } [Fact] @@ -331,21 +331,21 @@ public void KeyMigrate() { EndPoint toServer = new IPEndPoint(IPAddress.Loopback, 123); prefixed.KeyMigrate("key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None); - mock.Verify(_ => _.KeyMigrate("prefix:key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None)); + mock.Received().KeyMigrate("prefix:key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None); } [Fact] public void KeyMove() { prefixed.KeyMove("key", 123, CommandFlags.None); - mock.Verify(_ => _.KeyMove("prefix:key", 123, CommandFlags.None)); + mock.Received().KeyMove("prefix:key", 123, CommandFlags.None); } [Fact] public void KeyPersist() { prefixed.KeyPersist("key", CommandFlags.None); - mock.Verify(_ => _.KeyPersist("prefix:key", CommandFlags.None)); + mock.Received().KeyPersist("prefix:key", CommandFlags.None); } [Fact] @@ -358,14 +358,14 @@ public void KeyRandom() public void KeyRefCount() { prefixed.KeyRefCount("key", CommandFlags.None); - mock.Verify(_ => _.KeyRefCount("prefix:key", CommandFlags.None)); + mock.Received().KeyRefCount("prefix:key", CommandFlags.None); } [Fact] public void KeyRename() { prefixed.KeyRename("key", "newKey", When.Exists, CommandFlags.None); - mock.Verify(_ => _.KeyRename("prefix:key", "prefix:newKey", When.Exists, CommandFlags.None)); + mock.Received().KeyRename("prefix:key", "prefix:newKey", When.Exists, CommandFlags.None); } [Fact] @@ -374,63 +374,63 @@ public void KeyRestore() byte[] value = Array.Empty(); TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.KeyRestore("key", value, expiry, CommandFlags.None); - mock.Verify(_ => _.KeyRestore("prefix:key", value, expiry, CommandFlags.None)); + mock.Received().KeyRestore("prefix:key", value, expiry, CommandFlags.None); } [Fact] public void KeyTimeToLive() { prefixed.KeyTimeToLive("key", CommandFlags.None); - mock.Verify(_ => _.KeyTimeToLive("prefix:key", CommandFlags.None)); + mock.Received().KeyTimeToLive("prefix:key", CommandFlags.None); } [Fact] public void KeyType() { prefixed.KeyType("key", CommandFlags.None); - mock.Verify(_ => _.KeyType("prefix:key", CommandFlags.None)); + mock.Received().KeyType("prefix:key", CommandFlags.None); } [Fact] public void ListGetByIndex() { prefixed.ListGetByIndex("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListGetByIndex("prefix:key", 123, CommandFlags.None)); + mock.Received().ListGetByIndex("prefix:key", 123, CommandFlags.None); } [Fact] public void ListInsertAfter() { prefixed.ListInsertAfter("key", "pivot", "value", CommandFlags.None); - mock.Verify(_ => _.ListInsertAfter("prefix:key", "pivot", "value", CommandFlags.None)); + mock.Received().ListInsertAfter("prefix:key", "pivot", "value", CommandFlags.None); } [Fact] public void ListInsertBefore() { prefixed.ListInsertBefore("key", "pivot", "value", CommandFlags.None); - mock.Verify(_ => _.ListInsertBefore("prefix:key", "pivot", "value", CommandFlags.None)); + mock.Received().ListInsertBefore("prefix:key", "pivot", "value", CommandFlags.None); } [Fact] public void ListLeftPop() { prefixed.ListLeftPop("key", CommandFlags.None); - mock.Verify(_ => _.ListLeftPop("prefix:key", CommandFlags.None)); + mock.Received().ListLeftPop("prefix:key", CommandFlags.None); } [Fact] public void ListLeftPop_1() { prefixed.ListLeftPop("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListLeftPop("prefix:key", 123, CommandFlags.None)); + mock.Received().ListLeftPop("prefix:key", 123, CommandFlags.None); } [Fact] public void ListLeftPush_1() { prefixed.ListLeftPush("key", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListLeftPush("prefix:key", "value", When.Exists, CommandFlags.None)); + mock.Received().ListLeftPush("prefix:key", "value", When.Exists, CommandFlags.None); } [Fact] @@ -438,7 +438,7 @@ public void ListLeftPush_2() { RedisValue[] values = Array.Empty(); prefixed.ListLeftPush("key", values, CommandFlags.None); - mock.Verify(_ => _.ListLeftPush("prefix:key", values, CommandFlags.None)); + mock.Received().ListLeftPush("prefix:key", values, CommandFlags.None); } [Fact] @@ -446,63 +446,63 @@ public void ListLeftPush_3() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; prefixed.ListLeftPush("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListLeftPush("prefix:key", values, When.Exists, CommandFlags.None)); + mock.Received().ListLeftPush("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] public void ListLength() { prefixed.ListLength("key", CommandFlags.None); - mock.Verify(_ => _.ListLength("prefix:key", CommandFlags.None)); + mock.Received().ListLength("prefix:key", CommandFlags.None); } [Fact] public void ListMove() { prefixed.ListMove("key", "destination", ListSide.Left, ListSide.Right, CommandFlags.None); - mock.Verify(_ => _.ListMove("prefix:key", "prefix:destination", ListSide.Left, ListSide.Right, CommandFlags.None)); + mock.Received().ListMove("prefix:key", "prefix:destination", ListSide.Left, ListSide.Right, CommandFlags.None); } [Fact] public void ListRange() { prefixed.ListRange("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.ListRange("prefix:key", 123, 456, CommandFlags.None)); + mock.Received().ListRange("prefix:key", 123, 456, CommandFlags.None); } [Fact] public void ListRemove() { prefixed.ListRemove("key", "value", 123, CommandFlags.None); - mock.Verify(_ => _.ListRemove("prefix:key", "value", 123, CommandFlags.None)); + mock.Received().ListRemove("prefix:key", "value", 123, CommandFlags.None); } [Fact] public void ListRightPop() { prefixed.ListRightPop("key", CommandFlags.None); - mock.Verify(_ => _.ListRightPop("prefix:key", CommandFlags.None)); + mock.Received().ListRightPop("prefix:key", CommandFlags.None); } [Fact] public void ListRightPop_1() { prefixed.ListRightPop("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListRightPop("prefix:key", 123, CommandFlags.None)); + mock.Received().ListRightPop("prefix:key", 123, CommandFlags.None); } [Fact] public void ListRightPopLeftPush() { prefixed.ListRightPopLeftPush("source", "destination", CommandFlags.None); - mock.Verify(_ => _.ListRightPopLeftPush("prefix:source", "prefix:destination", CommandFlags.None)); + mock.Received().ListRightPopLeftPush("prefix:source", "prefix:destination", CommandFlags.None); } [Fact] public void ListRightPush_1() { prefixed.ListRightPush("key", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListRightPush("prefix:key", "value", When.Exists, CommandFlags.None)); + mock.Received().ListRightPush("prefix:key", "value", When.Exists, CommandFlags.None); } [Fact] @@ -510,7 +510,7 @@ public void ListRightPush_2() { RedisValue[] values = Array.Empty(); prefixed.ListRightPush("key", values, CommandFlags.None); - mock.Verify(_ => _.ListRightPush("prefix:key", values, CommandFlags.None)); + mock.Received().ListRightPush("prefix:key", values, CommandFlags.None); } [Fact] @@ -518,21 +518,21 @@ public void ListRightPush_3() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; prefixed.ListRightPush("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListRightPush("prefix:key", values, When.Exists, CommandFlags.None)); + mock.Received().ListRightPush("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] public void ListSetByIndex() { prefixed.ListSetByIndex("key", 123, "value", CommandFlags.None); - mock.Verify(_ => _.ListSetByIndex("prefix:key", 123, "value", CommandFlags.None)); + mock.Received().ListSetByIndex("prefix:key", 123, "value", CommandFlags.None); } [Fact] public void ListTrim() { prefixed.ListTrim("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.ListTrim("prefix:key", 123, 456, CommandFlags.None)); + mock.Received().ListTrim("prefix:key", 123, 456, CommandFlags.None); } [Fact] @@ -540,21 +540,21 @@ public void LockExtend() { TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.LockExtend("key", "value", expiry, CommandFlags.None); - mock.Verify(_ => _.LockExtend("prefix:key", "value", expiry, CommandFlags.None)); + mock.Received().LockExtend("prefix:key", "value", expiry, CommandFlags.None); } [Fact] public void LockQuery() { prefixed.LockQuery("key", CommandFlags.None); - mock.Verify(_ => _.LockQuery("prefix:key", CommandFlags.None)); + mock.Received().LockQuery("prefix:key", CommandFlags.None); } [Fact] public void LockRelease() { prefixed.LockRelease("key", "value", CommandFlags.None); - mock.Verify(_ => _.LockRelease("prefix:key", "value", CommandFlags.None)); + mock.Received().LockRelease("prefix:key", "value", CommandFlags.None); } [Fact] @@ -562,7 +562,7 @@ public void LockTake() { TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.LockTake("key", "value", expiry, CommandFlags.None); - mock.Verify(_ => _.LockTake("prefix:key", "value", expiry, CommandFlags.None)); + mock.Received().LockTake("prefix:key", "value", expiry, CommandFlags.None); } [Fact] @@ -570,7 +570,7 @@ public void Publish() { #pragma warning disable CS0618 prefixed.Publish("channel", "message", CommandFlags.None); - mock.Verify(_ => _.Publish("prefix:channel", "message", CommandFlags.None)); + mock.Received().Publish("prefix:channel", "message", CommandFlags.None); #pragma warning restore CS0618 } @@ -580,9 +580,9 @@ public void ScriptEvaluate_1() byte[] hash = Array.Empty(); RedisValue[] values = Array.Empty(); RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.ScriptEvaluate(hash, keys, values, CommandFlags.None); - mock.Verify(_ => _.ScriptEvaluate(hash, It.Is(valid), values, CommandFlags.None)); + mock.Received().ScriptEvaluate(hash, Arg.Is(valid), values, CommandFlags.None); } [Fact] @@ -590,16 +590,16 @@ public void ScriptEvaluate_2() { RedisValue[] values = Array.Empty(); RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.ScriptEvaluate("script", keys, values, CommandFlags.None); - mock.Verify(_ => _.ScriptEvaluate("script", It.Is(valid), values, CommandFlags.None)); + mock.Received().ScriptEvaluate("script", Arg.Is(valid), values, CommandFlags.None); } [Fact] public void SetAdd_1() { prefixed.SetAdd("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetAdd("prefix:key", "value", CommandFlags.None)); + mock.Received().SetAdd("prefix:key", "value", CommandFlags.None); } [Fact] @@ -607,46 +607,46 @@ public void SetAdd_2() { RedisValue[] values = Array.Empty(); prefixed.SetAdd("key", values, CommandFlags.None); - mock.Verify(_ => _.SetAdd("prefix:key", values, CommandFlags.None)); + mock.Received().SetAdd("prefix:key", values, CommandFlags.None); } [Fact] public void SetCombine_1() { prefixed.SetCombine(SetOperation.Intersect, "first", "second", CommandFlags.None); - mock.Verify(_ => _.SetCombine(SetOperation.Intersect, "prefix:first", "prefix:second", CommandFlags.None)); + mock.Received().SetCombine(SetOperation.Intersect, "prefix:first", "prefix:second", CommandFlags.None); } [Fact] public void SetCombine_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.SetCombine(SetOperation.Intersect, keys, CommandFlags.None); - mock.Verify(_ => _.SetCombine(SetOperation.Intersect, It.Is(valid), CommandFlags.None)); + mock.Received().SetCombine(SetOperation.Intersect, Arg.Is(valid), CommandFlags.None); } [Fact] public void SetCombineAndStore_1() { prefixed.SetCombineAndStore(SetOperation.Intersect, "destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStore(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + mock.Received().SetCombineAndStore(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] public void SetCombineAndStore_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.SetCombineAndStore(SetOperation.Intersect, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStore(SetOperation.Intersect, "prefix:destination", It.Is(valid), CommandFlags.None)); + mock.Received().SetCombineAndStore(SetOperation.Intersect, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] public void SetContains() { prefixed.SetContains("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetContains("prefix:key", "value", CommandFlags.None)); + mock.Received().SetContains("prefix:key", "value", CommandFlags.None); } [Fact] @@ -654,7 +654,7 @@ public void SetContains_2() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; prefixed.SetContains("key", values, CommandFlags.None); - mock.Verify(_ => _.SetContains("prefix:key", values, CommandFlags.None)); + mock.Received().SetContains("prefix:key", values, CommandFlags.None); } [Fact] @@ -662,66 +662,66 @@ public void SetIntersectionLength() { var keys = new RedisKey[] { "key1", "key2" }; prefixed.SetIntersectionLength(keys); - mock.Verify(_ => _.SetIntersectionLength(keys, 0, CommandFlags.None)); + mock.Received().SetIntersectionLength(keys, 0, CommandFlags.None); } [Fact] public void SetLength() { prefixed.SetLength("key", CommandFlags.None); - mock.Verify(_ => _.SetLength("prefix:key", CommandFlags.None)); + mock.Received().SetLength("prefix:key", CommandFlags.None); } [Fact] public void SetMembers() { prefixed.SetMembers("key", CommandFlags.None); - mock.Verify(_ => _.SetMembers("prefix:key", CommandFlags.None)); + mock.Received().SetMembers("prefix:key", CommandFlags.None); } [Fact] public void SetMove() { prefixed.SetMove("source", "destination", "value", CommandFlags.None); - mock.Verify(_ => _.SetMove("prefix:source", "prefix:destination", "value", CommandFlags.None)); + mock.Received().SetMove("prefix:source", "prefix:destination", "value", CommandFlags.None); } [Fact] public void SetPop_1() { prefixed.SetPop("key", CommandFlags.None); - mock.Verify(_ => _.SetPop("prefix:key", CommandFlags.None)); + mock.Received().SetPop("prefix:key", CommandFlags.None); prefixed.SetPop("key", 5, CommandFlags.None); - mock.Verify(_ => _.SetPop("prefix:key", 5, CommandFlags.None)); + mock.Received().SetPop("prefix:key", 5, CommandFlags.None); } [Fact] public void SetPop_2() { prefixed.SetPop("key", 5, CommandFlags.None); - mock.Verify(_ => _.SetPop("prefix:key", 5, CommandFlags.None)); + mock.Received().SetPop("prefix:key", 5, CommandFlags.None); } [Fact] public void SetRandomMember() { prefixed.SetRandomMember("key", CommandFlags.None); - mock.Verify(_ => _.SetRandomMember("prefix:key", CommandFlags.None)); + mock.Received().SetRandomMember("prefix:key", CommandFlags.None); } [Fact] public void SetRandomMembers() { prefixed.SetRandomMembers("key", 123, CommandFlags.None); - mock.Verify(_ => _.SetRandomMembers("prefix:key", 123, CommandFlags.None)); + mock.Received().SetRandomMembers("prefix:key", 123, CommandFlags.None); } [Fact] public void SetRemove_1() { prefixed.SetRemove("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetRemove("prefix:key", "value", CommandFlags.None)); + mock.Received().SetRemove("prefix:key", "value", CommandFlags.None); } [Fact] @@ -729,54 +729,54 @@ public void SetRemove_2() { RedisValue[] values = Array.Empty(); prefixed.SetRemove("key", values, CommandFlags.None); - mock.Verify(_ => _.SetRemove("prefix:key", values, CommandFlags.None)); + mock.Received().SetRemove("prefix:key", values, CommandFlags.None); } [Fact] public void SetScan() { prefixed.SetScan("key", "pattern", 123, flags: CommandFlags.None); - mock.Verify(_ => _.SetScan("prefix:key", "pattern", 123, CommandFlags.None)); + mock.Received().SetScan("prefix:key", "pattern", 123, CommandFlags.None); } [Fact] public void SetScan_Full() { prefixed.SetScan("key", "pattern", 123, 42, 64, flags: CommandFlags.None); - mock.Verify(_ => _.SetScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None)); + mock.Received().SetScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None); } [Fact] public void Sort() { RedisValue[] get = new RedisValue[] { "a", "#" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; prefixed.Sort("key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); prefixed.Sort("key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); - mock.Verify(_ => _.Sort("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", It.Is(valid), CommandFlags.None)); - mock.Verify(_ => _.Sort("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", It.Is(valid), CommandFlags.None)); + mock.Received().Sort("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", Arg.Is(valid), CommandFlags.None); + mock.Received().Sort("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", Arg.Is(valid), CommandFlags.None); } [Fact] public void SortAndStore() { RedisValue[] get = new RedisValue[] { "a", "#" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; prefixed.SortAndStore("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); prefixed.SortAndStore("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); - mock.Verify(_ => _.SortAndStore("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", It.Is(valid), CommandFlags.None)); - mock.Verify(_ => _.SortAndStore("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", It.Is(valid), CommandFlags.None)); + mock.Received().SortAndStore("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", Arg.Is(valid), CommandFlags.None); + mock.Received().SortAndStore("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", Arg.Is(valid), CommandFlags.None); } [Fact] public void SortedSetAdd_1() { prefixed.SortedSetAdd("key", "member", 1.23, When.Exists, CommandFlags.None); - mock.Verify(_ => _.SortedSetAdd("prefix:key", "member", 1.23, When.Exists, CommandFlags.None)); + mock.Received().SortedSetAdd("prefix:key", "member", 1.23, When.Exists, CommandFlags.None); } [Fact] @@ -784,7 +784,7 @@ public void SortedSetAdd_2() { SortedSetEntry[] values = Array.Empty(); prefixed.SortedSetAdd("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.SortedSetAdd("prefix:key", values, When.Exists, CommandFlags.None)); + mock.Received().SortedSetAdd("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] @@ -792,7 +792,7 @@ public void SortedSetAdd_3() { SortedSetEntry[] values = Array.Empty(); prefixed.SortedSetAdd("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); - mock.Verify(_ => _.SortedSetAdd("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None)); + mock.Received().SortedSetAdd("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None); } [Fact] @@ -800,7 +800,7 @@ public void SortedSetCombine() { RedisKey[] keys = new RedisKey[] { "a", "b" }; prefixed.SortedSetCombine(SetOperation.Intersect, keys); - mock.Verify(_ => _.SortedSetCombine(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None)); + mock.Received().SortedSetCombine(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None); } [Fact] @@ -808,37 +808,37 @@ public void SortedSetCombineWithScores() { RedisKey[] keys = new RedisKey[] { "a", "b" }; prefixed.SortedSetCombineWithScores(SetOperation.Intersect, keys); - mock.Verify(_ => _.SortedSetCombineWithScores(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None)); + mock.Received().SortedSetCombineWithScores(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None); } [Fact] public void SortedSetCombineAndStore_1() { prefixed.SortedSetCombineAndStore(SetOperation.Intersect, "destination", "first", "second", Aggregate.Max, CommandFlags.None); - mock.Verify(_ => _.SortedSetCombineAndStore(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", Aggregate.Max, CommandFlags.None)); + mock.Received().SortedSetCombineAndStore(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", Aggregate.Max, CommandFlags.None); } [Fact] public void SortedSetCombineAndStore_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.SetCombineAndStore(SetOperation.Intersect, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStore(SetOperation.Intersect, "prefix:destination", It.Is(valid), CommandFlags.None)); + mock.Received().SetCombineAndStore(SetOperation.Intersect, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] public void SortedSetDecrement() { prefixed.SortedSetDecrement("key", "member", 1.23, CommandFlags.None); - mock.Verify(_ => _.SortedSetDecrement("prefix:key", "member", 1.23, CommandFlags.None)); + mock.Received().SortedSetDecrement("prefix:key", "member", 1.23, CommandFlags.None); } [Fact] public void SortedSetIncrement() { prefixed.SortedSetIncrement("key", "member", 1.23, CommandFlags.None); - mock.Verify(_ => _.SortedSetIncrement("prefix:key", "member", 1.23, CommandFlags.None)); + mock.Received().SortedSetIncrement("prefix:key", "member", 1.23, CommandFlags.None); } [Fact] @@ -846,98 +846,98 @@ public void SortedSetIntersectionLength() { RedisKey[] keys = new RedisKey[] { "a", "b" }; prefixed.SortedSetIntersectionLength(keys, 1, CommandFlags.None); - mock.Verify(_ => _.SortedSetIntersectionLength(keys, 1, CommandFlags.None)); + mock.Received().SortedSetIntersectionLength(keys, 1, CommandFlags.None); } [Fact] public void SortedSetLength() { prefixed.SortedSetLength("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetLength("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None)); + mock.Received().SortedSetLength("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None); } [Fact] public void SortedSetRandomMember() { prefixed.SortedSetRandomMember("key", CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMember("prefix:key", CommandFlags.None)); + mock.Received().SortedSetRandomMember("prefix:key", CommandFlags.None); } [Fact] public void SortedSetRandomMembers() { prefixed.SortedSetRandomMembers("key", 2, CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMembers("prefix:key", 2, CommandFlags.None)); + mock.Received().SortedSetRandomMembers("prefix:key", 2, CommandFlags.None); } [Fact] public void SortedSetRandomMembersWithScores() { prefixed.SortedSetRandomMembersWithScores("key", 2, CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMembersWithScores("prefix:key", 2, CommandFlags.None)); + mock.Received().SortedSetRandomMembersWithScores("prefix:key", 2, CommandFlags.None); } [Fact] public void SortedSetLengthByValue() { prefixed.SortedSetLengthByValue("key", "min", "max", Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetLengthByValue("prefix:key", "min", "max", Exclude.Start, CommandFlags.None)); + mock.Received().SortedSetLengthByValue("prefix:key", "min", "max", Exclude.Start, CommandFlags.None); } [Fact] public void SortedSetRangeByRank() { prefixed.SortedSetRangeByRank("key", 123, 456, Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByRank("prefix:key", 123, 456, Order.Descending, CommandFlags.None)); + mock.Received().SortedSetRangeByRank("prefix:key", 123, 456, Order.Descending, CommandFlags.None); } [Fact] public void SortedSetRangeByRankWithScores() { prefixed.SortedSetRangeByRankWithScores("key", 123, 456, Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByRankWithScores("prefix:key", 123, 456, Order.Descending, CommandFlags.None)); + mock.Received().SortedSetRangeByRankWithScores("prefix:key", 123, 456, Order.Descending, CommandFlags.None); } [Fact] public void SortedSetRangeByScore() { prefixed.SortedSetRangeByScore("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByScore("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + mock.Received().SortedSetRangeByScore("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] public void SortedSetRangeByScoreWithScores() { prefixed.SortedSetRangeByScoreWithScores("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByScoreWithScores("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + mock.Received().SortedSetRangeByScoreWithScores("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] public void SortedSetRangeByValue() { prefixed.SortedSetRangeByValue("key", "min", "max", Exclude.Start, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByValue("prefix:key", "min", "max", Exclude.Start, Order.Ascending, 123, 456, CommandFlags.None)); + mock.Received().SortedSetRangeByValue("prefix:key", "min", "max", Exclude.Start, Order.Ascending, 123, 456, CommandFlags.None); } [Fact] public void SortedSetRangeByValueDesc() { prefixed.SortedSetRangeByValue("key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByValue("prefix:key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + mock.Received().SortedSetRangeByValue("prefix:key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] public void SortedSetRank() { prefixed.SortedSetRank("key", "member", Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRank("prefix:key", "member", Order.Descending, CommandFlags.None)); + mock.Received().SortedSetRank("prefix:key", "member", Order.Descending, CommandFlags.None); } [Fact] public void SortedSetRemove_1() { prefixed.SortedSetRemove("key", "member", CommandFlags.None); - mock.Verify(_ => _.SortedSetRemove("prefix:key", "member", CommandFlags.None)); + mock.Received().SortedSetRemove("prefix:key", "member", CommandFlags.None); } [Fact] @@ -945,56 +945,57 @@ public void SortedSetRemove_2() { RedisValue[] members = Array.Empty(); prefixed.SortedSetRemove("key", members, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemove("prefix:key", members, CommandFlags.None)); + mock.Received().SortedSetRemove("prefix:key", members, CommandFlags.None); } [Fact] public void SortedSetRemoveRangeByRank() { prefixed.SortedSetRemoveRangeByRank("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByRank("prefix:key", 123, 456, CommandFlags.None)); + mock.Received().SortedSetRemoveRangeByRank("prefix:key", 123, 456, CommandFlags.None); } [Fact] public void SortedSetRemoveRangeByScore() { prefixed.SortedSetRemoveRangeByScore("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByScore("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None)); + mock.Received().SortedSetRemoveRangeByScore("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None); } [Fact] public void SortedSetRemoveRangeByValue() { prefixed.SortedSetRemoveRangeByValue("key", "min", "max", Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByValue("prefix:key", "min", "max", Exclude.Start, CommandFlags.None)); + mock.Received().SortedSetRemoveRangeByValue("prefix:key", "min", "max", Exclude.Start, CommandFlags.None); } [Fact] public void SortedSetScan() { prefixed.SortedSetScan("key", "pattern", 123, flags: CommandFlags.None); - mock.Verify(_ => _.SortedSetScan("prefix:key", "pattern", 123, CommandFlags.None)); + mock.Received().SortedSetScan("prefix:key", "pattern", 123, CommandFlags.None); } [Fact] public void SortedSetScan_Full() { prefixed.SortedSetScan("key", "pattern", 123, 42, 64, flags: CommandFlags.None); - mock.Verify(_ => _.SortedSetScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None)); + mock.Received().SortedSetScan("prefix:key", "pattern", 123, 42, 64, CommandFlags.None); } [Fact] public void SortedSetScore() { prefixed.SortedSetScore("key", "member", CommandFlags.None); - mock.Verify(_ => _.SortedSetScore("prefix:key", "member", CommandFlags.None)); + mock.Received().SortedSetScore("prefix:key", "member", CommandFlags.None); } [Fact] public void SortedSetScore_Multiple() { - prefixed.SortedSetScores("key", new RedisValue[] { "member1", "member2" }, CommandFlags.None); - mock.Verify(_ => _.SortedSetScores("prefix:key", new RedisValue[] { "member1", "member2" }, CommandFlags.None)); + var values = new RedisValue[] { "member1", "member2" }; + prefixed.SortedSetScores("key", values, CommandFlags.None); + mock.Received().SortedSetScores("prefix:key", values, CommandFlags.None); } [Fact] @@ -1002,14 +1003,14 @@ public void SortedSetUpdate() { SortedSetEntry[] values = Array.Empty(); prefixed.SortedSetUpdate("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); - mock.Verify(_ => _.SortedSetUpdate("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None)); + mock.Received().SortedSetUpdate("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None); } [Fact] public void StreamAcknowledge_1() { prefixed.StreamAcknowledge("key", "group", "0-0", CommandFlags.None); - mock.Verify(_ => _.StreamAcknowledge("prefix:key", "group", "0-0", CommandFlags.None)); + mock.Received().StreamAcknowledge("prefix:key", "group", "0-0", CommandFlags.None); } [Fact] @@ -1017,14 +1018,14 @@ public void StreamAcknowledge_2() { var messageIds = new RedisValue[] { "0-0", "0-1", "0-2" }; prefixed.StreamAcknowledge("key", "group", messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamAcknowledge("prefix:key", "group", messageIds, CommandFlags.None)); + mock.Received().StreamAcknowledge("prefix:key", "group", messageIds, CommandFlags.None); } [Fact] public void StreamAdd_1() { prefixed.StreamAdd("key", "field1", "value1", "*", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamAdd("prefix:key", "field1", "value1", "*", 1000, true, CommandFlags.None)); + mock.Received().StreamAdd("prefix:key", "field1", "value1", "*", 1000, true, CommandFlags.None); } [Fact] @@ -1032,21 +1033,21 @@ public void StreamAdd_2() { var fields = Array.Empty(); prefixed.StreamAdd("key", fields, "*", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamAdd("prefix:key", fields, "*", 1000, true, CommandFlags.None)); + mock.Received().StreamAdd("prefix:key", fields, "*", 1000, true, CommandFlags.None); } [Fact] public void StreamAutoClaim() { prefixed.StreamAutoClaim("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); - mock.Verify(_ => _.StreamAutoClaim("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None)); + mock.Received().StreamAutoClaim("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); } [Fact] public void StreamAutoClaimIdsOnly() { prefixed.StreamAutoClaimIdsOnly("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); - mock.Verify(_ => _.StreamAutoClaimIdsOnly("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None)); + mock.Received().StreamAutoClaimIdsOnly("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); } [Fact] @@ -1054,7 +1055,7 @@ public void StreamClaimMessages() { var messageIds = Array.Empty(); prefixed.StreamClaim("key", "group", "consumer", 1000, messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamClaim("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None)); + mock.Received().StreamClaim("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None); } [Fact] @@ -1062,49 +1063,49 @@ public void StreamClaimMessagesReturningIds() { var messageIds = Array.Empty(); prefixed.StreamClaimIdsOnly("key", "group", "consumer", 1000, messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamClaimIdsOnly("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None)); + mock.Received().StreamClaimIdsOnly("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None); } [Fact] public void StreamConsumerGroupSetPosition() { prefixed.StreamConsumerGroupSetPosition("key", "group", StreamPosition.Beginning, CommandFlags.None); - mock.Verify(_ => _.StreamConsumerGroupSetPosition("prefix:key", "group", StreamPosition.Beginning, CommandFlags.None)); + mock.Received().StreamConsumerGroupSetPosition("prefix:key", "group", StreamPosition.Beginning, CommandFlags.None); } [Fact] public void StreamConsumerInfoGet() { prefixed.StreamConsumerInfo("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamConsumerInfo("prefix:key", "group", CommandFlags.None)); + mock.Received().StreamConsumerInfo("prefix:key", "group", CommandFlags.None); } [Fact] public void StreamCreateConsumerGroup() { prefixed.StreamCreateConsumerGroup("key", "group", StreamPosition.Beginning, false, CommandFlags.None); - mock.Verify(_ => _.StreamCreateConsumerGroup("prefix:key", "group", StreamPosition.Beginning, false, CommandFlags.None)); + mock.Received().StreamCreateConsumerGroup("prefix:key", "group", StreamPosition.Beginning, false, CommandFlags.None); } [Fact] public void StreamGroupInfoGet() { prefixed.StreamGroupInfo("key", CommandFlags.None); - mock.Verify(_ => _.StreamGroupInfo("prefix:key", CommandFlags.None)); + mock.Received().StreamGroupInfo("prefix:key", CommandFlags.None); } [Fact] public void StreamInfoGet() { prefixed.StreamInfo("key", CommandFlags.None); - mock.Verify(_ => _.StreamInfo("prefix:key", CommandFlags.None)); + mock.Received().StreamInfo("prefix:key", CommandFlags.None); } [Fact] public void StreamLength() { prefixed.StreamLength("key", CommandFlags.None); - mock.Verify(_ => _.StreamLength("prefix:key", CommandFlags.None)); + mock.Received().StreamLength("prefix:key", CommandFlags.None); } [Fact] @@ -1112,42 +1113,42 @@ public void StreamMessagesDelete() { var messageIds = Array.Empty(); prefixed.StreamDelete("key", messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamDelete("prefix:key", messageIds, CommandFlags.None)); + mock.Received().StreamDelete("prefix:key", messageIds, CommandFlags.None); } [Fact] public void StreamDeleteConsumer() { prefixed.StreamDeleteConsumer("key", "group", "consumer", CommandFlags.None); - mock.Verify(_ => _.StreamDeleteConsumer("prefix:key", "group", "consumer", CommandFlags.None)); + mock.Received().StreamDeleteConsumer("prefix:key", "group", "consumer", CommandFlags.None); } [Fact] public void StreamDeleteConsumerGroup() { prefixed.StreamDeleteConsumerGroup("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamDeleteConsumerGroup("prefix:key", "group", CommandFlags.None)); + mock.Received().StreamDeleteConsumerGroup("prefix:key", "group", CommandFlags.None); } [Fact] public void StreamPendingInfoGet() { prefixed.StreamPending("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamPending("prefix:key", "group", CommandFlags.None)); + mock.Received().StreamPending("prefix:key", "group", CommandFlags.None); } [Fact] public void StreamPendingMessageInfoGet() { prefixed.StreamPendingMessages("key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None); - mock.Verify(_ => _.StreamPendingMessages("prefix:key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None)); + mock.Received().StreamPendingMessages("prefix:key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None); } [Fact] public void StreamRange() { prefixed.StreamRange("key", "-", "+", null, Order.Ascending, CommandFlags.None); - mock.Verify(_ => _.StreamRange("prefix:key", "-", "+", null, Order.Ascending, CommandFlags.None)); + mock.Received().StreamRange("prefix:key", "-", "+", null, Order.Ascending, CommandFlags.None); } [Fact] @@ -1155,21 +1156,21 @@ public void StreamRead_1() { var streamPositions = Array.Empty(); prefixed.StreamRead(streamPositions, null, CommandFlags.None); - mock.Verify(_ => _.StreamRead(streamPositions, null, CommandFlags.None)); + mock.Received().StreamRead(streamPositions, null, CommandFlags.None); } [Fact] public void StreamRead_2() { prefixed.StreamRead("key", "0-0", null, CommandFlags.None); - mock.Verify(_ => _.StreamRead("prefix:key", "0-0", null, CommandFlags.None)); + mock.Received().StreamRead("prefix:key", "0-0", null, CommandFlags.None); } [Fact] public void StreamStreamReadGroup_1() { prefixed.StreamReadGroup("key", "group", "consumer", "0-0", 10, false, CommandFlags.None); - mock.Verify(_ => _.StreamReadGroup("prefix:key", "group", "consumer", "0-0", 10, false, CommandFlags.None)); + mock.Received().StreamReadGroup("prefix:key", "group", "consumer", "0-0", 10, false, CommandFlags.None); } [Fact] @@ -1177,151 +1178,151 @@ public void StreamStreamReadGroup_2() { var streamPositions = Array.Empty(); prefixed.StreamReadGroup(streamPositions, "group", "consumer", 10, false, CommandFlags.None); - mock.Verify(_ => _.StreamReadGroup(streamPositions, "group", "consumer", 10, false, CommandFlags.None)); + mock.Received().StreamReadGroup(streamPositions, "group", "consumer", 10, false, CommandFlags.None); } [Fact] public void StreamTrim() { prefixed.StreamTrim("key", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamTrim("prefix:key", 1000, true, CommandFlags.None)); + mock.Received().StreamTrim("prefix:key", 1000, true, CommandFlags.None); } [Fact] public void StringAppend() { prefixed.StringAppend("key", "value", CommandFlags.None); - mock.Verify(_ => _.StringAppend("prefix:key", "value", CommandFlags.None)); + mock.Received().StringAppend("prefix:key", "value", CommandFlags.None); } [Fact] public void StringBitCount() { prefixed.StringBitCount("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringBitCount("prefix:key", 123, 456, CommandFlags.None)); + mock.Received().StringBitCount("prefix:key", 123, 456, CommandFlags.None); } [Fact] public void StringBitCount_2() { prefixed.StringBitCount("key", 123, 456, StringIndexType.Byte, CommandFlags.None); - mock.Verify(_ => _.StringBitCount("prefix:key", 123, 456, StringIndexType.Byte, CommandFlags.None)); + mock.Received().StringBitCount("prefix:key", 123, 456, StringIndexType.Byte, CommandFlags.None); } [Fact] public void StringBitOperation_1() { prefixed.StringBitOperation(Bitwise.Xor, "destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.StringBitOperation(Bitwise.Xor, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + mock.Received().StringBitOperation(Bitwise.Xor, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] public void StringBitOperation_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.StringBitOperation(Bitwise.Xor, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.StringBitOperation(Bitwise.Xor, "prefix:destination", It.Is(valid), CommandFlags.None)); + mock.Received().StringBitOperation(Bitwise.Xor, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] public void StringBitPosition() { prefixed.StringBitPosition("key", true, 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringBitPosition("prefix:key", true, 123, 456, CommandFlags.None)); + mock.Received().StringBitPosition("prefix:key", true, 123, 456, CommandFlags.None); } [Fact] public void StringBitPosition_2() { prefixed.StringBitPosition("key", true, 123, 456, StringIndexType.Byte, CommandFlags.None); - mock.Verify(_ => _.StringBitPosition("prefix:key", true, 123, 456, StringIndexType.Byte, CommandFlags.None)); + mock.Received().StringBitPosition("prefix:key", true, 123, 456, StringIndexType.Byte, CommandFlags.None); } [Fact] public void StringDecrement_1() { prefixed.StringDecrement("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringDecrement("prefix:key", 123, CommandFlags.None)); + mock.Received().StringDecrement("prefix:key", 123, CommandFlags.None); } [Fact] public void StringDecrement_2() { prefixed.StringDecrement("key", 1.23, CommandFlags.None); - mock.Verify(_ => _.StringDecrement("prefix:key", 1.23, CommandFlags.None)); + mock.Received().StringDecrement("prefix:key", 1.23, CommandFlags.None); } [Fact] public void StringGet_1() { prefixed.StringGet("key", CommandFlags.None); - mock.Verify(_ => _.StringGet("prefix:key", CommandFlags.None)); + mock.Received().StringGet("prefix:key", CommandFlags.None); } [Fact] public void StringGet_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; prefixed.StringGet(keys, CommandFlags.None); - mock.Verify(_ => _.StringGet(It.Is(valid), CommandFlags.None)); + mock.Received().StringGet(Arg.Is(valid), CommandFlags.None); } [Fact] public void StringGetBit() { prefixed.StringGetBit("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringGetBit("prefix:key", 123, CommandFlags.None)); + mock.Received().StringGetBit("prefix:key", 123, CommandFlags.None); } [Fact] public void StringGetRange() { prefixed.StringGetRange("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringGetRange("prefix:key", 123, 456, CommandFlags.None)); + mock.Received().StringGetRange("prefix:key", 123, 456, CommandFlags.None); } [Fact] public void StringGetSet() { prefixed.StringGetSet("key", "value", CommandFlags.None); - mock.Verify(_ => _.StringGetSet("prefix:key", "value", CommandFlags.None)); + mock.Received().StringGetSet("prefix:key", "value", CommandFlags.None); } [Fact] public void StringGetDelete() { prefixed.StringGetDelete("key", CommandFlags.None); - mock.Verify(_ => _.StringGetDelete("prefix:key", CommandFlags.None)); + mock.Received().StringGetDelete("prefix:key", CommandFlags.None); } [Fact] public void StringGetWithExpiry() { prefixed.StringGetWithExpiry("key", CommandFlags.None); - mock.Verify(_ => _.StringGetWithExpiry("prefix:key", CommandFlags.None)); + mock.Received().StringGetWithExpiry("prefix:key", CommandFlags.None); } [Fact] public void StringIncrement_1() { prefixed.StringIncrement("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringIncrement("prefix:key", 123, CommandFlags.None)); + mock.Received().StringIncrement("prefix:key", 123, CommandFlags.None); } [Fact] public void StringIncrement_2() { prefixed.StringIncrement("key", 1.23, CommandFlags.None); - mock.Verify(_ => _.StringIncrement("prefix:key", 1.23, CommandFlags.None)); + mock.Received().StringIncrement("prefix:key", 1.23, CommandFlags.None); } [Fact] public void StringLength() { prefixed.StringLength("key", CommandFlags.None); - mock.Verify(_ => _.StringLength("prefix:key", CommandFlags.None)); + mock.Received().StringLength("prefix:key", CommandFlags.None); } [Fact] @@ -1329,7 +1330,7 @@ public void StringSet_1() { TimeSpan expiry = TimeSpan.FromSeconds(123); prefixed.StringSet("key", "value", expiry, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSet("prefix:key", "value", expiry, When.Exists, CommandFlags.None)); + mock.Received().StringSet("prefix:key", "value", expiry, When.Exists, CommandFlags.None); } [Fact] @@ -1337,16 +1338,16 @@ public void StringSet_2() { TimeSpan? expiry = null; prefixed.StringSet("key", "value", expiry, true, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSet("prefix:key", "value", expiry, true, When.Exists, CommandFlags.None)); + mock.Received().StringSet("prefix:key", "value", expiry, true, When.Exists, CommandFlags.None); } [Fact] public void StringSet_3() { KeyValuePair[] values = new KeyValuePair[] { new KeyValuePair("a", "x"), new KeyValuePair("b", "y") }; - Expression[], bool>> valid = _ => _.Length == 2 && _[0].Key == "prefix:a" && _[0].Value == "x" && _[1].Key == "prefix:b" && _[1].Value == "y"; + Expression[]>> valid = _ => _.Length == 2 && _[0].Key == "prefix:a" && _[0].Value == "x" && _[1].Key == "prefix:b" && _[1].Value == "y"; prefixed.StringSet(values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSet(It.Is(valid), When.Exists, CommandFlags.None)); + mock.Received().StringSet(Arg.Is(valid), When.Exists, CommandFlags.None); } [Fact] @@ -1354,20 +1355,20 @@ public void StringSet_Compat() { TimeSpan? expiry = null; prefixed.StringSet("key", "value", expiry, When.Exists); - mock.Verify(_ => _.StringSet("prefix:key", "value", expiry, When.Exists)); + mock.Received().StringSet("prefix:key", "value", expiry, When.Exists); } [Fact] public void StringSetBit() { prefixed.StringSetBit("key", 123, true, CommandFlags.None); - mock.Verify(_ => _.StringSetBit("prefix:key", 123, true, CommandFlags.None)); + mock.Received().StringSetBit("prefix:key", 123, true, CommandFlags.None); } [Fact] public void StringSetRange() { prefixed.StringSetRange("key", 123, "value", CommandFlags.None); - mock.Verify(_ => _.StringSetRange("prefix:key", 123, "value", CommandFlags.None)); + mock.Received().StringSetRange("prefix:key", 123, "value", CommandFlags.None); } } diff --git a/tests/StackExchange.Redis.Tests/KeyPrefixedTests.cs b/tests/StackExchange.Redis.Tests/KeyPrefixedTests.cs index 2d6b53390..8cbe7ad7f 100644 --- a/tests/StackExchange.Redis.Tests/KeyPrefixedTests.cs +++ b/tests/StackExchange.Redis.Tests/KeyPrefixedTests.cs @@ -3,309 +3,309 @@ using System.Linq.Expressions; using System.Net; using System.Text; -using Moq; +using NSubstitute; using StackExchange.Redis.KeyspaceIsolation; using Xunit; using System.Threading.Tasks; namespace StackExchange.Redis.Tests { - [Collection(nameof(MoqDependentCollection))] + [Collection(nameof(SubstituteDependentCollection))] public sealed class KeyPrefixedTests { - private readonly Mock mock; + private readonly IDatabaseAsync mock; private readonly KeyPrefixed prefixed; public KeyPrefixedTests() { - mock = new Mock(); - prefixed = new KeyPrefixed(mock.Object, Encoding.UTF8.GetBytes("prefix:")); + mock = Substitute.For(); + prefixed = new KeyPrefixed(mock, Encoding.UTF8.GetBytes("prefix:")); } [Fact] public async Task DebugObjectAsync() { await prefixed.DebugObjectAsync("key", CommandFlags.None); - mock.Verify(_ => _.DebugObjectAsync("prefix:key", CommandFlags.None)); + await mock.Received().DebugObjectAsync("prefix:key", CommandFlags.None); } [Fact] - public void HashDecrementAsync_1() + public async Task HashDecrementAsync_1() { - prefixed.HashDecrementAsync("key", "hashField", 123, CommandFlags.None); - mock.Verify(_ => _.HashDecrementAsync("prefix:key", "hashField", 123, CommandFlags.None)); + await prefixed.HashDecrementAsync("key", "hashField", 123, CommandFlags.None); + await mock.Received().HashDecrementAsync("prefix:key", "hashField", 123, CommandFlags.None); } [Fact] - public void HashDecrementAsync_2() + public async Task HashDecrementAsync_2() { - prefixed.HashDecrementAsync("key", "hashField", 1.23, CommandFlags.None); - mock.Verify(_ => _.HashDecrementAsync("prefix:key", "hashField", 1.23, CommandFlags.None)); + await prefixed.HashDecrementAsync("key", "hashField", 1.23, CommandFlags.None); + await mock.Received().HashDecrementAsync("prefix:key", "hashField", 1.23, CommandFlags.None); } [Fact] - public void HashDeleteAsync_1() + public async Task HashDeleteAsync_1() { - prefixed.HashDeleteAsync("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashDeleteAsync("prefix:key", "hashField", CommandFlags.None)); + await prefixed.HashDeleteAsync("key", "hashField", CommandFlags.None); + await mock.Received().HashDeleteAsync("prefix:key", "hashField", CommandFlags.None); } [Fact] - public void HashDeleteAsync_2() + public async Task HashDeleteAsync_2() { RedisValue[] hashFields = Array.Empty(); - prefixed.HashDeleteAsync("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashDeleteAsync("prefix:key", hashFields, CommandFlags.None)); + await prefixed.HashDeleteAsync("key", hashFields, CommandFlags.None); + await mock.Received().HashDeleteAsync("prefix:key", hashFields, CommandFlags.None); } [Fact] - public void HashExistsAsync() + public async Task HashExistsAsync() { - prefixed.HashExistsAsync("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashExistsAsync("prefix:key", "hashField", CommandFlags.None)); + await prefixed.HashExistsAsync("key", "hashField", CommandFlags.None); + await mock.Received().HashExistsAsync("prefix:key", "hashField", CommandFlags.None); } [Fact] - public void HashGetAllAsync() + public async Task HashGetAllAsync() { - prefixed.HashGetAllAsync("key", CommandFlags.None); - mock.Verify(_ => _.HashGetAllAsync("prefix:key", CommandFlags.None)); + await prefixed.HashGetAllAsync("key", CommandFlags.None); + await mock.Received().HashGetAllAsync("prefix:key", CommandFlags.None); } [Fact] - public void HashGetAsync_1() + public async Task HashGetAsync_1() { - prefixed.HashGetAsync("key", "hashField", CommandFlags.None); - mock.Verify(_ => _.HashGetAsync("prefix:key", "hashField", CommandFlags.None)); + await prefixed.HashGetAsync("key", "hashField", CommandFlags.None); + await mock.Received().HashGetAsync("prefix:key", "hashField", CommandFlags.None); } [Fact] - public void HashGetAsync_2() + public async Task HashGetAsync_2() { RedisValue[] hashFields = Array.Empty(); - prefixed.HashGetAsync("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashGetAsync("prefix:key", hashFields, CommandFlags.None)); + await prefixed.HashGetAsync("key", hashFields, CommandFlags.None); + await mock.Received().HashGetAsync("prefix:key", hashFields, CommandFlags.None); } [Fact] - public void HashIncrementAsync_1() + public async Task HashIncrementAsync_1() { - prefixed.HashIncrementAsync("key", "hashField", 123, CommandFlags.None); - mock.Verify(_ => _.HashIncrementAsync("prefix:key", "hashField", 123, CommandFlags.None)); + await prefixed.HashIncrementAsync("key", "hashField", 123, CommandFlags.None); + await mock.Received().HashIncrementAsync("prefix:key", "hashField", 123, CommandFlags.None); } [Fact] - public void HashIncrementAsync_2() + public async Task HashIncrementAsync_2() { - prefixed.HashIncrementAsync("key", "hashField", 1.23, CommandFlags.None); - mock.Verify(_ => _.HashIncrementAsync("prefix:key", "hashField", 1.23, CommandFlags.None)); + await prefixed.HashIncrementAsync("key", "hashField", 1.23, CommandFlags.None); + await mock.Received().HashIncrementAsync("prefix:key", "hashField", 1.23, CommandFlags.None); } [Fact] - public void HashKeysAsync() + public async Task HashKeysAsync() { - prefixed.HashKeysAsync("key", CommandFlags.None); - mock.Verify(_ => _.HashKeysAsync("prefix:key", CommandFlags.None)); + await prefixed.HashKeysAsync("key", CommandFlags.None); + await mock.Received().HashKeysAsync("prefix:key", CommandFlags.None); } [Fact] - public void HashLengthAsync() + public async Task HashLengthAsync() { - prefixed.HashLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.HashLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.HashLengthAsync("key", CommandFlags.None); + await mock.Received().HashLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void HashSetAsync_1() + public async Task HashSetAsync_1() { HashEntry[] hashFields = Array.Empty(); - prefixed.HashSetAsync("key", hashFields, CommandFlags.None); - mock.Verify(_ => _.HashSetAsync("prefix:key", hashFields, CommandFlags.None)); + await prefixed.HashSetAsync("key", hashFields, CommandFlags.None); + await mock.Received().HashSetAsync("prefix:key", hashFields, CommandFlags.None); } [Fact] - public void HashSetAsync_2() + public async Task HashSetAsync_2() { - prefixed.HashSetAsync("key", "hashField", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.HashSetAsync("prefix:key", "hashField", "value", When.Exists, CommandFlags.None)); + await prefixed.HashSetAsync("key", "hashField", "value", When.Exists, CommandFlags.None); + await mock.Received().HashSetAsync("prefix:key", "hashField", "value", When.Exists, CommandFlags.None); } [Fact] - public void HashStringLengthAsync() + public async Task HashStringLengthAsync() { - prefixed.HashStringLengthAsync("key","field", CommandFlags.None); - mock.Verify(_ => _.HashStringLengthAsync("prefix:key", "field", CommandFlags.None)); + await prefixed.HashStringLengthAsync("key","field", CommandFlags.None); + await mock.Received().HashStringLengthAsync("prefix:key", "field", CommandFlags.None); } [Fact] - public void HashValuesAsync() + public async Task HashValuesAsync() { - prefixed.HashValuesAsync("key", CommandFlags.None); - mock.Verify(_ => _.HashValuesAsync("prefix:key", CommandFlags.None)); + await prefixed.HashValuesAsync("key", CommandFlags.None); + await mock.Received().HashValuesAsync("prefix:key", CommandFlags.None); } [Fact] - public void HyperLogLogAddAsync_1() + public async Task HyperLogLogAddAsync_1() { - prefixed.HyperLogLogAddAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogAddAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.HyperLogLogAddAsync("key", "value", CommandFlags.None); + await mock.Received().HyperLogLogAddAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void HyperLogLogAddAsync_2() + public async Task HyperLogLogAddAsync_2() { var values = Array.Empty(); - prefixed.HyperLogLogAddAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.HyperLogLogAddAsync("prefix:key", values, CommandFlags.None)); + await prefixed.HyperLogLogAddAsync("key", values, CommandFlags.None); + await mock.Received().HyperLogLogAddAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void HyperLogLogLengthAsync() + public async Task HyperLogLogLengthAsync() { - prefixed.HyperLogLogLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.HyperLogLogLengthAsync("key", CommandFlags.None); + await mock.Received().HyperLogLogLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void HyperLogLogMergeAsync_1() + public async Task HyperLogLogMergeAsync_1() { - prefixed.HyperLogLogMergeAsync("destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.HyperLogLogMergeAsync("prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + await prefixed.HyperLogLogMergeAsync("destination", "first", "second", CommandFlags.None); + await mock.Received().HyperLogLogMergeAsync("prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] - public void HyperLogLogMergeAsync_2() + public async Task HyperLogLogMergeAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.HyperLogLogMergeAsync("destination", keys, CommandFlags.None); - mock.Verify(_ => _.HyperLogLogMergeAsync("prefix:destination", It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.HyperLogLogMergeAsync("destination", keys, CommandFlags.None); + await mock.Received().HyperLogLogMergeAsync("prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] - public void IdentifyEndpointAsync() + public async Task IdentifyEndpointAsync() { - prefixed.IdentifyEndpointAsync("key", CommandFlags.None); - mock.Verify(_ => _.IdentifyEndpointAsync("prefix:key", CommandFlags.None)); + await prefixed.IdentifyEndpointAsync("key", CommandFlags.None); + await mock.Received().IdentifyEndpointAsync("prefix:key", CommandFlags.None); } [Fact] public void IsConnected() { prefixed.IsConnected("key", CommandFlags.None); - mock.Verify(_ => _.IsConnected("prefix:key", CommandFlags.None)); + mock.Received().IsConnected("prefix:key", CommandFlags.None); } [Fact] - public void KeyCopyAsync() + public async Task KeyCopyAsync() { - prefixed.KeyCopyAsync("key", "destination", flags: CommandFlags.None); - mock.Verify(_ => _.KeyCopyAsync("prefix:key", "prefix:destination", -1, false, CommandFlags.None)); + await prefixed.KeyCopyAsync("key", "destination", flags: CommandFlags.None); + await mock.Received().KeyCopyAsync("prefix:key", "prefix:destination", -1, false, CommandFlags.None); } [Fact] - public void KeyDeleteAsync_1() + public async Task KeyDeleteAsync_1() { - prefixed.KeyDeleteAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyDeleteAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyDeleteAsync("key", CommandFlags.None); + await mock.Received().KeyDeleteAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyDeleteAsync_2() + public async Task KeyDeleteAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.KeyDeleteAsync(keys, CommandFlags.None); - mock.Verify(_ => _.KeyDeleteAsync(It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.KeyDeleteAsync(keys, CommandFlags.None); + await mock.Received().KeyDeleteAsync(Arg.Is(valid), CommandFlags.None); } [Fact] - public void KeyDumpAsync() + public async Task KeyDumpAsync() { - prefixed.KeyDumpAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyDumpAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyDumpAsync("key", CommandFlags.None); + await mock.Received().KeyDumpAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyEncodingAsync() + public async Task KeyEncodingAsync() { - prefixed.KeyEncodingAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyEncodingAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyEncodingAsync("key", CommandFlags.None); + await mock.Received().KeyEncodingAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyExistsAsync() + public async Task KeyExistsAsync() { - prefixed.KeyExistsAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyExistsAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyExistsAsync("key", CommandFlags.None); + await mock.Received().KeyExistsAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyExpireAsync_1() + public async Task KeyExpireAsync_1() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.KeyExpireAsync("key", expiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpireAsync("prefix:key", expiry, CommandFlags.None)); + await prefixed.KeyExpireAsync("key", expiry, CommandFlags.None); + await mock.Received().KeyExpireAsync("prefix:key", expiry, CommandFlags.None); } [Fact] - public void KeyExpireAsync_2() + public async Task KeyExpireAsync_2() { DateTime expiry = DateTime.Now; - prefixed.KeyExpireAsync("key", expiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpireAsync("prefix:key", expiry, CommandFlags.None)); + await prefixed.KeyExpireAsync("key", expiry, CommandFlags.None); + await mock.Received().KeyExpireAsync("prefix:key", expiry, CommandFlags.None); } [Fact] - public void KeyExpireAsync_3() + public async Task KeyExpireAsync_3() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.KeyExpireAsync("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpireAsync("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None)); + await prefixed.KeyExpireAsync("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); + await mock.Received().KeyExpireAsync("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); } [Fact] - public void KeyExpireAsync_4() + public async Task KeyExpireAsync_4() { DateTime expiry = DateTime.Now; - prefixed.KeyExpireAsync("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); - mock.Verify(_ => _.KeyExpireAsync("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None)); + await prefixed.KeyExpireAsync("key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); + await mock.Received().KeyExpireAsync("prefix:key", expiry, ExpireWhen.HasNoExpiry, CommandFlags.None); } [Fact] - public void KeyExpireTimeAsync() + public async Task KeyExpireTimeAsync() { - prefixed.KeyExpireTimeAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyExpireTimeAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyExpireTimeAsync("key", CommandFlags.None); + await mock.Received().KeyExpireTimeAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyFrequencyAsync() + public async Task KeyFrequencyAsync() { - prefixed.KeyFrequencyAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyFrequencyAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyFrequencyAsync("key", CommandFlags.None); + await mock.Received().KeyFrequencyAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyMigrateAsync() + public async Task KeyMigrateAsync() { EndPoint toServer = new IPEndPoint(IPAddress.Loopback, 123); - prefixed.KeyMigrateAsync("key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None); - mock.Verify(_ => _.KeyMigrateAsync("prefix:key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None)); + await prefixed.KeyMigrateAsync("key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None); + await mock.Received().KeyMigrateAsync("prefix:key", toServer, 123, 456, MigrateOptions.Copy, CommandFlags.None); } [Fact] - public void KeyMoveAsync() + public async Task KeyMoveAsync() { - prefixed.KeyMoveAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.KeyMoveAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.KeyMoveAsync("key", 123, CommandFlags.None); + await mock.Received().KeyMoveAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void KeyPersistAsync() + public async Task KeyPersistAsync() { - prefixed.KeyPersistAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyPersistAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyPersistAsync("key", CommandFlags.None); + await mock.Received().KeyPersistAsync("prefix:key", CommandFlags.None); } [Fact] @@ -315,1006 +315,1007 @@ public Task KeyRandomAsync() } [Fact] - public void KeyRefCountAsync() + public async Task KeyRefCountAsync() { - prefixed.KeyRefCountAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyRefCountAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyRefCountAsync("key", CommandFlags.None); + await mock.Received().KeyRefCountAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyRenameAsync() + public async Task KeyRenameAsync() { - prefixed.KeyRenameAsync("key", "newKey", When.Exists, CommandFlags.None); - mock.Verify(_ => _.KeyRenameAsync("prefix:key", "prefix:newKey", When.Exists, CommandFlags.None)); + await prefixed.KeyRenameAsync("key", "newKey", When.Exists, CommandFlags.None); + await mock.Received().KeyRenameAsync("prefix:key", "prefix:newKey", When.Exists, CommandFlags.None); } [Fact] - public void KeyRestoreAsync() + public async Task KeyRestoreAsync() { byte[] value = Array.Empty(); TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.KeyRestoreAsync("key", value, expiry, CommandFlags.None); - mock.Verify(_ => _.KeyRestoreAsync("prefix:key", value, expiry, CommandFlags.None)); + await prefixed.KeyRestoreAsync("key", value, expiry, CommandFlags.None); + await mock.Received().KeyRestoreAsync("prefix:key", value, expiry, CommandFlags.None); } [Fact] - public void KeyTimeToLiveAsync() + public async Task KeyTimeToLiveAsync() { - prefixed.KeyTimeToLiveAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyTimeToLiveAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyTimeToLiveAsync("key", CommandFlags.None); + await mock.Received().KeyTimeToLiveAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyTypeAsync() + public async Task KeyTypeAsync() { - prefixed.KeyTypeAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyTypeAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyTypeAsync("key", CommandFlags.None); + await mock.Received().KeyTypeAsync("prefix:key", CommandFlags.None); } [Fact] - public void ListGetByIndexAsync() + public async Task ListGetByIndexAsync() { - prefixed.ListGetByIndexAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListGetByIndexAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.ListGetByIndexAsync("key", 123, CommandFlags.None); + await mock.Received().ListGetByIndexAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void ListInsertAfterAsync() + public async Task ListInsertAfterAsync() { - prefixed.ListInsertAfterAsync("key", "pivot", "value", CommandFlags.None); - mock.Verify(_ => _.ListInsertAfterAsync("prefix:key", "pivot", "value", CommandFlags.None)); + await prefixed.ListInsertAfterAsync("key", "pivot", "value", CommandFlags.None); + await mock.Received().ListInsertAfterAsync("prefix:key", "pivot", "value", CommandFlags.None); } [Fact] - public void ListInsertBeforeAsync() + public async Task ListInsertBeforeAsync() { - prefixed.ListInsertBeforeAsync("key", "pivot", "value", CommandFlags.None); - mock.Verify(_ => _.ListInsertBeforeAsync("prefix:key", "pivot", "value", CommandFlags.None)); + await prefixed.ListInsertBeforeAsync("key", "pivot", "value", CommandFlags.None); + await mock.Received().ListInsertBeforeAsync("prefix:key", "pivot", "value", CommandFlags.None); } [Fact] - public void ListLeftPopAsync() + public async Task ListLeftPopAsync() { - prefixed.ListLeftPopAsync("key", CommandFlags.None); - mock.Verify(_ => _.ListLeftPopAsync("prefix:key", CommandFlags.None)); + await prefixed.ListLeftPopAsync("key", CommandFlags.None); + await mock.Received().ListLeftPopAsync("prefix:key", CommandFlags.None); } [Fact] - public void ListLeftPopAsync_1() + public async Task ListLeftPopAsync_1() { - prefixed.ListLeftPopAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListLeftPopAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.ListLeftPopAsync("key", 123, CommandFlags.None); + await mock.Received().ListLeftPopAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void ListLeftPushAsync_1() + public async Task ListLeftPushAsync_1() { - prefixed.ListLeftPushAsync("key", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListLeftPushAsync("prefix:key", "value", When.Exists, CommandFlags.None)); + await prefixed.ListLeftPushAsync("key", "value", When.Exists, CommandFlags.None); + await mock.Received().ListLeftPushAsync("prefix:key", "value", When.Exists, CommandFlags.None); } [Fact] - public void ListLeftPushAsync_2() + public async Task ListLeftPushAsync_2() { RedisValue[] values = Array.Empty(); - prefixed.ListLeftPushAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.ListLeftPushAsync("prefix:key", values, CommandFlags.None)); + await prefixed.ListLeftPushAsync("key", values, CommandFlags.None); + await mock.Received().ListLeftPushAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void ListLeftPushAsync_3() + public async Task ListLeftPushAsync_3() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; - prefixed.ListLeftPushAsync("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListLeftPushAsync("prefix:key", values, When.Exists, CommandFlags.None)); + await prefixed.ListLeftPushAsync("key", values, When.Exists, CommandFlags.None); + await mock.Received().ListLeftPushAsync("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] - public void ListLengthAsync() + public async Task ListLengthAsync() { - prefixed.ListLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.ListLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.ListLengthAsync("key", CommandFlags.None); + await mock.Received().ListLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void ListMoveAsync() + public async Task ListMoveAsync() { - prefixed.ListMoveAsync("key", "destination", ListSide.Left, ListSide.Right, CommandFlags.None); - mock.Verify(_ => _.ListMoveAsync("prefix:key", "prefix:destination", ListSide.Left, ListSide.Right, CommandFlags.None)); + await prefixed.ListMoveAsync("key", "destination", ListSide.Left, ListSide.Right, CommandFlags.None); + await mock.Received().ListMoveAsync("prefix:key", "prefix:destination", ListSide.Left, ListSide.Right, CommandFlags.None); } [Fact] - public void ListRangeAsync() + public async Task ListRangeAsync() { - prefixed.ListRangeAsync("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.ListRangeAsync("prefix:key", 123, 456, CommandFlags.None)); + await prefixed.ListRangeAsync("key", 123, 456, CommandFlags.None); + await mock.Received().ListRangeAsync("prefix:key", 123, 456, CommandFlags.None); } [Fact] - public void ListRemoveAsync() + public async Task ListRemoveAsync() { - prefixed.ListRemoveAsync("key", "value", 123, CommandFlags.None); - mock.Verify(_ => _.ListRemoveAsync("prefix:key", "value", 123, CommandFlags.None)); + await prefixed.ListRemoveAsync("key", "value", 123, CommandFlags.None); + await mock.Received().ListRemoveAsync("prefix:key", "value", 123, CommandFlags.None); } [Fact] - public void ListRightPopAsync() + public async Task ListRightPopAsync() { - prefixed.ListRightPopAsync("key", CommandFlags.None); - mock.Verify(_ => _.ListRightPopAsync("prefix:key", CommandFlags.None)); + await prefixed.ListRightPopAsync("key", CommandFlags.None); + await mock.Received().ListRightPopAsync("prefix:key", CommandFlags.None); } [Fact] - public void ListRightPopAsync_1() + public async Task ListRightPopAsync_1() { - prefixed.ListRightPopAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.ListRightPopAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.ListRightPopAsync("key", 123, CommandFlags.None); + await mock.Received().ListRightPopAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void ListRightPopLeftPushAsync() + public async Task ListRightPopLeftPushAsync() { - prefixed.ListRightPopLeftPushAsync("source", "destination", CommandFlags.None); - mock.Verify(_ => _.ListRightPopLeftPushAsync("prefix:source", "prefix:destination", CommandFlags.None)); + await prefixed.ListRightPopLeftPushAsync("source", "destination", CommandFlags.None); + await mock.Received().ListRightPopLeftPushAsync("prefix:source", "prefix:destination", CommandFlags.None); } [Fact] - public void ListRightPushAsync_1() + public async Task ListRightPushAsync_1() { - prefixed.ListRightPushAsync("key", "value", When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListRightPushAsync("prefix:key", "value", When.Exists, CommandFlags.None)); + await prefixed.ListRightPushAsync("key", "value", When.Exists, CommandFlags.None); + await mock.Received().ListRightPushAsync("prefix:key", "value", When.Exists, CommandFlags.None); } [Fact] - public void ListRightPushAsync_2() + public async Task ListRightPushAsync_2() { RedisValue[] values = Array.Empty(); - prefixed.ListRightPushAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.ListRightPushAsync("prefix:key", values, CommandFlags.None)); + await prefixed.ListRightPushAsync("key", values, CommandFlags.None); + await mock.Received().ListRightPushAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void ListRightPushAsync_3() + public async Task ListRightPushAsync_3() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; - prefixed.ListRightPushAsync("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.ListRightPushAsync("prefix:key", values, When.Exists, CommandFlags.None)); + await prefixed.ListRightPushAsync("key", values, When.Exists, CommandFlags.None); + await mock.Received().ListRightPushAsync("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] - public void ListSetByIndexAsync() + public async Task ListSetByIndexAsync() { - prefixed.ListSetByIndexAsync("key", 123, "value", CommandFlags.None); - mock.Verify(_ => _.ListSetByIndexAsync("prefix:key", 123, "value", CommandFlags.None)); + await prefixed.ListSetByIndexAsync("key", 123, "value", CommandFlags.None); + await mock.Received().ListSetByIndexAsync("prefix:key", 123, "value", CommandFlags.None); } [Fact] - public void ListTrimAsync() + public async Task ListTrimAsync() { - prefixed.ListTrimAsync("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.ListTrimAsync("prefix:key", 123, 456, CommandFlags.None)); + await prefixed.ListTrimAsync("key", 123, 456, CommandFlags.None); + await mock.Received().ListTrimAsync("prefix:key", 123, 456, CommandFlags.None); } [Fact] - public void LockExtendAsync() + public async Task LockExtendAsync() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.LockExtendAsync("key", "value", expiry, CommandFlags.None); - mock.Verify(_ => _.LockExtendAsync("prefix:key", "value", expiry, CommandFlags.None)); + await prefixed.LockExtendAsync("key", "value", expiry, CommandFlags.None); + await mock.Received().LockExtendAsync("prefix:key", "value", expiry, CommandFlags.None); } [Fact] - public void LockQueryAsync() + public async Task LockQueryAsync() { - prefixed.LockQueryAsync("key", CommandFlags.None); - mock.Verify(_ => _.LockQueryAsync("prefix:key", CommandFlags.None)); + await prefixed.LockQueryAsync("key", CommandFlags.None); + await mock.Received().LockQueryAsync("prefix:key", CommandFlags.None); } [Fact] - public void LockReleaseAsync() + public async Task LockReleaseAsync() { - prefixed.LockReleaseAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.LockReleaseAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.LockReleaseAsync("key", "value", CommandFlags.None); + await mock.Received().LockReleaseAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void LockTakeAsync() + public async Task LockTakeAsync() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.LockTakeAsync("key", "value", expiry, CommandFlags.None); - mock.Verify(_ => _.LockTakeAsync("prefix:key", "value", expiry, CommandFlags.None)); + await prefixed.LockTakeAsync("key", "value", expiry, CommandFlags.None); + await mock.Received().LockTakeAsync("prefix:key", "value", expiry, CommandFlags.None); } [Fact] - public void PublishAsync() + public async Task PublishAsync() { - prefixed.PublishAsync(RedisChannel.Literal("channel"), "message", CommandFlags.None); - mock.Verify(_ => _.PublishAsync(RedisChannel.Literal("prefix:channel"), "message", CommandFlags.None)); + await prefixed.PublishAsync(RedisChannel.Literal("channel"), "message", CommandFlags.None); + await mock.Received().PublishAsync(RedisChannel.Literal("prefix:channel"), "message", CommandFlags.None); } [Fact] - public void ScriptEvaluateAsync_1() + public async Task ScriptEvaluateAsync_1() { byte[] hash = Array.Empty(); RedisValue[] values = Array.Empty(); RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.ScriptEvaluateAsync(hash, keys, values, CommandFlags.None); - mock.Verify(_ => _.ScriptEvaluateAsync(hash, It.Is(valid), values, CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.ScriptEvaluateAsync(hash, keys, values, CommandFlags.None); + await mock.Received().ScriptEvaluateAsync(hash, Arg.Is(valid), values, CommandFlags.None); } [Fact] - public void ScriptEvaluateAsync_2() + public async Task ScriptEvaluateAsync_2() { RedisValue[] values = Array.Empty(); RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.ScriptEvaluateAsync("script", keys, values, CommandFlags.None); - mock.Verify(_ => _.ScriptEvaluateAsync("script", It.Is(valid), values, CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.ScriptEvaluateAsync("script", keys, values, CommandFlags.None); + await mock.Received().ScriptEvaluateAsync("script", Arg.Is(valid), values, CommandFlags.None); } [Fact] - public void SetAddAsync_1() + public async Task SetAddAsync_1() { - prefixed.SetAddAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetAddAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.SetAddAsync("key", "value", CommandFlags.None); + await mock.Received().SetAddAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void SetAddAsync_2() + public async Task SetAddAsync_2() { RedisValue[] values = Array.Empty(); - prefixed.SetAddAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.SetAddAsync("prefix:key", values, CommandFlags.None)); + await prefixed.SetAddAsync("key", values, CommandFlags.None); + await mock.Received().SetAddAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void SetCombineAndStoreAsync_1() + public async Task SetCombineAndStoreAsync_1() { - prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + await prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", "first", "second", CommandFlags.None); + await mock.Received().SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] - public void SetCombineAndStoreAsync_2() + public async Task SetCombineAndStoreAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", keys, CommandFlags.None); + await mock.Received().SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] - public void SetCombineAsync_1() + public async Task SetCombineAsync_1() { - prefixed.SetCombineAsync(SetOperation.Intersect, "first", "second", CommandFlags.None); - mock.Verify(_ => _.SetCombineAsync(SetOperation.Intersect, "prefix:first", "prefix:second", CommandFlags.None)); + await prefixed.SetCombineAsync(SetOperation.Intersect, "first", "second", CommandFlags.None); + await mock.Received().SetCombineAsync(SetOperation.Intersect, "prefix:first", "prefix:second", CommandFlags.None); } [Fact] - public void SetCombineAsync_2() + public async Task SetCombineAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.SetCombineAsync(SetOperation.Intersect, keys, CommandFlags.None); - mock.Verify(_ => _.SetCombineAsync(SetOperation.Intersect, It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.SetCombineAsync(SetOperation.Intersect, keys, CommandFlags.None); + await mock.Received().SetCombineAsync(SetOperation.Intersect, Arg.Is(valid), CommandFlags.None); } [Fact] - public void SetContainsAsync() + public async Task SetContainsAsync() { - prefixed.SetContainsAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetContainsAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.SetContainsAsync("key", "value", CommandFlags.None); + await mock.Received().SetContainsAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void SetContainsAsync_2() + public async Task SetContainsAsync_2() { RedisValue[] values = new RedisValue[] { "value1", "value2" }; - prefixed.SetContainsAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.SetContainsAsync("prefix:key", values, CommandFlags.None)); + await prefixed.SetContainsAsync("key", values, CommandFlags.None); + await mock.Received().SetContainsAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void SetIntersectionLengthAsync() + public async Task SetIntersectionLengthAsync() { var keys = new RedisKey[] { "key1", "key2" }; - prefixed.SetIntersectionLengthAsync(keys); - mock.Verify(_ => _.SetIntersectionLengthAsync(keys, 0, CommandFlags.None)); + await prefixed.SetIntersectionLengthAsync(keys); + await mock.Received().SetIntersectionLengthAsync(keys, 0, CommandFlags.None); } [Fact] - public void SetLengthAsync() + public async Task SetLengthAsync() { - prefixed.SetLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.SetLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.SetLengthAsync("key", CommandFlags.None); + await mock.Received().SetLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void SetMembersAsync() + public async Task SetMembersAsync() { - prefixed.SetMembersAsync("key", CommandFlags.None); - mock.Verify(_ => _.SetMembersAsync("prefix:key", CommandFlags.None)); + await prefixed.SetMembersAsync("key", CommandFlags.None); + await mock.Received().SetMembersAsync("prefix:key", CommandFlags.None); } [Fact] - public void SetMoveAsync() + public async Task SetMoveAsync() { - prefixed.SetMoveAsync("source", "destination", "value", CommandFlags.None); - mock.Verify(_ => _.SetMoveAsync("prefix:source", "prefix:destination", "value", CommandFlags.None)); + await prefixed.SetMoveAsync("source", "destination", "value", CommandFlags.None); + await mock.Received().SetMoveAsync("prefix:source", "prefix:destination", "value", CommandFlags.None); } [Fact] - public void SetPopAsync_1() + public async Task SetPopAsync_1() { - prefixed.SetPopAsync("key", CommandFlags.None); - mock.Verify(_ => _.SetPopAsync("prefix:key", CommandFlags.None)); + await prefixed.SetPopAsync("key", CommandFlags.None); + await mock.Received().SetPopAsync("prefix:key", CommandFlags.None); - prefixed.SetPopAsync("key", 5, CommandFlags.None); - mock.Verify(_ => _.SetPopAsync("prefix:key", 5, CommandFlags.None)); + await prefixed.SetPopAsync("key", 5, CommandFlags.None); + await mock.Received().SetPopAsync("prefix:key", 5, CommandFlags.None); } [Fact] - public void SetPopAsync_2() + public async Task SetPopAsync_2() { - prefixed.SetPopAsync("key", 5, CommandFlags.None); - mock.Verify(_ => _.SetPopAsync("prefix:key", 5, CommandFlags.None)); + await prefixed.SetPopAsync("key", 5, CommandFlags.None); + await mock.Received().SetPopAsync("prefix:key", 5, CommandFlags.None); } [Fact] - public void SetRandomMemberAsync() + public async Task SetRandomMemberAsync() { - prefixed.SetRandomMemberAsync("key", CommandFlags.None); - mock.Verify(_ => _.SetRandomMemberAsync("prefix:key", CommandFlags.None)); + await prefixed.SetRandomMemberAsync("key", CommandFlags.None); + await mock.Received().SetRandomMemberAsync("prefix:key", CommandFlags.None); } [Fact] - public void SetRandomMembersAsync() + public async Task SetRandomMembersAsync() { - prefixed.SetRandomMembersAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.SetRandomMembersAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.SetRandomMembersAsync("key", 123, CommandFlags.None); + await mock.Received().SetRandomMembersAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void SetRemoveAsync_1() + public async Task SetRemoveAsync_1() { - prefixed.SetRemoveAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.SetRemoveAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.SetRemoveAsync("key", "value", CommandFlags.None); + await mock.Received().SetRemoveAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void SetRemoveAsync_2() + public async Task SetRemoveAsync_2() { RedisValue[] values = Array.Empty(); - prefixed.SetRemoveAsync("key", values, CommandFlags.None); - mock.Verify(_ => _.SetRemoveAsync("prefix:key", values, CommandFlags.None)); + await prefixed.SetRemoveAsync("key", values, CommandFlags.None); + await mock.Received().SetRemoveAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void SortAndStoreAsync() + public async Task SortAndStoreAsync() { RedisValue[] get = new RedisValue[] { "a", "#" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; - prefixed.SortAndStoreAsync("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); - prefixed.SortAndStoreAsync("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); + await prefixed.SortAndStoreAsync("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); + await prefixed.SortAndStoreAsync("destination", "key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); - mock.Verify(_ => _.SortAndStoreAsync("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", It.Is(valid), CommandFlags.None)); - mock.Verify(_ => _.SortAndStoreAsync("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", It.Is(valid), CommandFlags.None)); + await mock.Received().SortAndStoreAsync("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", Arg.Is(valid), CommandFlags.None); + await mock.Received().SortAndStoreAsync("prefix:destination", "prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", Arg.Is(valid), CommandFlags.None); } [Fact] - public void SortAsync() + public async Task SortAsync() { RedisValue[] get = new RedisValue[] { "a", "#" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "#"; - prefixed.SortAsync("key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); - prefixed.SortAsync("key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); + await prefixed.SortAsync("key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", get, CommandFlags.None); + await prefixed.SortAsync("key", 123, 456, Order.Descending, SortType.Alphabetic, "by", get, CommandFlags.None); - mock.Verify(_ => _.SortAsync("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", It.Is(valid), CommandFlags.None)); - mock.Verify(_ => _.SortAsync("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", It.Is(valid), CommandFlags.None)); + await mock.Received().SortAsync("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "nosort", Arg.Is(valid), CommandFlags.None); + await mock.Received().SortAsync("prefix:key", 123, 456, Order.Descending, SortType.Alphabetic, "prefix:by", Arg.Is(valid), CommandFlags.None); } [Fact] - public void SortedSetAddAsync_1() + public async Task SortedSetAddAsync_1() { - prefixed.SortedSetAddAsync("key", "member", 1.23, When.Exists, CommandFlags.None); - mock.Verify(_ => _.SortedSetAddAsync("prefix:key", "member", 1.23, When.Exists, CommandFlags.None)); + await prefixed.SortedSetAddAsync("key", "member", 1.23, When.Exists, CommandFlags.None); + await mock.Received().SortedSetAddAsync("prefix:key", "member", 1.23, When.Exists, CommandFlags.None); } [Fact] - public void SortedSetAddAsync_2() + public async Task SortedSetAddAsync_2() { SortedSetEntry[] values = Array.Empty(); - prefixed.SortedSetAddAsync("key", values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.SortedSetAddAsync("prefix:key", values, When.Exists, CommandFlags.None)); + await prefixed.SortedSetAddAsync("key", values, When.Exists, CommandFlags.None); + await mock.Received().SortedSetAddAsync("prefix:key", values, When.Exists, CommandFlags.None); } [Fact] - public void SortedSetAddAsync_3() + public async Task SortedSetAddAsync_3() { SortedSetEntry[] values = Array.Empty(); - prefixed.SortedSetAddAsync("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); - mock.Verify(_ => _.SortedSetAddAsync("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None)); + await prefixed.SortedSetAddAsync("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); + await mock.Received().SortedSetAddAsync("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None); } [Fact] - public void SortedSetCombineAsync() + public async Task SortedSetCombineAsync() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - prefixed.SortedSetCombineAsync(SetOperation.Intersect, keys); - mock.Verify(_ => _.SortedSetCombineAsync(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None)); + await prefixed.SortedSetCombineAsync(SetOperation.Intersect, keys); + await mock.Received().SortedSetCombineAsync(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None); } [Fact] - public void SortedSetCombineWithScoresAsync() + public async Task SortedSetCombineWithScoresAsync() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - prefixed.SortedSetCombineWithScoresAsync(SetOperation.Intersect, keys); - mock.Verify(_ => _.SortedSetCombineWithScoresAsync(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None)); + await prefixed.SortedSetCombineWithScoresAsync(SetOperation.Intersect, keys); + await mock.Received().SortedSetCombineWithScoresAsync(SetOperation.Intersect, keys, null, Aggregate.Sum, CommandFlags.None); } [Fact] - public void SortedSetCombineAndStoreAsync_1() + public async Task SortedSetCombineAndStoreAsync_1() { - prefixed.SortedSetCombineAndStoreAsync(SetOperation.Intersect, "destination", "first", "second", Aggregate.Max, CommandFlags.None); - mock.Verify(_ => _.SortedSetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", Aggregate.Max, CommandFlags.None)); + await prefixed.SortedSetCombineAndStoreAsync(SetOperation.Intersect, "destination", "first", "second", Aggregate.Max, CommandFlags.None); + await mock.Received().SortedSetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", "prefix:first", "prefix:second", Aggregate.Max, CommandFlags.None); } [Fact] - public void SortedSetCombineAndStoreAsync_2() + public async Task SortedSetCombineAndStoreAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.SetCombineAndStoreAsync(SetOperation.Intersect, "destination", keys, CommandFlags.None); + await mock.Received().SetCombineAndStoreAsync(SetOperation.Intersect, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] - public void SortedSetDecrementAsync() + public async Task SortedSetDecrementAsync() { - prefixed.SortedSetDecrementAsync("key", "member", 1.23, CommandFlags.None); - mock.Verify(_ => _.SortedSetDecrementAsync("prefix:key", "member", 1.23, CommandFlags.None)); + await prefixed.SortedSetDecrementAsync("key", "member", 1.23, CommandFlags.None); + await mock.Received().SortedSetDecrementAsync("prefix:key", "member", 1.23, CommandFlags.None); } [Fact] - public void SortedSetIncrementAsync() + public async Task SortedSetIncrementAsync() { - prefixed.SortedSetIncrementAsync("key", "member", 1.23, CommandFlags.None); - mock.Verify(_ => _.SortedSetIncrementAsync("prefix:key", "member", 1.23, CommandFlags.None)); + await prefixed.SortedSetIncrementAsync("key", "member", 1.23, CommandFlags.None); + await mock.Received().SortedSetIncrementAsync("prefix:key", "member", 1.23, CommandFlags.None); } [Fact] - public void SortedSetIntersectionLengthAsync() + public async Task SortedSetIntersectionLengthAsync() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - prefixed.SortedSetIntersectionLengthAsync(keys, 1, CommandFlags.None); - mock.Verify(_ => _.SortedSetIntersectionLengthAsync(keys, 1, CommandFlags.None)); + await prefixed.SortedSetIntersectionLengthAsync(keys, 1, CommandFlags.None); + await mock.Received().SortedSetIntersectionLengthAsync(keys, 1, CommandFlags.None); } [Fact] - public void SortedSetLengthAsync() + public async Task SortedSetLengthAsync() { - prefixed.SortedSetLengthAsync("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetLengthAsync("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None)); + await prefixed.SortedSetLengthAsync("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); + await mock.Received().SortedSetLengthAsync("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None); } [Fact] - public void SortedSetLengthByValueAsync() + public async Task SortedSetLengthByValueAsync() { - prefixed.SortedSetLengthByValueAsync("key", "min", "max", Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetLengthByValueAsync("prefix:key", "min", "max", Exclude.Start, CommandFlags.None)); + await prefixed.SortedSetLengthByValueAsync("key", "min", "max", Exclude.Start, CommandFlags.None); + await mock.Received().SortedSetLengthByValueAsync("prefix:key", "min", "max", Exclude.Start, CommandFlags.None); } [Fact] - public void SortedSetRandomMemberAsync() + public async Task SortedSetRandomMemberAsync() { - prefixed.SortedSetRandomMemberAsync("key", CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMemberAsync("prefix:key", CommandFlags.None)); + await prefixed.SortedSetRandomMemberAsync("key", CommandFlags.None); + await mock.Received().SortedSetRandomMemberAsync("prefix:key", CommandFlags.None); } [Fact] - public void SortedSetRandomMembersAsync() + public async Task SortedSetRandomMembersAsync() { - prefixed.SortedSetRandomMembersAsync("key", 2, CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMembersAsync("prefix:key", 2, CommandFlags.None)); + await prefixed.SortedSetRandomMembersAsync("key", 2, CommandFlags.None); + await mock.Received().SortedSetRandomMembersAsync("prefix:key", 2, CommandFlags.None); } [Fact] - public void SortedSetRandomMemberWithScoresAsync() + public async Task SortedSetRandomMemberWithScoresAsync() { - prefixed.SortedSetRandomMembersWithScoresAsync("key", 2, CommandFlags.None); - mock.Verify(_ => _.SortedSetRandomMembersWithScoresAsync("prefix:key", 2, CommandFlags.None)); + await prefixed.SortedSetRandomMembersWithScoresAsync("key", 2, CommandFlags.None); + await mock.Received().SortedSetRandomMembersWithScoresAsync("prefix:key", 2, CommandFlags.None); } [Fact] - public void SortedSetRangeByRankAsync() + public async Task SortedSetRangeByRankAsync() { - prefixed.SortedSetRangeByRankAsync("key", 123, 456, Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByRankAsync("prefix:key", 123, 456, Order.Descending, CommandFlags.None)); + await prefixed.SortedSetRangeByRankAsync("key", 123, 456, Order.Descending, CommandFlags.None); + await mock.Received().SortedSetRangeByRankAsync("prefix:key", 123, 456, Order.Descending, CommandFlags.None); } [Fact] - public void SortedSetRangeByRankWithScoresAsync() + public async Task SortedSetRangeByRankWithScoresAsync() { - prefixed.SortedSetRangeByRankWithScoresAsync("key", 123, 456, Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByRankWithScoresAsync("prefix:key", 123, 456, Order.Descending, CommandFlags.None)); + await prefixed.SortedSetRangeByRankWithScoresAsync("key", 123, 456, Order.Descending, CommandFlags.None); + await mock.Received().SortedSetRangeByRankWithScoresAsync("prefix:key", 123, 456, Order.Descending, CommandFlags.None); } [Fact] - public void SortedSetRangeByScoreAsync() + public async Task SortedSetRangeByScoreAsync() { - prefixed.SortedSetRangeByScoreAsync("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByScoreAsync("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + await prefixed.SortedSetRangeByScoreAsync("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); + await mock.Received().SortedSetRangeByScoreAsync("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] - public void SortedSetRangeByScoreWithScoresAsync() + public async Task SortedSetRangeByScoreWithScoresAsync() { - prefixed.SortedSetRangeByScoreWithScoresAsync("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByScoreWithScoresAsync("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + await prefixed.SortedSetRangeByScoreWithScoresAsync("key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); + await mock.Received().SortedSetRangeByScoreWithScoresAsync("prefix:key", 1.23, 1.23, Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] - public void SortedSetRangeByValueAsync() + public async Task SortedSetRangeByValueAsync() { - prefixed.SortedSetRangeByValueAsync("key", "min", "max", Exclude.Start, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, Order.Ascending, 123, 456, CommandFlags.None)); + await prefixed.SortedSetRangeByValueAsync("key", "min", "max", Exclude.Start, 123, 456, CommandFlags.None); + await mock.Received().SortedSetRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, Order.Ascending, 123, 456, CommandFlags.None); } [Fact] - public void SortedSetRangeByValueDescAsync() + public async Task SortedSetRangeByValueDescAsync() { - prefixed.SortedSetRangeByValueAsync("key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None)); + await prefixed.SortedSetRangeByValueAsync("key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); + await mock.Received().SortedSetRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, Order.Descending, 123, 456, CommandFlags.None); } [Fact] - public void SortedSetRankAsync() + public async Task SortedSetRankAsync() { - prefixed.SortedSetRankAsync("key", "member", Order.Descending, CommandFlags.None); - mock.Verify(_ => _.SortedSetRankAsync("prefix:key", "member", Order.Descending, CommandFlags.None)); + await prefixed.SortedSetRankAsync("key", "member", Order.Descending, CommandFlags.None); + await mock.Received().SortedSetRankAsync("prefix:key", "member", Order.Descending, CommandFlags.None); } [Fact] - public void SortedSetRemoveAsync_1() + public async Task SortedSetRemoveAsync_1() { - prefixed.SortedSetRemoveAsync("key", "member", CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveAsync("prefix:key", "member", CommandFlags.None)); + await prefixed.SortedSetRemoveAsync("key", "member", CommandFlags.None); + await mock.Received().SortedSetRemoveAsync("prefix:key", "member", CommandFlags.None); } [Fact] - public void SortedSetRemoveAsync_2() + public async Task SortedSetRemoveAsync_2() { RedisValue[] members = Array.Empty(); - prefixed.SortedSetRemoveAsync("key", members, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveAsync("prefix:key", members, CommandFlags.None)); + await prefixed.SortedSetRemoveAsync("key", members, CommandFlags.None); + await mock.Received().SortedSetRemoveAsync("prefix:key", members, CommandFlags.None); } [Fact] - public void SortedSetRemoveRangeByRankAsync() + public async Task SortedSetRemoveRangeByRankAsync() { - prefixed.SortedSetRemoveRangeByRankAsync("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByRankAsync("prefix:key", 123, 456, CommandFlags.None)); + await prefixed.SortedSetRemoveRangeByRankAsync("key", 123, 456, CommandFlags.None); + await mock.Received().SortedSetRemoveRangeByRankAsync("prefix:key", 123, 456, CommandFlags.None); } [Fact] - public void SortedSetRemoveRangeByScoreAsync() + public async Task SortedSetRemoveRangeByScoreAsync() { - prefixed.SortedSetRemoveRangeByScoreAsync("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByScoreAsync("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None)); + await prefixed.SortedSetRemoveRangeByScoreAsync("key", 1.23, 1.23, Exclude.Start, CommandFlags.None); + await mock.Received().SortedSetRemoveRangeByScoreAsync("prefix:key", 1.23, 1.23, Exclude.Start, CommandFlags.None); } [Fact] - public void SortedSetRemoveRangeByValueAsync() + public async Task SortedSetRemoveRangeByValueAsync() { - prefixed.SortedSetRemoveRangeByValueAsync("key", "min", "max", Exclude.Start, CommandFlags.None); - mock.Verify(_ => _.SortedSetRemoveRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, CommandFlags.None)); + await prefixed.SortedSetRemoveRangeByValueAsync("key", "min", "max", Exclude.Start, CommandFlags.None); + await mock.Received().SortedSetRemoveRangeByValueAsync("prefix:key", "min", "max", Exclude.Start, CommandFlags.None); } [Fact] - public void SortedSetScoreAsync() + public async Task SortedSetScoreAsync() { - prefixed.SortedSetScoreAsync("key", "member", CommandFlags.None); - mock.Verify(_ => _.SortedSetScoreAsync("prefix:key", "member", CommandFlags.None)); + await prefixed.SortedSetScoreAsync("key", "member", CommandFlags.None); + await mock.Received().SortedSetScoreAsync("prefix:key", "member", CommandFlags.None); } [Fact] - public void SortedSetScoreAsync_Multiple() + public async Task SortedSetScoreAsync_Multiple() { - prefixed.SortedSetScoresAsync("key", new RedisValue[] { "member1", "member2" }, CommandFlags.None); - mock.Verify(_ => _.SortedSetScoresAsync("prefix:key", new RedisValue[] { "member1", "member2" }, CommandFlags.None)); + var values = new RedisValue[] { "member1", "member2" }; + await prefixed.SortedSetScoresAsync("key", values, CommandFlags.None); + await mock.Received().SortedSetScoresAsync("prefix:key", values, CommandFlags.None); } [Fact] - public void SortedSetUpdateAsync() + public async Task SortedSetUpdateAsync() { SortedSetEntry[] values = Array.Empty(); - prefixed.SortedSetUpdateAsync("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); - mock.Verify(_ => _.SortedSetUpdateAsync("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None)); + await prefixed.SortedSetUpdateAsync("key", values, SortedSetWhen.GreaterThan, CommandFlags.None); + await mock.Received().SortedSetUpdateAsync("prefix:key", values, SortedSetWhen.GreaterThan, CommandFlags.None); } [Fact] - public void StreamAcknowledgeAsync_1() + public async Task StreamAcknowledgeAsync_1() { - prefixed.StreamAcknowledgeAsync("key", "group", "0-0", CommandFlags.None); - mock.Verify(_ => _.StreamAcknowledgeAsync("prefix:key", "group", "0-0", CommandFlags.None)); + await prefixed.StreamAcknowledgeAsync("key", "group", "0-0", CommandFlags.None); + await mock.Received().StreamAcknowledgeAsync("prefix:key", "group", "0-0", CommandFlags.None); } [Fact] - public void StreamAcknowledgeAsync_2() + public async Task StreamAcknowledgeAsync_2() { var messageIds = new RedisValue[] { "0-0", "0-1", "0-2" }; - prefixed.StreamAcknowledgeAsync("key", "group", messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamAcknowledgeAsync("prefix:key", "group", messageIds, CommandFlags.None)); + await prefixed.StreamAcknowledgeAsync("key", "group", messageIds, CommandFlags.None); + await mock.Received().StreamAcknowledgeAsync("prefix:key", "group", messageIds, CommandFlags.None); } [Fact] - public void StreamAddAsync_1() + public async Task StreamAddAsync_1() { - prefixed.StreamAddAsync("key", "field1", "value1", "*", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamAddAsync("prefix:key", "field1", "value1", "*", 1000, true, CommandFlags.None)); + await prefixed.StreamAddAsync("key", "field1", "value1", "*", 1000, true, CommandFlags.None); + await mock.Received().StreamAddAsync("prefix:key", "field1", "value1", "*", 1000, true, CommandFlags.None); } [Fact] - public void StreamAddAsync_2() + public async Task StreamAddAsync_2() { var fields = Array.Empty(); - prefixed.StreamAddAsync("key", fields, "*", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamAddAsync("prefix:key", fields, "*", 1000, true, CommandFlags.None)); + await prefixed.StreamAddAsync("key", fields, "*", 1000, true, CommandFlags.None); + await mock.Received().StreamAddAsync("prefix:key", fields, "*", 1000, true, CommandFlags.None); } [Fact] - public void StreamAutoClaimAsync() + public async Task StreamAutoClaimAsync() { - prefixed.StreamAutoClaimAsync("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); - mock.Verify(_ => _.StreamAutoClaimAsync("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None)); + await prefixed.StreamAutoClaimAsync("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); + await mock.Received().StreamAutoClaimAsync("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); } [Fact] - public void StreamAutoClaimIdsOnlyAsync() + public async Task StreamAutoClaimIdsOnlyAsync() { - prefixed.StreamAutoClaimIdsOnlyAsync("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); - mock.Verify(_ => _.StreamAutoClaimIdsOnlyAsync("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None)); + await prefixed.StreamAutoClaimIdsOnlyAsync("key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); + await mock.Received().StreamAutoClaimIdsOnlyAsync("prefix:key", "group", "consumer", 0, "0-0", 100, CommandFlags.None); } [Fact] - public void StreamClaimMessagesAsync() + public async Task StreamClaimMessagesAsync() { var messageIds = Array.Empty(); - prefixed.StreamClaimAsync("key", "group", "consumer", 1000, messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamClaimAsync("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None)); + await prefixed.StreamClaimAsync("key", "group", "consumer", 1000, messageIds, CommandFlags.None); + await mock.Received().StreamClaimAsync("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None); } [Fact] - public void StreamClaimMessagesReturningIdsAsync() + public async Task StreamClaimMessagesReturningIdsAsync() { var messageIds = Array.Empty(); - prefixed.StreamClaimIdsOnlyAsync("key", "group", "consumer", 1000, messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamClaimIdsOnlyAsync("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None)); + await prefixed.StreamClaimIdsOnlyAsync("key", "group", "consumer", 1000, messageIds, CommandFlags.None); + await mock.Received().StreamClaimIdsOnlyAsync("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.None); } [Fact] - public void StreamConsumerInfoGetAsync() + public async Task StreamConsumerInfoGetAsync() { - prefixed.StreamConsumerInfoAsync("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamConsumerInfoAsync("prefix:key", "group", CommandFlags.None)); + await prefixed.StreamConsumerInfoAsync("key", "group", CommandFlags.None); + await mock.Received().StreamConsumerInfoAsync("prefix:key", "group", CommandFlags.None); } [Fact] - public void StreamConsumerGroupSetPositionAsync() + public async Task StreamConsumerGroupSetPositionAsync() { - prefixed.StreamConsumerGroupSetPositionAsync("key", "group", StreamPosition.Beginning, CommandFlags.None); - mock.Verify(_ => _.StreamConsumerGroupSetPositionAsync("prefix:key", "group", StreamPosition.Beginning, CommandFlags.None)); + await prefixed.StreamConsumerGroupSetPositionAsync("key", "group", StreamPosition.Beginning, CommandFlags.None); + await mock.Received().StreamConsumerGroupSetPositionAsync("prefix:key", "group", StreamPosition.Beginning, CommandFlags.None); } [Fact] - public void StreamCreateConsumerGroupAsync() + public async Task StreamCreateConsumerGroupAsync() { - prefixed.StreamCreateConsumerGroupAsync("key", "group", "0-0", false, CommandFlags.None); - mock.Verify(_ => _.StreamCreateConsumerGroupAsync("prefix:key", "group", "0-0", false, CommandFlags.None)); + await prefixed.StreamCreateConsumerGroupAsync("key", "group", "0-0", false, CommandFlags.None); + await mock.Received().StreamCreateConsumerGroupAsync("prefix:key", "group", "0-0", false, CommandFlags.None); } [Fact] - public void StreamGroupInfoGetAsync() + public async Task StreamGroupInfoGetAsync() { - prefixed.StreamGroupInfoAsync("key", CommandFlags.None); - mock.Verify(_ => _.StreamGroupInfoAsync("prefix:key", CommandFlags.None)); + await prefixed.StreamGroupInfoAsync("key", CommandFlags.None); + await mock.Received().StreamGroupInfoAsync("prefix:key", CommandFlags.None); } [Fact] - public void StreamInfoGetAsync() + public async Task StreamInfoGetAsync() { - prefixed.StreamInfoAsync("key", CommandFlags.None); - mock.Verify(_ => _.StreamInfoAsync("prefix:key", CommandFlags.None)); + await prefixed.StreamInfoAsync("key", CommandFlags.None); + await mock.Received().StreamInfoAsync("prefix:key", CommandFlags.None); } [Fact] - public void StreamLengthAsync() + public async Task StreamLengthAsync() { - prefixed.StreamLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.StreamLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.StreamLengthAsync("key", CommandFlags.None); + await mock.Received().StreamLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void StreamMessagesDeleteAsync() + public async Task StreamMessagesDeleteAsync() { var messageIds = Array.Empty(); - prefixed.StreamDeleteAsync("key", messageIds, CommandFlags.None); - mock.Verify(_ => _.StreamDeleteAsync("prefix:key", messageIds, CommandFlags.None)); + await prefixed.StreamDeleteAsync("key", messageIds, CommandFlags.None); + await mock.Received().StreamDeleteAsync("prefix:key", messageIds, CommandFlags.None); } [Fact] - public void StreamDeleteConsumerAsync() + public async Task StreamDeleteConsumerAsync() { - prefixed.StreamDeleteConsumerAsync("key", "group", "consumer", CommandFlags.None); - mock.Verify(_ => _.StreamDeleteConsumerAsync("prefix:key", "group", "consumer", CommandFlags.None)); + await prefixed.StreamDeleteConsumerAsync("key", "group", "consumer", CommandFlags.None); + await mock.Received().StreamDeleteConsumerAsync("prefix:key", "group", "consumer", CommandFlags.None); } [Fact] - public void StreamDeleteConsumerGroupAsync() + public async Task StreamDeleteConsumerGroupAsync() { - prefixed.StreamDeleteConsumerGroupAsync("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamDeleteConsumerGroupAsync("prefix:key", "group", CommandFlags.None)); + await prefixed.StreamDeleteConsumerGroupAsync("key", "group", CommandFlags.None); + await mock.Received().StreamDeleteConsumerGroupAsync("prefix:key", "group", CommandFlags.None); } [Fact] - public void StreamPendingInfoGetAsync() + public async Task StreamPendingInfoGetAsync() { - prefixed.StreamPendingAsync("key", "group", CommandFlags.None); - mock.Verify(_ => _.StreamPendingAsync("prefix:key", "group", CommandFlags.None)); + await prefixed.StreamPendingAsync("key", "group", CommandFlags.None); + await mock.Received().StreamPendingAsync("prefix:key", "group", CommandFlags.None); } [Fact] - public void StreamPendingMessageInfoGetAsync() + public async Task StreamPendingMessageInfoGetAsync() { - prefixed.StreamPendingMessagesAsync("key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None); - mock.Verify(_ => _.StreamPendingMessagesAsync("prefix:key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None)); + await prefixed.StreamPendingMessagesAsync("key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None); + await mock.Received().StreamPendingMessagesAsync("prefix:key", "group", 10, RedisValue.Null, "-", "+", CommandFlags.None); } [Fact] - public void StreamRangeAsync() + public async Task StreamRangeAsync() { - prefixed.StreamRangeAsync("key", "-", "+", null, Order.Ascending, CommandFlags.None); - mock.Verify(_ => _.StreamRangeAsync("prefix:key", "-", "+", null, Order.Ascending, CommandFlags.None)); + await prefixed.StreamRangeAsync("key", "-", "+", null, Order.Ascending, CommandFlags.None); + await mock.Received().StreamRangeAsync("prefix:key", "-", "+", null, Order.Ascending, CommandFlags.None); } [Fact] - public void StreamReadAsync_1() + public async Task StreamReadAsync_1() { var streamPositions = Array.Empty(); - prefixed.StreamReadAsync(streamPositions, null, CommandFlags.None); - mock.Verify(_ => _.StreamReadAsync(streamPositions, null, CommandFlags.None)); + await prefixed.StreamReadAsync(streamPositions, null, CommandFlags.None); + await mock.Received().StreamReadAsync(streamPositions, null, CommandFlags.None); } [Fact] - public void StreamReadAsync_2() + public async Task StreamReadAsync_2() { - prefixed.StreamReadAsync("key", "0-0", null, CommandFlags.None); - mock.Verify(_ => _.StreamReadAsync("prefix:key", "0-0", null, CommandFlags.None)); + await prefixed.StreamReadAsync("key", "0-0", null, CommandFlags.None); + await mock.Received().StreamReadAsync("prefix:key", "0-0", null, CommandFlags.None); } [Fact] - public void StreamReadGroupAsync_1() + public async Task StreamReadGroupAsync_1() { - prefixed.StreamReadGroupAsync("key", "group", "consumer", StreamPosition.Beginning, 10, false, CommandFlags.None); - mock.Verify(_ => _.StreamReadGroupAsync("prefix:key", "group", "consumer", StreamPosition.Beginning, 10, false, CommandFlags.None)); + await prefixed.StreamReadGroupAsync("key", "group", "consumer", StreamPosition.Beginning, 10, false, CommandFlags.None); + await mock.Received().StreamReadGroupAsync("prefix:key", "group", "consumer", StreamPosition.Beginning, 10, false, CommandFlags.None); } [Fact] - public void StreamStreamReadGroupAsync_2() + public async Task StreamStreamReadGroupAsync_2() { var streamPositions = Array.Empty(); - prefixed.StreamReadGroupAsync(streamPositions, "group", "consumer", 10, false, CommandFlags.None); - mock.Verify(_ => _.StreamReadGroupAsync(streamPositions, "group", "consumer", 10, false, CommandFlags.None)); + await prefixed.StreamReadGroupAsync(streamPositions, "group", "consumer", 10, false, CommandFlags.None); + await mock.Received().StreamReadGroupAsync(streamPositions, "group", "consumer", 10, false, CommandFlags.None); } [Fact] - public void StreamTrimAsync() + public async Task StreamTrimAsync() { - prefixed.StreamTrimAsync("key", 1000, true, CommandFlags.None); - mock.Verify(_ => _.StreamTrimAsync("prefix:key", 1000, true, CommandFlags.None)); + await prefixed.StreamTrimAsync("key", 1000, true, CommandFlags.None); + await mock.Received().StreamTrimAsync("prefix:key", 1000, true, CommandFlags.None); } [Fact] - public void StringAppendAsync() + public async Task StringAppendAsync() { - prefixed.StringAppendAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.StringAppendAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.StringAppendAsync("key", "value", CommandFlags.None); + await mock.Received().StringAppendAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void StringBitCountAsync() + public async Task StringBitCountAsync() { - prefixed.StringBitCountAsync("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringBitCountAsync("prefix:key", 123, 456, CommandFlags.None)); + await prefixed.StringBitCountAsync("key", 123, 456, CommandFlags.None); + await mock.Received().StringBitCountAsync("prefix:key", 123, 456, CommandFlags.None); } [Fact] - public void StringBitCountAsync_2() + public async Task StringBitCountAsync_2() { - prefixed.StringBitCountAsync("key", 123, 456, StringIndexType.Byte, CommandFlags.None); - mock.Verify(_ => _.StringBitCountAsync("prefix:key", 123, 456, StringIndexType.Byte, CommandFlags.None)); + await prefixed.StringBitCountAsync("key", 123, 456, StringIndexType.Byte, CommandFlags.None); + await mock.Received().StringBitCountAsync("prefix:key", 123, 456, StringIndexType.Byte, CommandFlags.None); } [Fact] - public void StringBitOperationAsync_1() + public async Task StringBitOperationAsync_1() { - prefixed.StringBitOperationAsync(Bitwise.Xor, "destination", "first", "second", CommandFlags.None); - mock.Verify(_ => _.StringBitOperationAsync(Bitwise.Xor, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None)); + await prefixed.StringBitOperationAsync(Bitwise.Xor, "destination", "first", "second", CommandFlags.None); + await mock.Received().StringBitOperationAsync(Bitwise.Xor, "prefix:destination", "prefix:first", "prefix:second", CommandFlags.None); } [Fact] - public void StringBitOperationAsync_2() + public async Task StringBitOperationAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.StringBitOperationAsync(Bitwise.Xor, "destination", keys, CommandFlags.None); - mock.Verify(_ => _.StringBitOperationAsync(Bitwise.Xor, "prefix:destination", It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.StringBitOperationAsync(Bitwise.Xor, "destination", keys, CommandFlags.None); + await mock.Received().StringBitOperationAsync(Bitwise.Xor, "prefix:destination", Arg.Is(valid), CommandFlags.None); } [Fact] - public void StringBitPositionAsync() + public async Task StringBitPositionAsync() { - prefixed.StringBitPositionAsync("key", true, 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringBitPositionAsync("prefix:key", true, 123, 456, CommandFlags.None)); + await prefixed.StringBitPositionAsync("key", true, 123, 456, CommandFlags.None); + await mock.Received().StringBitPositionAsync("prefix:key", true, 123, 456, CommandFlags.None); } [Fact] - public void StringBitPositionAsync_2() + public async Task StringBitPositionAsync_2() { - prefixed.StringBitPositionAsync("key", true, 123, 456, StringIndexType.Byte, CommandFlags.None); - mock.Verify(_ => _.StringBitPositionAsync("prefix:key", true, 123, 456, StringIndexType.Byte, CommandFlags.None)); + await prefixed.StringBitPositionAsync("key", true, 123, 456, StringIndexType.Byte, CommandFlags.None); + await mock.Received().StringBitPositionAsync("prefix:key", true, 123, 456, StringIndexType.Byte, CommandFlags.None); } [Fact] - public void StringDecrementAsync_1() + public async Task StringDecrementAsync_1() { - prefixed.StringDecrementAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringDecrementAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.StringDecrementAsync("key", 123, CommandFlags.None); + await mock.Received().StringDecrementAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void StringDecrementAsync_2() + public async Task StringDecrementAsync_2() { - prefixed.StringDecrementAsync("key", 1.23, CommandFlags.None); - mock.Verify(_ => _.StringDecrementAsync("prefix:key", 1.23, CommandFlags.None)); + await prefixed.StringDecrementAsync("key", 1.23, CommandFlags.None); + await mock.Received().StringDecrementAsync("prefix:key", 1.23, CommandFlags.None); } [Fact] - public void StringGetAsync_1() + public async Task StringGetAsync_1() { - prefixed.StringGetAsync("key", CommandFlags.None); - mock.Verify(_ => _.StringGetAsync("prefix:key", CommandFlags.None)); + await prefixed.StringGetAsync("key", CommandFlags.None); + await mock.Received().StringGetAsync("prefix:key", CommandFlags.None); } [Fact] - public void StringGetAsync_2() + public async Task StringGetAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.StringGetAsync(keys, CommandFlags.None); - mock.Verify(_ => _.StringGetAsync(It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.StringGetAsync(keys, CommandFlags.None); + await mock.Received().StringGetAsync(Arg.Is(valid), CommandFlags.None); } [Fact] - public void StringGetBitAsync() + public async Task StringGetBitAsync() { - prefixed.StringGetBitAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringGetBitAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.StringGetBitAsync("key", 123, CommandFlags.None); + await mock.Received().StringGetBitAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void StringGetRangeAsync() + public async Task StringGetRangeAsync() { - prefixed.StringGetRangeAsync("key", 123, 456, CommandFlags.None); - mock.Verify(_ => _.StringGetRangeAsync("prefix:key", 123, 456, CommandFlags.None)); + await prefixed.StringGetRangeAsync("key", 123, 456, CommandFlags.None); + await mock.Received().StringGetRangeAsync("prefix:key", 123, 456, CommandFlags.None); } [Fact] - public void StringGetSetAsync() + public async Task StringGetSetAsync() { - prefixed.StringGetSetAsync("key", "value", CommandFlags.None); - mock.Verify(_ => _.StringGetSetAsync("prefix:key", "value", CommandFlags.None)); + await prefixed.StringGetSetAsync("key", "value", CommandFlags.None); + await mock.Received().StringGetSetAsync("prefix:key", "value", CommandFlags.None); } [Fact] - public void StringGetDeleteAsync() + public async Task StringGetDeleteAsync() { - prefixed.StringGetDeleteAsync("key", CommandFlags.None); - mock.Verify(_ => _.StringGetDeleteAsync("prefix:key", CommandFlags.None)); + await prefixed.StringGetDeleteAsync("key", CommandFlags.None); + await mock.Received().StringGetDeleteAsync("prefix:key", CommandFlags.None); } [Fact] - public void StringGetWithExpiryAsync() + public async Task StringGetWithExpiryAsync() { - prefixed.StringGetWithExpiryAsync("key", CommandFlags.None); - mock.Verify(_ => _.StringGetWithExpiryAsync("prefix:key", CommandFlags.None)); + await prefixed.StringGetWithExpiryAsync("key", CommandFlags.None); + await mock.Received().StringGetWithExpiryAsync("prefix:key", CommandFlags.None); } [Fact] - public void StringIncrementAsync_1() + public async Task StringIncrementAsync_1() { - prefixed.StringIncrementAsync("key", 123, CommandFlags.None); - mock.Verify(_ => _.StringIncrementAsync("prefix:key", 123, CommandFlags.None)); + await prefixed.StringIncrementAsync("key", 123, CommandFlags.None); + await mock.Received().StringIncrementAsync("prefix:key", 123, CommandFlags.None); } [Fact] - public void StringIncrementAsync_2() + public async Task StringIncrementAsync_2() { - prefixed.StringIncrementAsync("key", 1.23, CommandFlags.None); - mock.Verify(_ => _.StringIncrementAsync("prefix:key", 1.23, CommandFlags.None)); + await prefixed.StringIncrementAsync("key", 1.23, CommandFlags.None); + await mock.Received().StringIncrementAsync("prefix:key", 1.23, CommandFlags.None); } [Fact] - public void StringLengthAsync() + public async Task StringLengthAsync() { - prefixed.StringLengthAsync("key", CommandFlags.None); - mock.Verify(_ => _.StringLengthAsync("prefix:key", CommandFlags.None)); + await prefixed.StringLengthAsync("key", CommandFlags.None); + await mock.Received().StringLengthAsync("prefix:key", CommandFlags.None); } [Fact] - public void StringSetAsync_1() + public async Task StringSetAsync_1() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.StringSetAsync("key", "value", expiry, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSetAsync("prefix:key", "value", expiry, When.Exists, CommandFlags.None)); + await prefixed.StringSetAsync("key", "value", expiry, When.Exists, CommandFlags.None); + await mock.Received().StringSetAsync("prefix:key", "value", expiry, When.Exists, CommandFlags.None); } [Fact] - public void StringSetAsync_2() + public async Task StringSetAsync_2() { TimeSpan? expiry = null; - prefixed.StringSetAsync("key", "value", expiry, true, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSetAsync("prefix:key", "value", expiry, true, When.Exists, CommandFlags.None)); + await prefixed.StringSetAsync("key", "value", expiry, true, When.Exists, CommandFlags.None); + await mock.Received().StringSetAsync("prefix:key", "value", expiry, true, When.Exists, CommandFlags.None); } [Fact] - public void StringSetAsync_3() + public async Task StringSetAsync_3() { KeyValuePair[] values = new KeyValuePair[] { new KeyValuePair("a", "x"), new KeyValuePair("b", "y") }; - Expression[], bool>> valid = _ => _.Length == 2 && _[0].Key == "prefix:a" && _[0].Value == "x" && _[1].Key == "prefix:b" && _[1].Value == "y"; - prefixed.StringSetAsync(values, When.Exists, CommandFlags.None); - mock.Verify(_ => _.StringSetAsync(It.Is(valid), When.Exists, CommandFlags.None)); + Expression[]>> valid = _ => _.Length == 2 && _[0].Key == "prefix:a" && _[0].Value == "x" && _[1].Key == "prefix:b" && _[1].Value == "y"; + await prefixed.StringSetAsync(values, When.Exists, CommandFlags.None); + await mock.Received().StringSetAsync(Arg.Is(valid), When.Exists, CommandFlags.None); } [Fact] - public void StringSetAsync_Compat() + public async Task StringSetAsync_Compat() { TimeSpan expiry = TimeSpan.FromSeconds(123); - prefixed.StringSetAsync("key", "value", expiry, When.Exists); - mock.Verify(_ => _.StringSetAsync("prefix:key", "value", expiry, When.Exists)); + await prefixed.StringSetAsync("key", "value", expiry, When.Exists); + await mock.Received().StringSetAsync("prefix:key", "value", expiry, When.Exists); } [Fact] - public void StringSetBitAsync() + public async Task StringSetBitAsync() { - prefixed.StringSetBitAsync("key", 123, true, CommandFlags.None); - mock.Verify(_ => _.StringSetBitAsync("prefix:key", 123, true, CommandFlags.None)); + await prefixed.StringSetBitAsync("key", 123, true, CommandFlags.None); + await mock.Received().StringSetBitAsync("prefix:key", 123, true, CommandFlags.None); } [Fact] - public void StringSetRangeAsync() + public async Task StringSetRangeAsync() { - prefixed.StringSetRangeAsync("key", 123, "value", CommandFlags.None); - mock.Verify(_ => _.StringSetRangeAsync("prefix:key", 123, "value", CommandFlags.None)); + await prefixed.StringSetRangeAsync("key", 123, "value", CommandFlags.None); + await mock.Received().StringSetRangeAsync("prefix:key", 123, "value", CommandFlags.None); } [Fact] - public void KeyTouchAsync_1() + public async Task KeyTouchAsync_1() { - prefixed.KeyTouchAsync("key", CommandFlags.None); - mock.Verify(_ => _.KeyTouchAsync("prefix:key", CommandFlags.None)); + await prefixed.KeyTouchAsync("key", CommandFlags.None); + await mock.Received().KeyTouchAsync("prefix:key", CommandFlags.None); } [Fact] - public void KeyTouchAsync_2() + public async Task KeyTouchAsync_2() { RedisKey[] keys = new RedisKey[] { "a", "b" }; - Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; - prefixed.KeyTouchAsync(keys, CommandFlags.None); - mock.Verify(_ => _.KeyTouchAsync(It.Is(valid), CommandFlags.None)); + Expression> valid = _ => _.Length == 2 && _[0] == "prefix:a" && _[1] == "prefix:b"; + await prefixed.KeyTouchAsync(keys, CommandFlags.None); + await mock.Received().KeyTouchAsync(Arg.Is(valid), CommandFlags.None); } } } diff --git a/tests/StackExchange.Redis.Tests/KeyPrefixedTransactionTests.cs b/tests/StackExchange.Redis.Tests/KeyPrefixedTransactionTests.cs index e8af40c6e..04a974808 100644 --- a/tests/StackExchange.Redis.Tests/KeyPrefixedTransactionTests.cs +++ b/tests/StackExchange.Redis.Tests/KeyPrefixedTransactionTests.cs @@ -1,132 +1,132 @@ using System.Text; using System.Threading.Tasks; -using Moq; +using NSubstitute; using StackExchange.Redis.KeyspaceIsolation; using Xunit; namespace StackExchange.Redis.Tests; -[Collection(nameof(MoqDependentCollection))] +[Collection(nameof(SubstituteDependentCollection))] public sealed class KeyPrefixedTransactionTests { - private readonly Mock mock; + private readonly ITransaction mock; private readonly KeyPrefixedTransaction prefixed; public KeyPrefixedTransactionTests() { - mock = new Mock(); - prefixed = new KeyPrefixedTransaction(mock.Object, Encoding.UTF8.GetBytes("prefix:")); + mock = Substitute.For(); + prefixed = new KeyPrefixedTransaction(mock, Encoding.UTF8.GetBytes("prefix:")); } [Fact] public void AddCondition_HashEqual() { prefixed.AddCondition(Condition.HashEqual("key", "field", "value")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key Hash > field == value" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key Hash > field == value" == value.ToString())); } [Fact] public void AddCondition_HashNotEqual() { prefixed.AddCondition(Condition.HashNotEqual("key", "field", "value")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key Hash > field != value" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key Hash > field != value" == value.ToString())); } [Fact] public void AddCondition_HashExists() { prefixed.AddCondition(Condition.HashExists("key", "field")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key Hash > field exists" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key Hash > field exists" == value.ToString())); } [Fact] public void AddCondition_HashNotExists() { prefixed.AddCondition(Condition.HashNotExists("key", "field")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key Hash > field does not exists" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key Hash > field does not exists" == value.ToString())); } [Fact] public void AddCondition_KeyExists() { prefixed.AddCondition(Condition.KeyExists("key")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key exists" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key exists" == value.ToString())); } [Fact] public void AddCondition_KeyNotExists() { prefixed.AddCondition(Condition.KeyNotExists("key")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key does not exists" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key does not exists" == value.ToString())); } [Fact] public void AddCondition_StringEqual() { prefixed.AddCondition(Condition.StringEqual("key", "value")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key == value" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key == value" == value.ToString())); } [Fact] public void AddCondition_StringNotEqual() { prefixed.AddCondition(Condition.StringNotEqual("key", "value")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key != value" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key != value" == value.ToString())); } [Fact] public void AddCondition_SortedSetEqual() { prefixed.AddCondition(Condition.SortedSetEqual("key", "member", "score")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key SortedSet > member == score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key SortedSet > member == score" == value.ToString())); } [Fact] public void AddCondition_SortedSetNotEqual() { prefixed.AddCondition(Condition.SortedSetNotEqual("key", "member", "score")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key SortedSet > member != score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key SortedSet > member != score" == value.ToString())); } [Fact] public void AddCondition_SortedSetScoreExists() { prefixed.AddCondition(Condition.SortedSetScoreExists("key", "score")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key not contains 0 members with score: score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key not contains 0 members with score: score" == value.ToString())); } [Fact] public void AddCondition_SortedSetScoreNotExists() { prefixed.AddCondition(Condition.SortedSetScoreNotExists("key", "score")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key contains 0 members with score: score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key contains 0 members with score: score" == value.ToString())); } [Fact] public void AddCondition_SortedSetScoreCountExists() { prefixed.AddCondition(Condition.SortedSetScoreExists("key", "score", "count")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key contains count members with score: score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key contains count members with score: score" == value.ToString())); } [Fact] public void AddCondition_SortedSetScoreCountNotExists() { prefixed.AddCondition(Condition.SortedSetScoreNotExists("key", "score", "count")); - mock.Verify(_ => _.AddCondition(It.Is(value => "prefix:key not contains count members with score: score" == value.ToString()))); + mock.Received().AddCondition(Arg.Is(value => "prefix:key not contains count members with score: score" == value.ToString())); } [Fact] public async Task ExecuteAsync() { await prefixed.ExecuteAsync(CommandFlags.None); - mock.Verify(_ => _.ExecuteAsync(CommandFlags.None), Times.Once()); + await mock.Received(1).ExecuteAsync(CommandFlags.None); } [Fact] public void Execute() { prefixed.Execute(CommandFlags.None); - mock.Verify(_ => _.Execute(CommandFlags.None), Times.Once()); + mock.Received(1).Execute(CommandFlags.None); } } diff --git a/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj b/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj index 112513a85..9e0d5f36a 100644 --- a/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj +++ b/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj @@ -19,7 +19,6 @@ - From 412ef46f42f7b4350d79517f8ab8920fc52e2253 Mon Sep 17 00:00:00 2001 From: Nick Craver Date: Tue, 8 Aug 2023 21:20:07 -0400 Subject: [PATCH 2/2] Fix missing check in CreateBatch --- tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs b/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs index 25cc58cf8..587d5a0da 100644 --- a/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs +++ b/tests/StackExchange.Redis.Tests/KeyPrefixedDatabaseTests.cs @@ -31,7 +31,7 @@ public void CreateBatch() IBatch innerBatch = Substitute.For(); mock.CreateBatch(asyncState).Returns(innerBatch); IBatch wrappedBatch = prefixed.CreateBatch(asyncState); - mock.CreateBatch(asyncState); + mock.Received().CreateBatch(asyncState); Assert.IsType(wrappedBatch); Assert.Same(innerBatch, ((KeyPrefixedBatch)wrappedBatch).Inner); }