From 74431cea7464b9395beb7302c72a672f784bee5a Mon Sep 17 00:00:00 2001 From: KonH Date: Fri, 27 Oct 2023 07:43:55 +0200 Subject: [PATCH] Fix tests, uses dictionaries lookup --- .../YarnBlockFileTests.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/YarnBlockFileTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/YarnBlockFileTests.cs index 6e1f8ca96..8cdfb0096 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/YarnBlockFileTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/YarnBlockFileTests.cs @@ -94,8 +94,9 @@ public async Task BlockFileParserV1WithSingleBlock_ParsesAsync() block.Title.Should().Be("block1"); block.Children.Should().ContainSingle(); block.Values["property"].Should().Be("value"); - block.Children.Single(x => x.Title == "block2").Values.Should().ContainValue("otherProperty") - .Which.Should().Be("otherValue"); + block.Children.Single(x => x.Title == "block2").Values.Should().ContainKey("otherProperty"); + var value = block.Children.Single(x => x.Title == "block2").Values["otherProperty"]; + value.Should().Be("otherValue"); file.VersionHeader.Should().Be(yarnLockFileVersionString); file.YarnLockVersion.Should().Be(YarnLockVersion.V1); } @@ -204,8 +205,8 @@ public async Task BlockFileParserV2WithSingleBlock_ParsesAsync() block.Title.Should().Be("block1"); block.Children.Should().ContainSingle(); block.Values["property"].Should().Be("value"); - block.Children.Single(x => x.Title == "block2").Values.Should().ContainValue("otherProperty") - .Which.Should().Be("otherValue"); + block.Children.Single(x => x.Title == "block2").Values.Should().ContainKey("otherProperty"); + var value = block.Children.Single(x => x.Title == "block2").Values["otherProperty"]; file.VersionHeader.Should().Be(yarnLockFileVersionString); file.YarnLockVersion.Should().Be(YarnLockVersion.V2); } @@ -243,8 +244,8 @@ public async Task BlockFileParserV2WithSingleBlock_ParsesWithQuotesAsync() block.Title.Should().Be("block1"); block.Children.Should().ContainSingle(); block.Values["property"].Should().Be("value"); - block.Children.Single(x => x.Title == "block2").Values.Should().ContainValue("otherProperty") - .Which.Should().Be("otherValue"); + block.Children.Single(x => x.Title == "block2").Values.Should().ContainKey("otherProperty"); + var value = block.Children.Single(x => x.Title == "block2").Values["otherProperty"]; file.VersionHeader.Should().Be(yarnLockFileVersionString); file.YarnLockVersion.Should().Be(YarnLockVersion.V2); }