Problem with IocManager and Test Project
See original GitHub issueI am using Test project generated by MVC Asp Net Core (Full Standard) template.
My LocalIocManager has more then 1000 registered components.
This property (LocalIocManager) is defined on AbpIntegratedTestBase<TStartupModule>.
I changed UserAppService and i need some another component that is registered on LocalIocManager.
When i run a unit test like:
[Fact]
public async Task GetUsers_Test()
{
var _userAppService = Resolve<IUserAppService>();
// Act
var output = await _userAppService.GetAll(new PagedResultRequestDto
{
MaxResultCount = 20,
SkipCount = 0
});
// Assert
output.Data.Count().ShouldBeGreaterThan(0);
}
The method “Resolve” call resolve form LocalIocManager and _userAppService is created but IocManager property inside _userAppService is created empty, without registered components.
I need that the IocManager property create inside _userAppService be the same as LocalIocManager with all registered components.
Somebody Helps?
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:28 (13 by maintainers)
Top Results From Across the Web
IocManager.Instance in integration tests #10577
IocManager.Instance is fine normally, but in a test project, it doesn't resolve dependencies. IIocManager should be used in my reading, ...
Read more >Tests project problem #5195 | Support Center - ASP.NET Zero
Hi guys, I ran all tests and almost all failed with the message "Message: Castle.MicroKernel.ComponentNotFoundException : No component for ...
Read more >c# - IHostingEnvironment for testing
I'm trying to use the unit test project in ABP 2.0.2 and I get the following error when I run the selected test...
Read more >IoC | Space Wizards Developer Wiki
IoC stands for Inversion of Control. What our IoCManager does is more specifically Dependency Injection. At it's core, Dependency Injection means that ...
Read more >Dependency Injection | Documentation Center | ABP.IO
So, if we try to inject the IExternalLogger interface, we get an error indicating that no implementation found. If we register both of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
acjh, thanks for your help!
I’ve created a template and checked that Property Injection is working !!. I found the problem in my project, it’s dependency on compiled assembly (Module) using “IocManager.Instance”. Now, with property injection, I can move on with my tests! I’ll refactor to use Constructor Injection as soon as I find the time
A clean fork of aspnetboilerplate/module-zero-core-template would be good.