diff --git a/src/Cake.Common.Tests/Cake.Common.Tests.csproj b/src/Cake.Common.Tests/Cake.Common.Tests.csproj index 13006b8ef1..495523babc 100644 --- a/src/Cake.Common.Tests/Cake.Common.Tests.csproj +++ b/src/Cake.Common.Tests/Cake.Common.Tests.csproj @@ -12,12 +12,12 @@ - + - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Cake.Core.Tests/Cake.Core.Tests.csproj b/src/Cake.Core.Tests/Cake.Core.Tests.csproj index 4d65a57456..18a90c2a61 100644 --- a/src/Cake.Core.Tests/Cake.Core.Tests.csproj +++ b/src/Cake.Core.Tests/Cake.Core.Tests.csproj @@ -10,14 +10,14 @@ - + - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs b/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs index 923bafff86..18b490a310 100644 --- a/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs +++ b/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Cake.Testing.Xunit; using Xunit; -using Xunit.Abstractions; namespace Cake.Core.Tests.Unit { diff --git a/src/Cake.Core.Tests/Unit/CakeTaskBuilderExtensionsTests.cs b/src/Cake.Core.Tests/Unit/CakeTaskBuilderExtensionsTests.cs index 53c7b9b8f3..ed16431dc1 100644 --- a/src/Cake.Core.Tests/Unit/CakeTaskBuilderExtensionsTests.cs +++ b/src/Cake.Core.Tests/Unit/CakeTaskBuilderExtensionsTests.cs @@ -258,7 +258,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async (data, context) => { await Task.Delay(0); }); + builder.Does(async (data, context) => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); @@ -289,7 +289,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async data => { await Task.Delay(0); }); + builder.Does(async data => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); @@ -323,7 +323,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async c => { await Task.Delay(0); }); + builder.Does(async c => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); @@ -354,7 +354,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async () => { await Task.Delay(0); }); + builder.Does(async () => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); diff --git a/src/Cake.Core.Tests/Unit/CakeTaskBuilderOfTExtensionsTests.cs b/src/Cake.Core.Tests/Unit/CakeTaskBuilderOfTExtensionsTests.cs index 371163fbcb..8e21737f30 100644 --- a/src/Cake.Core.Tests/Unit/CakeTaskBuilderOfTExtensionsTests.cs +++ b/src/Cake.Core.Tests/Unit/CakeTaskBuilderOfTExtensionsTests.cs @@ -226,7 +226,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async (data, ctx) => { await Task.Delay(0); }); + builder.Does(async (data, ctx) => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); @@ -257,7 +257,7 @@ public void Should_Add_Action_To_Task() var builder = new CakeTaskBuilder(task); // When - builder.Does(async (ctx, data) => { await Task.Delay(0); }); + builder.Does(async (ctx, data) => { await Task.Delay(0, TestContext.Current.CancellationToken); }); // Then Assert.Single(task.Actions); diff --git a/src/Cake.Core/Properties/AssemblyInfo.cs b/src/Cake.Core/Properties/AssemblyInfo.cs index 4fe656b68f..f5412b928a 100644 --- a/src/Cake.Core/Properties/AssemblyInfo.cs +++ b/src/Cake.Core/Properties/AssemblyInfo.cs @@ -25,4 +25,5 @@ [assembly: InternalsVisibleTo("Cake.Tool")] [assembly: InternalsVisibleTo("Cake.Common")] [assembly: InternalsVisibleTo("Cake.Core.Tests")] -[assembly: InternalsVisibleTo("Cake.Testing.Xunit")] \ No newline at end of file +[assembly: InternalsVisibleTo("Cake.Testing.Xunit")] +[assembly: InternalsVisibleTo("Cake.Testing.Xunit.v3")] \ No newline at end of file diff --git a/src/Cake.DotNetTool.Module.Tests/Cake.DotNetTool.Module.Tests.csproj b/src/Cake.DotNetTool.Module.Tests/Cake.DotNetTool.Module.Tests.csproj index 3a31d930d1..07ac82eb9e 100644 --- a/src/Cake.DotNetTool.Module.Tests/Cake.DotNetTool.Module.Tests.csproj +++ b/src/Cake.DotNetTool.Module.Tests/Cake.DotNetTool.Module.Tests.csproj @@ -12,12 +12,12 @@ - + - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Cake.Frosting.Tests.Tasks/Cake.Frosting.Tests.Tasks.csproj b/src/Cake.Frosting.Tests.Tasks/Cake.Frosting.Tests.Tasks.csproj new file mode 100644 index 0000000000..6eff59c64f --- /dev/null +++ b/src/Cake.Frosting.Tests.Tasks/Cake.Frosting.Tests.Tasks.csproj @@ -0,0 +1,12 @@ + + + + + false + + + + + + + \ No newline at end of file diff --git a/src/Cake.Frosting.Tests/Tasks/BuildTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/BuildTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/BuildTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/BuildTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/CleanTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/CleanTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/CleanTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/CleanTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/ContinueOnErrorTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/ContinueOnErrorTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/ContinueOnErrorTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/ContinueOnErrorTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/DependeeTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/DependeeTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/DependeeTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/DependeeTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/DummyTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/DummyTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/DummyTask2.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask2.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/DummyTask2.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask2.cs diff --git a/src/Cake.Frosting.Tests/Tasks/DummyTask3.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask3.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/DummyTask3.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/DummyTask3.cs diff --git a/src/Cake.Frosting.Tests/Tasks/FinallyTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/FinallyTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/FinallyTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/FinallyTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/InvalidDependencyTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/InvalidDependencyTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/InvalidDependencyTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/InvalidDependencyTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/OnErrorRunAsyncFailedTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunAsyncFailedTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/OnErrorRunAsyncFailedTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunAsyncFailedTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/OnErrorRunCompletedTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunCompletedTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/OnErrorRunCompletedTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunCompletedTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/OnErrorRunFailedTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunFailedTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/OnErrorRunFailedTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/OnErrorRunFailedTask.cs diff --git a/src/Cake.Frosting.Tests/Tasks/UnitTestsTask.cs b/src/Cake.Frosting.Tests.Tasks/Tasks/UnitTestsTask.cs similarity index 100% rename from src/Cake.Frosting.Tests/Tasks/UnitTestsTask.cs rename to src/Cake.Frosting.Tests.Tasks/Tasks/UnitTestsTask.cs diff --git a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj index abd5e96878..327077daca 100644 --- a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj +++ b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj @@ -5,12 +5,13 @@ + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Cake.Frosting.Tests/CakeHostTests.cs b/src/Cake.Frosting.Tests/CakeHostTests.cs index 02e330fbca..aa3aea7233 100644 --- a/src/Cake.Frosting.Tests/CakeHostTests.cs +++ b/src/Cake.Frosting.Tests/CakeHostTests.cs @@ -10,7 +10,6 @@ using Microsoft.Extensions.DependencyInjection; using NSubstitute; using Xunit; -using Xunit.Sdk; namespace Cake.Frosting.Tests { diff --git a/src/Cake.NuGet.Tests/Cake.NuGet.Tests.csproj b/src/Cake.NuGet.Tests/Cake.NuGet.Tests.csproj index 5db3525641..3bbf0e5a7a 100644 --- a/src/Cake.NuGet.Tests/Cake.NuGet.Tests.csproj +++ b/src/Cake.NuGet.Tests/Cake.NuGet.Tests.csproj @@ -11,12 +11,12 @@ - + - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Cake.Testing.Xunit.v3/Cake.Testing.Xunit.v3.csproj b/src/Cake.Testing.Xunit.v3/Cake.Testing.Xunit.v3.csproj new file mode 100644 index 0000000000..80886a49b0 --- /dev/null +++ b/src/Cake.Testing.Xunit.v3/Cake.Testing.Xunit.v3.csproj @@ -0,0 +1,28 @@ + + + Cake.Testing.Xunit.v3 + Library + AnyCpu + true + $(DefineConstants);XUNIT3 + + + + Contains Xunit.v3 testing utilities for Cake. + + + + + + + + + + + + + + %(RecursiveDir)%(Filename)%(Extension) + + + \ No newline at end of file diff --git a/src/Cake.Testing.Xunit.v3/Properties/AssemblyInfo.cs b/src/Cake.Testing.Xunit.v3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..cb86cdb13b --- /dev/null +++ b/src/Cake.Testing.Xunit.v3/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +// 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.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Cake.Testing.Xunit.v3")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] \ No newline at end of file diff --git a/src/Cake.Testing.Xunit/PlatformRestrictedFactAttribute.cs b/src/Cake.Testing.Xunit/PlatformRestrictedFactAttribute.cs index 43ebfffa27..65c92fab65 100644 --- a/src/Cake.Testing.Xunit/PlatformRestrictedFactAttribute.cs +++ b/src/Cake.Testing.Xunit/PlatformRestrictedFactAttribute.cs @@ -12,7 +12,9 @@ namespace Cake.Testing.Xunit public abstract class PlatformRestrictedFactAttribute : FactAttribute { private static readonly PlatformFamily _family; +#if !XUNIT3 private string _skip; +#endif static PlatformRestrictedFactAttribute() { @@ -38,15 +40,23 @@ protected PlatformRestrictedFactAttribute( } Reason = reason; +#if XUNIT3 + if (!string.IsNullOrEmpty(reason) && string.IsNullOrWhiteSpace(Skip)) + { + Skip = reason; + } +#endif } } - private string Reason { get; } + protected string Reason { get; } +#if !XUNIT3 public override string Skip { get => _skip ?? Reason; set => _skip = value; } +#endif } } \ No newline at end of file diff --git a/src/Cake.Testing.Xunit/PlatformRestrictedTheoryAttribute.cs b/src/Cake.Testing.Xunit/PlatformRestrictedTheoryAttribute.cs index fd5bdab5e1..5e4b839f4c 100644 --- a/src/Cake.Testing.Xunit/PlatformRestrictedTheoryAttribute.cs +++ b/src/Cake.Testing.Xunit/PlatformRestrictedTheoryAttribute.cs @@ -12,7 +12,9 @@ namespace Cake.Testing.Xunit public abstract class PlatformRestrictedTheoryAttribute : TheoryAttribute { private static readonly PlatformFamily _family; +#if !XUNIT3 private string _skip; +#endif static PlatformRestrictedTheoryAttribute() { @@ -38,15 +40,23 @@ protected PlatformRestrictedTheoryAttribute( } Reason = reason; +#if XUNIT3 + if (!string.IsNullOrEmpty(reason) && string.IsNullOrEmpty(Skip)) + { + Skip = reason; + } +#endif } } - private string Reason { get; } + protected string Reason { get; } +#if !XUNIT3 public override string Skip { get => _skip ?? Reason; set => _skip = value; } +#endif } } \ No newline at end of file diff --git a/src/Cake.Tests/Cake.Tests.csproj b/src/Cake.Tests/Cake.Tests.csproj index e58d52e762..bd4fc4b440 100644 --- a/src/Cake.Tests/Cake.Tests.csproj +++ b/src/Cake.Tests/Cake.Tests.csproj @@ -11,7 +11,7 @@ - + all runtime; build; native; contentfiles; analyzers @@ -23,7 +23,7 @@ - + diff --git a/src/Cake.sln b/src/Cake.sln index 59b946186e..680a249d62 100644 --- a/src/Cake.sln +++ b/src/Cake.sln @@ -72,6 +72,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.DotNetTool.Module", "C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.DotNetTool.Module.Tests", "Cake.DotNetTool.Module.Tests\Cake.DotNetTool.Module.Tests.csproj", "{CE4433AD-A5F2-44DA-A0DA-E51D141FFFDC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Testing.Xunit.v3", "Cake.Testing.Xunit.v3\Cake.Testing.Xunit.v3.csproj", "{EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Frosting.Tests.Tasks", "Cake.Frosting.Tests.Tasks\Cake.Frosting.Tests.Tasks.csproj", "{CCEB314C-5724-4E07-B2D9-C7A78DE50CE2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -146,6 +150,14 @@ Global {CE4433AD-A5F2-44DA-A0DA-E51D141FFFDC}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE4433AD-A5F2-44DA-A0DA-E51D141FFFDC}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE4433AD-A5F2-44DA-A0DA-E51D141FFFDC}.Release|Any CPU.Build.0 = Release|Any CPU + {EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1}.Release|Any CPU.Build.0 = Release|Any CPU + {CCEB314C-5724-4E07-B2D9-C7A78DE50CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCEB314C-5724-4E07-B2D9-C7A78DE50CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCEB314C-5724-4E07-B2D9-C7A78DE50CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCEB314C-5724-4E07-B2D9-C7A78DE50CE2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -161,6 +173,8 @@ Global {26F4E738-122C-428D-A014-62A357F39023} = {8615F41E-65C7-4BE5-AFD4-C9C78912AF80} {83848400-2E27-4B57-B733-FAF357ED1AE6} = {A01118B7-C6FC-4B0B-8B5C-F580F31FE57D} {CE4433AD-A5F2-44DA-A0DA-E51D141FFFDC} = {8615F41E-65C7-4BE5-AFD4-C9C78912AF80} + {EAF830C8-6D2E-43FB-83E2-A1E192A6B8B1} = {DD6045D3-D869-48FE-9BB1-9F61EF73F192} + {CCEB314C-5724-4E07-B2D9-C7A78DE50CE2} = {DD6045D3-D869-48FE-9BB1-9F61EF73F192} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {35585E1D-D23E-40C8-A01E-2E5FF5B41083} diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 0557745dec..7ee24c03cf 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -32,8 +32,9 @@ - + +