From dbcc749e7daabf1052a5903bc3e067e1a13b2d6f Mon Sep 17 00:00:00 2001 From: Justin Perez Date: Tue, 3 Oct 2023 14:19:50 -0700 Subject: [PATCH] fix: inject `NullLogger` --- .../ComponentDetectorTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/ComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/ComponentDetectorTests.cs index 7c1e6d1b1..ffe405ba8 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/ComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/ComponentDetectorTests.cs @@ -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] @@ -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().ToList(); }