Skip to content

Commit

Permalink
fix: inject NullLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
melotic committed Oct 3, 2023
1 parent bef591f commit dbcc749
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace Microsoft.ComponentDetection.Detectors.Tests;
using Microsoft.ComponentDetection.Contracts;
using Microsoft.ComponentDetection.Orchestrator.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
Expand All @@ -18,7 +20,10 @@ public class ComponentDetectorTests
[TestInitialize]
public void Initialize()
{
var serviceProvider = new ServiceCollection().AddComponentDetection().BuildServiceProvider();
var serviceProvider = new ServiceCollection()
.AddComponentDetection()
.AddSingleton(typeof(ILogger<>), typeof(NullLogger<>))
.BuildServiceProvider();

this.detectors = serviceProvider.GetServices<IComponentDetector>().ToList();
}
Expand Down

0 comments on commit dbcc749

Please sign in to comment.