Skip to content

Commit 439f55c

Browse files
committed
better
1 parent 4b22297 commit 439f55c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public void Build_IsIncremental()
2727
var filesToIgnore = new[]
2828
{
2929
Path.Combine(buildOutputDirectory, "RazorClassLibrary.staticwebassets.endpoints.json"),
30-
Path.Combine(buildOutputDirectory, "blazorwasm.staticwebassets.endpoints.json"),
31-
Path.Combine(buildOutputDirectory, "blazorwasm.runtimeconfig.json")
30+
Path.Combine(buildOutputDirectory, "blazorwasm.staticwebassets.endpoints.json")
3231
};
3332

3433
// Act
@@ -44,7 +43,11 @@ public void Build_IsIncremental()
4443
newThumbPrint.Count.Should().Be(thumbPrint.Count);
4544
for (var j = 0; j < thumbPrint.Count; j++)
4645
{
47-
thumbPrint[j].Equals(newThumbPrint[j]).Should().BeTrue();
46+
var first = thumbPrint[j];
47+
var actual = newThumbPrint[j];
48+
actual.Path.Equals(first.Path).Should().BeTrue($"because {actual.Path} should match {first.Path}");
49+
actual.Hash.Equals(first.Hash).Should().BeTrue($"because {actual.Hash} should match {first.Hash} for {first.Path}");
50+
actual.LastWriteTimeUtc.Equals(first.LastWriteTimeUtc).Should().BeTrue($"because {actual.LastWriteTimeUtc} should match {first.LastWriteTimeUtc} for {first.Path}");
4851
}
4952
}
5053
}

test/Microsoft.NET.TestFramework/Utilities/FileThumbPrint.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ public bool Equals(FileThumbPrint? other)
6161
string.Equals(Hash, other.Hash, StringComparison.Ordinal);
6262
}
6363

64-
public override int GetHashCode() => LastWriteTimeUtc.GetHashCode();
64+
public override int GetHashCode()
65+
{
66+
#if NET
67+
return HashCode.Combine(Path, LastWriteTimeUtc, Hash);
68+
#else
69+
return Path.GetHashCode() ^ LastWriteTimeUtc.GetHashCode() ^ Hash.GetHashCode();
70+
#endif
71+
}
6572

6673
private string GetDebuggerDisplay()
6774
{

0 commit comments

Comments
 (0)