diff --git a/src/NuGetUtility/NuGetUtility.csproj b/src/NuGetUtility/NuGetUtility.csproj index 8893334c..3387dd82 100644 --- a/src/NuGetUtility/NuGetUtility.csproj +++ b/src/NuGetUtility/NuGetUtility.csproj @@ -45,7 +45,7 @@ - + diff --git a/src/NuGetUtility/Wrapper/NuGetWrapper/NugetWrapperException.cs b/src/NuGetUtility/Wrapper/NuGetWrapper/NugetWrapperException.cs index c78bc068..f83d6f30 100644 --- a/src/NuGetUtility/Wrapper/NuGetWrapper/NugetWrapperException.cs +++ b/src/NuGetUtility/Wrapper/NuGetWrapper/NugetWrapperException.cs @@ -3,7 +3,7 @@ namespace NuGetUtility.Wrapper.NuGetWrapper { - internal class NugetWrapperException : Exception + public class NugetWrapperException : Exception { public NugetWrapperException(string message) : base(message) { } diff --git a/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/CachingDisposableSourceRepository.cs b/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/CachingDisposableSourceRepository.cs index 4190f814..c49c0119 100644 --- a/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/CachingDisposableSourceRepository.cs +++ b/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/CachingDisposableSourceRepository.cs @@ -5,7 +5,7 @@ namespace NuGetUtility.Wrapper.NuGetWrapper.Protocol.Core.Types { - internal class CachingDisposableSourceRepository : IDisposableSourceRepository + internal sealed class CachingDisposableSourceRepository : IDisposableSourceRepository { private readonly SourceCacheContext _cacheContext = new SourceCacheContext(); private readonly SourceRepository _sourceRepository; diff --git a/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/WrappedSourceRepositoryProvider.cs b/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/WrappedSourceRepositoryProvider.cs index 0971052f..1b4f2e42 100644 --- a/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/WrappedSourceRepositoryProvider.cs +++ b/src/NuGetUtility/Wrapper/NuGetWrapper/Protocol/Core/Types/WrappedSourceRepositoryProvider.cs @@ -5,7 +5,7 @@ namespace NuGetUtility.Wrapper.NuGetWrapper.Protocol.Core.Types { - internal class WrappedSourceRepositoryProvider : IWrappedSourceRepositoryProvider, IDisposable + internal sealed class WrappedSourceRepositoryProvider : IWrappedSourceRepositoryProvider, IDisposable { private readonly IDisposableSourceRepository[] _repositories; diff --git a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedAutoDataAttribute.cs b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedAutoDataAttribute.cs index 223d00bf..99d9630a 100644 --- a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedAutoDataAttribute.cs +++ b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedAutoDataAttribute.cs @@ -7,6 +7,7 @@ namespace NuGetUtility.Test.Helper.AutoFixture.NuGet.Versioning { + [AttributeUsage(AttributeTargets.Method)] public class ExtendedAutoDataAttribute : AutoDataAttribute { public ExtendedAutoDataAttribute(params System.Type[] customizations) diff --git a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedInlineAutoDataAttribute.cs b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedInlineAutoDataAttribute.cs index 30fb348c..1a24b3ee 100644 --- a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedInlineAutoDataAttribute.cs +++ b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/ExtendedInlineAutoDataAttribute.cs @@ -7,6 +7,7 @@ namespace NuGetUtility.Test.Helper.AutoFixture.NuGet.Versioning { + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class ExtendedInlineAutoDataAttribute : InlineAutoDataAttribute { public ExtendedInlineAutoDataAttribute(System.Type customization, params object[] arguments) diff --git a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/NuGetVersionBuilder.cs b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/NuGetVersionBuilder.cs index efbf99e9..fa233f3e 100644 --- a/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/NuGetVersionBuilder.cs +++ b/tests/NuGetUtility.Test/Helper/AutoFixture/NuGet/Versioning/NuGetVersionBuilder.cs @@ -12,12 +12,9 @@ internal class NuGetVersionBuilder : ISpecimenBuilder public object Create(object request, ISpecimenContext context) { - if (request is System.Type t) + if (request is System.Type t && t == typeof(INuGetVersion)) { - if (t == typeof(INuGetVersion)) - { - return new NuGetVersion($"{_rnd.Next(100, 999)}.{_rnd.Next(100, 999)}{GetPatch()}{GetBeta()}"); - } + return new NuGetVersion($"{_rnd.Next(100, 999)}.{_rnd.Next(100, 999)}{GetPatch()}{GetBeta()}"); } return new NoSpecimen(); diff --git a/tests/NuGetUtility.Test/LicenseValidator/LicenseValidationResultValueEqualityComparer.cs b/tests/NuGetUtility.Test/LicenseValidator/LicenseValidationResultValueEqualityComparer.cs index c4626789..cc500c35 100644 --- a/tests/NuGetUtility.Test/LicenseValidator/LicenseValidationResultValueEqualityComparer.cs +++ b/tests/NuGetUtility.Test/LicenseValidator/LicenseValidationResultValueEqualityComparer.cs @@ -26,7 +26,7 @@ public int GetHashCode(LicenseValidationResult obj) obj.PackageVersion, obj.PackageProjectUrl); } - private HashCode GetHashCode(List validationErrors) + private static HashCode GetHashCode(List validationErrors) { var code = new HashCode(); foreach (ValidationError error in validationErrors) diff --git a/tests/NuGetUtility.Test/Output/TestBase.cs b/tests/NuGetUtility.Test/Output/TestBase.cs index f6452a37..fa8a1424 100644 --- a/tests/NuGetUtility.Test/Output/TestBase.cs +++ b/tests/NuGetUtility.Test/Output/TestBase.cs @@ -54,7 +54,7 @@ public void SetUp() } protected abstract IOutputFormatter CreateUut(); - private T? GetNullable(Faker faker, Func getter) where T : class + private static T? GetNullable(Faker faker, Func getter) where T : class { if (faker.Random.Bool()) { @@ -63,7 +63,7 @@ public void SetUp() return getter(); } - private IEnumerable GetErrorList(Faker faker) + private static IEnumerable GetErrorList(Faker faker) { int itemCount = faker.Random.Int(3, 10); for (int i = 0; i < itemCount; i++) diff --git a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs index d84808d1..47c51846 100644 --- a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs +++ b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs @@ -139,7 +139,7 @@ public async Task GetPackageInfo_Should_PreferLocalPackageCacheOverRepositories( } } - private void SetupPackagesForRepositories(IEnumerable packages, IEnumerable packageMetadataResources) + private static void SetupPackagesForRepositories(IEnumerable packages, IEnumerable packageMetadataResources) { foreach (CustomPackageInformation package in packages) {