I am in the process of migrating an existing aspnet core solution to .NET Core 3.1 from 2.2 which previously utilised StructureMap. I have moved over to Lamar as part of the migration as StructureMap doesn't work with 3.1.
The aspnet application has been migrated and works fine, however I am using Jimmy Bogard's MediatR exclusively as part of the vertical slice architecture for the app. As part of this, I have an integration test project which has a SliceFixture.cs static class which invokes the Startup.cs class in the aspnet application as part of its lifecycle calling all of the requisite startup code for the tests to run correctly.
The problem I am having with Lamar is that it doesn't have any of the ILogger dependencies registered when I execute any integration tests on classes which depend on an ILogger.
The error I get is
System.InvalidOperationException : Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger`1[Web.Features.Maintenance.HearingLoss.SortOrder+CommandHandler]' while attempting to activate 'Web.Features.Maintenance.HearingLoss.SortOrder+CommandHandler'.
Register any single implementation of any interface against that interface
Connect all implementations of open generic type MediatR.IRequestHandler`2
Connect all implementations of open generic type MediatR.INotificationHandler`1
No problems were encountered in exporting types from Assemblies
The results from WhatDoIHave() method from running from the aspnet application show all of the ILogger dependencies have been registered but not so when I run the integration tests.
Hello,
I am in the process of migrating an existing aspnet core solution to .NET Core 3.1 from 2.2 which previously utilised StructureMap. I have moved over to Lamar as part of the migration as StructureMap doesn't work with 3.1.
The aspnet application has been migrated and works fine, however I am using Jimmy Bogard's MediatR exclusively as part of the vertical slice architecture for the app. As part of this, I have an integration test project which has a SliceFixture.cs static class which invokes the Startup.cs class in the aspnet application as part of its lifecycle calling all of the requisite startup code for the tests to run correctly.
The problem I am having with Lamar is that it doesn't have any of the ILogger dependencies registered when I execute any integration tests on classes which depend on an ILogger.
The error I get is
This is the scanning code I have in my startup:
The results of WhatDidIScan() from both the aspnet app and the intergration tests are exactly the same:
The results from WhatDoIHave() method from running from the aspnet application show all of the ILogger dependencies have been registered but not so when I run the integration tests.