From 0253c563be7b0953765744e36df8e2003f8ee705 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 18 Sep 2015 16:53:13 -0700 Subject: [PATCH] Update tests to run correctly on stable mono. --- ...PrecompilationTagHelperTypeResolverTest.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) 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)