mercredi 25 février 2015

NServiceBus Test.Initialize() given key was not present

I was wondering if anyone knows of this issue when attempting to unit test NServiceBus.


Realise I have two initialize methods below but this is to illustrate what I am trying to do.


Should mention seen these posts which I am not sure are up to date:


http://ift.tt/1Gus4Qa http://ift.tt/1vyQmXX



public static class CustomInit
{
public static void Init()
{
//Previous versions of NBUS, specifically 4.6.5
//MessageConventionExtensions.IsEventTypeAction = MessageConfiguration.ForEvents();
//MessageConventionExtensions.IsCommandTypeAction = MessageConfiguration.ForCommands();

//New 5.2.0 how to setup tests
Test.Initialize(x => x.AssembliesToScan(GetAssembliesToScan()));

Test.Initialize(
x =>
{
x.Conventions().DefiningCommandsAs([my namespaces]);
x.Conventions().DefiningEventsAs();
x.AssembliesToScan(GetAssembliesToScan());
});
}

private static IEnumerable<Assembly> GetAssembliesToScan()
{
return new[]
{
AssemblyFromType<ISomeInterface>()
};
}
}

Aucun commentaire:

Enregistrer un commentaire