Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
7809d6d3
Commit
7809d6d3
authored
Jul 15, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: remove .Wait from Transactions
parent
474eb386
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
71 deletions
+71
-71
Transactions.cs
StackExchange.Redis.Tests/Transactions.cs
+71
-71
No files found.
StackExchange.Redis.Tests/Transactions.cs
View file @
7809d6d3
...
@@ -44,7 +44,7 @@ public void NestedTransactionThrows()
...
@@ -44,7 +44,7 @@ public void NestedTransactionThrows()
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
true
,
true
)]
[
InlineData
(
true
,
true
,
true
)]
public
void
BasicTranWithExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
public
async
Task
BasicTranWithExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
{
{
...
@@ -62,17 +62,17 @@ public void BasicTranWithExistsCondition(bool demandKeyExists, bool keyExists, b
...
@@ -62,17 +62,17 @@ public void BasicTranWithExistsCondition(bool demandKeyExists, bool keyExists, b
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
demandKeyExists
==
keyExists
)
if
(
demandKeyExists
==
keyExists
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -92,7 +92,7 @@ public void BasicTranWithExistsCondition(bool demandKeyExists, bool keyExists, b
...
@@ -92,7 +92,7 @@ public void BasicTranWithExistsCondition(bool demandKeyExists, bool keyExists, b
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
public
void
BasicTranWithEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectTranResult
)
public
async
Task
BasicTranWithEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -111,17 +111,17 @@ public void BasicTranWithEqualsCondition(string expected, string value, bool exp
...
@@ -111,17 +111,17 @@ public void BasicTranWithEqualsCondition(string expected, string value, bool exp
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectEqual
==
(
value
==
expected
))
if
(
expectEqual
==
(
value
==
expected
))
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -134,7 +134,7 @@ public void BasicTranWithEqualsCondition(string expected, string value, bool exp
...
@@ -134,7 +134,7 @@ public void BasicTranWithEqualsCondition(string expected, string value, bool exp
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
true
,
true
)]
[
InlineData
(
true
,
true
,
true
)]
public
void
BasicTranWithHashExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
public
async
Task
BasicTranWithHashExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
{
{
...
@@ -153,17 +153,17 @@ public void BasicTranWithHashExistsCondition(bool demandKeyExists, bool keyExist
...
@@ -153,17 +153,17 @@ public void BasicTranWithHashExistsCondition(bool demandKeyExists, bool keyExist
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
demandKeyExists
==
keyExists
)
if
(
demandKeyExists
==
keyExists
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -183,7 +183,7 @@ public void BasicTranWithHashExistsCondition(bool demandKeyExists, bool keyExist
...
@@ -183,7 +183,7 @@ public void BasicTranWithHashExistsCondition(bool demandKeyExists, bool keyExist
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
public
void
BasicTranWithHashEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectedTranResult
)
public
async
Task
BasicTranWithHashEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectedTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -203,17 +203,17 @@ public void BasicTranWithHashEqualsCondition(string expected, string value, bool
...
@@ -203,17 +203,17 @@ public void BasicTranWithHashEqualsCondition(string expected, string value, bool
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectedTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectedTranResult
,
await
exec
);
if
(
expectEqual
==
(
value
==
expected
))
if
(
expectEqual
==
(
value
==
expected
))
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -226,7 +226,7 @@ public void BasicTranWithHashEqualsCondition(string expected, string value, bool
...
@@ -226,7 +226,7 @@ public void BasicTranWithHashEqualsCondition(string expected, string value, bool
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
true
,
true
)]
[
InlineData
(
true
,
true
,
true
)]
public
void
BasicTranWithListExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
public
async
Task
BasicTranWithListExistsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
{
{
...
@@ -244,17 +244,17 @@ public void BasicTranWithListExistsCondition(bool demandKeyExists, bool keyExist
...
@@ -244,17 +244,17 @@ public void BasicTranWithListExistsCondition(bool demandKeyExists, bool keyExist
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
ListGetByIndex
(
key
,
0
);
var
get
=
db
.
ListGetByIndex
(
key
,
0
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
demandKeyExists
==
keyExists
)
if
(
demandKeyExists
==
keyExists
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
push
)
);
// eq: push
Assert
.
Equal
(
1
,
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
,
(
string
)
get
);
// eq: get
Assert
.
Equal
(
"any value"
,
(
string
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Null
((
string
)
get
);
// neq: get
Assert
.
Null
((
string
)
get
);
// neq: get
...
@@ -274,7 +274,7 @@ public void BasicTranWithListExistsCondition(bool demandKeyExists, bool keyExist
...
@@ -274,7 +274,7 @@ public void BasicTranWithListExistsCondition(bool demandKeyExists, bool keyExist
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
"x"
,
null
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
"y"
,
false
,
true
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
[
InlineData
(
null
,
null
,
false
,
false
)]
public
void
BasicTranWithListEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectTranResult
)
public
async
Task
BasicTranWithListEqualsCondition
(
string
expected
,
string
value
,
bool
expectEqual
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -293,17 +293,17 @@ public void BasicTranWithListEqualsCondition(string expected, string value, bool
...
@@ -293,17 +293,17 @@ public void BasicTranWithListEqualsCondition(string expected, string value, bool
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
ListGetByIndex
(
key
,
0
);
var
get
=
db
.
ListGetByIndex
(
key
,
0
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectEqual
==
(
value
==
expected
))
if
(
expectEqual
==
(
value
==
expected
))
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
push
)
);
// eq: push
Assert
.
Equal
(
1
,
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Null
((
string
)
get
);
// neq: get
Assert
.
Null
((
string
)
get
);
// neq: get
...
@@ -342,7 +342,7 @@ public enum ComparisonType
...
@@ -342,7 +342,7 @@ public enum ComparisonType
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
null
,
ComparisonType
.
GreaterThan
,
1L
,
false
)]
[
InlineData
(
null
,
ComparisonType
.
GreaterThan
,
1L
,
false
)]
[
InlineData
(
null
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
null
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
public
void
BasicTranWithStringLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
public
async
Task
BasicTranWithStringLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -383,18 +383,18 @@ public void BasicTranWithStringLengthCondition(string value, ComparisonType type
...
@@ -383,18 +383,18 @@ public void BasicTranWithStringLengthCondition(string value, ComparisonType type
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringLength
(
key
);
var
get
=
db
.
StringLength
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectSuccess
)
if
(
expectSuccess
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
db
.
Wait
(
push
)
);
// eq: push
Assert
.
True
(
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
0
,
get
);
// neq: get
Assert
.
Equal
(
0
,
get
);
// neq: get
...
@@ -420,7 +420,7 @@ public void BasicTranWithStringLengthCondition(string value, ComparisonType type
...
@@ -420,7 +420,7 @@ public void BasicTranWithStringLengthCondition(string value, ComparisonType type
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
public
void
BasicTranWithHashLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
public
async
Task
BasicTranWithHashLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -461,18 +461,18 @@ public void BasicTranWithHashLengthCondition(string value, ComparisonType type,
...
@@ -461,18 +461,18 @@ public void BasicTranWithHashLengthCondition(string value, ComparisonType type,
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringLength
(
key
);
var
get
=
db
.
StringLength
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectSuccess
)
if
(
expectSuccess
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
db
.
Wait
(
push
)
);
// eq: push
Assert
.
True
(
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
0
,
get
);
// neq: get
Assert
.
Equal
(
0
,
get
);
// neq: get
...
@@ -498,7 +498,7 @@ public void BasicTranWithHashLengthCondition(string value, ComparisonType type,
...
@@ -498,7 +498,7 @@ public void BasicTranWithHashLengthCondition(string value, ComparisonType type,
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
public
void
BasicTranWithSetCardinalityCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
public
async
Task
BasicTranWithSetCardinalityCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -539,18 +539,18 @@ public void BasicTranWithSetCardinalityCondition(string value, ComparisonType ty
...
@@ -539,18 +539,18 @@ public void BasicTranWithSetCardinalityCondition(string value, ComparisonType ty
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringLength
(
key
);
var
get
=
db
.
StringLength
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectSuccess
)
if
(
expectSuccess
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
db
.
Wait
(
push
)
);
// eq: push
Assert
.
True
(
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
0
,
get
);
// neq: get
Assert
.
Equal
(
0
,
get
);
// neq: get
...
@@ -563,7 +563,7 @@ public void BasicTranWithSetCardinalityCondition(string value, ComparisonType ty
...
@@ -563,7 +563,7 @@ public void BasicTranWithSetCardinalityCondition(string value, ComparisonType ty
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
true
,
true
)]
[
InlineData
(
true
,
true
,
true
)]
public
void
BasicTranWithSetContainsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
public
async
Task
BasicTranWithSetContainsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
{
{
...
@@ -582,17 +582,17 @@ public void BasicTranWithSetContainsCondition(bool demandKeyExists, bool keyExis
...
@@ -582,17 +582,17 @@ public void BasicTranWithSetContainsCondition(bool demandKeyExists, bool keyExis
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
demandKeyExists
==
keyExists
)
if
(
demandKeyExists
==
keyExists
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -618,7 +618,7 @@ public void BasicTranWithSetContainsCondition(bool demandKeyExists, bool keyExis
...
@@ -618,7 +618,7 @@ public void BasicTranWithSetContainsCondition(bool demandKeyExists, bool keyExis
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
public
void
BasicTranWithSortedSetCardinalityCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
public
async
Task
BasicTranWithSortedSetCardinalityCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -659,18 +659,18 @@ public void BasicTranWithSortedSetCardinalityCondition(string value, ComparisonT
...
@@ -659,18 +659,18 @@ public void BasicTranWithSortedSetCardinalityCondition(string value, ComparisonT
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringLength
(
key
);
var
get
=
db
.
StringLength
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectSuccess
)
if
(
expectSuccess
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
db
.
Wait
(
push
)
);
// eq: push
Assert
.
True
(
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
0
,
get
);
// neq: get
Assert
.
Equal
(
0
,
get
);
// neq: get
...
@@ -683,7 +683,7 @@ public void BasicTranWithSortedSetCardinalityCondition(string value, ComparisonT
...
@@ -683,7 +683,7 @@ public void BasicTranWithSortedSetCardinalityCondition(string value, ComparisonT
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
false
,
true
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
false
,
false
)]
[
InlineData
(
true
,
true
,
true
)]
[
InlineData
(
true
,
true
,
true
)]
public
void
BasicTranWithSortedSetContainsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
public
async
Task
BasicTranWithSortedSetContainsCondition
(
bool
demandKeyExists
,
bool
keyExists
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
using
(
var
muxer
=
Create
(
disabledCommands
:
new
[]
{
"info"
,
"config"
}))
{
{
...
@@ -702,17 +702,17 @@ public void BasicTranWithSortedSetContainsCondition(bool demandKeyExists, bool k
...
@@ -702,17 +702,17 @@ public void BasicTranWithSortedSetContainsCondition(bool demandKeyExists, bool k
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringGet
(
key
);
var
get
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
demandKeyExists
==
keyExists
)
if
(
demandKeyExists
==
keyExists
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
Equal
(
1
,
db
.
Wait
(
incr
)
);
// eq: incr
Assert
.
Equal
(
1
,
await
incr
);
// eq: incr
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
Assert
.
Equal
(
1
,
(
long
)
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
TaskStatus
.
Canceled
,
incr
.
Status
);
// neq: incr
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
Assert
.
Equal
(
0
,
(
long
)
get
);
// neq: get
...
@@ -738,7 +738,7 @@ public void BasicTranWithSortedSetContainsCondition(bool demandKeyExists, bool k
...
@@ -738,7 +738,7 @@ public void BasicTranWithSortedSetContainsCondition(bool demandKeyExists, bool k
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
"three"
,
ComparisonType
.
GreaterThan
,
3L
,
true
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
2L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
[
InlineData
(
""
,
ComparisonType
.
GreaterThan
,
0L
,
false
)]
public
void
BasicTranWithListLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
public
async
Task
BasicTranWithListLengthCondition
(
string
value
,
ComparisonType
type
,
long
length
,
bool
expectTranResult
)
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -779,18 +779,18 @@ public void BasicTranWithListLengthCondition(string value, ComparisonType type,
...
@@ -779,18 +779,18 @@ public void BasicTranWithListLengthCondition(string value, ComparisonType type,
var
exec
=
tran
.
ExecuteAsync
();
var
exec
=
tran
.
ExecuteAsync
();
var
get
=
db
.
StringLength
(
key
);
var
get
=
db
.
StringLength
(
key
);
Assert
.
Equal
(
expectTranResult
,
db
.
Wait
(
exec
)
);
Assert
.
Equal
(
expectTranResult
,
await
exec
);
if
(
expectSuccess
)
if
(
expectSuccess
)
{
{
Assert
.
True
(
db
.
Wait
(
exec
)
,
"eq: exec"
);
Assert
.
True
(
await
exec
,
"eq: exec"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
cond
.
WasSatisfied
,
"eq: was satisfied"
);
Assert
.
True
(
db
.
Wait
(
push
)
);
// eq: push
Assert
.
True
(
await
push
);
// eq: push
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
Assert
.
Equal
(
"any value"
.
Length
,
get
);
// eq: get
}
}
else
else
{
{
Assert
.
False
(
db
.
Wait
(
exec
)
,
"neq: exec"
);
Assert
.
False
(
await
exec
,
"neq: exec"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
False
(
cond
.
WasSatisfied
,
"neq: was satisfied"
);
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
TaskStatus
.
Canceled
,
push
.
Status
);
// neq: push
Assert
.
Equal
(
0
,
get
);
// neq: get
Assert
.
Equal
(
0
,
get
);
// neq: get
...
@@ -821,9 +821,9 @@ public async Task BasicTran()
...
@@ -821,9 +821,9 @@ public async Task BasicTran()
Assert
.
False
(
d
.
IsCompleted
);
Assert
.
False
(
d
.
IsCompleted
);
Assert
.
False
(
e
.
IsCompleted
);
Assert
.
False
(
e
.
IsCompleted
);
Assert
.
False
(
f
.
IsCompleted
);
Assert
.
False
(
f
.
IsCompleted
);
var
result
=
db
.
Wait
(
tran
.
ExecuteAsync
()
);
var
result
=
await
tran
.
ExecuteAsync
().
ForAwait
(
);
Assert
.
True
(
result
,
"result"
);
Assert
.
True
(
result
,
"result"
);
db
.
WaitAll
(
a
,
b
,
c
,
d
,
e
,
f
);
await
Task
.
WhenAll
(
a
,
b
,
c
,
d
,
e
,
f
).
ForAwait
(
);
Assert
.
True
(
a
.
IsCompleted
,
"a"
);
Assert
.
True
(
a
.
IsCompleted
,
"a"
);
Assert
.
True
(
b
.
IsCompleted
,
"b"
);
Assert
.
True
(
b
.
IsCompleted
,
"b"
);
Assert
.
True
(
c
.
IsCompleted
,
"c"
);
Assert
.
True
(
c
.
IsCompleted
,
"c"
);
...
@@ -844,7 +844,7 @@ public async Task BasicTran()
...
@@ -844,7 +844,7 @@ public async Task BasicTran()
}
}
[
Fact
]
[
Fact
]
public
void
CombineFireAndForgetAndRegularAsyncInTransaction
()
public
async
Task
CombineFireAndForgetAndRegularAsyncInTransaction
()
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
...
@@ -860,11 +860,11 @@ public void CombineFireAndForgetAndRegularAsyncInTransaction()
...
@@ -860,11 +860,11 @@ public void CombineFireAndForgetAndRegularAsyncInTransaction()
Assert
.
True
(
tran
.
Execute
());
Assert
.
True
(
tran
.
Execute
());
var
count
=
(
long
)
db
.
StringGet
(
key
);
var
count
=
(
long
)
db
.
StringGet
(
key
);
Assert
.
Equal
(
5
,
db
.
Wait
(
a
)
);
Assert
.
Equal
(
5
,
await
a
);
Assert
.
Equal
(
"state"
,
a
.
AsyncState
);
Assert
.
Equal
(
"state"
,
a
.
AsyncState
);
Assert
.
Equal
(
0
,
db
.
Wait
(
b
)
);
Assert
.
Equal
(
0
,
await
b
);
Assert
.
Null
(
b
.
AsyncState
);
Assert
.
Null
(
b
.
AsyncState
);
Assert
.
Equal
(
30
,
db
.
Wait
(
c
)
);
Assert
.
Equal
(
30
,
await
c
);
Assert
.
Equal
(
"state"
,
a
.
AsyncState
);
Assert
.
Equal
(
"state"
,
a
.
AsyncState
);
Assert
.
Equal
(
30
,
count
);
Assert
.
Equal
(
30
,
count
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment