Skip to content

Commit

Permalink
Obsolete the given when then syntax with a WARN to guide users toward…
Browse files Browse the repository at this point in the history
…s the AAA syntax (#299)

* Obsolete given when then syntax with WARN for v7

* Approve API changes
  • Loading branch information
andreasohlund committed Sep 6, 2021
1 parent 00ebf61 commit ecbab6b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
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

0 comments on commit ecbab6b

Please sign in to comment.