Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CleanArchitecture
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
CleanArchitecture
Commits
8413066e
Commit
8413066e
authored
Jun 06, 2018
by
Scott DePouw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NoOpDomainEventDispatcher for integration test purposes.
parent
d2a1cce0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
Startup.cs
src/CleanArchitecture.Web/Startup.cs
+0
-9
CustomWebApplicationFactory.cs
...ture.Tests/Integration/Web/CustomWebApplicationFactory.cs
+6
-3
NoOpDomainEventDispatcher.cs
...ecture.Tests/Integration/Web/NoOpDomainEventDispatcher.cs
+10
-0
No files found.
src/CleanArchitecture.Web/Startup.cs
View file @
8413066e
...
@@ -72,15 +72,6 @@ namespace CleanArchitecture.Web
...
@@ -72,15 +72,6 @@ namespace CleanArchitecture.Web
return
container
.
GetInstance
<
IServiceProvider
>();
return
container
.
GetInstance
<
IServiceProvider
>();
}
}
public
void
ConfigureTesting
(
IApplicationBuilder
app
,
IHostingEnvironment
env
,
ILoggerFactory
loggerFactory
)
{
this
.
Configure
(
app
,
env
,
loggerFactory
);
SeedData
.
PopulateTestData
(
app
.
ApplicationServices
.
GetService
<
AppDbContext
>());
}
public
void
Configure
(
IApplicationBuilder
app
,
IHostingEnvironment
env
,
ILoggerFactory
loggerFactory
)
public
void
Configure
(
IApplicationBuilder
app
,
IHostingEnvironment
env
,
ILoggerFactory
loggerFactory
)
{
{
loggerFactory
.
AddConsole
(
Configuration
.
GetSection
(
"Logging"
));
loggerFactory
.
AddConsole
(
Configuration
.
GetSection
(
"Logging"
));
...
...
tests/CleanArchitecture.Tests/Integration/Web/CustomWebApplicationFactory.cs
View file @
8413066e
using
CleanArchitecture.Infrastructure.Data
;
using
CleanArchitecture.Core.Interfaces
;
using
CleanArchitecture.Infrastructure.Data
;
using
CleanArchitecture.Web
;
using
CleanArchitecture.Web
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Mvc.Testing
;
using
Microsoft.AspNetCore.Mvc.Testing
;
...
@@ -28,11 +29,13 @@ namespace CleanArchitecture.Tests.Integration.Web
...
@@ -28,11 +29,13 @@ namespace CleanArchitecture.Tests.Integration.Web
options
.
UseInternalServiceProvider
(
serviceProvider
);
options
.
UseInternalServiceProvider
(
serviceProvider
);
});
});
services
.
AddScoped
<
IDomainEventDispatcher
,
NoOpDomainEventDispatcher
>();
// Build the service provider.
// Build the service provider.
var
sp
=
services
.
BuildServiceProvider
();
var
sp
=
services
.
BuildServiceProvider
();
// Create a scope to obtain a reference to the database
// Create a scope to obtain a reference to the database
// context (App
lication
DbContext).
// context (AppDbContext).
using
(
var
scope
=
sp
.
CreateScope
())
using
(
var
scope
=
sp
.
CreateScope
())
{
{
var
scopedServices
=
scope
.
ServiceProvider
;
var
scopedServices
=
scope
.
ServiceProvider
;
...
@@ -51,7 +54,7 @@ namespace CleanArchitecture.Tests.Integration.Web
...
@@ -51,7 +54,7 @@ namespace CleanArchitecture.Tests.Integration.Web
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
logger
.
LogError
(
ex
,
$
"An error occurred seeding the "
+
logger
.
LogError
(
ex
,
"An error occurred seeding the "
+
"database with test messages. Error: {ex.Message}"
);
"database with test messages. Error: {ex.Message}"
);
}
}
}
}
...
...
tests/CleanArchitecture.Tests/Integration/Web/NoOpDomainEventDispatcher.cs
0 → 100644
View file @
8413066e
using
CleanArchitecture.Core.Interfaces
;
using
CleanArchitecture.Core.SharedKernel
;
namespace
CleanArchitecture.Tests.Integration.Web
{
public
class
NoOpDomainEventDispatcher
:
IDomainEventDispatcher
{
public
void
Dispatch
(
BaseDomainEvent
domainEvent
)
{
}
}
}
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