コード例 #1
0
        public void UseEnrichers(LogLevel level, string message)
        {
            var dependencies = new DependencyCollection().AddLogs();
            var enrichers    = Many(() => new Mock <ILogEnricher>());

            foreach (var enricher in enrichers)
            {
                dependencies.AddLogEnricher(enricher.Object);
            }

            dependencies
            .AddLogWriter(Mock.Of <ILogWriter>())
            .BuildProvider()
            .GetRequired <ILogger <LogProviderShould> >()
            .Log(level, message);

            foreach (var enricher in enrichers)
            {
                enricher.Verify(e => e
                                .Enrich(level, _sender, It.IsNotNull <JsonObject>()));
            }
        }