Hello there,
I was wondering why ILocalizationManager does not get injected in custom classes (not appservice and alike) when using the Test infrastructure (extending from AbpIntegratedTestBase).
Is this expected behavior ?
If so, how can I make the ILocalizationManager to be registered in Test infrastructure?
Bruno
5 Answer(s)
-
0
The issue here is :
If I resolve ILocalizationManager inside test class constructor = its not registered.
If I resolve inside a [Fact] it works
Is this expected behavior ?
BRuno
-
0
This test passes for me:
public class LocalizationManager_Constructor_Resolve_Test : AbpIntegratedTestBase { private readonly ILocalizationManager _localizationManager; public LocalizationManager_Constructor_Resolve_Test() { _localizationManager = Resolve<ILocalizationManager>(); } [Fact] public void Test_If_Null() { _localizationManager.ShouldNotBeNull(); } }
There is no such a restriction.
-
0
Thank you Halil.
I will try to reproduce the test and let you know
Bruno
-
0
Hi, I'm facing this same issue, but not in the test classes.
I want to create a custom exception type that contains a localized error message (specific to the exception, and not injected from outside). But when I try to resolve the ILocalizationManager interface I get an error that it is not implemented.
-
0
Can you share some code. ILocalizationManager should be injectable, because most of base classes (MVC Controllers, App services) already injecting and using it eveywhere.