-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix-4.2.7' into support-4.2
- Loading branch information
Showing
47 changed files
with
960 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NuGet.CommandLine" version="2.8.2" /> | ||
<package id="GitHubReleaseNotes" version="0.1.0" /> | ||
<package id="NuGet.CommandLine" version="2.8.2" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...Messaging/When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
namespace NServiceBus.AcceptanceTests.BasicMessaging | ||
{ | ||
using System; | ||
using System.Threading; | ||
using EndpointTemplates; | ||
using AcceptanceTesting; | ||
using NUnit.Framework; | ||
|
||
public class When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void First_registration_should_be_the_final_destination() | ||
{ | ||
var context = new Context(); | ||
|
||
Scenario.Define(context) | ||
.WithEndpoint<Sender>(b => b.Given((bus, c) => bus.Send(new MyCommand1()))) | ||
.WithEndpoint<Receiver1>() | ||
.WithEndpoint<Receiver2>() | ||
.Done(c => c.WasCalled1 || c.WasCalled2) | ||
.Run(); | ||
|
||
Assert.IsTrue(context.WasCalled1); | ||
Assert.IsFalse(context.WasCalled2); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled1 { get; set; } | ||
public bool WasCalled2 { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>() | ||
.AddMapping<MyCommand1>(typeof(Receiver1)) | ||
.AddMapping<MyCommand2>(typeof(Receiver2)); | ||
} | ||
} | ||
|
||
public class Receiver1 : EndpointConfigurationBuilder | ||
{ | ||
public Receiver1() | ||
{ | ||
EndpointSetup<DefaultServer>(); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyBaseCommand> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public IBus Bus { get; set; } | ||
|
||
public void Handle(MyBaseCommand message) | ||
{ | ||
Context.WasCalled1 = true; | ||
Thread.Sleep(2000); // Just to be sure the other receiver is finished | ||
} | ||
} | ||
} | ||
|
||
public class Receiver2 : EndpointConfigurationBuilder | ||
{ | ||
public Receiver2() | ||
{ | ||
EndpointSetup<DefaultServer>(); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyBaseCommand> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public IBus Bus { get; set; } | ||
|
||
public void Handle(MyBaseCommand message) | ||
{ | ||
Context.WasCalled2 = true; | ||
Thread.Sleep(2000); // Just to be sure the other receiver is finished | ||
} | ||
} | ||
} | ||
|
||
[Serializable] | ||
public abstract class MyBaseCommand : ICommand | ||
{ | ||
} | ||
|
||
[Serializable] | ||
public class MyCommand1 : MyBaseCommand | ||
{ | ||
} | ||
|
||
[Serializable] | ||
public class MyCommand2 : MyBaseCommand | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.