diff --git a/src/Autofac.Extras.Moq/AutoMock.cs b/src/Autofac.Extras.Moq/AutoMock.cs index a617391..5eaf1e7 100644 --- a/src/Autofac.Extras.Moq/AutoMock.cs +++ b/src/Autofac.Extras.Moq/AutoMock.cs @@ -9,6 +9,26 @@ namespace Autofac.Extras.Moq; /// /// Wrapper around and . /// +/// +/// +/// Adding real framework services (for example, Entity Framework Core or +/// Microsoft.Extensions.Logging) into the +/// container can produce unexpected behavior. +/// automatically supplies a mock for any service it can't otherwise resolve, +/// including the individual elements of an otherwise-empty collection +/// dependency (such as IEnumerable<ILoggerProvider>). A +/// loosely-mocked element returns from members that +/// aren't explicitly set up, which can cause the consuming framework to throw - +/// for example a deep inside the +/// framework's own code. +/// +/// +/// If you need real framework services in your test, register concrete +/// implementations for the services that framework consumes (or avoid mixing +/// real framework wiring into the auto-mocking container) so that +/// does not fill those slots with mocks. +/// +/// public class AutoMock : IDisposable { private readonly HashSet _createdServiceTypes = new();