From d48224e234561b11d51c4f713860d824acbf90b3 Mon Sep 17 00:00:00 2001 From: sensslen Date: Mon, 3 Oct 2022 21:17:55 +0200 Subject: [PATCH] Add parameter to select the type of output for version 3.0.0 (#142) --- .github/workflows/action.yml | 4 +- .github/workflows/release.yml | 8 +- .whitesource | 14 +++ NugetUtility.sln | 1 + README.md | 12 +- renovate.json | 6 + .../LicenseValidationError.cs | 2 +- .../LicenseValidator/ValidatedLicense.cs | 2 +- src/NuGetUtility/Output/IOuputFormatter.cs | 10 ++ .../Output/Json/JsonOutputFormatter.cs | 26 +++++ .../Output/Json/NuGetVersionJsonConverter.cs | 20 ++++ .../Output/Table/TableOutputFormatter.cs | 34 ++++++ .../Table}/TablePrinter.cs | 58 +++++----- .../Table}/TablePrinterExtensions.cs | 6 +- src/NuGetUtility/OutputType.cs | 8 ++ src/NuGetUtility/Program.cs | 46 ++++---- src/Properties/launchSettings.json | 12 -- .../Extensions/HashSetExtensionsTest.cs | 1 - .../Extensions/MemoryStreamExtension.cs | 14 +++ .../Extensions/ProjectExtensionsTest.cs | 1 - ...sion.cs => EnumEnumerableWithException.cs} | 4 +- .../EnumValuesExceptAttribute.cs | 5 +- .../LicenseValidator/LicenseValidatorTest.cs | 1 - .../NuGetUtility.Test.csproj | 2 + ...rintCorrectTable_errorCount=0.verified.txt | 1 + ...rintCorrectTable_errorCount=1.verified.txt | 1 + ...intCorrectTable_errorCount=20.verified.txt | 1 + ...rintCorrectTable_errorCount=5.verified.txt | 1 + ...Table_validatedLicenseCount=0.verified.txt | 1 + ...Table_validatedLicenseCount=1.verified.txt | 1 + ...ble_validatedLicenseCount=100.verified.txt | 1 + ...able_validatedLicenseCount=20.verified.txt | 1 + ...Table_validatedLicenseCount=5.verified.txt | 1 + .../Output/Json/JsonOutputFormatterTest.cs | 55 +++++++++ ...rintCorrectTable_errorCount=0.verified.txt | 4 + ...rintCorrectTable_errorCount=1.verified.txt | 5 + ...intCorrectTable_errorCount=20.verified.txt | 24 ++++ ...rintCorrectTable_errorCount=5.verified.txt | 9 ++ ...Table_validatedLicenseCount=0.verified.txt | 4 + ...Table_validatedLicenseCount=1.verified.txt | 5 + ...ble_validatedLicenseCount=100.verified.txt | 104 ++++++++++++++++++ ...able_validatedLicenseCount=20.verified.txt | 24 ++++ ...Table_validatedLicenseCount=5.verified.txt | 9 ++ .../Output/Table/TableOutputFormatterTest.cs | 55 +++++++++ .../PackageInformationReaderTest.cs | 1 - ...ReferencedPackagesReaderIntegrationTest.cs | 9 +- .../ReferencedPackagesReaderTest.cs | 1 - 47 files changed, 522 insertions(+), 93 deletions(-) create mode 100644 .whitesource create mode 100644 renovate.json create mode 100644 src/NuGetUtility/Output/IOuputFormatter.cs create mode 100644 src/NuGetUtility/Output/Json/JsonOutputFormatter.cs create mode 100644 src/NuGetUtility/Output/Json/NuGetVersionJsonConverter.cs create mode 100644 src/NuGetUtility/Output/Table/TableOutputFormatter.cs rename src/NuGetUtility/{ConsoleUtilities => Output/Table}/TablePrinter.cs (51%) rename src/NuGetUtility/{ConsoleUtilities => Output/Table}/TablePrinterExtensions.cs (71%) create mode 100644 src/NuGetUtility/OutputType.cs delete mode 100644 src/Properties/launchSettings.json create mode 100644 tests/NuGetUtility.Test/Extensions/MemoryStreamExtension.cs rename tests/NuGetUtility.Test/Helper/NUnitExtension/{EnumEnumerableWithExtension.cs => EnumEnumerableWithException.cs} (78%) create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.cs create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt create mode 100644 tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.cs diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 19886b70..6fc1201f 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -24,9 +24,9 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dotnet 6.0.x - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: "6.0.x" # SDK Version to use (x uses the latest version). # dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d73f52b..26f2829f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,9 +13,9 @@ jobs: runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dotnet 6.0.x - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: "6.0.x" # SDK Version to use (x uses the latest version). env: @@ -43,12 +43,12 @@ jobs: run: dotnet pack -c Release -o ./artifacts # Zip Artifacts - name: Zip artifacts - uses: tomchavakis/action-zip@v0.1.0 + uses: tomchavakis/action-zip@v0.1.1 with: args: zip -qq -r ./release.zip ./artifacts - name: Create release id: create_release - uses: actions/create-release@v1.0.0 + uses: actions/create-release@v1.1.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.whitesource b/.whitesource new file mode 100644 index 00000000..9c7ae90b --- /dev/null +++ b/.whitesource @@ -0,0 +1,14 @@ +{ + "scanSettings": { + "baseBranches": [] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff", + "useMendCheckNames": true + }, + "issueSettings": { + "minSeverityLevel": "LOW", + "issueType": "DEPENDENCY" + } +} \ No newline at end of file diff --git a/NugetUtility.sln b/NugetUtility.sln index e1560d85..dd6dabb8 100644 --- a/NugetUtility.sln +++ b/NugetUtility.sln @@ -8,6 +8,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{B72B75A4-ADBC-4F0B-82DA-0C8594437F5D}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + README.md = README.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetUtility.Test", "tests\NuGetUtility.Test\NuGetUtility.Test.csproj", "{1EBC8E4A-7677-4AF9-9C37-0CF81A9A689E}" diff --git a/README.md b/README.md index 4a6a3a9f..d4d38f71 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Nuget License Utility [![Build Status](https://travis-ci.com/tomchavakis/nuget-license.svg?branch=develop)](https://travis-ci.com/tomchavakis/nuget-license.svg?branch=develop) [![NuGet](https://img.shields.io/nuget/v/dotnet-project-licenses.svg)](https://www.nuget.org/packages/dotnet-project-licenses) -A .net core tool to print the licenses of a project. This tool supports .NET Core and .NET Standard and .NET Framework Projects. +A .net core tool to print the licenses of a project. This tool supports .NET Core and .NET Standard and .NET Framework +Projects. ## dotnet-project-licenses tool @@ -33,16 +34,21 @@ Usage: dotnet-project-licenses [options] | `-mapping, --licenseurl-to-license-mappings` | When used, this option allows to override the url to license mapping built into the application (see [here](src/NuGetUtility/LicenseValidator/UrlToLicenseMapping.cs)) | | `-override, --override-package-information` | When used, this option allows to override the package information used for the validation. This makes sure that no attempt is made to get the associated information about the package from the available web resources. This is useful for packages that e.g. provide a license file as part of the nuget package which (at the time of writing) cannot be used for validation and thus requires the package's information to be provided by this option. | | `-d, --license-information-download-location` | When used, this option downloads the html content of the license URL to the specified folder. This is done for all NuGet packages that specify a license URL instead of providing the license expression. | +| `-o, --output` | This Parameter accepts the value `table` or `json`. It allows to select the type of output that should be given. If omitted, the output is given in tabular form. | ## Example tool commands - +### Show help ```ps dotnet-project-licenses --help ``` - +### Validate licenses for .csproj file ```ps dotnet-project-licenses -i project.csproj ``` +### Generate machine readable output +```ps +dotnet-project-licenses -i project.csproj -o json +``` ## Docker diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..39a2b6e9 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ] +} diff --git a/src/NuGetUtility/LicenseValidator/LicenseValidationError.cs b/src/NuGetUtility/LicenseValidator/LicenseValidationError.cs index 5e745099..911bac74 100644 --- a/src/NuGetUtility/LicenseValidator/LicenseValidationError.cs +++ b/src/NuGetUtility/LicenseValidator/LicenseValidationError.cs @@ -2,7 +2,7 @@ namespace NuGetUtility.LicenseValidator { - public record struct LicenseValidationError(string Context, + public record LicenseValidationError(string Context, string PackageId, NuGetVersion PackageVersion, string Message); diff --git a/src/NuGetUtility/LicenseValidator/ValidatedLicense.cs b/src/NuGetUtility/LicenseValidator/ValidatedLicense.cs index 746c68e5..0995708a 100644 --- a/src/NuGetUtility/LicenseValidator/ValidatedLicense.cs +++ b/src/NuGetUtility/LicenseValidator/ValidatedLicense.cs @@ -2,7 +2,7 @@ namespace NuGetUtility.LicenseValidator { - public record struct ValidatedLicense(string PackageId, + public record ValidatedLicense(string PackageId, NuGetVersion PackageVersion, string License, LicenseInformationOrigin LicenseInformationOrigin); diff --git a/src/NuGetUtility/Output/IOuputFormatter.cs b/src/NuGetUtility/Output/IOuputFormatter.cs new file mode 100644 index 00000000..aef9ec9f --- /dev/null +++ b/src/NuGetUtility/Output/IOuputFormatter.cs @@ -0,0 +1,10 @@ +using NuGetUtility.LicenseValidator; + +namespace NuGetUtility.Output +{ + public interface IOutputFormatter + { + Task Write(Stream stream, IEnumerable errors); + Task Write(Stream stream, IEnumerable validated); + } +} diff --git a/src/NuGetUtility/Output/Json/JsonOutputFormatter.cs b/src/NuGetUtility/Output/Json/JsonOutputFormatter.cs new file mode 100644 index 00000000..fe9e74d4 --- /dev/null +++ b/src/NuGetUtility/Output/Json/JsonOutputFormatter.cs @@ -0,0 +1,26 @@ +using NuGetUtility.LicenseValidator; +using System.Text.Json; + +namespace NuGetUtility.Output.Json +{ + public class JsonOutputFormatter : IOutputFormatter + { + private readonly JsonSerializerOptions _options; + public JsonOutputFormatter() + { + _options = new JsonSerializerOptions + { + Converters = { new NuGetVersionJsonConverter() } + }; + } + + public async Task Write(Stream stream, IEnumerable errors) + { + await JsonSerializer.SerializeAsync(stream, errors, _options); + } + public async Task Write(Stream stream, IEnumerable validated) + { + await JsonSerializer.SerializeAsync(stream, validated, _options); + } + } +} diff --git a/src/NuGetUtility/Output/Json/NuGetVersionJsonConverter.cs b/src/NuGetUtility/Output/Json/NuGetVersionJsonConverter.cs new file mode 100644 index 00000000..2f5a3ad3 --- /dev/null +++ b/src/NuGetUtility/Output/Json/NuGetVersionJsonConverter.cs @@ -0,0 +1,20 @@ +using NuGet.Versioning; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace NuGetUtility.Output.Json +{ + public class NuGetVersionJsonConverter : JsonConverter + { + public override NuGetVersion? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var readStringValue = reader.GetString(); + return new NuGetVersion(readStringValue); + } + + public override void Write(Utf8JsonWriter writer, NuGetVersion value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.ToString()); + } + } +} diff --git a/src/NuGetUtility/Output/Table/TableOutputFormatter.cs b/src/NuGetUtility/Output/Table/TableOutputFormatter.cs new file mode 100644 index 00000000..079fcee0 --- /dev/null +++ b/src/NuGetUtility/Output/Table/TableOutputFormatter.cs @@ -0,0 +1,34 @@ +using NuGetUtility.LicenseValidator; + +namespace NuGetUtility.Output.Table +{ + public class TableOutputFormatter : IOutputFormatter + { + public async Task Write(Stream stream, IEnumerable errors) + { + await TablePrinterExtensions.Create(stream, "Context", "Package", "Version", "LicenseError") + .FromValues(errors, + error => + { + return new object[] { error.Context, error.PackageId, error.PackageVersion, error.Message }; + }) + .Print(); + } + + public async Task Write(Stream stream, IEnumerable validated) + { + await TablePrinterExtensions + .Create(stream, "Package", "Version", "License Information Origin", "License Expression") + .FromValues( + validated, + license => + { + return new object[] + { + license.PackageId, license.PackageVersion, license.LicenseInformationOrigin, license.License + }; + }) + .Print(); + } + } +} diff --git a/src/NuGetUtility/ConsoleUtilities/TablePrinter.cs b/src/NuGetUtility/Output/Table/TablePrinter.cs similarity index 51% rename from src/NuGetUtility/ConsoleUtilities/TablePrinter.cs rename to src/NuGetUtility/Output/Table/TablePrinter.cs index e27e76eb..eff2a8b9 100644 --- a/src/NuGetUtility/ConsoleUtilities/TablePrinter.cs +++ b/src/NuGetUtility/Output/Table/TablePrinter.cs @@ -1,5 +1,7 @@ // ReSharper disable once CheckNamespace +using System.Text; + namespace Utilities { /// @@ -9,10 +11,12 @@ public class TablePrinter { private readonly List _lengths; private readonly List _rows = new List(); + private readonly Stream _stream; private readonly string[] _titles; - public TablePrinter(params string[] titles) + public TablePrinter(Stream stream, params string[] titles) { + _stream = stream; _titles = titles; _lengths = titles.Select(t => t.Length).ToList(); } @@ -35,42 +39,40 @@ public void AddRow(params object?[] row) } } - public void Print() + public async Task Print() { - _lengths.ForEach(l => Console.Write("+-" + new string('-', l) + '-')); - Console.WriteLine("+"); + await using var writer = new StreamWriter(_stream, leaveOpen: true); - var line = ""; - for (var i = 0; i < _titles.Length; i++) + await WriteSeparator(writer); + await WriteRow(_titles, writer); + await WriteSeparator(writer); + + foreach (var row in _rows) { - line += "| " + _titles[i].PadRight(_lengths[i]) + ' '; + await WriteRow(row, writer); } - Console.WriteLine(line + "|"); + await WriteSeparator(writer); + } + private async Task WriteRow(string[] values, TextWriter writer) + { + for (var i = 0; i < values.Length; i++) + { + await writer.WriteAsync("| "); + await writer.WriteAsync(values[i].PadRight(_lengths[i])); + await writer.WriteAsync(' '); + } - _lengths.ForEach(l => Console.Write("+-" + new string('-', l) + '-')); - Console.WriteLine("+"); + await writer.WriteLineAsync("|"); + } - foreach (var row in _rows) + private async Task WriteSeparator(TextWriter writer) + { + foreach (var l in _lengths) { - line = ""; - for (var i = 0; i < row.Length; i++) - { - if (int.TryParse(row[i], out var n)) - { - line += "| " + row[i].PadLeft(_lengths[i]) + ' ';// numbers are padded to the left - } - else - { - line += "| " + row[i].PadRight(_lengths[i]) + ' '; - } - } - - Console.WriteLine(line + "|"); + await writer.WriteAsync("+-" + new string('-', l) + '-'); } - - _lengths.ForEach(l => Console.Write("+-" + new string('-', l) + '-')); - Console.WriteLine("+"); + await writer.WriteLineAsync("+"); } } } diff --git a/src/NuGetUtility/ConsoleUtilities/TablePrinterExtensions.cs b/src/NuGetUtility/Output/Table/TablePrinterExtensions.cs similarity index 71% rename from src/NuGetUtility/ConsoleUtilities/TablePrinterExtensions.cs rename to src/NuGetUtility/Output/Table/TablePrinterExtensions.cs index 1a16b6a6..633ab963 100644 --- a/src/NuGetUtility/ConsoleUtilities/TablePrinterExtensions.cs +++ b/src/NuGetUtility/Output/Table/TablePrinterExtensions.cs @@ -1,12 +1,12 @@ using Utilities; -namespace NuGetUtility.ConsoleUtilities +namespace NuGetUtility.Output.Table { internal static class TablePrinterExtensions { - public static TablePrinter Create(params string[] headings) + public static TablePrinter Create(Stream stream, params string[] headings) { - return new TablePrinter(headings); + return new TablePrinter(stream, headings); } public static TablePrinter FromValues(this TablePrinter printer, diff --git a/src/NuGetUtility/OutputType.cs b/src/NuGetUtility/OutputType.cs new file mode 100644 index 00000000..7b6fa293 --- /dev/null +++ b/src/NuGetUtility/OutputType.cs @@ -0,0 +1,8 @@ +namespace NuGetUtility +{ + public enum OutputType + { + Table, + Json + } +} diff --git a/src/NuGetUtility/Program.cs b/src/NuGetUtility/Program.cs index d987874d..094327bc 100644 --- a/src/NuGetUtility/Program.cs +++ b/src/NuGetUtility/Program.cs @@ -1,8 +1,10 @@ using McMaster.Extensions.CommandLineUtils; using NuGet.Configuration; using NuGet.Protocol.Core.Types; -using NuGetUtility.ConsoleUtilities; using NuGetUtility.LicenseValidator; +using NuGetUtility.Output; +using NuGetUtility.Output.Json; +using NuGetUtility.Output.Table; using NuGetUtility.PackageInformationReader; using NuGetUtility.ReferencedPackagesReader; using NuGetUtility.Serialization; @@ -63,6 +65,11 @@ public class Program "When set, the application downloads all licenses given using a license URL to the specified folder.")] public string? DownloadLicenseInformation { get; } = null; + [Option(LongName = "output", + ShortName = "o", + Description = "This parameter allows to choose between tabular and json output.")] + public OutputType OutputType { get; } = OutputType.Table; + private HttpClient HttpClient { get @@ -91,6 +98,7 @@ private async Task OnExecuteAsync() var allowedLicenses = GetAllowedLicenses(); var overridePackageInformation = GetOverridePackageInformation(); var urlLicenseFileDownloader = GetFileDownloader(); + var output = GetOutputFormatter(); var msBuild = new MsBuildAbstraction(); var projectCollector = new ProjectsCollector(msBuild); @@ -134,26 +142,27 @@ private async Task OnExecuteAsync() return -1; } + await using var outputStream = Console.OpenStandardOutput(); if (validator.GetErrors().Any()) { - WriteValidationErrors(validator); + await output.Write(outputStream, validator.GetErrors()); return -1; } - TablePrinterExtensions.Create("Package", "Version", "License Information Origin", "License Expression") - .FromValues( - validator.GetValidatedLicenses(), - license => - { - return new object[] - { - license.PackageId, license.PackageVersion, license.LicenseInformationOrigin, license.License - }; - }) - .Print(); + await output.Write(outputStream, validator.GetValidatedLicenses()); return 0; } + private IOutputFormatter GetOutputFormatter() + { + return OutputType switch + { + OutputType.Json => new JsonOutputFormatter(), + OutputType.Table => new TableOutputFormatter(), + _ => throw new ArgumentOutOfRangeException($"{OutputType} not supported") + }; + } + private IFileDownloader GetFileDownloader() { if (DownloadLicenseInformation == null) @@ -169,17 +178,6 @@ private IFileDownloader GetFileDownloader() return new FileDownloader(HttpClient, DownloadLicenseInformation); } - private static void WriteValidationErrors(LicenseValidator.LicenseValidator validator) - { - TablePrinterExtensions.Create("Context", "Package", "Version", "LicenseError") - .FromValues(validator.GetErrors(), - error => - { - return new object[] { error.Context, error.PackageId, error.PackageVersion, error.Message }; - }) - .Print(); - } - private static async Task WriteValidationExceptions(List validationExceptions) { foreach (var exception in validationExceptions) diff --git a/src/Properties/launchSettings.json b/src/Properties/launchSettings.json deleted file mode 100644 index dee68fe4..00000000 --- a/src/Properties/launchSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "profiles": { - "NugetUtility": { - "commandName": "Project" - }, - "WSL": { - "commandName": "WSL2", - "environmentVariables": {}, - "distributionName": "" - } - } -} \ No newline at end of file diff --git a/tests/NuGetUtility.Test/Extensions/HashSetExtensionsTest.cs b/tests/NuGetUtility.Test/Extensions/HashSetExtensionsTest.cs index 71430fef..aea27221 100644 --- a/tests/NuGetUtility.Test/Extensions/HashSetExtensionsTest.cs +++ b/tests/NuGetUtility.Test/Extensions/HashSetExtensionsTest.cs @@ -1,7 +1,6 @@ using AutoFixture; using AutoFixture.NUnit3; using NuGetUtility.Extensions; -using NUnit.Framework; using System.Collections.Immutable; namespace NuGetUtility.Test.Extensions diff --git a/tests/NuGetUtility.Test/Extensions/MemoryStreamExtension.cs b/tests/NuGetUtility.Test/Extensions/MemoryStreamExtension.cs new file mode 100644 index 00000000..b420cf94 --- /dev/null +++ b/tests/NuGetUtility.Test/Extensions/MemoryStreamExtension.cs @@ -0,0 +1,14 @@ +using System.Text; + +namespace NuGetUtility.Test.Extensions +{ + public static class MemoryStreamExtension + { + public static string AsString(this MemoryStream stream) + { + stream.Position = 0; + using var reader = new StreamReader(stream, leaveOpen: true); + return reader.ReadToEnd(); + } + } +} diff --git a/tests/NuGetUtility.Test/Extensions/ProjectExtensionsTest.cs b/tests/NuGetUtility.Test/Extensions/ProjectExtensionsTest.cs index 34ea9cd6..0f93e340 100644 --- a/tests/NuGetUtility.Test/Extensions/ProjectExtensionsTest.cs +++ b/tests/NuGetUtility.Test/Extensions/ProjectExtensionsTest.cs @@ -1,7 +1,6 @@ using Moq; using NuGetUtility.Extensions; using NuGetUtility.Wrapper.MsBuildWrapper; -using NUnit.Framework; namespace NuGetUtility.Test.Extensions { diff --git a/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithExtension.cs b/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithException.cs similarity index 78% rename from tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithExtension.cs rename to tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithException.cs index 1cabcf1d..91bf4310 100644 --- a/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithExtension.cs +++ b/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumEnumerableWithException.cs @@ -2,12 +2,12 @@ namespace NuGetUtility.Test.Helper.NUnitExtension { - internal class EnumEnumerableWithExtension : IEnumerable + internal class EnumEnumerableWithException : IEnumerable { private readonly Array _allEnumOptions; private readonly object[] _exceptions; - public EnumEnumerableWithExtension(System.Type t, object[] exceptions) + public EnumEnumerableWithException(System.Type t, object[] exceptions) { _exceptions = exceptions; _allEnumOptions = Enum.GetValues(t); diff --git a/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumValuesExceptAttribute.cs b/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumValuesExceptAttribute.cs index 2616e9f2..9f919ad3 100644 --- a/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumValuesExceptAttribute.cs +++ b/tests/NuGetUtility.Test/Helper/NUnitExtension/EnumValuesExceptAttribute.cs @@ -1,5 +1,4 @@ -using NUnit.Framework; -using NUnit.Framework.Interfaces; +using NUnit.Framework.Interfaces; using System.Collections; namespace NuGetUtility.Test.Helper.NUnitExtension @@ -16,7 +15,7 @@ public EnumValuesExceptAttribute(params object[] exceptions) public IEnumerable GetData(IParameterInfo parameter) { - return new EnumEnumerableWithExtension(parameter.ParameterType, _exceptions); + return new EnumEnumerableWithException(parameter.ParameterType, _exceptions); } } } diff --git a/tests/NuGetUtility.Test/LicenseValidator/LicenseValidatorTest.cs b/tests/NuGetUtility.Test/LicenseValidator/LicenseValidatorTest.cs index 77c1f79a..c75b2dc3 100644 --- a/tests/NuGetUtility.Test/LicenseValidator/LicenseValidatorTest.cs +++ b/tests/NuGetUtility.Test/LicenseValidator/LicenseValidatorTest.cs @@ -11,7 +11,6 @@ using NuGetUtility.Test.Helper.NUnitExtension; using NuGetUtility.Test.Helper.ShuffelledEnumerable; using NuGetUtility.Wrapper.HttpClientWrapper; -using NUnit.Framework; namespace NuGetUtility.Test.LicenseValidator { diff --git a/tests/NuGetUtility.Test/NuGetUtility.Test.csproj b/tests/NuGetUtility.Test/NuGetUtility.Test.csproj index 3a30b175..cddb5997 100644 --- a/tests/NuGetUtility.Test/NuGetUtility.Test.csproj +++ b/tests/NuGetUtility.Test/NuGetUtility.Test.csproj @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt new file mode 100644 index 00000000..b76e44e1 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt @@ -0,0 +1 @@ +[] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt new file mode 100644 index 00000000..e098e189 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt @@ -0,0 +1 @@ +[{"Context":"/boot/defaults/background_comoro_franc.mods","PackageId":"Rae Beahan","PackageVersion":"4.0.9","Message":"Hic labore libero rerum."}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt new file mode 100644 index 00000000..527423a1 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt @@ -0,0 +1 @@ +[{"Context":"/boot/defaults/background_comoro_franc.mods","PackageId":"Rae Beahan","PackageVersion":"4.0.9","Message":"Hic labore libero rerum."},{"Context":"/Users/concrete_oklahoma.sig","PackageId":"Wilfrid Keebler","PackageVersion":"8.2.3","Message":"Eveniet aut expedita eum officia sequi ipsa."},{"Context":"/lost\u002Bfound/outdoors_\u0026_industrial_legacy_lodge.qps","PackageId":"Zakary Kozey","PackageVersion":"2.5.5","Message":"Officia quos saepe neque dolores aliquam mollitia omnis totam et."},{"Context":"/rescue/virtual.xlam","PackageId":"Arturo Murazik","PackageVersion":"6.7.4","Message":"Nemo error repellendus commodi ut ut."},{"Context":"/opt/include/ftp.ppt","PackageId":"Floyd Predovic","PackageVersion":"2.0.2","Message":"Ratione et nihil debitis voluptate error reprehenderit iste aut aut."},{"Context":"/etc/calculating_back_up_bedfordshire.p","PackageId":"Bernhard Schmitt","PackageVersion":"5.2.2","Message":"Id aut sequi qui rerum odit."},{"Context":"/lost\u002Bfound/sensor_ergonomic_turnpike.ez","PackageId":"Godfrey Schoen","PackageVersion":"4.8.3","Message":"Sit harum id voluptas velit."},{"Context":"/var/spool/ergonomic_rubber_pants.dna","PackageId":"Gerard Schneider","PackageVersion":"4.2.7","Message":"Alias illum vitae aut incidunt nam."},{"Context":"/var/spool/cultivate_matrix_practical_frozen_computer.cxt","PackageId":"Jarvis Lockman","PackageVersion":"4.4.1","Message":"Cum nam repudiandae."},{"Context":"/usr/lib/blue_delaware_tasty.ics","PackageId":"Jazlyn Greenfelder","PackageVersion":"9.4.9","Message":"Quis officia ut iusto dicta."},{"Context":"/opt/include/data_warehouse_virtual_egyptian_pound.pfr","PackageId":"Sabina Rath","PackageVersion":"4.4.3","Message":"Fugit impedit minima eum iste et amet similique molestiae eum."},{"Context":"/usr/crescent.air","PackageId":"Kaylah Stroman","PackageVersion":"2.5.5","Message":"Unde itaque debitis sunt totam fugiat tenetur repellat est."},{"Context":"/usr/share/small_organized.joda","PackageId":"Royce Thiel","PackageVersion":"1.1.3","Message":"Iusto omnis et dicta aut et nemo nulla dolorem vero."},{"Context":"/usr/local/bin/rhode_island.edx","PackageId":"Ramiro Borer","PackageVersion":"0.2.5","Message":"Rerum consectetur maiores officia aut in dolore perferendis."},{"Context":"/opt/killer_withdrawal.skd","PackageId":"Marc Hoppe","PackageVersion":"7.0.6","Message":"Quo dolorum exercitationem rerum soluta aut ut ipsa temporibus beatae."},{"Context":"/var/spool/networked_cultivate_bedfordshire.icm","PackageId":"Anastacio Shields","PackageVersion":"8.4.4","Message":"Saepe enim beatae qui nihil commodi voluptatem aut."},{"Context":"/usr/include/ohio.xenc","PackageId":"Cody Runte","PackageVersion":"3.9.5","Message":"Consequatur dolorum qui consequatur sapiente."},{"Context":"/usr/lib/buckinghamshire_checking_account_corporate.xwd","PackageId":"Chadd Schamberger","PackageVersion":"5.8.8","Message":"Quo consequatur et."},{"Context":"/private/var/open_source.svgz","PackageId":"Alessia Lebsack","PackageVersion":"7.8.2","Message":"Aspernatur sunt odio."},{"Context":"/Library/networks.txt","PackageId":"Flavio Franecki","PackageVersion":"6.3.3","Message":"Provident velit ut occaecati architecto quos fuga iste optio."}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt new file mode 100644 index 00000000..066ed02f --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt @@ -0,0 +1 @@ +[{"Context":"/boot/defaults/background_comoro_franc.mods","PackageId":"Rae Beahan","PackageVersion":"4.0.9","Message":"Hic labore libero rerum."},{"Context":"/Users/concrete_oklahoma.sig","PackageId":"Wilfrid Keebler","PackageVersion":"8.2.3","Message":"Eveniet aut expedita eum officia sequi ipsa."},{"Context":"/lost\u002Bfound/outdoors_\u0026_industrial_legacy_lodge.qps","PackageId":"Zakary Kozey","PackageVersion":"2.5.5","Message":"Officia quos saepe neque dolores aliquam mollitia omnis totam et."},{"Context":"/rescue/virtual.xlam","PackageId":"Arturo Murazik","PackageVersion":"6.7.4","Message":"Nemo error repellendus commodi ut ut."},{"Context":"/opt/include/ftp.ppt","PackageId":"Floyd Predovic","PackageVersion":"2.0.2","Message":"Ratione et nihil debitis voluptate error reprehenderit iste aut aut."}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt new file mode 100644 index 00000000..b76e44e1 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt @@ -0,0 +1 @@ +[] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt new file mode 100644 index 00000000..547d15a7 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt @@ -0,0 +1 @@ +[{"PackageId":"Dynamic Intranet Planner","PackageVersion":"0.2.4","License":"Try to synthesize the TCP matrix, maybe it will synthesize the primary matrix!","LicenseInformationOrigin":0}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt new file mode 100644 index 00000000..5a813f30 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt @@ -0,0 +1 @@ +[{"PackageId":"Dynamic Intranet Planner","PackageVersion":"0.2.4","License":"Try to synthesize the TCP matrix, maybe it will synthesize the primary matrix!","LicenseInformationOrigin":0},{"PackageId":"District Factors Supervisor","PackageVersion":"4.7.7","License":"compressing the matrix won\u0027t do anything, we need to calculate the 1080p TCP matrix!","LicenseInformationOrigin":0},{"PackageId":"International Integration Strategist","PackageVersion":"4.1.9","License":"You can\u0027t compress the hard drive without bypassing the bluetooth SDD hard drive!","LicenseInformationOrigin":0},{"PackageId":"Dynamic Creative Supervisor","PackageVersion":"4.4.8","License":"If we index the capacitor, we can get to the IB capacitor through the multi-byte IB capacitor!","LicenseInformationOrigin":0},{"PackageId":"Principal Branding Officer","PackageVersion":"9.2.6","License":"You can\u0027t calculate the driver without bypassing the wireless CSS driver!","LicenseInformationOrigin":0},{"PackageId":"Principal Response Engineer","PackageVersion":"7.8.4","License":"We need to navigate the multi-byte FTP matrix!","LicenseInformationOrigin":1},{"PackageId":"Senior Infrastructure Officer","PackageVersion":"1.4.0","License":"If we input the circuit, we can get to the IB circuit through the auxiliary IB circuit!","LicenseInformationOrigin":1},{"PackageId":"Principal Configuration Engineer","PackageVersion":"4.7.9","License":"synthesizing the pixel won\u0027t do anything, we need to transmit the solid state FTP pixel!","LicenseInformationOrigin":1},{"PackageId":"Central Directives Representative","PackageVersion":"3.6.2","License":"Use the multi-byte ADP matrix, then you can quantify the multi-byte matrix!","LicenseInformationOrigin":1},{"PackageId":"Principal Web Manager","PackageVersion":"9.5.3","License":"If we bypass the protocol, we can get to the JBOD protocol through the online JBOD protocol!","LicenseInformationOrigin":0},{"PackageId":"Principal Intranet Designer","PackageVersion":"1.7.5","License":"Try to calculate the EXE circuit, maybe it will calculate the multi-byte circuit!","LicenseInformationOrigin":0},{"PackageId":"International Directives Coordinator","PackageVersion":"3.0.2","License":"hacking the panel won\u0027t do anything, we need to reboot the auxiliary SDD panel!","LicenseInformationOrigin":0},{"PackageId":"Future Mobility Strategist","PackageVersion":"0.7.8","License":"Try to index the FTP circuit, maybe it will index the digital circuit!","LicenseInformationOrigin":0},{"PackageId":"District Response Executive","PackageVersion":"3.7.3","License":"Try to bypass the ADP hard drive, maybe it will bypass the bluetooth hard drive!","LicenseInformationOrigin":0},{"PackageId":"Internal Integration Manager","PackageVersion":"9.4.4","License":"We need to generate the cross-platform EXE hard drive!","LicenseInformationOrigin":0},{"PackageId":"Lead Identity Consultant","PackageVersion":"4.1.5","License":"I\u0027ll calculate the optical XSS matrix, that should matrix the XSS matrix!","LicenseInformationOrigin":0},{"PackageId":"Forward Intranet Assistant","PackageVersion":"5.8.3","License":"I\u0027ll compress the primary AI bandwidth, that should bandwidth the AI bandwidth!","LicenseInformationOrigin":1},{"PackageId":"Central Marketing Analyst","PackageVersion":"0.6.5","License":"parsing the alarm won\u0027t do anything, we need to hack the virtual SMS alarm!","LicenseInformationOrigin":1},{"PackageId":"Senior Security Administrator","PackageVersion":"9.6.2","License":"Try to input the HTTP monitor, maybe it will input the multi-byte monitor!","LicenseInformationOrigin":1},{"PackageId":"Corporate Web Technician","PackageVersion":"9.3.6","License":"We need to input the auxiliary THX system!","LicenseInformationOrigin":1},{"PackageId":"Central Data Technician","PackageVersion":"4.5.1","License":"You can\u0027t bypass the matrix without transmitting the virtual CSS matrix!","LicenseInformationOrigin":0},{"PackageId":"Human Usability Analyst","PackageVersion":"8.4.7","License":"Try to navigate the XSS protocol, maybe it will navigate the cross-platform protocol!","LicenseInformationOrigin":1},{"PackageId":"Chief Factors Supervisor","PackageVersion":"0.2.9","License":"We need to hack the 1080p SMS interface!","LicenseInformationOrigin":0},{"PackageId":"Customer Paradigm Designer","PackageVersion":"8.7.6","License":"I\u0027ll hack the neural JSON panel, that should panel the JSON panel!","LicenseInformationOrigin":0},{"PackageId":"International Division Representative","PackageVersion":"0.5.6","License":"If we compress the panel, we can get to the JSON panel through the digital JSON panel!","LicenseInformationOrigin":1},{"PackageId":"Lead Configuration Developer","PackageVersion":"1.4.1","License":"backing up the system won\u0027t do anything, we need to generate the digital AI system!","LicenseInformationOrigin":0},{"PackageId":"Regional Applications Consultant","PackageVersion":"1.6.8","License":"I\u0027ll synthesize the virtual SCSI application, that should application the SCSI application!","LicenseInformationOrigin":1},{"PackageId":"Legacy Solutions Officer","PackageVersion":"3.8.3","License":"Use the bluetooth CSS microchip, then you can synthesize the bluetooth microchip!","LicenseInformationOrigin":1},{"PackageId":"Lead Identity Strategist","PackageVersion":"5.4.5","License":"Use the digital GB bandwidth, then you can bypass the digital bandwidth!","LicenseInformationOrigin":1},{"PackageId":"Future Paradigm Producer","PackageVersion":"7.0.9","License":"You can\u0027t transmit the microchip without synthesizing the cross-platform EXE microchip!","LicenseInformationOrigin":0},{"PackageId":"Lead Factors Manager","PackageVersion":"7.4.5","License":"You can\u0027t transmit the circuit without generating the optical SAS circuit!","LicenseInformationOrigin":0},{"PackageId":"Dynamic Marketing Consultant","PackageVersion":"5.3.0","License":"Try to parse the XSS sensor, maybe it will parse the back-end sensor!","LicenseInformationOrigin":1},{"PackageId":"Future Response Specialist","PackageVersion":"6.5.8","License":"The CSS capacitor is down, connect the haptic capacitor so we can connect the CSS capacitor!","LicenseInformationOrigin":0},{"PackageId":"Global Web Supervisor","PackageVersion":"4.7.8","License":"I\u0027ll transmit the 1080p SMTP application, that should application the SMTP application!","LicenseInformationOrigin":0},{"PackageId":"Direct Applications Engineer","PackageVersion":"9.6.7","License":"hacking the firewall won\u0027t do anything, we need to hack the virtual RSS firewall!","LicenseInformationOrigin":1},{"PackageId":"Senior Brand Officer","PackageVersion":"7.5.8","License":"If we synthesize the circuit, we can get to the CSS circuit through the multi-byte CSS circuit!","LicenseInformationOrigin":1},{"PackageId":"Investor Program Specialist","PackageVersion":"5.9.5","License":"I\u0027ll quantify the wireless SSL capacitor, that should capacitor the SSL capacitor!","LicenseInformationOrigin":1},{"PackageId":"Corporate Assurance Developer","PackageVersion":"2.4.5","License":"Try to back up the USB firewall, maybe it will back up the 1080p firewall!","LicenseInformationOrigin":1},{"PackageId":"Chief Mobility Officer","PackageVersion":"5.7.3","License":"We need to transmit the back-end HTTP panel!","LicenseInformationOrigin":0},{"PackageId":"Chief Functionality Consultant","PackageVersion":"3.8.2","License":"If we navigate the sensor, we can get to the EXE sensor through the bluetooth EXE sensor!","LicenseInformationOrigin":0},{"PackageId":"Regional Division Facilitator","PackageVersion":"8.2.7","License":"Use the bluetooth SSL protocol, then you can override the bluetooth protocol!","LicenseInformationOrigin":0},{"PackageId":"Customer Markets Agent","PackageVersion":"0.0.5","License":"You can\u0027t index the matrix without parsing the multi-byte FTP matrix!","LicenseInformationOrigin":0},{"PackageId":"Future Interactions Manager","PackageVersion":"2.4.6","License":"We need to compress the mobile HDD program!","LicenseInformationOrigin":1},{"PackageId":"Regional Functionality Representative","PackageVersion":"3.1.7","License":"We need to quantify the wireless PCI alarm!","LicenseInformationOrigin":0},{"PackageId":"Chief Factors Facilitator","PackageVersion":"8.4.8","License":"You can\u0027t navigate the driver without generating the haptic GB driver!","LicenseInformationOrigin":1},{"PackageId":"National Metrics Facilitator","PackageVersion":"5.6.6","License":"hacking the interface won\u0027t do anything, we need to compress the digital XML interface!","LicenseInformationOrigin":1},{"PackageId":"Future Integration Developer","PackageVersion":"5.1.5","License":"The SDD monitor is down, hack the 1080p monitor so we can hack the SDD monitor!","LicenseInformationOrigin":0},{"PackageId":"National Data Director","PackageVersion":"8.6.9","License":"I\u0027ll hack the cross-platform AI sensor, that should sensor the AI sensor!","LicenseInformationOrigin":0},{"PackageId":"Chief Accounts Assistant","PackageVersion":"7.8.4","License":"Use the bluetooth HDD sensor, then you can parse the bluetooth sensor!","LicenseInformationOrigin":0},{"PackageId":"District Assurance Orchestrator","PackageVersion":"5.7.1","License":"You can\u0027t navigate the panel without backing up the cross-platform FTP panel!","LicenseInformationOrigin":0},{"PackageId":"Central Tactics Analyst","PackageVersion":"8.0.1","License":"You can\u0027t back up the port without programming the bluetooth HTTP port!","LicenseInformationOrigin":0},{"PackageId":"Future Communications Developer","PackageVersion":"7.5.8","License":"overriding the monitor won\u0027t do anything, we need to input the online CSS monitor!","LicenseInformationOrigin":0},{"PackageId":"National Quality Consultant","PackageVersion":"5.7.6","License":"You can\u0027t input the bandwidth without overriding the mobile FTP bandwidth!","LicenseInformationOrigin":0},{"PackageId":"Product Infrastructure Coordinator","PackageVersion":"7.8.3","License":"Use the solid state FTP pixel, then you can calculate the solid state pixel!","LicenseInformationOrigin":0},{"PackageId":"Product Optimization Specialist","PackageVersion":"0.0.7","License":"If we bypass the port, we can get to the COM port through the optical COM port!","LicenseInformationOrigin":0},{"PackageId":"Investor Communications Liaison","PackageVersion":"2.3.6","License":"I\u0027ll synthesize the multi-byte PCI transmitter, that should transmitter the PCI transmitter!","LicenseInformationOrigin":0},{"PackageId":"Regional Directives Liaison","PackageVersion":"4.8.1","License":"I\u0027ll parse the redundant FTP driver, that should driver the FTP driver!","LicenseInformationOrigin":0},{"PackageId":"National Web Technician","PackageVersion":"4.8.1","License":"The SMS microchip is down, synthesize the 1080p microchip so we can synthesize the SMS microchip!","LicenseInformationOrigin":0},{"PackageId":"Principal Assurance Executive","PackageVersion":"7.2.4","License":"Try to index the SMS system, maybe it will index the cross-platform system!","LicenseInformationOrigin":1},{"PackageId":"Direct Marketing Consultant","PackageVersion":"2.6.1","License":"Try to hack the SSL monitor, maybe it will hack the open-source monitor!","LicenseInformationOrigin":0},{"PackageId":"International Usability Developer","PackageVersion":"6.1.9","License":"overriding the program won\u0027t do anything, we need to synthesize the digital AI program!","LicenseInformationOrigin":1},{"PackageId":"Global Branding Architect","PackageVersion":"0.6.2","License":"I\u0027ll generate the auxiliary XSS circuit, that should circuit the XSS circuit!","LicenseInformationOrigin":0},{"PackageId":"Senior Markets Manager","PackageVersion":"7.4.3","License":"Use the 1080p PNG matrix, then you can synthesize the 1080p matrix!","LicenseInformationOrigin":1},{"PackageId":"Central Quality Architect","PackageVersion":"8.9.5","License":"Use the multi-byte TCP transmitter, then you can compress the multi-byte transmitter!","LicenseInformationOrigin":1},{"PackageId":"Global Marketing Analyst","PackageVersion":"6.3.7","License":"If we connect the microchip, we can get to the SCSI microchip through the optical SCSI microchip!","LicenseInformationOrigin":1},{"PackageId":"Human Research Agent","PackageVersion":"7.3.4","License":"Try to hack the JSON sensor, maybe it will hack the 1080p sensor!","LicenseInformationOrigin":1},{"PackageId":"National Solutions Engineer","PackageVersion":"5.8.4","License":"You can\u0027t bypass the port without navigating the optical PNG port!","LicenseInformationOrigin":1},{"PackageId":"Dynamic Intranet Agent","PackageVersion":"6.3.2","License":"You can\u0027t transmit the panel without navigating the wireless RAM panel!","LicenseInformationOrigin":0},{"PackageId":"National Factors Developer","PackageVersion":"7.8.0","License":"Use the redundant SMS pixel, then you can navigate the redundant pixel!","LicenseInformationOrigin":1},{"PackageId":"Forward Usability Supervisor","PackageVersion":"9.7.6","License":"The SQL driver is down, hack the open-source driver so we can hack the SQL driver!","LicenseInformationOrigin":1},{"PackageId":"Dynamic Quality Designer","PackageVersion":"6.6.1","License":"The XML bandwidth is down, bypass the primary bandwidth so we can bypass the XML bandwidth!","LicenseInformationOrigin":1},{"PackageId":"Dynamic Operations Specialist","PackageVersion":"7.4.2","License":"Try to synthesize the PNG bandwidth, maybe it will synthesize the online bandwidth!","LicenseInformationOrigin":1},{"PackageId":"Global Research Strategist","PackageVersion":"1.1.6","License":"The IB panel is down, input the optical panel so we can input the IB panel!","LicenseInformationOrigin":0},{"PackageId":"Central Communications Supervisor","PackageVersion":"7.3.9","License":"I\u0027ll connect the redundant RAM driver, that should driver the RAM driver!","LicenseInformationOrigin":0},{"PackageId":"Legacy Accountability Officer","PackageVersion":"7.2.4","License":"I\u0027ll parse the bluetooth JBOD firewall, that should firewall the JBOD firewall!","LicenseInformationOrigin":0},{"PackageId":"District Applications Producer","PackageVersion":"3.6.1","License":"If we input the monitor, we can get to the HTTP monitor through the neural HTTP monitor!","LicenseInformationOrigin":0},{"PackageId":"Corporate Data Designer","PackageVersion":"0.9.9","License":"The XSS alarm is down, hack the solid state alarm so we can hack the XSS alarm!","LicenseInformationOrigin":1},{"PackageId":"International Accounts Analyst","PackageVersion":"8.9.5","License":"navigating the interface won\u0027t do anything, we need to bypass the haptic TCP interface!","LicenseInformationOrigin":0},{"PackageId":"Human Group Manager","PackageVersion":"9.2.4","License":"I\u0027ll generate the virtual GB system, that should system the GB system!","LicenseInformationOrigin":1},{"PackageId":"Customer Response Architect","PackageVersion":"4.7.0","License":"We need to parse the online JBOD hard drive!","LicenseInformationOrigin":1},{"PackageId":"Future Metrics Associate","PackageVersion":"6.3.1","License":"If we back up the monitor, we can get to the RSS monitor through the primary RSS monitor!","LicenseInformationOrigin":1},{"PackageId":"Dynamic Implementation Analyst","PackageVersion":"3.6.0","License":"Try to back up the FTP hard drive, maybe it will back up the mobile hard drive!","LicenseInformationOrigin":1},{"PackageId":"National Configuration Analyst","PackageVersion":"4.1.6","License":"I\u0027ll synthesize the digital COM protocol, that should protocol the COM protocol!","LicenseInformationOrigin":1},{"PackageId":"Product Optimization Manager","PackageVersion":"4.0.7","License":"You can\u0027t bypass the sensor without parsing the optical CSS sensor!","LicenseInformationOrigin":1},{"PackageId":"Central Web Director","PackageVersion":"2.4.5","License":"Use the 1080p SMTP matrix, then you can synthesize the 1080p matrix!","LicenseInformationOrigin":0},{"PackageId":"Senior Program Representative","PackageVersion":"0.2.4","License":"The IB bandwidth is down, generate the 1080p bandwidth so we can generate the IB bandwidth!","LicenseInformationOrigin":0},{"PackageId":"Internal Operations Analyst","PackageVersion":"5.8.0","License":"Try to parse the EXE program, maybe it will parse the digital program!","LicenseInformationOrigin":0},{"PackageId":"Customer Brand Executive","PackageVersion":"5.3.2","License":"The XSS program is down, transmit the bluetooth program so we can transmit the XSS program!","LicenseInformationOrigin":1},{"PackageId":"Senior Markets Consultant","PackageVersion":"7.8.2","License":"The TCP microchip is down, compress the wireless microchip so we can compress the TCP microchip!","LicenseInformationOrigin":0},{"PackageId":"Chief Markets Planner","PackageVersion":"8.7.7","License":"If we override the application, we can get to the PNG application through the optical PNG application!","LicenseInformationOrigin":1},{"PackageId":"Human Data Designer","PackageVersion":"1.0.2","License":"The RAM monitor is down, index the mobile monitor so we can index the RAM monitor!","LicenseInformationOrigin":1},{"PackageId":"Lead Integration Architect","PackageVersion":"8.9.9","License":"Try to input the JBOD array, maybe it will input the virtual array!","LicenseInformationOrigin":1},{"PackageId":"Global Accounts Strategist","PackageVersion":"1.7.0","License":"Use the cross-platform SQL sensor, then you can generate the cross-platform sensor!","LicenseInformationOrigin":1},{"PackageId":"Human Intranet Manager","PackageVersion":"9.4.8","License":"You can\u0027t back up the port without transmitting the wireless SSL port!","LicenseInformationOrigin":1},{"PackageId":"Internal Interactions Designer","PackageVersion":"5.4.1","License":"You can\u0027t transmit the bandwidth without programming the 1080p PCI bandwidth!","LicenseInformationOrigin":0},{"PackageId":"International Accountability Manager","PackageVersion":"6.2.0","License":"Try to copy the TCP monitor, maybe it will copy the auxiliary monitor!","LicenseInformationOrigin":1},{"PackageId":"Global Response Analyst","PackageVersion":"8.9.7","License":"We need to input the digital RAM monitor!","LicenseInformationOrigin":0},{"PackageId":"Product Research Orchestrator","PackageVersion":"1.6.1","License":"We need to back up the back-end SQL matrix!","LicenseInformationOrigin":1},{"PackageId":"Product Quality Orchestrator","PackageVersion":"8.1.8","License":"We need to parse the bluetooth EXE bus!","LicenseInformationOrigin":1},{"PackageId":"District Branding Associate","PackageVersion":"4.2.5","License":"I\u0027ll reboot the wireless PNG interface, that should interface the PNG interface!","LicenseInformationOrigin":0}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt new file mode 100644 index 00000000..4646e44b --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt @@ -0,0 +1 @@ +[{"PackageId":"Dynamic Intranet Planner","PackageVersion":"0.2.4","License":"Try to synthesize the TCP matrix, maybe it will synthesize the primary matrix!","LicenseInformationOrigin":0},{"PackageId":"District Factors Supervisor","PackageVersion":"4.7.7","License":"compressing the matrix won\u0027t do anything, we need to calculate the 1080p TCP matrix!","LicenseInformationOrigin":0},{"PackageId":"International Integration Strategist","PackageVersion":"4.1.9","License":"You can\u0027t compress the hard drive without bypassing the bluetooth SDD hard drive!","LicenseInformationOrigin":0},{"PackageId":"Dynamic Creative Supervisor","PackageVersion":"4.4.8","License":"If we index the capacitor, we can get to the IB capacitor through the multi-byte IB capacitor!","LicenseInformationOrigin":0},{"PackageId":"Principal Branding Officer","PackageVersion":"9.2.6","License":"You can\u0027t calculate the driver without bypassing the wireless CSS driver!","LicenseInformationOrigin":0},{"PackageId":"Principal Response Engineer","PackageVersion":"7.8.4","License":"We need to navigate the multi-byte FTP matrix!","LicenseInformationOrigin":1},{"PackageId":"Senior Infrastructure Officer","PackageVersion":"1.4.0","License":"If we input the circuit, we can get to the IB circuit through the auxiliary IB circuit!","LicenseInformationOrigin":1},{"PackageId":"Principal Configuration Engineer","PackageVersion":"4.7.9","License":"synthesizing the pixel won\u0027t do anything, we need to transmit the solid state FTP pixel!","LicenseInformationOrigin":1},{"PackageId":"Central Directives Representative","PackageVersion":"3.6.2","License":"Use the multi-byte ADP matrix, then you can quantify the multi-byte matrix!","LicenseInformationOrigin":1},{"PackageId":"Principal Web Manager","PackageVersion":"9.5.3","License":"If we bypass the protocol, we can get to the JBOD protocol through the online JBOD protocol!","LicenseInformationOrigin":0},{"PackageId":"Principal Intranet Designer","PackageVersion":"1.7.5","License":"Try to calculate the EXE circuit, maybe it will calculate the multi-byte circuit!","LicenseInformationOrigin":0},{"PackageId":"International Directives Coordinator","PackageVersion":"3.0.2","License":"hacking the panel won\u0027t do anything, we need to reboot the auxiliary SDD panel!","LicenseInformationOrigin":0},{"PackageId":"Future Mobility Strategist","PackageVersion":"0.7.8","License":"Try to index the FTP circuit, maybe it will index the digital circuit!","LicenseInformationOrigin":0},{"PackageId":"District Response Executive","PackageVersion":"3.7.3","License":"Try to bypass the ADP hard drive, maybe it will bypass the bluetooth hard drive!","LicenseInformationOrigin":0},{"PackageId":"Internal Integration Manager","PackageVersion":"9.4.4","License":"We need to generate the cross-platform EXE hard drive!","LicenseInformationOrigin":0},{"PackageId":"Lead Identity Consultant","PackageVersion":"4.1.5","License":"I\u0027ll calculate the optical XSS matrix, that should matrix the XSS matrix!","LicenseInformationOrigin":0},{"PackageId":"Forward Intranet Assistant","PackageVersion":"5.8.3","License":"I\u0027ll compress the primary AI bandwidth, that should bandwidth the AI bandwidth!","LicenseInformationOrigin":1},{"PackageId":"Central Marketing Analyst","PackageVersion":"0.6.5","License":"parsing the alarm won\u0027t do anything, we need to hack the virtual SMS alarm!","LicenseInformationOrigin":1},{"PackageId":"Senior Security Administrator","PackageVersion":"9.6.2","License":"Try to input the HTTP monitor, maybe it will input the multi-byte monitor!","LicenseInformationOrigin":1},{"PackageId":"Corporate Web Technician","PackageVersion":"9.3.6","License":"We need to input the auxiliary THX system!","LicenseInformationOrigin":1}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt new file mode 100644 index 00000000..464095f3 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt @@ -0,0 +1 @@ +[{"PackageId":"Dynamic Intranet Planner","PackageVersion":"0.2.4","License":"Try to synthesize the TCP matrix, maybe it will synthesize the primary matrix!","LicenseInformationOrigin":0},{"PackageId":"District Factors Supervisor","PackageVersion":"4.7.7","License":"compressing the matrix won\u0027t do anything, we need to calculate the 1080p TCP matrix!","LicenseInformationOrigin":0},{"PackageId":"International Integration Strategist","PackageVersion":"4.1.9","License":"You can\u0027t compress the hard drive without bypassing the bluetooth SDD hard drive!","LicenseInformationOrigin":0},{"PackageId":"Dynamic Creative Supervisor","PackageVersion":"4.4.8","License":"If we index the capacitor, we can get to the IB capacitor through the multi-byte IB capacitor!","LicenseInformationOrigin":0},{"PackageId":"Principal Branding Officer","PackageVersion":"9.2.6","License":"You can\u0027t calculate the driver without bypassing the wireless CSS driver!","LicenseInformationOrigin":0}] diff --git a/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.cs b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.cs new file mode 100644 index 00000000..80f0724a --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Json/JsonOutputFormatterTest.cs @@ -0,0 +1,55 @@ +using Bogus; +using NuGet.Versioning; +using NuGetUtility.LicenseValidator; +using NuGetUtility.Output; +using NuGetUtility.Output.Json; +using NuGetUtility.Test.Extensions; + +namespace NuGetUtility.Test.Output.Json +{ + [TestFixture] + public class JsonOutputFormatterTest + { + [SetUp] + public void SetUp() + { + _validatedLicenseFaker = new Faker().CustomInstantiator(f => + new ValidatedLicense(f.Name.JobTitle(), + new NuGetVersion(f.System.Semver()), + f.Hacker.Phrase(), + f.Random.Enum())) + .UseSeed(23498); + _licenseValidationErrorFaker = new Faker().CustomInstantiator(f => + new LicenseValidationError(f.System.FilePath(), + f.Name.FullName(), + new NuGetVersion(f.System.Semver()), + f.Lorem.Sentence())) + .UseSeed(745039342); + _uut = new JsonOutputFormatter(); + } + private IOutputFormatter _uut = null!; + private Faker _validatedLicenseFaker = null!; + private Faker _licenseValidationErrorFaker = null!; + + [Test] + public async Task Errors_Should_PrintCorrectTable([Values(0, 1, 5, 20)] int errorCount) + { + using var stream = new MemoryStream(); + var errors = _licenseValidationErrorFaker.GenerateForever().Take(errorCount); + await _uut.Write(stream, errors); + + await Verify(stream.AsString()); + } + + [Test] + public async Task ValidatedLicenses_Should_PrintCorrectTable( + [Values(0, 1, 5, 20, 100)] int validatedLicenseCount) + { + using var stream = new MemoryStream(); + var validated = _validatedLicenseFaker.GenerateForever().Take(validatedLicenseCount); + await _uut.Write(stream, validated); + + await Verify(stream.AsString()); + } + } +} diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt new file mode 100644 index 00000000..d97a4970 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=0.verified.txt @@ -0,0 +1,4 @@ ++---------+---------+---------+--------------+ +| Context | Package | Version | LicenseError | ++---------+---------+---------+--------------+ ++---------+---------+---------+--------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt new file mode 100644 index 00000000..29511a90 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=1.verified.txt @@ -0,0 +1,5 @@ ++----------------------------+----------------+---------+--------------------------+ +| Context | Package | Version | LicenseError | ++----------------------------+----------------+---------+--------------------------+ +| /var/spool/direct.unityweb | Evelyn Dibbert | 5.8.9 | Unde sint nostrum quasi. | ++----------------------------+----------------+---------+--------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt new file mode 100644 index 00000000..b55a9849 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=20.verified.txt @@ -0,0 +1,24 @@ ++-----------------------------------------------------+---------------------+---------+------------------------------------------------------------------------------+ +| Context | Package | Version | LicenseError | ++-----------------------------------------------------+---------------------+---------+------------------------------------------------------------------------------+ +| /var/spool/direct.unityweb | Evelyn Dibbert | 5.8.9 | Unde sint nostrum quasi. | +| /home/mobile_navigating.ipfix | Otho Kirlin | 3.7.8 | Quam exercitationem sunt praesentium qui possimus et. | +| /home/user/dir/compress_purple_enhance.rdf | Addie Will | 9.8.3 | Dolor recusandae adipisci soluta sequi. | +| /var/mail/run_system.sv4crc | Beth Marquardt | 8.7.1 | Quidem voluptas autem possimus provident repellendus libero ipsa temporibus. | +| /usr/networks_rustic_steel_hat.xdp | Dianna Rau | 6.7.7 | Accusantium provident placeat deleniti dolore. | +| /usr/scalable.ez2 | Cynthia Labadie | 9.0.4 | Perferendis fugit ratione aut consequatur voluptatem. | +| /var/bahrain_handmade_granite_table.air | Tessie Bogan | 0.7.9 | Consectetur autem quia. | +| /opt/sbin/home_loan_account.sid | Makenzie Bechtelar | 4.7.8 | Corrupti sunt hic ea impedit dolorum laboriosam ut. | +| /etc/ppp/south_carolina_optimize.qbo | Hazle Yost | 2.4.3 | Quia accusantium eum quo nihil laboriosam officia nulla perferendis. | +| /selinux/credit_card_account_withdrawal_metal.gml | Gene Price | 2.6.5 | Quis et et cupiditate et et adipisci aliquid atque aut. | +| /etc/periodic/nebraska_shoes.rtf | Catherine Bashirian | 5.1.6 | Hic veniam laboriosam enim accusantium tempore. | +| /sys/liechtenstein_berkshire_bypassing.ttf | Valentin Hodkiewicz | 5.1.8 | Quibusdam sunt consequuntur voluptatem aspernatur hic aspernatur. | +| /opt/share/collaboration_common.pgn | Vida Reinger | 9.3.8 | Qui eaque inventore inventore ut. | +| /opt/share/cuba_invoice_licensed_fresh_keyboard.xop | Craig Fritsch | 9.7.5 | Aperiam modi ad et maxime. | +| /private/var/multi_channelled_eco_centric.vcd | Amely Rowe | 5.0.4 | Voluptatem sunt modi illum quis qui et amet. | +| /opt/sbin/pakistan.n_gage | Astrid Ryan | 1.0.8 | Cum optio consectetur aut asperiores sed qui est tempora. | +| /usr/sbin/purple_compress.rmvb | Tomasa Bechtelar | 2.9.1 | Natus architecto iure. | +| /usr/bin/ssl_optical_synthesize.hps | Prudence Will | 0.6.2 | Natus esse in sit accusantium illo consequatur. | +| /var/auto_loan_account.scq | Otis Turner | 6.6.1 | Dolores quis nihil. | +| /usr/sbin/wall_home_loan_account.jsx | Vivian Halvorson | 3.2.8 | Quis quo corrupti incidunt ab suscipit laboriosam. | ++-----------------------------------------------------+---------------------+---------+------------------------------------------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt new file mode 100644 index 00000000..8575ed90 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.Errors_Should_PrintCorrectTable_errorCount=5.verified.txt @@ -0,0 +1,9 @@ ++--------------------------------------------+----------------+---------+------------------------------------------------------------------------------+ +| Context | Package | Version | LicenseError | ++--------------------------------------------+----------------+---------+------------------------------------------------------------------------------+ +| /var/spool/direct.unityweb | Evelyn Dibbert | 5.8.9 | Unde sint nostrum quasi. | +| /home/mobile_navigating.ipfix | Otho Kirlin | 3.7.8 | Quam exercitationem sunt praesentium qui possimus et. | +| /home/user/dir/compress_purple_enhance.rdf | Addie Will | 9.8.3 | Dolor recusandae adipisci soluta sequi. | +| /var/mail/run_system.sv4crc | Beth Marquardt | 8.7.1 | Quidem voluptas autem possimus provident repellendus libero ipsa temporibus. | +| /usr/networks_rustic_steel_hat.xdp | Dianna Rau | 6.7.7 | Accusantium provident placeat deleniti dolore. | ++--------------------------------------------+----------------+---------+------------------------------------------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt new file mode 100644 index 00000000..7883c51d --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=0.verified.txt @@ -0,0 +1,4 @@ ++---------+---------+----------------------------+--------------------+ +| Package | Version | License Information Origin | License Expression | ++---------+---------+----------------------------+--------------------+ ++---------+---------+----------------------------+--------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt new file mode 100644 index 00000000..3eff3ca4 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=1.verified.txt @@ -0,0 +1,5 @@ ++------------------------+---------+----------------------------+-----------------------------------------------+ +| Package | Version | License Information Origin | License Expression | ++------------------------+---------+----------------------------+-----------------------------------------------+ +| Legacy Metrics Planner | 9.5.0 | Url | We need to generate the multi-byte SMTP port! | ++------------------------+---------+----------------------------+-----------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt new file mode 100644 index 00000000..b58192e0 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=100.verified.txt @@ -0,0 +1,104 @@ ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------------+ +| Package | Version | License Information Origin | License Expression | ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------------+ +| Legacy Metrics Planner | 9.5.0 | Url | We need to generate the multi-byte SMTP port! | +| International Implementation Consultant | 6.7.6 | Url | Try to generate the PNG sensor, maybe it will generate the haptic sensor! | +| Dynamic Implementation Orchestrator | 3.1.0 | Url | I'll override the primary AI program, that should program the AI program! | +| Direct Program Director | 5.9.9 | Expression | Try to copy the EXE array, maybe it will copy the solid state array! | +| Legacy Markets Coordinator | 2.3.0 | Url | You can't override the driver without backing up the redundant THX driver! | +| Future Infrastructure Planner | 5.7.5 | Url | You can't parse the system without compressing the haptic GB system! | +| Customer Directives Director | 7.9.2 | Expression | If we program the driver, we can get to the USB driver through the virtual USB driver! | +| Direct Creative Representative | 7.0.3 | Url | Try to navigate the RAM capacitor, maybe it will navigate the wireless capacitor! | +| Forward Configuration Engineer | 2.1.9 | Expression | Try to synthesize the COM port, maybe it will synthesize the haptic port! | +| Legacy Research Associate | 9.9.5 | Expression | The THX program is down, transmit the redundant program so we can transmit the THX program! | +| Direct Branding Orchestrator | 8.3.3 | Expression | You can't bypass the sensor without overriding the online ADP sensor! | +| Senior Intranet Designer | 5.6.6 | Url | If we synthesize the protocol, we can get to the JBOD protocol through the multi-byte JBOD protocol! | +| National Communications Facilitator | 3.1.0 | Url | You can't calculate the matrix without generating the optical JSON matrix! | +| Human Response Technician | 2.8.5 | Expression | I'll transmit the haptic COM protocol, that should protocol the COM protocol! | +| Customer Accounts Engineer | 5.4.5 | Expression | We need to hack the auxiliary COM hard drive! | +| District Branding Analyst | 1.9.5 | Expression | I'll navigate the neural SAS card, that should card the SAS card! | +| Central Creative Manager | 8.4.8 | Expression | Use the online GB alarm, then you can navigate the online alarm! | +| District Operations Manager | 8.5.0 | Expression | We need to navigate the back-end IB protocol! | +| Central Interactions Manager | 7.0.9 | Expression | We need to compress the primary GB array! | +| Legacy Intranet Agent | 9.0.8 | Expression | navigating the pixel won't do anything, we need to parse the back-end IB pixel! | +| Future Implementation Architect | 3.5.1 | Url | You can't input the capacitor without quantifying the virtual SQL capacitor! | +| International Directives Supervisor | 3.1.8 | Expression | Use the cross-platform CSS capacitor, then you can override the cross-platform capacitor! | +| Dynamic Optimization Director | 3.4.6 | Url | parsing the feed won't do anything, we need to input the wireless SAS feed! | +| Corporate Data Associate | 4.9.9 | Expression | We need to transmit the back-end RSS transmitter! | +| International Identity Supervisor | 8.6.5 | Expression | We need to parse the mobile PCI capacitor! | +| Product Factors Producer | 0.2.3 | Url | The AI panel is down, reboot the wireless panel so we can reboot the AI panel! | +| Principal Factors Producer | 0.8.5 | Expression | Use the solid state SSL transmitter, then you can transmit the solid state transmitter! | +| Corporate Infrastructure Administrator | 2.8.0 | Expression | You can't hack the feed without compressing the bluetooth PNG feed! | +| Central Marketing Assistant | 9.5.8 | Expression | I'll reboot the haptic SDD pixel, that should pixel the SDD pixel! | +| District Group Representative | 3.5.9 | Url | We need to connect the digital XSS matrix! | +| Senior Optimization Assistant | 3.6.0 | Url | I'll reboot the auxiliary PCI interface, that should interface the PCI interface! | +| Chief Configuration Manager | 6.3.8 | Url | Try to compress the SMS bus, maybe it will compress the bluetooth bus! | +| Legacy Interactions Analyst | 3.0.8 | Url | You can't override the port without indexing the neural THX port! | +| Global Usability Producer | 4.9.5 | Url | You can't quantify the monitor without copying the auxiliary SMTP monitor! | +| Corporate Implementation Engineer | 4.4.9 | Expression | If we synthesize the circuit, we can get to the SCSI circuit through the virtual SCSI circuit! | +| Customer Division Manager | 1.3.9 | Expression | You can't compress the capacitor without copying the virtual USB capacitor! | +| National Creative Executive | 7.5.7 | Expression | The SQL interface is down, index the bluetooth interface so we can index the SQL interface! | +| National Security Developer | 2.9.8 | Expression | The THX sensor is down, reboot the solid state sensor so we can reboot the THX sensor! | +| Forward Research Strategist | 8.8.2 | Url | We need to generate the multi-byte RSS application! | +| Direct Metrics Associate | 9.1.8 | Expression | The PCI protocol is down, back up the multi-byte protocol so we can back up the PCI protocol! | +| Senior Operations Coordinator | 4.8.6 | Expression | quantifying the card won't do anything, we need to transmit the solid state EXE card! | +| Senior Functionality Designer | 7.8.9 | Url | The AI hard drive is down, back up the 1080p hard drive so we can back up the AI hard drive! | +| Investor Implementation Technician | 2.7.9 | Expression | generating the protocol won't do anything, we need to hack the digital AI protocol! | +| Direct Assurance Strategist | 1.3.7 | Url | We need to program the 1080p SMS transmitter! | +| Corporate Tactics Associate | 3.8.8 | Url | You can't synthesize the bus without generating the auxiliary XSS bus! | +| Regional Factors Supervisor | 8.6.4 | Expression | Use the neural PCI interface, then you can quantify the neural interface! | +| Internal Accountability Officer | 8.7.8 | Url | You can't program the array without connecting the neural SSL array! | +| Future Assurance Analyst | 1.1.1 | Url | You can't program the alarm without overriding the cross-platform RSS alarm! | +| Product Integration Officer | 3.3.6 | Url | connecting the application won't do anything, we need to bypass the mobile ADP application! | +| Principal Tactics Technician | 5.4.6 | Url | I'll calculate the open-source SAS bus, that should bus the SAS bus! | +| Future Security Agent | 4.6.5 | Expression | If we connect the protocol, we can get to the JSON protocol through the multi-byte JSON protocol! | +| International Research Coordinator | 2.1.7 | Url | If we transmit the transmitter, we can get to the SSL transmitter through the back-end SSL transmitter! | +| Principal Accountability Supervisor | 0.3.2 | Url | The XML firewall is down, generate the cross-platform firewall so we can generate the XML firewall! | +| Future Brand Representative | 4.1.6 | Url | If we reboot the system, we can get to the SQL system through the mobile SQL system! | +| Direct Web Orchestrator | 1.9.1 | Url | The JSON capacitor is down, connect the haptic capacitor so we can connect the JSON capacitor! | +| Legacy Accounts Technician | 3.4.8 | Url | parsing the card won't do anything, we need to synthesize the online SQL card! | +| Dynamic Quality Analyst | 0.9.5 | Url | We need to compress the back-end COM bus! | +| District Interactions Strategist | 7.9.0 | Expression | I'll calculate the optical SQL pixel, that should pixel the SQL pixel! | +| Customer Directives Architect | 6.6.3 | Expression | You can't connect the interface without parsing the solid state XSS interface! | +| National Tactics Specialist | 5.7.8 | Expression | If we transmit the card, we can get to the SMTP card through the redundant SMTP card! | +| Product Mobility Technician | 3.3.8 | Expression | You can't generate the bandwidth without parsing the mobile EXE bandwidth! | +| Global Configuration Consultant | 5.9.5 | Url | We need to compress the wireless USB driver! | +| Forward Infrastructure Consultant | 1.3.1 | Url | quantifying the port won't do anything, we need to generate the primary THX port! | +| Global Security Orchestrator | 3.3.1 | Url | If we reboot the circuit, we can get to the PCI circuit through the virtual PCI circuit! | +| Forward Infrastructure Specialist | 6.1.6 | Url | If we transmit the application, we can get to the SMS application through the primary SMS application! | +| Lead Branding Developer | 4.1.5 | Expression | I'll copy the auxiliary PCI panel, that should panel the PCI panel! | +| Human Directives Engineer | 5.3.9 | Url | Try to connect the ADP array, maybe it will connect the virtual array! | +| Dynamic Division Agent | 4.2.8 | Expression | Use the back-end SMS feed, then you can program the back-end feed! | +| Regional Factors Designer | 7.4.1 | Url | Try to quantify the SCSI system, maybe it will quantify the 1080p system! | +| Internal Intranet Manager | 6.3.3 | Url | I'll generate the optical THX system, that should system the THX system! | +| Product Data Designer | 7.7.5 | Url | The SQL circuit is down, generate the haptic circuit so we can generate the SQL circuit! | +| Dynamic Directives Technician | 8.5.4 | Expression | I'll connect the mobile SMS sensor, that should sensor the SMS sensor! | +| National Accountability Administrator | 5.3.0 | Expression | Try to bypass the EXE card, maybe it will bypass the optical card! | +| Human Factors Manager | 3.2.3 | Expression | We need to parse the back-end EXE matrix! | +| Lead Communications Officer | 2.8.0 | Url | We need to back up the open-source PNG circuit! | +| Forward Response Specialist | 3.6.3 | Url | parsing the firewall won't do anything, we need to calculate the multi-byte PCI firewall! | +| Direct Tactics Analyst | 1.0.4 | Url | Use the primary PCI array, then you can quantify the primary array! | +| Future Creative Coordinator | 6.1.3 | Expression | Try to transmit the SQL program, maybe it will transmit the multi-byte program! | +| Investor Directives Technician | 4.6.6 | Url | The RAM port is down, bypass the mobile port so we can bypass the RAM port! | +| Central Applications Planner | 6.6.9 | Url | parsing the driver won't do anything, we need to parse the primary TCP driver! | +| Corporate Paradigm Administrator | 5.5.2 | Url | Try to calculate the XSS feed, maybe it will calculate the neural feed! | +| Dynamic Factors Designer | 2.9.0 | Expression | Use the optical RSS feed, then you can program the optical feed! | +| Future Program Liaison | 5.1.6 | Expression | You can't index the feed without copying the haptic SAS feed! | +| Lead Assurance Producer | 6.1.8 | Expression | If we transmit the system, we can get to the SMTP system through the virtual SMTP system! | +| Chief Division Director | 3.4.7 | Expression | The FTP transmitter is down, compress the auxiliary transmitter so we can compress the FTP transmitter! | +| Senior Directives Officer | 1.5.8 | Url | I'll override the primary XML monitor, that should monitor the XML monitor! | +| Internal Creative Analyst | 9.2.6 | Url | The SDD sensor is down, override the wireless sensor so we can override the SDD sensor! | +| Principal Assurance Associate | 9.3.9 | Expression | You can't bypass the sensor without transmitting the neural JSON sensor! | +| Customer Factors Planner | 8.6.6 | Expression | If we bypass the transmitter, we can get to the SMTP transmitter through the solid state SMTP transmitter! | +| Direct Operations Executive | 3.1.7 | Expression | I'll bypass the solid state SMS system, that should system the SMS system! | +| Legacy Data Facilitator | 0.9.0 | Expression | synthesizing the firewall won't do anything, we need to program the primary JBOD firewall! | +| Internal Brand Manager | 0.8.2 | Url | I'll connect the optical SQL transmitter, that should transmitter the SQL transmitter! | +| Forward Research Designer | 6.7.1 | Url | compressing the transmitter won't do anything, we need to reboot the optical SSL transmitter! | +| Forward Implementation Liaison | 0.7.5 | Expression | Use the optical USB firewall, then you can program the optical firewall! | +| Dynamic Directives Executive | 9.9.0 | Expression | Use the open-source SQL system, then you can index the open-source system! | +| Regional Security Officer | 9.7.3 | Expression | We need to transmit the redundant TCP panel! | +| Future Factors Representative | 9.2.0 | Expression | generating the bandwidth won't do anything, we need to reboot the solid state XML bandwidth! | +| Forward Tactics Planner | 5.4.6 | Expression | Use the digital SMTP hard drive, then you can program the digital hard drive! | +| Direct Branding Engineer | 7.4.9 | Url | If we copy the array, we can get to the SAS array through the neural SAS array! | +| District Intranet Designer | 4.5.0 | Expression | If we program the system, we can get to the AI system through the bluetooth AI system! | ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt new file mode 100644 index 00000000..d3607515 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=20.verified.txt @@ -0,0 +1,24 @@ ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------+ +| Package | Version | License Information Origin | License Expression | ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------+ +| Legacy Metrics Planner | 9.5.0 | Url | We need to generate the multi-byte SMTP port! | +| International Implementation Consultant | 6.7.6 | Url | Try to generate the PNG sensor, maybe it will generate the haptic sensor! | +| Dynamic Implementation Orchestrator | 3.1.0 | Url | I'll override the primary AI program, that should program the AI program! | +| Direct Program Director | 5.9.9 | Expression | Try to copy the EXE array, maybe it will copy the solid state array! | +| Legacy Markets Coordinator | 2.3.0 | Url | You can't override the driver without backing up the redundant THX driver! | +| Future Infrastructure Planner | 5.7.5 | Url | You can't parse the system without compressing the haptic GB system! | +| Customer Directives Director | 7.9.2 | Expression | If we program the driver, we can get to the USB driver through the virtual USB driver! | +| Direct Creative Representative | 7.0.3 | Url | Try to navigate the RAM capacitor, maybe it will navigate the wireless capacitor! | +| Forward Configuration Engineer | 2.1.9 | Expression | Try to synthesize the COM port, maybe it will synthesize the haptic port! | +| Legacy Research Associate | 9.9.5 | Expression | The THX program is down, transmit the redundant program so we can transmit the THX program! | +| Direct Branding Orchestrator | 8.3.3 | Expression | You can't bypass the sensor without overriding the online ADP sensor! | +| Senior Intranet Designer | 5.6.6 | Url | If we synthesize the protocol, we can get to the JBOD protocol through the multi-byte JBOD protocol! | +| National Communications Facilitator | 3.1.0 | Url | You can't calculate the matrix without generating the optical JSON matrix! | +| Human Response Technician | 2.8.5 | Expression | I'll transmit the haptic COM protocol, that should protocol the COM protocol! | +| Customer Accounts Engineer | 5.4.5 | Expression | We need to hack the auxiliary COM hard drive! | +| District Branding Analyst | 1.9.5 | Expression | I'll navigate the neural SAS card, that should card the SAS card! | +| Central Creative Manager | 8.4.8 | Expression | Use the online GB alarm, then you can navigate the online alarm! | +| District Operations Manager | 8.5.0 | Expression | We need to navigate the back-end IB protocol! | +| Central Interactions Manager | 7.0.9 | Expression | We need to compress the primary GB array! | +| Legacy Intranet Agent | 9.0.8 | Expression | navigating the pixel won't do anything, we need to parse the back-end IB pixel! | ++-----------------------------------------+---------+----------------------------+------------------------------------------------------------------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt new file mode 100644 index 00000000..ab031344 --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.ValidatedLicenses_Should_PrintCorrectTable_validatedLicenseCount=5.verified.txt @@ -0,0 +1,9 @@ ++-----------------------------------------+---------+----------------------------+----------------------------------------------------------------------------+ +| Package | Version | License Information Origin | License Expression | ++-----------------------------------------+---------+----------------------------+----------------------------------------------------------------------------+ +| Legacy Metrics Planner | 9.5.0 | Url | We need to generate the multi-byte SMTP port! | +| International Implementation Consultant | 6.7.6 | Url | Try to generate the PNG sensor, maybe it will generate the haptic sensor! | +| Dynamic Implementation Orchestrator | 3.1.0 | Url | I'll override the primary AI program, that should program the AI program! | +| Direct Program Director | 5.9.9 | Expression | Try to copy the EXE array, maybe it will copy the solid state array! | +| Legacy Markets Coordinator | 2.3.0 | Url | You can't override the driver without backing up the redundant THX driver! | ++-----------------------------------------+---------+----------------------------+----------------------------------------------------------------------------+ diff --git a/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.cs b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.cs new file mode 100644 index 00000000..7adb895f --- /dev/null +++ b/tests/NuGetUtility.Test/Output/Table/TableOutputFormatterTest.cs @@ -0,0 +1,55 @@ +using Bogus; +using NuGet.Versioning; +using NuGetUtility.LicenseValidator; +using NuGetUtility.Output; +using NuGetUtility.Output.Table; +using NuGetUtility.Test.Extensions; + +namespace NuGetUtility.Test.Output.Table +{ + [TestFixture] + public class TableOutputFormatterTest + { + [SetUp] + public void SetUp() + { + _validatedLicenseFaker = new Faker().CustomInstantiator(f => + new ValidatedLicense(f.Name.JobTitle(), + new NuGetVersion(f.System.Semver()), + f.Hacker.Phrase(), + f.Random.Enum())) + .UseSeed(8675309); + _licenseValidationErrorFaker = new Faker().CustomInstantiator(f => + new LicenseValidationError(f.System.FilePath(), + f.Name.FullName(), + new NuGetVersion(f.System.Semver()), + f.Lorem.Sentence())) + .UseSeed(9078345); + _uut = new TableOutputFormatter(); + } + private IOutputFormatter _uut = null!; + private Faker _validatedLicenseFaker = null!; + private Faker _licenseValidationErrorFaker = null!; + + [Test] + public async Task Errors_Should_PrintCorrectTable([Values(0, 1, 5, 20)] int errorCount) + { + using var stream = new MemoryStream(); + var errors = _licenseValidationErrorFaker.GenerateForever().Take(errorCount); + await _uut.Write(stream, errors); + + await Verify(stream.AsString()); + } + + [Test] + public async Task ValidatedLicenses_Should_PrintCorrectTable( + [Values(0, 1, 5, 20, 100)] int validatedLicenseCount) + { + using var stream = new MemoryStream(); + var validated = _validatedLicenseFaker.GenerateForever().Take(validatedLicenseCount); + await _uut.Write(stream, validated); + + await Verify(stream.AsString()); + } + } +} diff --git a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs index c4c2372a..962f9d62 100644 --- a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs +++ b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs @@ -11,7 +11,6 @@ using NuGetUtility.Wrapper.NuGetWrapper.Packaging.Core; using NuGetUtility.Wrapper.NuGetWrapper.Protocol.Core.Types; using NuGetUtility.Wrapper.NuGetWrapper.Versioning; -using NUnit.Framework; namespace NuGetUtility.Test.PackageInformationReader { diff --git a/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderIntegrationTest.cs b/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderIntegrationTest.cs index 4f562247..805c32ca 100644 --- a/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderIntegrationTest.cs +++ b/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderIntegrationTest.cs @@ -2,7 +2,6 @@ using NuGetUtility.Wrapper.MsBuildWrapper; using NuGetUtility.Wrapper.NuGetWrapper.ProjectModel; using NuGetUtility.Wrapper.NuGetWrapper.Protocol.Core.Types; -using NUnit.Framework; namespace NuGetUtility.Test.ReferencedPackagesReader { @@ -73,10 +72,10 @@ public void GetInstalledPackagesShould_ThrowMsBuildAbstractionException_If_Proje { var path = Path.GetFullPath("../../../../targets/PackagesConfigProject/PackagesConfigProject.csproj"); - Assert.That(() => _uut!.GetInstalledPackages(path, false), - Throws.TypeOf() - .With.Message.EqualTo( - $"Invalid project structure detected. Currently only PackageReference projects are supported (Project: {path})")); + var exception = Assert.Throws(() => _uut!.GetInstalledPackages(path, false)); + Assert.AreEqual( + $"Invalid project structure detected. Currently only PackageReference projects are supported (Project: {path})", + exception?.Message); } } } diff --git a/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderTest.cs b/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderTest.cs index dcb8f7f1..36ef07e0 100644 --- a/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderTest.cs +++ b/tests/NuGetUtility.Test/ReferencedPackagesReader/ReferencedPackagesReaderTest.cs @@ -10,7 +10,6 @@ using NuGetUtility.Wrapper.NuGetWrapper.ProjectModel; using NuGetUtility.Wrapper.NuGetWrapper.Protocol.Core.Types; using NuGetUtility.Wrapper.NuGetWrapper.Versioning; -using NUnit.Framework; namespace NuGetUtility.Test.ReferencedPackagesReader {