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
117d5556
Commit
117d5556
authored
Jun 09, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
8106a7d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
DefaultPocoTest.cs
...p.Consistency.EntityFrameworkCore.Test/DefaultPocoTest.cs
+4
-3
MessageStoreTest.cs
....Consistency.EntityFrameworkCore.Test/MessageStoreTest.cs
+3
-2
MessageStoreWithGenericsTest.cs
....EntityFrameworkCore.Test/MessageStoreWithGenericsTest.cs
+6
-5
No files found.
test/Cap.Consistency.EntityFrameworkCore.Test/DefaultPocoTest.cs
View file @
117d5556
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Cap.Consistency.Infrastructure
;
using
Cap.Consistency.Store
;
using
Microsoft.AspNetCore.Builder.Internal
;
using
Microsoft.AspNetCore.Testing.xunit
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -20,7 +21,7 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
services
.
AddDbContext
<
ConsistencyDbContext
>(
o
=>
o
.
UseSqlServer
(
fixture
.
ConnectionString
))
.
AddConsistency
<
ConsistencyMessage
>
()
.
AddConsistency
()
.
AddEntityFrameworkStores
<
ConsistencyDbContext
>();
services
.
AddLogging
();
...
...
@@ -39,8 +40,8 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
[
OSSkipCondition
(
OperatingSystems
.
Linux
)]
[
OSSkipCondition
(
OperatingSystems
.
MacOSX
)]
public
async
Task
EnsureStartupUsageWorks
()
{
var
messageStore
=
_builder
.
ApplicationServices
.
GetRequiredService
<
IConsistencyMessageStore
<
ConsistencyMessage
>
>();
var
messageManager
=
_builder
.
ApplicationServices
.
GetRequiredService
<
ConsistencyMessageManager
<
ConsistencyMessage
>
>();
var
messageStore
=
_builder
.
ApplicationServices
.
GetRequiredService
<
IConsistencyMessageStore
>();
var
messageManager
=
_builder
.
ApplicationServices
.
GetRequiredService
<
ConsistencyMessageManager
>();
Assert
.
NotNull
(
messageStore
);
Assert
.
NotNull
(
messageManager
);
...
...
test/Cap.Consistency.EntityFrameworkCore.Test/MessageStoreTest.cs
View file @
117d5556
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Cap.Consistency.Infrastructure
;
using
Cap.Consistency.Store
;
using
Cap.Consistency.Test
;
using
Microsoft.AspNetCore.Testing
;
using
Microsoft.AspNetCore.Testing.xunit
;
...
...
@@ -24,7 +25,7 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
return
TestPlatformHelper
.
IsMono
||
!
TestPlatformHelper
.
IsWindows
;
}
public
class
ApplicationDbContext
:
ConsistencyDbContext
<
ApplicationMessage
,
string
>
public
class
ApplicationDbContext
:
ConsistencyDbContext
{
public
ApplicationDbContext
(
DbContextOptions
<
ApplicationDbContext
>
options
)
:
base
(
options
)
{
}
}
...
...
@@ -95,7 +96,7 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
}
protected
override
void
AddMessageStore
(
IServiceCollection
services
,
object
context
=
null
)
{
services
.
AddSingleton
<
IConsistencyMessageStore
<
ConsistencyMessage
>>(
new
ConsistencyMessageStore
<
ConsistencyMessage
>((
ConsistencyDbContext
)
context
));
services
.
AddSingleton
<
IConsistencyMessageStore
>(
new
ConsistencyMessageStore
<
ConsistencyDbContext
>((
ConsistencyDbContext
)
context
));
}
}
...
...
test/Cap.Consistency.EntityFrameworkCore.Test/MessageStoreWithGenericsTest.cs
View file @
117d5556
using
System
;
using
Cap.Consistency.Infrastructure
;
using
Cap.Consistency.Store
;
using
Cap.Consistency.Test
;
using
Microsoft.AspNetCore.Testing
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -17,7 +18,7 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
}
protected
override
void
AddMessageStore
(
IServiceCollection
services
,
object
context
=
null
)
{
services
.
AddSingleton
<
IConsistencyMessageStore
<
MessageWithGenerics
>
>(
new
MessageStoreWithGenerics
((
ContextWithGenerics
)
context
));
services
.
AddSingleton
<
IConsistencyMessageStore
>(
new
MessageStoreWithGenerics
((
ContextWithGenerics
)
context
));
}
protected
override
object
CreateTestContext
()
{
...
...
@@ -48,15 +49,15 @@ namespace Cap.Consistency.EntityFrameworkCore.Test
{
}
public
class
MessageStoreWithGenerics
:
ConsistencyMessageStore
<
Message
WithGenerics
>
public
class
MessageStoreWithGenerics
:
ConsistencyMessageStore
<
Context
WithGenerics
>
{
public
MessageStoreWithGenerics
(
DbContext
context
)
:
base
(
context
)
{
public
MessageStoreWithGenerics
(
ContextWithGenerics
context
)
:
base
(
context
)
{
}
}
public
class
ContextWithGenerics
:
ConsistencyDbContext
<
MessageWithGenerics
,
string
>
public
class
ContextWithGenerics
:
ConsistencyDbContext
{
public
ContextWithGenerics
(
DbContextOptions
options
)
:
base
(
options
)
{
public
ContextWithGenerics
()
{
}
}
}
\ No newline at end of file
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