Skip to content

Commit

Permalink
Completed requested changes.
Browse files Browse the repository at this point in the history
- Reverted changes to the Tests csproj file.
- Updated the type for messageId from string to RedisValue.
- Collapsed several overloads.
- Updated the method order in several places to follow the sync/async pattern.
- Added more tests.
- Miscellaneous cleanup.

Signed-off-by: ttingen <[email protected]>
  • Loading branch information
ttingen committed Jun 30, 2018
1 parent 076147b commit b0be6a9
Show file tree
Hide file tree
Showing 14 changed files with 778 additions and 952 deletions.
71 changes: 14 additions & 57 deletions StackExchange.Redis.Tests/DatabaseWrapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ public void StreamAcknowledge_1()
[Fact]
public void StreamAcknowledge_2()
{
var messageIds = new string[] { "0-0", "0-1", "0-2" };
var messageIds = new RedisValue[] { "0-0", "0-1", "0-2" };
wrapper.StreamAcknowledge("key", "group", messageIds, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamAcknowledge("prefix:key", "group", messageIds, CommandFlags.HighPriority));
}
Expand Down Expand Up @@ -830,15 +830,15 @@ public void StreamAdd_4()
[Fact]
public void StreamClaimMessages()
{
var messageIds = new string[0];
var messageIds = new RedisValue[0];
wrapper.StreamClaimMessages("key", "group", "consumer", 1000, messageIds, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamClaimMessages("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.HighPriority));
}

[Fact]
public void StreamClaimMessagesReturningIds()
{
var messageIds = new string[0];
var messageIds = new RedisValue[0];
wrapper.StreamClaimMessagesReturningIds("key", "group", "consumer", 1000, messageIds, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamClaimMessagesReturningIds("prefix:key", "group", "consumer", 1000, messageIds, CommandFlags.HighPriority));
}
Expand Down Expand Up @@ -881,7 +881,7 @@ public void StreamLength()
[Fact]
public void StreamMessagesDelete()
{
var messageIds = new string[0] { };
var messageIds = new RedisValue[0] { };
wrapper.StreamMessagesDelete("key", messageIds, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamMessagesDelete("prefix:key", messageIds, CommandFlags.HighPriority));
}
Expand All @@ -894,75 +894,32 @@ public void StreamPendingInfoGet()
}

[Fact]
public void StreamPendingMessageInfoGet_1()
public void StreamPendingMessageInfoGet()
{
wrapper.StreamPendingMessageInfoGet("key", "group", "-", "+", 10, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamPendingMessageInfoGet("prefix:key", "group", "-", "+", 10, CommandFlags.HighPriority));
wrapper.StreamPendingMessageInfoGet("key", "group", "-", "+", 10, RedisValue.Null, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamPendingMessageInfoGet("prefix:key", "group", "-", "+", 10, RedisValue.Null, CommandFlags.HighPriority));
}

[Fact]
public void StreamPendingMessageInfoGet_2()
public void StreamRange()
{
wrapper.StreamPendingMessageInfoGet("key", "group", "-", "+", 10, "consumer", CommandFlags.HighPriority);
mock.Verify(_ => _.StreamPendingMessageInfoGet("prefix:key", "group", "-", "+", 10, "consumer", CommandFlags.HighPriority));
}

[Fact]
public void StreamRange_1()
{
wrapper.StreamRange("key", "-", "+", CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRange("prefix:key", "-", "+", CommandFlags.HighPriority));
}

[Fact]
public void StreamRange_2()
{
wrapper.StreamRange("key", "-", "+", 10, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRange("prefix:key", "-", "+", 10, CommandFlags.HighPriority));
}

[Fact]
public void StreamRangeReverse_1()
{
wrapper.StreamRangeReverse("key", "+", "-", CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRangeReverse("prefix:key", "+", "-", CommandFlags.HighPriority));
}

[Fact]
public void StreamRangeReverse_2()
{
wrapper.StreamRangeReverse("key", "+", "-", 10, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRangeReverse("prefix:key", "+", "-", 10, CommandFlags.HighPriority));
wrapper.StreamRange("key", "-", "+", null, Order.Ascending, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRange("prefix:key", "-", "+",null, Order.Ascending, CommandFlags.HighPriority));
}

[Fact]
public void StreamRead_1()
{
var keysAndIds = new KeyValuePair<RedisKey, RedisValue>[0] { };
wrapper.StreamRead(keysAndIds, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead(keysAndIds, CommandFlags.HighPriority));
wrapper.StreamRead(keysAndIds, null, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead(keysAndIds, null, CommandFlags.HighPriority));
}

[Fact]
public void StreamRead_2()
{
wrapper.StreamRead("key", "0-0", CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead("prefix:key", "0-0", CommandFlags.HighPriority));
}

[Fact]
public void StreamRead_3()
{
var keysAndIds = new KeyValuePair<RedisKey, RedisValue>[0] { };
wrapper.StreamRead(keysAndIds, 10, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead(keysAndIds, 10, CommandFlags.HighPriority));
}

[Fact]
public void StreamRead_4()
{
wrapper.StreamRead("key", "0-0", 10, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead("prefix:key", "0-0", 10, CommandFlags.HighPriority));
wrapper.StreamRead("key", "0-0", null, CommandFlags.HighPriority);
mock.Verify(_ => _.StreamRead("prefix:key", "0-0", null, CommandFlags.HighPriority));
}

[Fact]
Expand Down
4 changes: 0 additions & 4 deletions StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,4 @@
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Loading

0 comments on commit b0be6a9

Please sign in to comment.