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
b591974b
Commit
b591974b
authored
Sep 26, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #94 from mwikstrom/master
Key space isolation tests
parents
63e3fdb9
b0301847
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2083 additions
and
129 deletions
+2083
-129
BatchWrapperTests.cs
StackExchange.Redis.Tests/BatchWrapperTests.cs
+28
-0
DatabaseWrapperTests.cs
StackExchange.Redis.Tests/DatabaseWrapperTests.cs
+934
-0
StackExchange.Redis.Tests.csproj
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
+131
-122
TransactionWrapperTests.cs
StackExchange.Redis.Tests/TransactionWrapperTests.cs
+91
-0
WrapperBaseTests.cs
StackExchange.Redis.Tests/WrapperBaseTests.cs
+889
-0
packages.config
StackExchange.Redis.Tests/packages.config
+5
-4
AssemblyInfo.cs
StackExchange.Redis/Properties/AssemblyInfo.cs
+3
-1
WrapperBase.cs
...edis/StackExchange/Redis/KeyspaceIsolation/WrapperBase.cs
+2
-2
No files found.
StackExchange.Redis.Tests/BatchWrapperTests.cs
0 → 100644
View file @
b591974b
using
System
;
using
Moq
;
using
NUnit.Framework
;
using
StackExchange.Redis.StackExchange.Redis.KeyspaceIsolation
;
namespace
StackExchange.Redis.Tests
{
[
TestFixture
]
public
sealed
class
BatchWrapperTests
{
private
Mock
<
IBatch
>
mock
;
private
BatchWrapper
wrapper
;
[
TestFixtureSetUp
]
public
void
Initialize
()
{
mock
=
new
Mock
<
IBatch
>();
wrapper
=
new
BatchWrapper
(
mock
.
Object
,
"prefix:"
);
}
[
Test
]
public
void
Execute
()
{
wrapper
.
Execute
();
mock
.
Verify
(
_
=>
_
.
Execute
(),
Times
.
Once
());
}
}
}
StackExchange.Redis.Tests/DatabaseWrapperTests.cs
0 → 100644
View file @
b591974b
This diff is collapsed.
Click to expand it.
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
View file @
b591974b
This diff is collapsed.
Click to expand it.
StackExchange.Redis.Tests/TransactionWrapperTests.cs
0 → 100644
View file @
b591974b
using
System
;
using
Moq
;
using
NUnit.Framework
;
using
StackExchange.Redis.StackExchange.Redis.KeyspaceIsolation
;
namespace
StackExchange.Redis.Tests
{
[
TestFixture
]
public
sealed
class
TransactionWrapperTests
{
private
Mock
<
ITransaction
>
mock
;
private
TransactionWrapper
wrapper
;
[
TestFixtureSetUp
]
public
void
Initialize
()
{
mock
=
new
Mock
<
ITransaction
>();
wrapper
=
new
TransactionWrapper
(
mock
.
Object
,
"prefix:"
);
}
[
Test
]
public
void
AddCondition_HashEqual
()
{
wrapper
.
AddCondition
(
Condition
.
HashEqual
(
"key"
,
"field"
,
"value"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key > field == value"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_HashNotEqual
()
{
wrapper
.
AddCondition
(
Condition
.
HashNotEqual
(
"key"
,
"field"
,
"value"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key > field != value"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_HashExists
()
{
wrapper
.
AddCondition
(
Condition
.
HashExists
(
"key"
,
"field"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key > field exists"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_HashNotExists
()
{
wrapper
.
AddCondition
(
Condition
.
HashNotExists
(
"key"
,
"field"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key > field does not exists"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_KeyExists
()
{
wrapper
.
AddCondition
(
Condition
.
KeyExists
(
"key"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key exists"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_KeyNotExists
()
{
wrapper
.
AddCondition
(
Condition
.
KeyNotExists
(
"key"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key does not exists"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_StringEqual
()
{
wrapper
.
AddCondition
(
Condition
.
StringEqual
(
"key"
,
"value"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key == value"
==
value
.
ToString
())));
}
[
Test
]
public
void
AddCondition_StringNotEqual
()
{
wrapper
.
AddCondition
(
Condition
.
StringNotEqual
(
"key"
,
"value"
));
mock
.
Verify
(
_
=>
_
.
AddCondition
(
It
.
Is
<
Condition
>(
value
=>
"prefix:key != value"
==
value
.
ToString
())));
}
[
Test
]
public
void
ExecuteAsync
()
{
wrapper
.
ExecuteAsync
(
CommandFlags
.
HighPriority
);
mock
.
Verify
(
_
=>
_
.
ExecuteAsync
(
CommandFlags
.
HighPriority
),
Times
.
Once
());
}
[
Test
]
public
void
Execute
()
{
wrapper
.
Execute
(
CommandFlags
.
HighPriority
);
mock
.
Verify
(
_
=>
_
.
Execute
(
CommandFlags
.
HighPriority
),
Times
.
Once
());
}
}
}
StackExchange.Redis.Tests/WrapperBaseTests.cs
0 → 100644
View file @
b591974b
This diff is collapsed.
Click to expand it.
StackExchange.Redis.Tests/packages.config
View file @
b591974b
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"BookSleeve"
version
=
"1.3.41"
targetFramework
=
"net45"
/>
<
package
id
=
"BookSleeve"
version
=
"1.3.41"
targetFramework
=
"net45"
/>
<
package
id
=
"NUnit"
version
=
"2.6.3"
targetFramework
=
"net45"
/>
<
package
id
=
"Moq"
version
=
"4.2.1409.1722"
targetFramework
=
"net45"
/>
<
package
id
=
"NUnit"
version
=
"2.6.3"
targetFramework
=
"net45"
/>
</
packages
>
</
packages
>
\ No newline at end of file
StackExchange.Redis/Properties/AssemblyInfo.cs
View file @
b591974b
...
@@ -37,4 +37,6 @@
...
@@ -37,4 +37,6 @@
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyInformationalVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyInformationalVersion
(
"1.0.0.0"
)]
[
assembly
:
CLSCompliant
(
true
)]
[
assembly
:
CLSCompliant
(
true
)]
\ No newline at end of file
[
assembly
:
InternalsVisibleTo
(
"StackExchange.Redis.Tests"
)]
\ No newline at end of file
StackExchange.Redis/StackExchange/Redis/KeyspaceIsolation/WrapperBase.cs
View file @
b591974b
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
namespace
StackExchange.Redis.StackExchange.Redis.KeyspaceIsolation
namespace
StackExchange.Redis.StackExchange.Redis.KeyspaceIsolation
{
{
internal
abstract
class
WrapperBase
<
TInner
>
:
IDatabaseAsync
where
TInner
:
IDatabaseAsync
internal
class
WrapperBase
<
TInner
>
:
IDatabaseAsync
where
TInner
:
IDatabaseAsync
{
{
private
readonly
TInner
_inner
;
private
readonly
TInner
_inner
;
private
readonly
RedisKey
_prefix
;
private
readonly
RedisKey
_prefix
;
protected
WrapperBase
(
TInner
inner
,
RedisKey
prefix
)
internal
WrapperBase
(
TInner
inner
,
RedisKey
prefix
)
{
{
_inner
=
inner
;
_inner
=
inner
;
_prefix
=
prefix
;
_prefix
=
prefix
;
...
...
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