Skip to content

Commit

Permalink
Test that PackageDownloads are DevDependencies
Browse files Browse the repository at this point in the history
Also fix up some other misuses of AllSatisfy.
  • Loading branch information
ericstj committed Dec 4, 2024
1 parent 500d771 commit 87fb88f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public async Task ScanDirectoryAsync_ExcludedFrameworkComponent_8_0_web_Verifica
.ExecuteDetectorAsync();

var detectedComponents = componentRecorder.GetDetectedComponents();
detectedComponents.Should().AllSatisfy(c => componentRecorder.GetEffectiveDevDependencyValue(c.Component.Id).GetValueOrDefault(), "All should be development dependencies");
detectedComponents.Should().AllSatisfy(c => componentRecorder.GetEffectiveDevDependencyValue(c.Component.Id).Should().BeTrue(), "All should be development dependencies");
}

[TestMethod]
Expand All @@ -289,7 +289,7 @@ public async Task ScanDirectoryAsync_ExcludedFrameworkComponent_42_15_web_Verifi

// net42.15 is not a known framework, but it can import framework packages from the closest known framework.
var detectedComponents = componentRecorder.GetDetectedComponents();
detectedComponents.Should().AllSatisfy(c => componentRecorder.GetEffectiveDevDependencyValue(c.Component.Id).GetValueOrDefault(), "All should be development dependencies");
detectedComponents.Should().AllSatisfy(c => componentRecorder.GetEffectiveDevDependencyValue(c.Component.Id).Should().BeTrue(), "All should be development dependencies");
}

[TestMethod]
Expand Down Expand Up @@ -329,6 +329,7 @@ public async Task ScanDirectoryAsync_PackageDownload_VerificationAsync()

var dependencies = componentRecorder.GetDetectedComponents();
dependencies.Should().HaveCount(3, "PackageDownload dependencies should exist.");
dependencies.Should().AllSatisfy(c => componentRecorder.GetEffectiveDevDependencyValue(c.Component.Id).Should().BeTrue(), "All PackageDownloads should be development dependencies");
dependencies.Select(c => c.Component).Should().AllBeOfType<NuGetComponent>();
dependencies.Select(c => c.TargetFrameworks).Should().AllSatisfy(tfms => tfms.Should().BeEquivalentTo(["net8.0"]));
}
Expand Down

0 comments on commit 87fb88f

Please sign in to comment.