diff --git a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs index a2718b3ac4..23643654af 100644 --- a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs +++ b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs @@ -141,7 +141,8 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation { Assert.Equal(expectedAttribute.Tag, actualAttribute.Tag); Assert.Equal(expectedAttribute.Attributes, actualAttribute.Attributes); - }); + }, + discoveredAttributes => discoveredAttributes.OrderBy(attribute => attribute.Tag)); // Verify if enum in attribute constructors works. AssertAttributes( @@ -391,7 +392,8 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation Assert.Equal(expectedAttribute.FirstArgument, actualAttribute.FirstArgument); Assert.Equal(expectedAttribute.SecondArgument, actualAttribute.SecondArgument); Assert.Equal(expectedAttribute.ThirdArgument, actualAttribute.ThirdArgument); - }); + }, + discoveredAttributes => discoveredAttributes.OrderBy(attribute => attribute.FirstArgument)); } [Fact] @@ -479,10 +481,20 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation Action assertItem) where TAttribute : Attribute { - Assert.Equal( - expected.GetCustomAttributes(), - actual.GetCustomAttributes(), - new DelegateAssertion(assertItem)); + AssertAttributes(expected, actual, assertItem, attributes => attributes); + } + + private static void AssertAttributes( + MemberInfo expected, + IMemberInfo actual, + Action assertItem, + Func, IEnumerable> reorderDiscoveredAttributes) + where TAttribute : Attribute + { + var expectedAttributes = reorderDiscoveredAttributes(expected.GetCustomAttributes()); + var actualAttributes = reorderDiscoveredAttributes(actual.GetCustomAttributes()); + + Assert.Equal(expectedAttributes, actualAttributes, new DelegateAssertion(assertItem)); } private static void AssertEqual(Type expected, ITypeInfo actual)