-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add DI tests for LightInject, StashBox, Lamar
#1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ba6d522
Add DI tests for LightInject
jithu7432 49f077b
Added DI tests for StashBox
jithu7432 ba3526b
Added DI tests for Lamar
jithu7432 f013c5b
Apply suggestion from @Copilot
jbogard 106d33c
Apply suggestion from @Copilot
jbogard ec96459
Apply suggestion from @Copilot
jbogard 0992a83
Merge branch 'master' into master
jbogard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
test/MediatR.DependencyInjectionTests/LamarDependencyInjectionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests; | ||
|
|
||
| public class LamarDependencyInjectionTests() | ||
| : BaseAssemblyResolutionTests(new LamarServiceProviderFixture()); |
7 changes: 7 additions & 0 deletions
7
test/MediatR.DependencyInjectionTests/LightInjectDependencyInjectionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests; | ||
|
|
||
| public class LightInjectDependencyInjectionTests() | ||
| : BaseAssemblyResolutionTests(new LightInjectServiceProviderFixture()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
test/MediatR.DependencyInjectionTests/Providers/LamarServiceProviderFixture.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using Lamar; | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| public class LamarServiceProviderFixture : BaseServiceProviderFixture | ||
| { | ||
| public override IServiceProvider Provider | ||
| { | ||
| get | ||
| { | ||
| var services = new ServiceCollection(); | ||
| services.AddFakeLogging(); | ||
| services.AddMediatR(x => x.RegisterServicesFromAssemblyContaining(typeof(Pong))); | ||
| var c = new Container(services); | ||
| return c.ServiceProvider; | ||
| } | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
test/MediatR.DependencyInjectionTests/Providers/LightInjectServiceProviderFixture.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using LightInject; | ||
| using LightInject.Microsoft.DependencyInjection; | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| public class LightInjectServiceProviderFixture : BaseServiceProviderFixture | ||
| { | ||
| public override IServiceProvider Provider | ||
| { | ||
| get | ||
| { | ||
| var services = new ServiceCollection(); | ||
| services.AddFakeLogging(); | ||
| services.AddMediatR(x => x.RegisterServicesFromAssemblyContaining(typeof(Pong))); | ||
|
|
||
| var container = new ServiceContainer(new ContainerOptions() | ||
| { | ||
| EnableMicrosoftCompatibility = true | ||
| }); | ||
| return container.CreateServiceProvider(services); | ||
| } | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
test/MediatR.DependencyInjectionTests/Providers/StashBoxServiceProviderFixture.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
| using Stashbox; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| public class StashBoxServiceProviderFixture : BaseServiceProviderFixture | ||
| { | ||
| public override IServiceProvider Provider | ||
| { | ||
| get | ||
| { | ||
| var services = new ServiceCollection(); | ||
| services.AddFakeLogging(); | ||
| services.AddMediatR(x => x.RegisterServicesFromAssemblyContaining(typeof(Pong))); | ||
|
|
||
| var container = new StashboxContainer(); | ||
| services.UseStashbox(container); | ||
| container.Validate(); | ||
|
|
||
| return services.BuildServiceProvider(); | ||
| } | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
test/MediatR.DependencyInjectionTests/StashBoxDependencyInjectionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| using MediatR.DependencyInjectionTests.Abstractions; | ||
| using MediatR.DependencyInjectionTests.Providers; | ||
|
|
||
| namespace MediatR.DependencyInjectionTests; | ||
|
|
||
| public class StashBoxDependencyInjectionTests : BaseAssemblyResolutionTests | ||
| { | ||
| public StashBoxDependencyInjectionTests() : base(new StashBoxServiceProviderFixture()) { } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.