Skip to content

Commit

Permalink
test: Update NServiceBus tests to include v8 and v9 (#2502)
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr authored May 23, 2024
1 parent 801edc3 commit 705f624
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,8 @@
<PackageReference Include="NServiceBus" Version="6.5.10" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="NServiceBus" Version="7.5.0" Condition="'$(TargetFramework)' == 'net48'" />
<PackageReference Include="NServiceBus" Version="7.5.0" Condition="'$(TargetFramework)' == 'net481'" />
<!-- NServiceBus 6.5 only appears to support .NET Framework. Uncomment for 'fun' -->
<PackageReference Include="NServiceBus" Version="7.5.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="NServiceBus" Version="7.7.4" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="NServiceBus" Version="8.2.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="NServiceBus" Version="9.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using System.Threading.Tasks;
Expand All @@ -15,7 +15,9 @@ public class AsyncCommandHandler :
public async Task Handle(Command command, IMessageHandlerContext context)
{
ConsoleMFLogger.Info($"Async Command handler received message with Id {command.Id}.");
#pragma warning disable NSB0002 // Forward the 'CancellationToken' property of the context parameter to methods
await Task.Delay(500);
#pragma warning restore NSB0002 // Forward the 'CancellationToken' property of the context parameter to methods
ConsoleMFLogger.Info($"Async Command handler done delaying message with Id {command.Id}.");
// Make sure segment/transaction ends
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using System.Threading.Tasks;
Expand All @@ -15,7 +15,9 @@ public class AsyncEventHandler :
public async Task Handle(Event message, IMessageHandlerContext context)
{
ConsoleMFLogger.Info($"Async Event handler received message with Id {message.Id}.");
#pragma warning disable NSB0002 // Forward the 'CancellationToken' property of the context parameter to methods
await Task.Delay(500);
#pragma warning restore NSB0002 // Forward the 'CancellationToken' property of the context parameter to methods
ConsoleMFLogger.Info($"Async Event handler done delaying message with Id {message.Id}.");
// Make sure segment/transaction ends
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using MultiFunctionApplicationHelpers;
Expand Down Expand Up @@ -35,6 +35,10 @@ private void StartNServiceBusInternal(Type handlerToAllow = null)
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.EnableInstallers();

#if NET8_0_OR_GREATER // serializer must be specified starting with NServiceBus 9.0.0
endpointConfiguration.UseSerialization<XmlSerializer>();
#endif

// We want to control which handlers are loaded for different test cases
endpointConfiguration.AssemblyScanner().ScanAppDomainAssemblies = false;
var typesToIgnore = new List<Type>
Expand Down

0 comments on commit 705f624

Please sign in to comment.