forked from Particular/NServiceBus.RabbitMQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
154 changed files
with
1,311 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
72 changes: 72 additions & 0 deletions
72
...sts/App_Packages/NSB.AcceptanceTests.5.2.0/Audit/When_ForwardReceivedMessagesTo_is_set.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,72 @@ | ||
namespace NServiceBus.AcceptanceTests.Audit | ||
{ | ||
using System; | ||
using EndpointTemplates; | ||
using AcceptanceTesting; | ||
using NServiceBus.Config; | ||
using NUnit.Framework; | ||
|
||
public class When_ForwardReceivedMessagesTo_is_set : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void Should_forward_message() | ||
{ | ||
var context = new Context(); | ||
|
||
Scenario.Define(context) | ||
.WithEndpoint<EndpointThatForwards>(b => b.Given((bus, c) => | ||
{ | ||
bus.SendLocal(new MessageToForward()); | ||
})) | ||
.WithEndpoint<ForwardReceiver>() | ||
.Done(c => c.GotForwardedMessage) | ||
.Run(); | ||
|
||
Assert.IsTrue(context.GotForwardedMessage); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool GotForwardedMessage { get; set; } | ||
} | ||
|
||
public class ForwardReceiver : EndpointConfigurationBuilder | ||
{ | ||
public ForwardReceiver() | ||
{ | ||
EndpointSetup<DefaultServer>(c => c.EndpointName("forward_receiver")); | ||
} | ||
|
||
public class MessageToForwardHandler : IHandleMessages<MessageToForward> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public void Handle(MessageToForward message) | ||
{ | ||
Context.GotForwardedMessage = true; | ||
} | ||
} | ||
} | ||
|
||
public class EndpointThatForwards : EndpointConfigurationBuilder | ||
{ | ||
public EndpointThatForwards() | ||
{ | ||
EndpointSetup<DefaultServer>() | ||
.WithConfig<UnicastBusConfig>(c => c.ForwardReceivedMessagesTo = "forward_receiver"); | ||
} | ||
|
||
public class MessageToForwardHandler : IHandleMessages<MessageToForward> | ||
{ | ||
public void Handle(MessageToForward message) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class MessageToForward : IMessage | ||
{ | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
...tanceTests/App_Packages/NSB.AcceptanceTests.5.2.0/Basic/When_callback_from_a_send_only.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,52 @@ | ||
namespace NServiceBus.AcceptanceTests.Basic | ||
{ | ||
using System; | ||
using NServiceBus.AcceptanceTesting; | ||
using NServiceBus.AcceptanceTests.EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_callback_from_a_send_only : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void Should_throw() | ||
{ | ||
Scenario.Define<Context>() | ||
.WithEndpoint<SendOnlyEndpoint>(b => b.Given((bus, c) => | ||
{ | ||
var exception = Assert.Throws<Exception>(() => bus.Send(new MyMessage()).Register(result => { })); | ||
Assert.AreEqual("Callbacks are invalid in a sendonly endpoint.", exception.Message); | ||
|
||
})) | ||
.WithEndpoint<Receiver>() | ||
.Run(); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
} | ||
|
||
public class SendOnlyEndpoint : EndpointConfigurationBuilder | ||
{ | ||
public SendOnlyEndpoint() | ||
{ | ||
EndpointSetup<DefaultServer>() | ||
.SendOnly() | ||
.AddMapping<MyMessage>(typeof(Receiver)); | ||
} | ||
|
||
} | ||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(); | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class MyMessage : ICommand | ||
{ | ||
} | ||
|
||
} | ||
} |
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions
67
...eptanceTests/App_Packages/NSB.AcceptanceTests.5.2.0/Basic/When_injecting_handler_props.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,67 @@ | ||
namespace NServiceBus.AcceptanceTests.Basic | ||
{ | ||
using System; | ||
using NServiceBus.AcceptanceTesting; | ||
using NServiceBus.AcceptanceTests.EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_injecting_handler_props : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void Run() | ||
{ | ||
var context = new Context(); | ||
|
||
Scenario.Define(context) | ||
.WithEndpoint<Receiver>(c=>c.When(b=>b.SendLocal(new MyMessage()))) | ||
.Done(c => c.WasCalled) | ||
.Run(); | ||
|
||
Assert.AreEqual(10, context.Number); | ||
Assert.AreEqual("Foo", context.Name); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled { get; set; } | ||
public string Name { get; set; } | ||
public int Number { get; set; } | ||
} | ||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(c => | ||
{ | ||
c.InitializeHandlerProperty<MyMessageHandler>("Number", 10); | ||
c.InitializeHandlerProperty<MyMessageHandler>("Name", "Foo"); | ||
}); | ||
|
||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyMessage> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public IBus Bus { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public int Number { get; set; } | ||
|
||
public void Handle(MyMessage message) | ||
{ | ||
Context.Number = Number; | ||
Context.Name = Name; | ||
Context.WasCalled = true; | ||
} | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class MyMessage : ICommand | ||
{ | ||
} | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
...eBus.RabbitMQ.AcceptanceTests/App_Packages/NSB.AcceptanceTests.5.2.0/DeterministicGuid.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,21 @@ | ||
namespace NServiceBus.Utils | ||
{ | ||
using System; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
static class DeterministicGuid | ||
{ | ||
public static Guid Create(params object[] data) | ||
{ | ||
// use MD5 hash to get a 16-byte hash of the string | ||
using (var provider = new MD5CryptoServiceProvider()) | ||
{ | ||
var inputBytes = Encoding.Default.GetBytes(String.Concat(data)); | ||
var hashBytes = provider.ComputeHash(inputBytes); | ||
// generate a guid from the hash: | ||
return new Guid(hashBytes); | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.