diff --git a/eng/Packages.props b/eng/Packages.props index 41045a6bdde..fa31f9b0b21 100644 --- a/eng/Packages.props +++ b/eng/Packages.props @@ -10,6 +10,7 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6f218ecd248..210f1df4281 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,5 +14,9 @@ https://github.com/dotnet/roslyn acc39bc99b84648f84d8775519a858a63dd739be + + https://github.com/dotnet/arcade + + diff --git a/eng/Versions.props b/eng/Versions.props index 5f881de4a85..ff1bd71b607 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -32,6 +32,7 @@ $([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\global.json')), '"dotnet": "([^"]*)"').Groups.get_Item(1)) + 6.0.0-beta.21329.2 6.0.0-preview.2.21154.6 4.0.0-2.21320.2 6.0.0-preview.1.107 diff --git a/src/Build.UnitTests/BackEnd/BuildManager_Tests.cs b/src/Build.UnitTests/BackEnd/BuildManager_Tests.cs index 8b71b196a1a..85e3a8797db 100644 --- a/src/Build.UnitTests/BackEnd/BuildManager_Tests.cs +++ b/src/Build.UnitTests/BackEnd/BuildManager_Tests.cs @@ -3954,7 +3954,7 @@ public void OutOfProcEvaluationIdsUnique() /// Regression test for https://github.com/Microsoft/msbuild/issues/3047 /// [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "out-of-proc nodes not working on mono yet")] + [SkipOnMono("out-of-proc nodes not working on mono yet")] public void MultiProcReentrantProjectWithCallTargetDoesNotFail() { var a = diff --git a/src/Build.UnitTests/BackEnd/BuildRequest_Tests.cs b/src/Build.UnitTests/BackEnd/BuildRequest_Tests.cs index 75e018b7cdc..9cede0f7298 100644 --- a/src/Build.UnitTests/BackEnd/BuildRequest_Tests.cs +++ b/src/Build.UnitTests/BackEnd/BuildRequest_Tests.cs @@ -138,7 +138,7 @@ public void TestTranslation() #if FEATURE_COM_INTEROP [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "disable com tests on mono")] + [SkipOnMono("disable com tests on mono")] public void TestTranslationRemoteHostObjects() { var stateInHostObject = 3; diff --git a/src/Build.UnitTests/ConsoleLogger_Tests.cs b/src/Build.UnitTests/ConsoleLogger_Tests.cs index 31c8209404d..b46784e7257 100644 --- a/src/Build.UnitTests/ConsoleLogger_Tests.cs +++ b/src/Build.UnitTests/ConsoleLogger_Tests.cs @@ -320,7 +320,7 @@ public void ErrorMessageWithMultiplePropertiesInMessage(bool includeEvaluationPr [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "Minimal path validation in Core allows expanding path containing quoted slashes.")] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Minimal path validation in Mono allows expanding path containing quoted slashes.")] + [SkipOnMono("Minimal path validation in Mono allows expanding path containing quoted slashes.")] public void TestItemsWithUnexpandableMetadata() { SimulatedConsole sc = new SimulatedConsole(); diff --git a/src/Build.UnitTests/Instance/HostServices_Tests.cs b/src/Build.UnitTests/Instance/HostServices_Tests.cs index 0bd541928cd..318d56ef351 100644 --- a/src/Build.UnitTests/Instance/HostServices_Tests.cs +++ b/src/Build.UnitTests/Instance/HostServices_Tests.cs @@ -245,7 +245,7 @@ public void TestContradictoryAffinityCausesException_Any() /// Test which ensures that setting an Any affinity for a project with a remote host object does not throws. /// [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "disable com tests on mono")] + [SkipOnMono("disable com tests on mono")] public void TestNoContradictoryRemoteHostObjectAffinity() { HostServices hostServices = new HostServices(); @@ -301,7 +301,7 @@ public void TestNonContraditcoryHostObjectAllowed_Any() /// Test which ensures the remote host object cannot affect a project which has the Any affinity specifically set. /// [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "disable com tests on mono")] + [SkipOnMono("disable com tests on mono")] public void TestRegisterRemoteHostObjectNoAffect_Any2() { HostServices hostServices = new HostServices(); @@ -341,7 +341,7 @@ public void TestNonContraditcoryHostObjectAllowed_InProc() /// Test which ensures the affinity for a project can be changed once the in process host object is registered /// [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "disable com tests on mono")] + [SkipOnMono("disable com tests on mono")] public void TestAffinityChangeAfterRegisterInprocessHostObject() { HostServices hostServices = new HostServices(); @@ -452,7 +452,7 @@ public void UnloadedProjectDiscardsHostServices() /// Tests that register overrides existing reigsted remote host object. /// [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "disable com tests on mono")] + [SkipOnMono("disable com tests on mono")] public void TestRegisterOverrideExistingRegisted() { var hostServices = new HostServices(); diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 8e0072633ea..eea309398ba 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -55,6 +55,8 @@ + + diff --git a/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs b/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs index 558b16bf131..99e3d7066b0 100644 --- a/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs +++ b/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs @@ -2716,7 +2716,7 @@ public References(ITestOutputHelper output) [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "Linked resources not supported on Core: https://github.com/microsoft/msbuild/issues/4094")] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "https://github.com/Microsoft/msbuild/issues/677")] + [SkipOnMono("https://github.com/Microsoft/msbuild/issues/677")] public void DontLockP2PReferenceWhenResolvingSystemTypes() { // This WriteLine is a hack. On a slow machine, the Tasks unittest fails because remoting @@ -2894,7 +2894,7 @@ public class Class1 /// [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp, "Linked resources not supported on Core: https://github.com/microsoft/msbuild/issues/4094")] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "https://github.com/Microsoft/msbuild/issues/677")] + [SkipOnMono("https://github.com/Microsoft/msbuild/issues/677")] public void ReferencedAssemblySpecifiedUsingRelativePath() { // This WriteLine is a hack. On a slow machine, the Tasks unittest fails because remoting diff --git a/src/Xunit.NetCore.Extensions/Attributes/ActiveIssueAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/ActiveIssueAttribute.cs deleted file mode 100644 index d4060615d87..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/ActiveIssueAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify an active issue. - /// - [TraitDiscoverer("Xunit.NetCore.Extensions.ActiveIssueDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class ActiveIssueAttribute : Attribute, ITraitAttribute - { - public ActiveIssueAttribute(int issueNumber, TestPlatforms platforms) { } - public ActiveIssueAttribute(string issue, TestPlatforms platforms) { } - public ActiveIssueAttribute(int issueNumber, TargetFrameworkMonikers framework) { } - public ActiveIssueAttribute(string issue, TargetFrameworkMonikers framework) { } - public ActiveIssueAttribute(int issueNumber, TestPlatforms platforms = TestPlatforms.Any, TargetFrameworkMonikers framework = (TargetFrameworkMonikers)0) { } - public ActiveIssueAttribute(string issue, TestPlatforms platforms = TestPlatforms.Any, TargetFrameworkMonikers framework = (TargetFrameworkMonikers)0) { } - } -} diff --git a/src/Xunit.NetCore.Extensions/Attributes/ConditionalFactAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/ConditionalFactAttribute.cs deleted file mode 100644 index f0951064b1b..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/ConditionalFactAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [XunitTestCaseDiscoverer("Xunit.NetCore.Extensions.ConditionalFactDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public sealed class ConditionalFactAttribute : FactAttribute - { - public Type CalleeType { get; private set; } - public string[] ConditionMemberNames { get; private set; } - - public ConditionalFactAttribute(Type calleeType, params string[] conditionMemberNames) - { - CalleeType = calleeType; - ConditionMemberNames = conditionMemberNames; - } - - public ConditionalFactAttribute(params string[] conditionMemberNames) - { - ConditionMemberNames = conditionMemberNames; - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Attributes/ConditionalTheoryAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/ConditionalTheoryAttribute.cs deleted file mode 100644 index 761f1ff4f1b..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/ConditionalTheoryAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [XunitTestCaseDiscoverer("Xunit.NetCore.Extensions.ConditionalTheoryDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public sealed class ConditionalTheoryAttribute : TheoryAttribute - { - public Type CalleeType { get; private set; } - public string[] ConditionMemberNames { get; private set; } - - public ConditionalTheoryAttribute(Type calleeType, params string[] conditionMemberNames) - { - CalleeType = calleeType; - ConditionMemberNames = conditionMemberNames; - } - - public ConditionalTheoryAttribute(params string[] conditionMemberNames) - { - ConditionMemberNames = conditionMemberNames; - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Attributes/OuterLoopAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/OuterLoopAttribute.cs deleted file mode 100644 index d09a52f4787..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/OuterLoopAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify a outer-loop category. - /// - [TraitDiscoverer("Xunit.NetCore.Extensions.OuterLoopTestsDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class OuterLoopAttribute : Attribute, ITraitAttribute - { - public OuterLoopAttribute() { } - public OuterLoopAttribute(string reason) { } - } -} diff --git a/src/Xunit.NetCore.Extensions/Attributes/PlatformSpecificAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/PlatformSpecificAttribute.cs deleted file mode 100644 index 50532884811..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/PlatformSpecificAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify this is a platform specific test. - /// - [TraitDiscoverer("Xunit.NetCore.Extensions.PlatformSpecificDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)] - public class PlatformSpecificAttribute : Attribute, ITraitAttribute - { - public PlatformSpecificAttribute(TestPlatforms platforms) { } - } -} diff --git a/src/Xunit.NetCore.Extensions/Attributes/SkipOnTargetFrameworkAttribute.cs b/src/Xunit.NetCore.Extensions/Attributes/SkipOnTargetFrameworkAttribute.cs deleted file mode 100644 index c44881202aa..00000000000 --- a/src/Xunit.NetCore.Extensions/Attributes/SkipOnTargetFrameworkAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify this is a platform specific test. - /// - [TraitDiscoverer("Xunit.NetCore.Extensions.SkipOnTargetFrameworkDiscoverer", "Xunit.NetCore.Extensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class SkipOnTargetFrameworkAttribute : Attribute, ITraitAttribute - { - public SkipOnTargetFrameworkAttribute(TargetFrameworkMonikers platform, string reason = null) { } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/ActiveIssueDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/ActiveIssueDiscoverer.cs deleted file mode 100644 index 0839e333bf3..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/ActiveIssueDiscoverer.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the ActiveIssue attribute - /// - public class ActiveIssueDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - IEnumerable ctorArgs = traitAttribute.GetConstructorArguments(); - Debug.Assert(ctorArgs.Count() >= 2); - - string issue = ctorArgs.First().ToString(); - TestPlatforms platforms = TestPlatforms.Any; - TargetFrameworkMonikers frameworks = (TargetFrameworkMonikers)0; - - foreach (object arg in ctorArgs.Skip(1)) // First argument is the issue number. - { - if (arg is TestPlatforms) - { - platforms = (TestPlatforms)arg; - } - else if (arg is TargetFrameworkMonikers) - { - frameworks = (TargetFrameworkMonikers)arg; - } - } - - if ((platforms.HasFlag(TestPlatforms.FreeBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) || - (platforms.HasFlag(TestPlatforms.Linux) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) || - (platforms.HasFlag(TestPlatforms.NetBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD"))) || - (platforms.HasFlag(TestPlatforms.OSX) && RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) || - (platforms.HasFlag(TestPlatforms.Windows) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))) - { - if (frameworks.HasFlag(TargetFrameworkMonikers.NetFramework)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetfxTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Mono)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonMonoTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Netcoreapp)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreappTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.UapNotUapAot)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.UapAot)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapAotTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.NetcoreCoreRT)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreCoreRTTest); - if (frameworks == (TargetFrameworkMonikers)0) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.Failing); - - yield return new KeyValuePair(XunitConstants.ActiveIssue, issue); - } - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalFactDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/ConditionalFactDiscoverer.cs deleted file mode 100644 index 3ef2fc34e4b..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalFactDiscoverer.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - public class ConditionalFactDiscoverer : FactDiscoverer - { - private readonly IMessageSink _diagnosticMessageSink; - - public ConditionalFactDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) - { - _diagnosticMessageSink = diagnosticMessageSink; - } - - public override IEnumerable Discover( - ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) - { - IEnumerable testCases = base.Discover(discoveryOptions, testMethod, factAttribute); - return ConditionalTestDiscoverer.Discover(discoveryOptions, _diagnosticMessageSink, testMethod, testCases, factAttribute.GetConstructorArguments().ToArray()); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTestDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTestDiscoverer.cs deleted file mode 100644 index 1fc7269cd91..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTestDiscoverer.cs +++ /dev/null @@ -1,165 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - // Internal helper class for code common to conditional test discovery through - // [ConditionalFact] and [ConditionalTheory] - internal class ConditionalTestDiscoverer - { - // This helper method evaluates the given condition member names for a given set of test cases. - // If any condition member evaluates to 'false', the test cases are marked to be skipped. - // The skip reason is the collection of all the condition members that evalated to 'false'. - internal static IEnumerable Discover( - ITestFrameworkDiscoveryOptions discoveryOptions, - IMessageSink diagnosticMessageSink, - ITestMethod testMethod, - IEnumerable testCases, - object[] conditionArguments) - { - // A null or empty list of conditionMemberNames is treated as "no conditions". - // and the test cases will not be skipped. - // Example: [ConditionalFact()] - if (conditionArguments == null || conditionArguments.Length == 0) - { - return testCases; - } - - string [] conditionMemberNames; - - Type calleeType = conditionArguments[0] as Type; - if (calleeType != null) - { - if (conditionArguments.Length < 2) - { - // [ConditionalFact(typeof(x))] no provided methods. - return testCases; - } - - // [ConditionalFact(typeof(x), "MethodName")] - conditionMemberNames = conditionArguments[1] as string[]; - } - else - { - // [ConditionalFact("MethodName")] - conditionMemberNames = conditionArguments[0] as string[]; - } - - // [ConditionalFact((string[]) null)] - int conditionCount = conditionMemberNames == null ? 0 : conditionMemberNames.Count(); - if (conditionCount == 0) - { - return testCases; - } - - MethodInfo testMethodInfo = testMethod.Method.ToRuntimeMethod(); - Type testMethodDeclaringType = testMethodInfo.DeclaringType; - List falseConditions = new List(conditionCount); - - foreach (string entry in conditionMemberNames) - { - string conditionMemberName = entry; - - // Null condition member names are silently tolerated - if (string.IsNullOrWhiteSpace(conditionMemberName)) - { - continue; - } - - Type declaringType; - - if (calleeType != null) - { - declaringType = calleeType; - } - else - { - declaringType = testMethodDeclaringType; - - string[] symbols = conditionMemberName.Split('.'); - if (symbols.Length == 2) - { - conditionMemberName = symbols[1]; - ITypeInfo type = testMethod.TestClass.Class.Assembly.GetTypes(false).Where(t => t.Name.Contains(symbols[0])).FirstOrDefault(); - if (type != null) - { - declaringType = type.ToRuntimeType(); - } - } - } - - MethodInfo conditionMethodInfo; - if ((conditionMethodInfo = LookupConditionalMethod(declaringType, conditionMemberName)) == null) - { - return new[] - { - new ExecutionErrorTestCase( - diagnosticMessageSink, - discoveryOptions.MethodDisplayOrDefault(), - TestMethodDisplayOptions.None, - testMethod, - GetFailedLookupString(conditionMemberName, declaringType)) - }; - } - - // In the case of multiple conditions, collect the results of all - // of them to produce a summary skip reason. - try - { - if (!(bool)conditionMethodInfo.Invoke(null, null)) - { - falseConditions.Add(conditionMemberName); - } - } - catch (Exception exc) - { - falseConditions.Add($"{conditionMemberName} ({exc.GetType().Name})"); - } - } - - // Compose a summary of all conditions that returned false. - if (falseConditions.Count > 0) - { - string skippedReason = string.Format("Condition(s) not met: \"{0}\"", string.Join("\", \"", falseConditions)); - return testCases.Select(tc => new SkippedTestCase(tc, skippedReason)); - } - - // No conditions returned false (including the absence of any conditions). - return testCases; - } - - internal static string GetFailedLookupString(string name, Type type) - { - return - $"An appropriate member '{name}' could not be found. " + - $"The conditional method needs to be a static method or property on the type {type} or any ancestor, " + - "of any visibility, accepting zero arguments, and having a return type of Boolean."; - } - - internal static MethodInfo LookupConditionalMethod(Type t, string name) - { - if (t == null || name == null) - return null; - - TypeInfo ti = t.GetTypeInfo(); - - MethodInfo mi = ti.GetDeclaredMethod(name); - if (mi?.IsStatic == true && mi.GetParameters().Length == 0 && mi.ReturnType == typeof(bool)) - return mi; - - PropertyInfo pi = ti.GetDeclaredProperty(name); - if (pi?.PropertyType == typeof(bool) && pi.GetMethod?.IsStatic == true && pi.GetMethod.GetParameters().Length == 0) - return pi.GetMethod; - - return LookupConditionalMethod(ti.BaseType, name); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTheoryDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTheoryDiscoverer.cs deleted file mode 100644 index b4b6e5b1ff7..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/ConditionalTheoryDiscoverer.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - public class ConditionalTheoryDiscoverer : TheoryDiscoverer - { - private readonly IMessageSink _diagnosticMessageSink; - - public ConditionalTheoryDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) - { - _diagnosticMessageSink = diagnosticMessageSink; - } - - public override IEnumerable Discover( - ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute) - { - IEnumerable testCases = base.Discover(discoveryOptions, testMethod, theoryAttribute); - return ConditionalTestDiscoverer.Discover(discoveryOptions, _diagnosticMessageSink, testMethod, testCases, theoryAttribute.GetConstructorArguments().ToArray()); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/OuterLoopTestsDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/OuterLoopTestsDiscoverer.cs deleted file mode 100644 index db67037d84f..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/OuterLoopTestsDiscoverer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the OuterLoop attribute - /// - public class OuterLoopTestsDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.OuterLoop); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/PlatformSpecificDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/PlatformSpecificDiscoverer.cs deleted file mode 100644 index ce3b9e4b99f..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/PlatformSpecificDiscoverer.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using System.Collections.Generic; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the PlatformSpecific attribute - /// - public class PlatformSpecificDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - TestPlatforms platforms = (TestPlatforms)traitAttribute.GetConstructorArguments().First(); - if (!platforms.HasFlag(TestPlatforms.Windows)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonWindowsTest); - if (!platforms.HasFlag(TestPlatforms.Linux)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonLinuxTest); - if (!platforms.HasFlag(TestPlatforms.OSX)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonOSXTest); - if (!platforms.HasFlag(TestPlatforms.FreeBSD)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonFreeBSDTest); - if (!platforms.HasFlag(TestPlatforms.NetBSD)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetBSDTest); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs b/src/Xunit.NetCore.Extensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs deleted file mode 100644 index 19f73d13a2a..00000000000 --- a/src/Xunit.NetCore.Extensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using System.Collections.Generic; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the TestOnTargetFrameworkDiscoverer attribute - /// - public class SkipOnTargetFrameworkDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - TargetFrameworkMonikers platform = (TargetFrameworkMonikers)traitAttribute.GetConstructorArguments().First(); - if (platform.HasFlag(TargetFrameworkMonikers.Net45)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet45Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net451)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet451Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net452)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet452Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net46)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet46Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net461)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet461Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net462)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet462Test); - if (platform.HasFlag(TargetFrameworkMonikers.Net463)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNet463Test); - if (platform.HasFlag(TargetFrameworkMonikers.Netcore50)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcore50Test); - if (platform.HasFlag(TargetFrameworkMonikers.Netcore50aot)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcore50aotTest); - if (platform.HasFlag(TargetFrameworkMonikers.Netcoreapp1_0)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreapp1_0Test); - if (platform.HasFlag(TargetFrameworkMonikers.Netcoreapp1_1)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreapp1_1Test); - if (platform.HasFlag(TargetFrameworkMonikers.NetFramework)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetfxTest); - if (platform.HasFlag(TargetFrameworkMonikers.Mono)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonMonoTest); - if (platform.HasFlag(TargetFrameworkMonikers.Netcoreapp)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreappTest); - if (platform.HasFlag(TargetFrameworkMonikers.UapNotUapAot)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapTest); - if (platform.HasFlag(TargetFrameworkMonikers.UapAot)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapAotTest); - if (platform.HasFlag(TargetFrameworkMonikers.NetcoreCoreRT)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreCoreRTTest); - } - } -} diff --git a/src/Xunit.NetCore.Extensions/README.md b/src/Xunit.NetCore.Extensions/README.md deleted file mode 100644 index 537725d4f33..00000000000 --- a/src/Xunit.NetCore.Extensions/README.md +++ /dev/null @@ -1 +0,0 @@ -# Xunit.NetCore.Extensions \ No newline at end of file diff --git a/src/Xunit.NetCore.Extensions/SkippedTestCase.cs b/src/Xunit.NetCore.Extensions/SkippedTestCase.cs deleted file mode 100644 index 518f4ffa77a..00000000000 --- a/src/Xunit.NetCore.Extensions/SkippedTestCase.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit.NetCore.Extensions -{ - /// Wraps another test case that should be skipped. - internal sealed class SkippedTestCase : LongLivedMarshalByRefObject, IXunitTestCase - { - private readonly IXunitTestCase _testCase; - private readonly string _skippedReason; - - public SkippedTestCase() - { - - } - - internal SkippedTestCase(IXunitTestCase testCase, string skippedReason) - { - _testCase = testCase; - _skippedReason = skippedReason; - } - - public string DisplayName { get { return _testCase.DisplayName; } } - - public IMethodInfo Method { get { return _testCase.Method; } } - - public string SkipReason { get { return _skippedReason; } } - - public ISourceInformation SourceInformation { get { return _testCase.SourceInformation; } set { _testCase.SourceInformation = value; } } - - public ITestMethod TestMethod { get { return _testCase.TestMethod; } } - - public object[] TestMethodArguments { get { return _testCase.TestMethodArguments; } } - - public Dictionary> Traits { get { return _testCase.Traits; } } - - public string UniqueID { get { return _testCase.UniqueID; } } - - public int Timeout { get { return _testCase.Timeout; } } - - public Exception InitializationException - { - get { return _testCase.InitializationException; } - } - - public void Deserialize(IXunitSerializationInfo info) { _testCase.Deserialize(info); } - - public Task RunAsync( - IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, - ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) - { - return new XunitTestCaseRunner(this, DisplayName, _skippedReason, constructorArguments, TestMethodArguments, messageBus, aggregator, cancellationTokenSource).RunAsync(); - } - - public void Serialize(IXunitSerializationInfo info) { _testCase.Serialize(info); } - } -} diff --git a/src/Xunit.NetCore.Extensions/TargetFrameworkMonikers.cs b/src/Xunit.NetCore.Extensions/TargetFrameworkMonikers.cs deleted file mode 100644 index 3091730edc7..00000000000 --- a/src/Xunit.NetCore.Extensions/TargetFrameworkMonikers.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Xunit -{ - [Flags] - public enum TargetFrameworkMonikers - { - Net45 = 0x1, - Net451 = 0x2, - Net452 = 0x4, - Net46 = 0x8, - Net461 = 0x10, - Net462 = 0x20, - Net463 = 0x40, - Netcore50 = 0x80, - Netcore50aot = 0x100, - Netcoreapp1_0 = 0x200, - Netcoreapp1_1 = 0x400, - NetFramework = 0x800, - Netcoreapp = 0x1000, - UapNotUapAot = 0x2000, - UapAot = 0x4000, - Uap = UapAot | UapNotUapAot, - NetcoreCoreRT = 0x8000, - Mono = 0x10000 - } -} diff --git a/src/Xunit.NetCore.Extensions/TestPlatforms.cs b/src/Xunit.NetCore.Extensions/TestPlatforms.cs deleted file mode 100644 index fe905803bec..00000000000 --- a/src/Xunit.NetCore.Extensions/TestPlatforms.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Xunit -{ - [Flags] - public enum TestPlatforms - { - Windows = 1, - Linux = 2, - OSX = 4, - FreeBSD = 8, - NetBSD = 16, - AnyUnix = FreeBSD | Linux | NetBSD | OSX, - Any = ~0 - } -} diff --git a/src/Xunit.NetCore.Extensions/XunitConstants.cs b/src/Xunit.NetCore.Extensions/XunitConstants.cs deleted file mode 100644 index 02d08d297f1..00000000000 --- a/src/Xunit.NetCore.Extensions/XunitConstants.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Xunit.NetCore.Extensions -{ - public struct XunitConstants - { - internal const string NonFreeBSDTest = "nonfreebsdtests"; - internal const string NonLinuxTest = "nonlinuxtests"; - internal const string NonNetBSDTest = "nonnetbsdtests"; - internal const string NonOSXTest = "nonosxtests"; - internal const string NonWindowsTest = "nonwindowstests"; - - internal const string NonNet45Test = "nonnet45tests"; - internal const string NonNet451Test = "nonnet451tests"; - internal static string NonNet452Test = "nonnet452tests"; - internal static string NonNet46Test = "nonnet46tests"; - internal static string NonNet461Test = "nonnet461tests"; - internal static string NonNet462Test = "nonnet462tests"; - internal static string NonNet463Test = "nonnet463tests"; - internal static string NonNetcore50Test = "nonnetcore50tests"; - internal static string NonNetcore50aotTest = "nonnetcore50aottests"; - internal static string NonNetcoreapp1_0Test = "nonnetcoreapp1.0tests"; - internal static string NonNetcoreapp1_1Test = "nonnetcoreapp1.1tests"; - - //Non version framework constants - internal static string NonNetfxTest = "nonnetfxtests"; - internal static string NonMonoTest = "nonmonotests"; - internal static string NonUapTest = "nonuaptests"; - internal static string NonUapAotTest = "nonuapaottests"; - internal static string NonNetcoreappTest = "nonnetcoreapptests"; - internal static string NonNetcoreCoreRTTest = "nonnetcorecorerttests"; - - internal const string Failing = "failing"; - internal const string ActiveIssue = "activeissue"; - internal const string OuterLoop = "outerloop"; - - public const string Category = "category"; - public const string IgnoreForCI = "ignoreforci"; - public const string RequiresElevation = "requireselevation"; - } -}