Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/NetEvolve.Extensions.MSTest/Internals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@ internal static class Internals
/// TestGroup
/// </summary>
public const string TestGroup = nameof(TestGroup);

/// <summary>
/// PublicApi
/// </summary>
public const string PublicApi = nameof(PublicApi);
}
17 changes: 17 additions & 0 deletions src/NetEvolve.Extensions.MSTest/PublicApiAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NetEvolve.Extensions.MSTest;

using System;
using NetEvolve.Extensions.MSTest.Internal;

/// <summary>
/// Attribute used to decorate a test class or method as <b>PublicApi</b>.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class PublicApiAttribute : TestTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublicApiAttribute"/> class.
/// </summary>
public PublicApiAttribute()
: base(Internals.PublicApi) { }
}
5 changes: 5 additions & 0 deletions src/NetEvolve.Extensions.NUnit/Internals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@ internal static class Internals
/// TestGroup
/// </summary>
public const string TestGroup = nameof(TestGroup);

/// <summary>
/// PublicApi
/// </summary>
public const string PublicApi = nameof(PublicApi);
}
17 changes: 17 additions & 0 deletions src/NetEvolve.Extensions.NUnit/PublicApiAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NetEvolve.Extensions.NUnit;

using System;
using global::NUnit.Framework;

/// <summary>
/// Attribute used to decorate a test class or method as <b>PublicApi</b>.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class PublicApiAttribute : CategoryAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublicApiAttribute"/> class.
/// </summary>
public PublicApiAttribute()
: base(Internals.PublicApi) { }
}
5 changes: 5 additions & 0 deletions src/NetEvolve.Extensions.TUnit/Internals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ internal static class Internals
/// TestGroup
/// </summary>
public const string TestGroup = nameof(TestGroup);

/// <summary>
/// PublicApi
/// </summary>
public const string PublicApi = nameof(PublicApi);
}
17 changes: 17 additions & 0 deletions src/NetEvolve.Extensions.TUnit/PublicApiAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NetEvolve.Extensions.TUnit;

using System;
using NetEvolve.Extensions.TUnit.Internal;

/// <summary>
/// Attribute used to decorate a test class or method as <b>PublicApi</b>.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class PublicApiAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublicApiAttribute"/> class.
/// </summary>
public PublicApiAttribute()
: base(Internals.PublicApi) { }
}
5 changes: 5 additions & 0 deletions src/NetEvolve.Extensions.XUnit.V3/Internals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@ internal static class Internals
/// TestGroup
/// </summary>
public const string TestGroup = nameof(TestGroup);

/// <summary>
/// PublicApi
/// </summary>
public const string PublicApi = nameof(PublicApi);
}
17 changes: 17 additions & 0 deletions src/NetEvolve.Extensions.XUnit.V3/PublicApiAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NetEvolve.Extensions.XUnit.V3;

using System;
using NetEvolve.Extensions.XUnit.V3.Internal;

/// <summary>
/// Attribute used to decorate a test class or method as <b>PublicApi</b>.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class PublicApiAttribute : CategoryTraitBaseAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PublicApiAttribute"/> class.
/// </summary>
public PublicApiAttribute()
: base(Internals.PublicApi) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.MSTest.Internal.TestTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.MSTest.Internal.TestCategoryWithIdBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.MSTest.Internal.TestTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.MSTest.Internal.TestCategoryWithIdBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.MSTest.Internal.TestTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.MSTest.Internal.TestCategoryWithIdBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace NetEvolve.Extensions.MSTest.Tests.Unit;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

/// <summary>
/// Unit tests for <see cref="PublicApiAttribute"/>.
/// </summary>
[ExcludeFromCodeCoverage]
[TestClass]
public class PublicApiAttributeTests : AttributeTestsBase
{
[TestMethod]
[PublicApi]
[DataRow(nameof(PublicApi_without_parameters))]
[DataRow(nameof(PublicApi_without_or_invalid_parameters))]
public async Task PublicApi_without_or_invalid_parameters(string methodName)
{
var properties = GetProperties(methodName);

_ = await VerifyMSTest(properties).UseParameters(methodName);
}

[PublicApi]
private void PublicApi_without_parameters() => throw new NotSupportedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NUnit.Framework.CategoryAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.NUnit.Internal.NamedCategoryBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NUnit.Framework.CategoryAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.NUnit.Internal.NamedCategoryBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NUnit.Framework.CategoryAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.NUnit.Internal.NamedCategoryBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace NetEvolve.Extensions.NUnit.Tests.Unit;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using global::NUnit.Framework;

/// <summary>
/// Unit tests for <see cref="PublicApiAttribute"/>.
/// </summary>
[ExcludeFromCodeCoverage]
public class PublicApiAttributeTests : AttributeTestsBase
{
[Theory]
[PublicApi]
[TestCase(nameof(PublicApi_without_parameters))]
[TestCase(nameof(PublicApi_without_or_invalid_parameters))]
public async Task PublicApi_without_or_invalid_parameters(string methodName)
{
var properties = GetProperties(methodName);

_ = await Verify(properties).UseParameters(methodName);
}

[PublicApi]
private void PublicApi_without_parameters() => throw new NotSupportedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.TUnit.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class SkipOnFailureAttribute : System.Attribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestEndEventReceiver
{
public SkipOnFailureAttribute() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.TUnit.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class SkipOnFailureAttribute : System.Attribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestEndEventReceiver
{
public SkipOnFailureAttribute() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.TUnit.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class SkipOnFailureAttribute : System.Attribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestEndEventReceiver
{
public SkipOnFailureAttribute() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.TUnit.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class SkipOnFailureAttribute : System.Attribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestEndEventReceiver
{
public SkipOnFailureAttribute() { }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace NetEvolve.Extensions.TUnit.Tests.Unit;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

/// <summary>
/// Unit tests for <see cref="PublicApiAttribute"/>.
/// </summary>
[ExcludeFromCodeCoverage]
public class PublicApiAttributeTests : AttributeTestsBase
{
[Test]
[PublicApi]
[Arguments(nameof(PublicApi_without_parameters))]
[Arguments(nameof(PublicApi_without_or_invalid_parameters))]
public async Task PublicApi_without_or_invalid_parameters(string methodName)
{
var traits = GetTraits(methodName);

_ = await Verify(traits).UseParameters(methodName);
}

[PublicApi]
protected void PublicApi_without_parameters() => throw new NotSupportedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryWithIdTraitBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryWithIdTraitBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
public PreDeploymentAttribute() { }
}
public sealed class PublicApiAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryTraitBaseAttribute
{
public PublicApiAttribute() { }
}
public sealed class TestGroupAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryWithIdTraitBaseAttribute
{
public TestGroupAttribute(string id) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace NetEvolve.Extensions.XUnit.V3.Tests.Unit;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Xunit;

/// <summary>
/// Unit tests for <see cref="PublicApiAttribute"/>.
/// </summary>
[ExcludeFromCodeCoverage]
public class PublicApiAttributeTests : AttributeTestsBase
{
[Theory]
[PublicApi]
[InlineData(nameof(PublicApi_without_parameters))]
[InlineData(nameof(PublicApi_without_or_invalid_parameters))]
public async Task PublicApi_without_or_invalid_parameters(string methodName)
{
var traits = GetTraits(methodName);

_ = await Verify(traits).UseParameters(methodName);
}

[PublicApi]
protected void PublicApi_without_parameters() => throw new NotSupportedException();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
TestCategory: PublicApi
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
TestCategory: PublicApi
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
TestCategory: PublicApi
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
TestCategory: PublicApi
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
TestCategory: PublicApi
}
]
Loading