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
eec15d6f
Commit
eec15d6f
authored
Apr 13, 2015
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #183 from xkrt/master
Test case for issue #182
parents
afe847fc
80b3a574
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
Issue182.cs
StackExchange.Redis.Tests/Issues/Issue182.cs
+62
-0
StackExchange.Redis.Tests.csproj
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
+1
-0
No files found.
StackExchange.Redis.Tests/Issues/Issue182.cs
0 → 100644
View file @
eec15d6f
using
System
;
using
System.Linq
;
using
NUnit.Framework
;
namespace
StackExchange.Redis.Tests.Issues
{
[
TestFixture
]
public
class
Issue182
:
TestBase
{
[
Test
]
public
void
SetMembers
()
{
using
(
var
conn
=
Create
())
{
var
db
=
conn
.
GetDatabase
();
var
key
=
Me
();
const
int
count
=
(
int
)
5
e6
;
db
.
KeyDeleteAsync
(
key
).
Wait
();
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
db
.
SetAdd
(
key
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
Assert
.
AreEqual
(
count
,
db
.
SetLengthAsync
(
key
).
Result
,
"SCARD for set"
);
var
task
=
db
.
SetMembersAsync
(
key
);
task
.
Wait
();
Assert
.
AreEqual
(
count
,
task
.
Result
.
Length
,
"SMEMBERS result length"
);
}
}
[
Test
]
public
void
SetUnion
()
{
using
(
var
conn
=
Create
())
{
var
db
=
conn
.
GetDatabase
();
var
key1
=
Me
()
+
":1"
;
var
key2
=
Me
()
+
":2"
;
var
dstkey
=
Me
()
+
":dst"
;
db
.
KeyDeleteAsync
(
key1
).
Wait
();
db
.
KeyDeleteAsync
(
key2
).
Wait
();
db
.
KeyDeleteAsync
(
dstkey
).
Wait
();
const
int
count
=
(
int
)
5
e6
;
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
{
db
.
SetAdd
(
key1
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
db
.
SetAdd
(
key2
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
}
Assert
.
AreEqual
(
count
,
db
.
SetLengthAsync
(
key1
).
Result
,
"SCARD for set 1"
);
Assert
.
AreEqual
(
count
,
db
.
SetLengthAsync
(
key2
).
Result
,
"SCARD for set 2"
);
db
.
SetCombineAndStoreAsync
(
SetOperation
.
Union
,
dstkey
,
key1
,
key2
).
Wait
();
var
dstLen
=
db
.
SetLength
(
dstkey
);
Assert
.
AreEqual
(
count
*
2
,
dstLen
,
"SCARD for destination set"
);
}
}
}
}
\ No newline at end of file
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
View file @
eec15d6f
...
...
@@ -70,6 +70,7 @@
<Compile
Include=
"ConnectingFailDetection.cs"
/>
<Compile
Include=
"ConnectToUnexistingHost.cs"
/>
<Compile
Include=
"HyperLogLog.cs"
/>
<Compile
Include=
"Issues\Issue182.cs"
/>
<Compile
Include=
"WrapperBaseTests.cs"
/>
<Compile
Include=
"TransactionWrapperTests.cs"
/>
<Compile
Include=
"Bits.cs"
/>
...
...
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