Skip to content

Commit 9f35139

Browse files
committed
More comparisons
1 parent 188a6fe commit 9f35139

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselineComparer.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,41 @@ internal void AssertManifest(StaticWebAssetsManifest expected, StaticWebAssetsMa
6363
}
6464

6565
var manifestEndpoints = manifest.Endpoints
66-
.OrderBy(a => a.AssetFile)
66+
.OrderBy(a => a.Route)
67+
.ThenBy(a => a.AssetFile)
6768
.GroupBy(a => GetEndpointGroup(a))
6869
.ToDictionary(a => a.Key, a => a.ToArray());
6970

71+
SortEndpointProperties(manifestEndpoints);
72+
7073
var expectedEndpoints = expected.Endpoints
7174
.OrderBy(a => a.Route)
7275
.ThenBy(a => a.AssetFile)
7376
.GroupBy(a => GetEndpointGroup(a))
7477
.ToDictionary(a => a.Key, a => a.ToArray());
7578

79+
SortEndpointProperties(expectedEndpoints);
80+
7681
foreach (var (group, manifestEndpointsGroup) in manifestEndpoints)
7782
{
7883
var expectedEndpointsGroup = expectedEndpoints[group];
7984
CompareEndpointGroup(group, manifestEndpointsGroup, expectedEndpointsGroup);
8085
}
8186
}
8287

88+
private static void SortEndpointProperties(Dictionary<string, StaticWebAssetEndpoint[]> endpoints)
89+
{
90+
foreach (var endpointGroup in endpoints.Values)
91+
{
92+
foreach (var endpoint in endpointGroup)
93+
{
94+
Array.Sort(endpoint.Selectors, (a, b) => (a.Name, a.Value).CompareTo((b.Name, b.Value)));
95+
Array.Sort(endpoint.ResponseHeaders, (a, b) => (a.Name, a.Value).CompareTo((b.Name, b.Value)));
96+
Array.Sort(endpoint.EndpointProperties, (a, b) => (a.Name, a.Value).CompareTo((b.Name, b.Value)));
97+
}
98+
}
99+
}
100+
83101
protected virtual void CompareAssetGroup(string group, StaticWebAsset[] manifestAssets, StaticWebAsset[] expectedAssets)
84102
{
85103
var comparisonMode = CompareAssetCounts(group, manifestAssets, expectedAssets);

0 commit comments

Comments
 (0)