NServiceBus/NServiceBus — comment on commit e46fbb1ff0f844ca957fa173986f5e1ec788aa52
File: src/core/NServiceBus.Saga/Saga.cs line 115
By andreasohlund:

We can probably do a default "null" action

On Tue, Dec 13, 2011 at 4:25 PM, Dan Bishop

wrote:
> I was able to work around the issue last night by initializing the
> SetHeaderAction in my Establish method.
>
> As far as reproducing it, you only need to do the following:
> 1. Setup an MSpec test with a Saga as the subject, and call
> Subject.Handle() for some message type
> 2. Setup the Saga to call RequestUtcTimeout
> 3. Run the MSpec test
>
> At this point, the test will fail with the null reference exception since
> the SetHeaderAction is null.
>
> It would be great if NSB could allow for SetHeaderAction to be null without
> needing to explicitly configure it in the test setup.
>
> Thanks,
> Dan
>
> On Tue, Dec 13, 2011 at 9:51 AM, Andreas hlund <
> reply@reply.github.com
>> wrote:
>
>> No you can't.
>>
>> Look at this setup for a sample on how you can set the headers: (line 50)
>>
>>
>> https://github.com/NServiceBus/NServiceBus/blob/develop/src/unicast/NServiceBus.Unicast.Tests/Contexts/using_the_unicastbus.cs#L50
>>
>> Can you send me a sample test that break so that I can see if I can fix
>> this in a better way?
>>
>> Cheers,
>>
>> Andreas
>>
>> On Tue, Dec 13, 2011 at 2:58 PM, Dan Bishop <
>> reply@reply.github.com
>> > wrote:
>>
>> > No, we aren't using the built-in unit test support - we're using MSpec +
>> > RhinoMocks. Can we use NServiceBus.Testing with MSpec tests?
>> >
>> > On Tue, Dec 13, 2011 at 8:47 AM, Andreas hlund <
>> > reply@reply.github.com
>> > > wrote:
>> >
>> > > Are you guys using the unittest support that comes with nsb?
>> > >
>> > > On Tue, Dec 13, 2011 at 5:06 AM, Dan Bishop <
>> > > reply@reply.github.com
>> > > > wrote:
>> > >
>> > > > In unit tests, the ExtensionMethods.SetHeaderAction is not
>> configured,
>> > > > which causes this line to throw a null reference exception.
>> > > >
>> > > > How can this be worked around?
>> > > >
>> > > > ---
>> > > > Reply to this email directly or view it on GitHub:
>> > > >
>> > > >
>> > >
>> >
>> https://github.com/NServiceBus/NServiceBus/commit/e46fbb1ff0f844ca957fa173986f5e1ec788aa52#commitcomment-789258
>> > > >
>> > >
>> > > ---
>> > > Reply to this email directly or view it on GitHub:
>> > >
>> > >
>> >
>> https://github.com/NServiceBus/NServiceBus/commit/e46fbb1ff0f844ca957fa173986f5e1ec788aa52#commitcomment-790363
>> > >
>> >
>> > ---
>> > Reply to this email directly or view it on GitHub:
>> >
>> >
>> https://github.com/NServiceBus/NServiceBus/commit/e46fbb1ff0f844ca957fa173986f5e1ec788aa52#commitcomment-790397
>> >
>>
>> ---
>> Reply to this email directly or view it on GitHub:
>>
>> https://github.com/NServiceBus/NServiceBus/commit/e46fbb1ff0f844ca957fa173986f5e1ec788aa52#commitcomment-790557
>>
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/NServiceBus/NServiceBus/commit/e46fbb1ff0f844ca957fa173986f5e1ec788aa52#commitcomment-790675