Skip to content

Commit 77c690f

Browse files
committed
Fix Moq tests (normalizing line endings as well)
1 parent 140d741 commit 77c690f

File tree

1 file changed

+90
-90
lines changed

1 file changed

+90
-90
lines changed
Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
using System.Text;
2-
using Moq;
3-
using StackExchange.Redis.KeyspaceIsolation;
4-
5-
namespace StackExchange.Redis.Tests
6-
{
7-
#pragma warning disable RCS1047 // Non-asynchronous method name should not end with 'Async'.
8-
public sealed class TransactionWrapperTests
9-
{
10-
private readonly Mock<ITransaction> mock;
11-
private readonly TransactionWrapper wrapper;
12-
13-
public TransactionWrapperTests()
14-
{
15-
mock = new Mock<ITransaction>();
16-
wrapper = new TransactionWrapper(mock.Object, Encoding.UTF8.GetBytes("prefix:"));
17-
}
18-
19-
[Fact]
20-
public void AddCondition_HashEqual()
21-
{
22-
wrapper.AddCondition(Condition.HashEqual("key", "field", "value"));
23-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field == value" == value.ToString())));
24-
}
25-
26-
[Fact]
27-
public void AddCondition_HashNotEqual()
28-
{
29-
wrapper.AddCondition(Condition.HashNotEqual("key", "field", "value"));
30-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field != value" == value.ToString())));
31-
}
32-
33-
[Fact]
34-
public void AddCondition_HashExists()
35-
{
36-
wrapper.AddCondition(Condition.HashExists("key", "field"));
37-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field exists" == value.ToString())));
38-
}
39-
40-
[Fact]
41-
public void AddCondition_HashNotExists()
42-
{
43-
wrapper.AddCondition(Condition.HashNotExists("key", "field"));
44-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field does not exists" == value.ToString())));
45-
}
46-
47-
[Fact]
48-
public void AddCondition_KeyExists()
49-
{
50-
wrapper.AddCondition(Condition.KeyExists("key"));
51-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key exists" == value.ToString())));
52-
}
53-
54-
[Fact]
55-
public void AddCondition_KeyNotExists()
56-
{
57-
wrapper.AddCondition(Condition.KeyNotExists("key"));
58-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key does not exists" == value.ToString())));
59-
}
60-
61-
[Fact]
62-
public void AddCondition_StringEqual()
63-
{
64-
wrapper.AddCondition(Condition.StringEqual("key", "value"));
65-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key == value" == value.ToString())));
66-
}
67-
68-
[Fact]
69-
public void AddCondition_StringNotEqual()
70-
{
71-
wrapper.AddCondition(Condition.StringNotEqual("key", "value"));
72-
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key != value" == value.ToString())));
73-
}
74-
75-
[Fact]
76-
public void ExecuteAsync()
77-
{
78-
wrapper.ExecuteAsync(CommandFlags.HighPriority);
79-
mock.Verify(_ => _.ExecuteAsync(CommandFlags.HighPriority), Times.Once());
80-
}
81-
82-
[Fact]
83-
public void Execute()
84-
{
85-
wrapper.Execute(CommandFlags.HighPriority);
86-
mock.Verify(_ => _.Execute(CommandFlags.HighPriority), Times.Once());
87-
}
88-
}
89-
#pragma warning restore RCS1047 // Non-asynchronous method name should not end with 'Async'.
90-
}
1+
using System.Text;
2+
using Moq;
3+
using StackExchange.Redis.KeyspaceIsolation;
4+
5+
namespace StackExchange.Redis.Tests
6+
{
7+
#pragma warning disable RCS1047 // Non-asynchronous method name should not end with 'Async'.
8+
public sealed class TransactionWrapperTests
9+
{
10+
private readonly Mock<ITransaction> mock;
11+
private readonly TransactionWrapper wrapper;
12+
13+
public TransactionWrapperTests()
14+
{
15+
mock = new Mock<ITransaction>();
16+
wrapper = new TransactionWrapper(mock.Object, Encoding.UTF8.GetBytes("prefix:"));
17+
}
18+
19+
[Fact]
20+
public void AddCondition_HashEqual()
21+
{
22+
wrapper.AddCondition(Condition.HashEqual("key", "field", "value"));
23+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field == value" == value.ToString())));
24+
}
25+
26+
[Fact]
27+
public void AddCondition_HashNotEqual()
28+
{
29+
wrapper.AddCondition(Condition.HashNotEqual("key", "field", "value"));
30+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key > field != value" == value.ToString())));
31+
}
32+
33+
[Fact]
34+
public void AddCondition_HashExists()
35+
{
36+
wrapper.AddCondition(Condition.HashExists("key", "field"));
37+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key Hash > field exists" == value.ToString())));
38+
}
39+
40+
[Fact]
41+
public void AddCondition_HashNotExists()
42+
{
43+
wrapper.AddCondition(Condition.HashNotExists("key", "field"));
44+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key Hash > field does not exists" == value.ToString())));
45+
}
46+
47+
[Fact]
48+
public void AddCondition_KeyExists()
49+
{
50+
wrapper.AddCondition(Condition.KeyExists("key"));
51+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key exists" == value.ToString())));
52+
}
53+
54+
[Fact]
55+
public void AddCondition_KeyNotExists()
56+
{
57+
wrapper.AddCondition(Condition.KeyNotExists("key"));
58+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key does not exists" == value.ToString())));
59+
}
60+
61+
[Fact]
62+
public void AddCondition_StringEqual()
63+
{
64+
wrapper.AddCondition(Condition.StringEqual("key", "value"));
65+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key == value" == value.ToString())));
66+
}
67+
68+
[Fact]
69+
public void AddCondition_StringNotEqual()
70+
{
71+
wrapper.AddCondition(Condition.StringNotEqual("key", "value"));
72+
mock.Verify(_ => _.AddCondition(It.Is<Condition>(value => "prefix:key != value" == value.ToString())));
73+
}
74+
75+
[Fact]
76+
public void ExecuteAsync()
77+
{
78+
wrapper.ExecuteAsync(CommandFlags.HighPriority);
79+
mock.Verify(_ => _.ExecuteAsync(CommandFlags.HighPriority), Times.Once());
80+
}
81+
82+
[Fact]
83+
public void Execute()
84+
{
85+
wrapper.Execute(CommandFlags.HighPriority);
86+
mock.Verify(_ => _.Execute(CommandFlags.HighPriority), Times.Once());
87+
}
88+
}
89+
#pragma warning restore RCS1047 // Non-asynchronous method name should not end with 'Async'.
90+
}

0 commit comments

Comments
 (0)