Skip to content

Commit 89c4967

Browse files
author
Aayush Maini
committed
Fix sbom parser UT
1 parent b9124a6 commit 89c4967

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/Microsoft.ComponentDetection.Detectors.Tests/RustSbomParserTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ public async Task ParseWithOwnershipAsync_PartialOwnership_MixesFallbackAndOwner
492492
var parentRecorder = new Mock<IComponentRecorder>(MockBehavior.Strict);
493493
var owner1 = new Mock<ISingleFileComponentRecorder>(MockBehavior.Loose);
494494

495+
// Set up DependencyGraph for the recorders
496+
var sbomGraph = new Mock<IDependencyGraph>();
497+
sbomGraph.Setup(g => g.Contains(It.IsAny<string>())).Returns(false);
498+
sbomRecorder.Setup(r => r.DependencyGraph).Returns(sbomGraph.Object);
499+
500+
var owner1Graph = new Mock<IDependencyGraph>();
501+
owner1Graph.Setup(g => g.Contains(It.IsAny<string>())).Returns(false);
502+
owner1.Setup(r => r.DependencyGraph).Returns(owner1Graph.Object);
503+
495504
parentRecorder.Setup(p => p.CreateSingleFileComponentRecorder("manifests/owner1")).Returns(owner1.Object);
496505

497506
var ownershipMap = new Dictionary<string, HashSet<string>>

0 commit comments

Comments
 (0)