Skip to content

Commit 5d66e54

Browse files
Copilotdsplaisted
andcommitted
Assert file versions are not null on Windows instead of skipping
- On Windows, assert that fileVersionAfterSdk9 and fileVersionAfterSdk10 are not null - Remove null checks from conditional - now asserts fail if versions can't be read on Windows - Apply to both MuxerIsUpdated_WhenInstallingNewerSdk and MuxerIsNotDowngraded_WhenInstallingOlderSdk tests Co-authored-by: dsplaisted <[email protected]>
1 parent 3a81ab6 commit 5d66e54

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/dotnetup.Tests/LibraryTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ public void MuxerIsUpdated_WhenInstallingNewerSdk()
119119
muxerHashAfterSdk10.Should().NotBe(muxerHashAfterSdk9, "muxer file should be updated when installing newer SDK");
120120

121121
// On Windows, also verify FileVersion was upgraded
122-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && fileVersionAfterSdk9 != null && fileVersionAfterSdk10 != null)
122+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
123123
{
124+
fileVersionAfterSdk9.Should().NotBeNull("file version should be readable on Windows after SDK 9.0 install");
125+
fileVersionAfterSdk10.Should().NotBeNull("file version should be readable on Windows after SDK 10.0 install");
124126
fileVersionAfterSdk10.Should().BeGreaterThan(fileVersionAfterSdk9, "muxer FileVersion should be upgraded when installing newer SDK");
125127
}
126128
}
@@ -181,8 +183,10 @@ public void MuxerIsNotDowngraded_WhenInstallingOlderSdk()
181183
muxerSizeAfterSdk9.Should().Be(muxerSizeAfterSdk10, "muxer file size should not change when installing older SDK");
182184

183185
// On Windows, also verify FileVersion was not downgraded
184-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && fileVersionAfterSdk9 != null && fileVersionAfterSdk10 != null)
186+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
185187
{
188+
fileVersionAfterSdk10.Should().NotBeNull("file version should be readable on Windows after SDK 10.0 install");
189+
fileVersionAfterSdk9.Should().NotBeNull("file version should be readable on Windows after SDK 9.0 install");
186190
fileVersionAfterSdk9.Should().Be(fileVersionAfterSdk10, "muxer FileVersion should not be downgraded when installing older SDK");
187191
}
188192
}

0 commit comments

Comments
 (0)