From ca62719f9d1d008bf16e8e7edba4a0a063cf306c Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 1 Dec 2015 09:48:35 -0800 Subject: [PATCH] Skip tests that are failing due to Mono issues Fixes #214 --- .../ApiConsistencyTestBase.cs | 88 ++++++++++--------- .../project.json | 1 + 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/ApiConsistencyTestBase.cs b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/ApiConsistencyTestBase.cs index d3fff1a5fe..d00b51df60 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/ApiConsistencyTestBase.cs +++ b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/ApiConsistencyTestBase.cs @@ -8,6 +8,7 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Diagnostics.Entity.Views; +using Microsoft.AspNet.Testing.xunit; using Xunit; namespace Microsoft.Data.Entity @@ -25,21 +26,22 @@ namespace Microsoft.Data.Entity protected const BindingFlags AnyInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - [Fact] + [ConditionalFact(Skip = "Skipping until we update to mono")] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] public void Public_inheritable_apis_should_be_virtual() { var nonVirtualMethods = (from type in GetAllTypes(TargetAssembly.DefinedTypes) - where type.IsVisible - && !type.IsSealed - && type.DeclaredConstructors.Any(c => c.IsPublic || c.IsFamily || c.IsFamilyOrAssembly) - && type.Namespace != null - && !type.Namespace.EndsWith(".Compiled") - && !_typesToSkip.Contains(type) - from method in type.DeclaredMethods.Where(m => m.IsPublic && !m.IsStatic) - where method.DeclaringType.GetTypeInfo() == type - && !(method.IsVirtual && !method.IsFinal) - select type.FullName + "." + method.Name) + where type.IsVisible + && !type.IsSealed + && type.DeclaredConstructors.Any(c => c.IsPublic || c.IsFamily || c.IsFamilyOrAssembly) + && type.Namespace != null + && !type.Namespace.EndsWith(".Compiled") + && !_typesToSkip.Contains(type) + from method in type.DeclaredMethods.Where(m => m.IsPublic && !m.IsStatic) + where method.DeclaringType.GetTypeInfo() == type + && !(method.IsVirtual && !method.IsFinal) + select type.FullName + "." + method.Name) .ToList(); Assert.False( @@ -47,26 +49,27 @@ namespace Microsoft.Data.Entity "\r\n-- Missing virtual APIs --\r\n" + string.Join("\r\n", nonVirtualMethods)); } - [Fact] + [ConditionalFact(Skip = "Skipping until we update to mono")] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] public void Public_api_arguments_should_have_not_null_annotation() { var parametersMissingAttribute = (from type in GetAllTypes(TargetAssembly.DefinedTypes) - where type.IsVisible && !typeof(Delegate).GetTypeInfo().IsAssignableFrom(type) && !_typesToSkip.Contains(type) - let interfaceMappings = type.ImplementedInterfaces.Select(type.GetRuntimeInterfaceMap) - let events = type.DeclaredEvents - from method in type.DeclaredMethods.Where(m => m.IsPublic) - .Concat(type.DeclaredConstructors) - where method.DeclaringType.GetTypeInfo() == type - where type.IsInterface || !interfaceMappings.Any(im => im.TargetMethods.Contains(method)) - where !events.Any(e => e.AddMethod == method || e.RemoveMethod == method) - from parameter in method.GetParameters() - where !parameter.ParameterType.GetTypeInfo().IsValueType - && !parameter.GetCustomAttributes() - .Any( - a => a.GetType().Name == "NotNullAttribute" - || a.GetType().Name == "CanBeNullAttribute") - select type.FullName + "." + method.Name + "[" + parameter.Name + "]") + where type.IsVisible && !typeof(Delegate).GetTypeInfo().IsAssignableFrom(type) && !_typesToSkip.Contains(type) + let interfaceMappings = type.ImplementedInterfaces.Select(type.GetRuntimeInterfaceMap) + let events = type.DeclaredEvents + from method in type.DeclaredMethods.Where(m => m.IsPublic) + .Concat(type.DeclaredConstructors) + where method.DeclaringType.GetTypeInfo() == type + where type.IsInterface || !interfaceMappings.Any(im => im.TargetMethods.Contains(method)) + where !events.Any(e => e.AddMethod == method || e.RemoveMethod == method) + from parameter in method.GetParameters() + where !parameter.ParameterType.GetTypeInfo().IsValueType + && !parameter.GetCustomAttributes() + .Any( + a => a.GetType().Name == "NotNullAttribute" + || a.GetType().Name == "CanBeNullAttribute") + select type.FullName + "." + method.Name + "[" + parameter.Name + "]") .ToList(); Assert.False( @@ -74,34 +77,35 @@ namespace Microsoft.Data.Entity "\r\n-- Missing NotNull annotations --\r\n" + string.Join("\r\n", parametersMissingAttribute)); } - [Fact] + [ConditionalFact(Skip = "Skipping until we update to mono")] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] public void Async_methods_should_have_overload_with_cancellation_token_and_end_with_async_suffix() { var asyncMethods = (from type in GetAllTypes(TargetAssembly.DefinedTypes) - where type.IsVisible - from method in type.DeclaredMethods.Where(m => m.IsPublic) - where method.DeclaringType.GetTypeInfo() == type - where typeof(Task).IsAssignableFrom(method.ReturnType) - select method).ToList(); + where type.IsVisible + from method in type.DeclaredMethods.Where(m => m.IsPublic) + where method.DeclaringType.GetTypeInfo() == type + where typeof(Task).IsAssignableFrom(method.ReturnType) + select method).ToList(); var asyncMethodsWithToken = (from method in asyncMethods - where method.GetParameters().Any(pi => pi.ParameterType == typeof(CancellationToken)) - select method).ToList(); + where method.GetParameters().Any(pi => pi.ParameterType == typeof(CancellationToken)) + select method).ToList(); var asyncMethodsWithoutToken = (from method in asyncMethods - where method.GetParameters().All(pi => pi.ParameterType != typeof(CancellationToken)) - select method).ToList(); + where method.GetParameters().All(pi => pi.ParameterType != typeof(CancellationToken)) + select method).ToList(); var missingOverloads = (from methodWithoutToken in asyncMethodsWithoutToken - where !asyncMethodsWithToken - .Any(methodWithToken => methodWithoutToken.Name == methodWithToken.Name - && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType) - // ReSharper disable once PossibleNullReferenceException - select methodWithoutToken.DeclaringType.Name + "." + methodWithoutToken.Name) + where !asyncMethodsWithToken + .Any(methodWithToken => methodWithoutToken.Name == methodWithToken.Name + && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType) + // ReSharper disable once PossibleNullReferenceException + select methodWithoutToken.DeclaringType.Name + "." + methodWithoutToken.Name) .Except(GetCancellationTokenExceptions()) .ToList(); diff --git a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json index db2a2a9331..2f6e676365 100644 --- a/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json +++ b/test/Microsoft.AspNet.Diagnostics.Entity.Tests/project.json @@ -5,6 +5,7 @@ "dependencies": { "EntityFramework.InMemory": "7.0.0-*", "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*", + "Microsoft.AspNet.Testing": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" }, "compile": [ "../Shared/ApiConsistencyTestBase.cs", "../Shared/TestHelpers.cs" ],