From d6fdb6bbee8f27710f7817e9fbc6f0928a876d57 Mon Sep 17 00:00:00 2001 From: Simon Ensslen Date: Mon, 8 Jul 2024 13:54:01 +0200 Subject: [PATCH] fix tests --- .../PackageInformationReaderTest.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs index 16f955b4..0eef5c9d 100644 --- a/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs +++ b/tests/NuGetUtility.Test/PackageInformationReader/PackageInformationReaderTest.cs @@ -94,8 +94,14 @@ private static void CheckResult(ReferencedPackageWithContext[] result, { CollectionAssert.AreEquivalent(packages, result.Select(s => new CustomPackageInformation(s.PackageInfo.Identity.Id, - s.PackageInfo.Identity.Version, - s.PackageInfo.LicenseMetadata!.License))); + s.PackageInfo.Identity.Version, + s.PackageInfo.LicenseMetadata!.License, + s.PackageInfo.Copyright, + s.PackageInfo.Authors, + s.PackageInfo.Title, + s.PackageInfo.ProjectUrl, + s.PackageInfo.Summary, + s.PackageInfo.Description))); foreach (ReferencedPackageWithContext r in result) { Assert.AreEqual(project, r.Context); @@ -113,6 +119,12 @@ public async Task GetPackageInfo_Should_PreferLocalPackageCacheOverRepositories( var identity = new PackageIdentity(info.Id, info.Version); IPackageMetadata mockedInfo = Substitute.For(); mockedInfo.Identity.Returns(identity); + mockedInfo.Copyright.Returns(info.Copyright); + mockedInfo.Authors.Returns(info.Authors); + mockedInfo.Title.Returns(info.Title); + mockedInfo.ProjectUrl.Returns(info.ProjectUrl); + mockedInfo.Summary.Returns(info.Summary); + mockedInfo.Description.Returns(info.Description); mockedInfo.LicenseMetadata.Returns(new LicenseMetadata(LicenseType.Expression, info.License)); _globalPackagesFolderUtility.GetPackage(identity).Returns(mockedInfo); @@ -136,6 +148,12 @@ private void SetupPackagesForRepositories(IEnumerable IPackageMetadata resultingInfo = Substitute.For(); resultingInfo.Identity.Returns(new PackageIdentity(package.Id, package.Version)); resultingInfo.LicenseMetadata.Returns(new LicenseMetadata(LicenseType.Expression, package.License)); + resultingInfo.Copyright.Returns(package.Copyright); + resultingInfo.Authors.Returns(package.Authors); + resultingInfo.Title.Returns(package.Title); + resultingInfo.Summary.Returns(package.Summary); + resultingInfo.Description.Returns(package.Description); + resultingInfo.ProjectUrl.Returns(package.ProjectUrl); metadataReturningProperInformation.TryGetMetadataAsync(new PackageIdentity(package.Id, package.Version), Arg.Any()). Returns(_ => Task.FromResult(resultingInfo)); @@ -193,8 +211,8 @@ public async Task GetPackageInfo_Should_ReturnDummyPackageMetadataForPackagesNot Assert.AreEqual(expectation.Version, result.PackageInfo.Identity.Version); Assert.IsNull(result.PackageInfo.LicenseMetadata); Assert.IsNull(result.PackageInfo.LicenseUrl); - Assert.AreEqual(string.Empty, result.PackageInfo.Summary); - Assert.AreEqual(string.Empty, result.PackageInfo.Title); + Assert.IsNull(result.PackageInfo.Summary); + Assert.IsNull(result.PackageInfo.Title); } } }