-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from Particular/prepare-rtm
Prepare RTM
- Loading branch information
Showing
16 changed files
with
106 additions
and
54 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
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
...cceptanceTests/Serialization/When_xml_serializer_processes_message_without_type_header.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,73 @@ | ||
namespace NServiceBus.AcceptanceTests.Serialization | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using NServiceBus.Pipeline; | ||
using NUnit.Framework; | ||
|
||
public class When_xml_serializer_processes_message_without_type_header : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_work_in_unobtrusive() | ||
{ | ||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Sender>(c => c.When(s => s.SendLocal(new MessageToBeDetectedByRootNodeName()))) | ||
.Done(c => c.WasCalled) | ||
.Run(); | ||
|
||
Assert.True(context.WasCalled); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>(c => | ||
{ | ||
c.Conventions().DefiningMessagesAs(t => t == typeof(MessageToBeDetectedByRootNodeName)); | ||
c.Pipeline.Register(typeof(RemoveTheTypeHeader), "Removes the message type header to simulate receiving a native message"); | ||
c.UseSerialization<XmlSerializer>(); | ||
}) | ||
//Need to include the message since it can't be nested inside the test class, see below | ||
.IncludeType<MessageToBeDetectedByRootNodeName>(); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MessageToBeDetectedByRootNodeName> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(MessageToBeDetectedByRootNodeName message, IMessageHandlerContext context) | ||
{ | ||
Context.WasCalled = true; | ||
return Task.FromResult(0); | ||
} | ||
} | ||
|
||
public class RemoveTheTypeHeader : Behavior<IDispatchContext> | ||
{ | ||
public override Task Invoke(IDispatchContext context, Func<Task> next) | ||
{ | ||
foreach (var op in context.Operations) | ||
{ | ||
op.Message.Headers.Remove(Headers.EnclosedMessageTypes); | ||
} | ||
|
||
return next(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
//Can't be nested inside the test class since the xml serializer can't deal with nested types | ||
public class MessageToBeDetectedByRootNodeName | ||
{ | ||
public int Data { get; set; } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NServiceBus" version="7.0.0-rc0001" targetFramework="net46" /> | ||
<package id="NServiceBus.AcceptanceTesting" version="7.0.0-rc0001" targetFramework="net46" /> | ||
<package id="NServiceBus.AcceptanceTests.Sources" version="7.0.0-rc0001" targetFramework="net46" /> | ||
<package id="NServiceBus" version="7.0.0" targetFramework="net46" /> | ||
<package id="NServiceBus.AcceptanceTesting" version="7.0.0" targetFramework="net46" /> | ||
<package id="NServiceBus.AcceptanceTests.Sources" version="7.0.0" targetFramework="net46" /> | ||
<package id="NUnit" version="3.7.1" targetFramework="net46" /> | ||
</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
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
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
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
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