-
Notifications
You must be signed in to change notification settings - Fork 648
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
4 changed files
with
167 additions
and
12 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
src/NServiceBus.AcceptanceTests/Exceptions/Message_without_an_id.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,94 @@ | ||
namespace NServiceBus.AcceptanceTests.Exceptions | ||
{ | ||
using System; | ||
using NServiceBus.AcceptanceTesting; | ||
using NServiceBus.AcceptanceTests.EndpointTemplates; | ||
using NServiceBus.Config; | ||
using NServiceBus.MessageMutator; | ||
using NServiceBus.Unicast; | ||
using NServiceBus.Unicast.Messages; | ||
using NServiceBus.Unicast.Transport; | ||
using NUnit.Framework; | ||
|
||
public class Message_without_an_id : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void Should_invoke_start_message_processing_listeners() | ||
{ | ||
var context = new Context(); | ||
|
||
Scenario.Define(context) | ||
.WithEndpoint<Endpoint>() | ||
.Done(c => c.StartMessageProcessingCalled) | ||
.Run(); | ||
|
||
Assert.IsTrue(context.StartMessageProcessingCalled); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool StartMessageProcessingCalled { get; set; } | ||
} | ||
|
||
public class Endpoint : EndpointConfigurationBuilder | ||
{ | ||
public Endpoint() | ||
{ | ||
EndpointSetup<DefaultServer>() | ||
.WithConfig<TransportConfig>(c => | ||
{ | ||
c.MaxRetries = 0; | ||
}); | ||
} | ||
|
||
class StartProcessingListener : IWantToRunWhenBusStartsAndStops | ||
{ | ||
readonly UnicastBus bus; | ||
Context context; | ||
|
||
public StartProcessingListener(UnicastBus bus, Context context) | ||
{ | ||
this.bus = bus; | ||
this.context = context; | ||
bus.Transport.StartedMessageProcessing += transport_StartedMessageProcessing; | ||
} | ||
|
||
void transport_StartedMessageProcessing(object sender, StartedMessageProcessingEventArgs e) | ||
{ | ||
context.StartMessageProcessingCalled = true; | ||
} | ||
|
||
public void Start() | ||
{ | ||
bus.SendLocal(new Message()); | ||
} | ||
|
||
public void Stop() | ||
{ | ||
bus.Transport.StartedMessageProcessing -= transport_StartedMessageProcessing; | ||
} | ||
} | ||
|
||
class CorruptionMutator : IMutateOutgoingTransportMessages | ||
{ | ||
public void MutateOutgoing(LogicalMessage logicalMessage, TransportMessage transportMessage) | ||
{ | ||
transportMessage.Headers[Headers.MessageId] = ""; | ||
} | ||
} | ||
|
||
class Handler : IHandleMessages<Message> | ||
{ | ||
public void Handle(Message message) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
[Serializable] | ||
public class Message : IMessage | ||
{ | ||
} | ||
} | ||
|
||
} |
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