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
a68ea655
Commit
a68ea655
authored
Jul 14, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: more .Wait* removal on Hashes
parent
e91662e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
Hashes.cs
StackExchange.Redis.Tests/Hashes.cs
+33
-33
No files found.
StackExchange.Redis.Tests/Hashes.cs
View file @
a68ea655
...
...
@@ -274,15 +274,15 @@ public async Task TestGet()
}
[
Fact
]
public
void
TestDelMulti
()
// https://redis.io/commands/hdel
public
async
Task
TestDelMulti
()
// https://redis.io/commands/hdel
{
using
(
var
muxer
=
Create
())
{
var
conn
=
muxer
.
GetDatabase
();
var
hashkey
=
Me
();
conn
.
HashSet
Async
(
hashkey
,
"key1"
,
"val1"
);
conn
.
HashSet
Async
(
hashkey
,
"key2"
,
"val2"
);
conn
.
HashSet
Async
(
hashkey
,
"key3"
,
"val3"
);
conn
.
HashSet
(
hashkey
,
"key1"
,
"val1"
,
flags
:
CommandFlags
.
FireAndForget
);
conn
.
HashSet
(
hashkey
,
"key2"
,
"val2"
,
flags
:
CommandFlags
.
FireAndForget
);
conn
.
HashSet
(
hashkey
,
"key3"
,
"val3"
,
flags
:
CommandFlags
.
FireAndForget
);
var
s1
=
conn
.
HashExistsAsync
(
hashkey
,
"key1"
);
var
s2
=
conn
.
HashExistsAsync
(
hashkey
,
"key2"
);
...
...
@@ -294,34 +294,34 @@ public async Task TestGet()
var
d2
=
conn
.
HashExistsAsync
(
hashkey
,
"key2"
);
var
d3
=
conn
.
HashExistsAsync
(
hashkey
,
"key3"
);
Assert
.
True
(
conn
.
Wait
(
s1
)
);
Assert
.
True
(
conn
.
Wait
(
s2
)
);
Assert
.
True
(
conn
.
Wait
(
s3
)
);
Assert
.
True
(
await
s1
);
Assert
.
True
(
await
s2
);
Assert
.
True
(
await
s3
);
Assert
.
Equal
(
2
,
conn
.
Wait
(
removed
)
);
Assert
.
Equal
(
2
,
await
removed
);
Assert
.
False
(
conn
.
Wait
(
d1
)
);
Assert
.
True
(
conn
.
Wait
(
d2
)
);
Assert
.
False
(
conn
.
Wait
(
d3
)
);
Assert
.
False
(
await
d1
);
Assert
.
True
(
await
d2
);
Assert
.
False
(
await
d3
);
var
removeFinal
=
conn
.
HashDeleteAsync
(
hashkey
,
new
RedisValue
[]
{
"key2"
});
Assert
.
Equal
(
0
,
conn
.
Wait
(
conn
.
HashLengthAsync
(
hashkey
)
));
Assert
.
Equal
(
1
,
conn
.
Wait
(
removeFinal
)
);
Assert
.
Equal
(
0
,
await
conn
.
HashLengthAsync
(
hashkey
).
ForAwait
(
));
Assert
.
Equal
(
1
,
await
removeFinal
);
}
}
[
Fact
]
public
void
TestDelMultiInsideTransaction
()
// https://redis.io/commands/hdel
public
async
Task
TestDelMultiInsideTransaction
()
// https://redis.io/commands/hdel
{
using
(
var
outer
=
Create
())
{
var
conn
=
outer
.
GetDatabase
().
CreateTransaction
();
{
var
hashkey
=
Me
();
conn
.
HashSetAsync
(
hashkey
,
"key1"
,
"val1"
);
conn
.
HashSetAsync
(
hashkey
,
"key2"
,
"val2"
);
conn
.
HashSetAsync
(
hashkey
,
"key3"
,
"val3"
);
var
t
=
conn
.
HashSetAsync
(
hashkey
,
"key1"
,
"val1"
);
var
t2
=
conn
.
HashSetAsync
(
hashkey
,
"key2"
,
"val2"
);
var
t3
=
conn
.
HashSetAsync
(
hashkey
,
"key3"
,
"val3"
);
var
s1
=
conn
.
HashExistsAsync
(
hashkey
,
"key1"
);
var
s2
=
conn
.
HashExistsAsync
(
hashkey
,
"key2"
);
...
...
@@ -335,15 +335,15 @@ public async Task TestGet()
conn
.
Execute
();
Assert
.
True
(
conn
.
Wait
(
s1
)
);
Assert
.
True
(
conn
.
Wait
(
s2
)
);
Assert
.
True
(
conn
.
Wait
(
s3
)
);
Assert
.
True
(
await
s1
);
Assert
.
True
(
await
s2
);
Assert
.
True
(
await
s3
);
Assert
.
Equal
(
2
,
conn
.
Wait
(
removed
)
);
Assert
.
Equal
(
2
,
await
removed
);
Assert
.
False
(
conn
.
Wait
(
d1
)
);
Assert
.
True
(
conn
.
Wait
(
d2
)
);
Assert
.
False
(
conn
.
Wait
(
d3
)
);
Assert
.
False
(
await
d1
);
Assert
.
True
(
await
d2
);
Assert
.
False
(
await
d3
);
}
}
}
...
...
@@ -418,23 +418,23 @@ public async Task TestGet()
}
[
Fact
]
public
void
TestHashLength
()
// https://redis.io/commands/hlen
public
async
Task
TestHashLength
()
// https://redis.io/commands/hlen
{
using
(
var
muxer
=
Create
())
{
var
conn
=
muxer
.
GetDatabase
();
var
hashkey
=
Me
();
conn
.
KeyDelete
Async
(
hashkey
);
conn
.
KeyDelete
(
hashkey
,
CommandFlags
.
FireAndForget
);
var
len0
=
conn
.
HashLengthAsync
(
hashkey
);
conn
.
HashSet
Async
(
hashkey
,
"foo"
,
"abc"
);
conn
.
HashSet
Async
(
hashkey
,
"bar"
,
"def"
);
conn
.
HashSet
(
hashkey
,
"foo"
,
"abc"
,
flags
:
CommandFlags
.
FireAndForget
);
conn
.
HashSet
(
hashkey
,
"bar"
,
"def"
,
flags
:
CommandFlags
.
FireAndForget
);
var
len1
=
conn
.
HashLengthAsync
(
hashkey
);
Assert
.
Equal
(
0
,
muxer
.
Wait
(
len0
)
);
Assert
.
Equal
(
2
,
muxer
.
Wait
(
len1
)
);
Assert
.
Equal
(
0
,
await
len0
);
Assert
.
Equal
(
2
,
await
len1
);
}
}
...
...
@@ -445,13 +445,13 @@ public async Task TestGet()
{
var
conn
=
muxer
.
GetDatabase
();
var
hashkey
=
Me
();
await
conn
.
KeyDeleteAsync
(
hashkey
).
ForAwait
(
);
conn
.
KeyDelete
(
hashkey
,
CommandFlags
.
FireAndForget
);
RedisValue
[]
fields
=
{
"foo"
,
"bar"
,
"blop"
};
var
arr0
=
await
conn
.
HashGetAsync
(
hashkey
,
fields
).
ForAwait
();
await
conn
.
HashSetAsync
(
hashkey
,
"foo"
,
"abc"
).
ForAwait
(
);
await
conn
.
HashSetAsync
(
hashkey
,
"bar"
,
"def"
).
ForAwait
(
);
conn
.
HashSet
(
hashkey
,
"foo"
,
"abc"
,
flags
:
CommandFlags
.
FireAndForget
);
conn
.
HashSet
(
hashkey
,
"bar"
,
"def"
,
flags
:
CommandFlags
.
FireAndForget
);
var
arr1
=
await
conn
.
HashGetAsync
(
hashkey
,
fields
).
ForAwait
();
var
arr2
=
await
conn
.
HashGetAsync
(
hashkey
,
fields
).
ForAwait
();
...
...
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