Skip to content

Commit f3f6744

Browse files
AndyButlandbergmania
authored andcommitted
Ensured order of Deploy artifact dependencies irrespective of ICU or NLS globalization settings. (#11265)
1 parent 5300d74 commit f3f6744

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/Umbraco.Core/Udi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.ComponentModel;
33
using System.Linq;
44

@@ -44,7 +44,7 @@ protected Udi(Uri uriValue)
4444

4545
public int CompareTo(Udi other)
4646
{
47-
return string.Compare(UriValue.ToString(), other.UriValue.ToString(), StringComparison.InvariantCultureIgnoreCase);
47+
return string.Compare(UriValue.ToString(), other.UriValue.ToString(), StringComparison.OrdinalIgnoreCase);
4848
}
4949

5050
public override string ToString()

src/Umbraco.Tests.UnitTests/Umbraco.Core/Deploy/ArtifactBaseTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Linq;
67
using Newtonsoft.Json;
78
using NUnit.Framework;
89
using Umbraco.Cms.Core;
@@ -29,6 +30,33 @@ public void CanSerialize()
2930
Assert.AreEqual(expected, serialized);
3031
}
3132

33+
[Test]
34+
public void Dependencies_Are_Correctly_Ordered()
35+
{
36+
// This test was introduced following: https://github.com/umbraco/Umbraco.Deploy.Issues/issues/72 to verify
37+
// that consistent ordering rules are used across platforms.
38+
var udi = new GuidUdi("test", Guid.Parse("3382d5433b5749d08919bc9961422a1f"));
39+
var artifact = new TestArtifact(udi, new List<ArtifactDependency>())
40+
{
41+
Name = "Test Name",
42+
Alias = "testAlias",
43+
};
44+
45+
var dependencies = new ArtifactDependencyCollection();
46+
47+
var dependencyUdi1 = new GuidUdi("template", Guid.Parse("d4651496fad24c1290a53ea4d55d945b"));
48+
dependencies.Add(new ArtifactDependency(dependencyUdi1, true, ArtifactDependencyMode.Exist));
49+
50+
var dependencyUdi2 = new StringUdi(Constants.UdiEntityType.TemplateFile, "TestPage.cshtml");
51+
dependencies.Add(new ArtifactDependency(dependencyUdi2, true, ArtifactDependencyMode.Exist));
52+
53+
artifact.Dependencies = dependencies;
54+
55+
Assert.AreEqual(
56+
"umb://template-file/TestPage.cshtml,umb://template/d4651496fad24c1290a53ea4d55d945b",
57+
string.Join(",", artifact.Dependencies.Select(x => x.Udi.ToString())));
58+
}
59+
3260
private class TestArtifact : ArtifactBase<GuidUdi>
3361
{
3462
public TestArtifact(GuidUdi udi, IEnumerable<ArtifactDependency> dependencies = null) : base(udi, dependencies)

0 commit comments

Comments
 (0)