From e86b83c9ab5f12b848af4c59f57ff328ca04fee0 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Sun, 24 Apr 2022 12:00:50 -0500 Subject: [PATCH] test: Fix analysis warnings for unused classes --- src/Trash.Tests/Command/Helpers/CliTypeActivatorTest.cs | 7 ++++++- src/Trash.Tests/CompositionRootTest.cs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Trash.Tests/Command/Helpers/CliTypeActivatorTest.cs b/src/Trash.Tests/Command/Helpers/CliTypeActivatorTest.cs index c6721c48..92dadebe 100644 --- a/src/Trash.Tests/Command/Helpers/CliTypeActivatorTest.cs +++ b/src/Trash.Tests/Command/Helpers/CliTypeActivatorTest.cs @@ -1,4 +1,5 @@ -using Autofac; +using System.Diagnostics.CodeAnalysis; +using Autofac; using FluentAssertions; using NUnit.Framework; using Trash.Command; @@ -10,10 +11,14 @@ namespace Trash.Tests.Command.Helpers; [Parallelizable(ParallelScope.All)] public class CliTypeActivatorTest { + // Warning CA1812 : an internal class that is apparently never instantiated. + [SuppressMessage("Performance", "CA1812", Justification = "Registered to and created by Autofac")] private class NonServiceCommandType { } + // Warning CA1812 : an internal class that is apparently never instantiated. + [SuppressMessage("Performance", "CA1812", Justification = "Registered to and created by Autofac")] private class StubCommand : IServiceCommand { public bool Preview => false; diff --git a/src/Trash.Tests/CompositionRootTest.cs b/src/Trash.Tests/CompositionRootTest.cs index d1b91b81..f60efafa 100644 --- a/src/Trash.Tests/CompositionRootTest.cs +++ b/src/Trash.Tests/CompositionRootTest.cs @@ -1,4 +1,5 @@ using System.Collections; +using System.Diagnostics.CodeAnalysis; using Autofac; using Autofac.Core; using FluentAssertions; @@ -39,6 +40,11 @@ public class CompositionRootTest act.Should().NotThrow(); } + // Warning CA1812 : CompositionRootTest.ConcreteTypeEnumerator is an internal class that is apparently never + // instantiated. + [SuppressMessage("Performance", "CA1812", + Justification = "Created via reflection by TestCaseSource attribute" + )] private sealed class ConcreteTypeEnumerator : IEnumerable { private readonly IContainer _container;