3
3
4
4
using System ;
5
5
using System . Collections . Generic ;
6
+ using System . Linq ;
6
7
using Newtonsoft . Json ;
7
8
using NUnit . Framework ;
8
9
using Umbraco . Cms . Core ;
@@ -29,6 +30,33 @@ public void CanSerialize()
29
30
Assert . AreEqual ( expected , serialized ) ;
30
31
}
31
32
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
+
32
60
private class TestArtifact : ArtifactBase < GuidUdi >
33
61
{
34
62
public TestArtifact ( GuidUdi udi , IEnumerable < ArtifactDependency > dependencies = null ) : base ( udi , dependencies )
0 commit comments