Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete the fluent (Given-When-Then) syntax and guide users towards the Arrange Act Assert (AAA) syntax #299

Merged
merged 2 commits into from Sep 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NServiceBus.Testing.Tests/APIApprovals.cs
Expand Up @@ -9,7 +9,7 @@ public class APIApprovals
[Test]
public void Approve()
{
var publicApi = ApiGenerator.GeneratePublicApi(typeof(Test).Assembly, excludeAttributes: new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" });
var publicApi = ApiGenerator.GeneratePublicApi(typeof(TestableMessageSession).Assembly, excludeAttributes: new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" });
Approver.Verify(publicApi);
}
}
Expand Up @@ -2,6 +2,9 @@
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
namespace NServiceBus.Testing
{
[System.ObsoleteAttribute("Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for" +
" more details. Will be treated as an error from version 8.0.0. Will be removed i" +
"n version 9.0.0.", false)]
public class ExpectationException : System.Exception
{
public ExpectationException() { }
Expand All @@ -26,6 +29,9 @@ namespace NServiceBus.Testing
public void Register(System.Type type, System.Func<object[]> factory) { }
public virtual void Release(object instance) { }
}
[System.ObsoleteAttribute("Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for" +
" more details. Will be treated as an error from version 8.0.0. Will be removed i" +
"n version 9.0.0.", false)]
public class Handler<T>
{
public NServiceBus.Testing.Handler<T> ConfigureHandlerContext(System.Action<NServiceBus.Testing.TestableMessageHandlerContext> contextInitializer) { }
Expand Down Expand Up @@ -92,6 +98,9 @@ namespace NServiceBus.Testing
{
public RepliedMessage(TMessage message, NServiceBus.ReplyOptions options) { }
}
[System.ObsoleteAttribute("Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for" +
" more details. Will be treated as an error from version 8.0.0. Will be removed i" +
"n version 9.0.0.", false)]
public class Saga<T>
where T : NServiceBus.Saga
{
Expand Down Expand Up @@ -171,6 +180,9 @@ namespace NServiceBus.Testing
{
public Subscription(System.Type message, NServiceBus.SubscribeOptions options) { }
}
[System.ObsoleteAttribute("Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for" +
" more details. Will be treated as an error from version 8.0.0. Will be removed i" +
"n version 9.0.0.", false)]
public class Test
{
public Test() { }
Expand Down
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net452;netcoreapp3.1;net5.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>0618</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/NServiceBus.Testing/ExpectationException.cs
Expand Up @@ -5,6 +5,10 @@
/// <summary>
/// Exception representing a failed expectation.
/// </summary>
[ObsoleteEx(
Message = "Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for more details.",
RemoveInVersion = "9",
TreatAsErrorFromVersion = "8")]
public class ExpectationException : Exception
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/NServiceBus.Testing/Handler.cs
Expand Up @@ -7,6 +7,10 @@ namespace NServiceBus.Testing
/// <summary>
/// Message handler unit testing framework.
/// </summary>
[ObsoleteEx(
Message = "Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for more details.",
RemoveInVersion = "9",
TreatAsErrorFromVersion = "8")]
public partial class Handler<T>
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/NServiceBus.Testing/Saga.cs
Expand Up @@ -14,6 +14,10 @@ internal static class SagaConsts
/// <summary>
/// Saga unit testing framework.
/// </summary>
[ObsoleteEx(
Message = "Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for more details.",
RemoveInVersion = "9",
TreatAsErrorFromVersion = "8")]
public partial class Saga<T> where T : Saga
{
internal Saga(T saga)
Expand Down
4 changes: 4 additions & 0 deletions src/NServiceBus.Testing/Test.cs
Expand Up @@ -6,6 +6,10 @@
/// <summary>
/// Entry class used for unit testing
/// </summary>
[ObsoleteEx(
Message = "Use the arrange act assert (AAA) syntax instead. Please see the upgrade guide for more details.",
RemoveInVersion = "9",
TreatAsErrorFromVersion = "8")]
public class Test
{
/// <summary>
Expand Down