Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
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
CAP
Commits
8106a7d1
Commit
8106a7d1
authored
Jun 09, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
e9f1a8d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
MessageManagerTestBase.cs
test/Shared/MessageManagerTestBase.cs
+7
-6
TestConsistencyMessage.cs
test/Shared/TestConsistencyMessage.cs
+0
-4
No files found.
test/Shared/MessageManagerTestBase.cs
View file @
8106a7d1
...
...
@@ -5,6 +5,7 @@ using System.Linq.Expressions;
using
System.Security.Claims
;
using
System.Threading.Tasks
;
using
Cap.Consistency.Infrastructure
;
using
Cap.Consistency.Store
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.Extensions.DependencyInjection
;
...
...
@@ -30,13 +31,13 @@ namespace Cap.Consistency.Test
protected
virtual
void
SetupMessageServices
(
IServiceCollection
services
,
object
context
=
null
)
{
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
services
.
AddConsistency
<
TMessage
>
();
services
.
AddConsistency
();
AddMessageStore
(
services
,
context
);
services
.
AddSingleton
<
ILogger
<
ConsistencyMessageManager
<
TMessage
>>>(
new
TestLogger
<
ConsistencyMessageManager
<
TMessage
>
>());
services
.
AddSingleton
<
ILogger
<
ConsistencyMessageManager
>>(
new
TestLogger
<
ConsistencyMessageManager
>());
}
protected
virtual
ConsistencyMessageManager
<
TMessage
>
CreateManager
(
object
context
=
null
,
IServiceCollection
services
=
null
,
Action
<
IServiceCollection
>
configureServices
=
null
)
{
protected
virtual
ConsistencyMessageManager
CreateManager
(
object
context
=
null
,
IServiceCollection
services
=
null
,
Action
<
IServiceCollection
>
configureServices
=
null
)
{
if
(
services
==
null
)
{
services
=
new
ServiceCollection
();
}
...
...
@@ -47,7 +48,7 @@ namespace Cap.Consistency.Test
configureServices
?.
Invoke
(
services
);
return
services
.
BuildServiceProvider
().
GetService
<
ConsistencyMessageManager
<
TMessage
>
>();
return
services
.
BuildServiceProvider
().
GetService
<
ConsistencyMessageManager
>();
}
protected
abstract
object
CreateTestContext
();
...
...
@@ -68,7 +69,7 @@ namespace Cap.Consistency.Test
Assert
.
NotNull
(
operateResult
);
Assert
.
True
(
operateResult
.
Succeeded
);
var
messageId
=
await
manager
.
Ge
t
MessageIdAsync
(
message
);
var
messageId
=
await
manager
.
Ge
Consistency
MessageIdAsync
(
message
);
operateResult
=
await
manager
.
DeleteAsync
(
message
);
Assert
.
Null
(
await
manager
.
FindByIdAsync
(
messageId
));
}
...
...
@@ -85,7 +86,7 @@ namespace Cap.Consistency.Test
Assert
.
NotNull
(
operateResult
);
Assert
.
True
(
operateResult
.
Succeeded
);
var
messageId
=
await
manager
.
Ge
t
MessageIdAsync
(
message
);
var
messageId
=
await
manager
.
Ge
Consistency
MessageIdAsync
(
message
);
Assert
.
NotNull
(
await
manager
.
FindByIdAsync
(
messageId
));
}
}
...
...
test/Shared/TestConsistencyMessage.cs
View file @
8106a7d1
...
...
@@ -4,8 +4,4 @@ using Cap.Consistency.Infrastructure;
namespace
Cap.Consistency.Test
{
public
class
TestConsistencyMessage
:
ConsistencyMessage
{
}
}
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