public void Lazy_loading_is_logged_only_when_actually_loading()
        {
            var loggerFactory = new ListLoggerFactory();

            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkInMemoryDatabase()
                                  .AddSingleton <ILoggerFactory>(loggerFactory)
                                  .BuildServiceProvider(validateScopes: true);

            using (var context = new WarningAsErrorContext(serviceProvider, defaultThrow: false))
            {
                context.Add(
                    new WarningAsErrorEntity {
                    Nav = new IncludedEntity()
                });
                context.SaveChanges();
            }

            using (var context = new WarningAsErrorContext(serviceProvider, defaultThrow: false))
            {
                var entity = context.WarningAsErrorEntities.OrderBy(e => e.Id).First();

                loggerFactory.Clear();
                Assert.NotNull(entity.Nav);

                Assert.Contains(
                    CoreResources.LogNavigationLazyLoading(new TestLogger <InMemoryLoggingDefinitions>())
                    .GenerateMessage("WarningAsErrorEntity", "Nav"),
                    loggerFactory.Log.Select(l => l.Message));

                loggerFactory.Clear();
                Assert.NotNull(entity.Nav);
                Assert.DoesNotContain(
                    CoreResources.LogNavigationLazyLoading(new TestLogger <InMemoryLoggingDefinitions>())
                    .GenerateMessage("WarningAsErrorEntity", "Nav"),
                    loggerFactory.Log.Select(l => l.Message));
            }
        }