Reputation: 8503
I am trying to unit test message handlers for NServiceBus 4.0.4. The bus is configured to use JSON serializer in the application using the Configure.Serialization.Json();
method call.
Whenever I call the Test.Initialize()
method from the unit tests assembly I get the following exception: System.Configuration.ConfigurationErrorsException : Multiple serializers are not supported. Please make sure to only enable one
I tried calling Configure.Serialization.Json()
and Serializers.SetDefault<JsonSerialization>()
before calling the Test.Initialize()
method without any success.
Does anyone know what am I doing wrong? All examples I see on the internet do not mention any Configure
calls.
Upvotes: 0
Views: 430
Reputation: 3414
This issue has been reported previously here and looks like it will be fixed in the next NServiceBus build (both 4.0.5 and 4.1.0)
A workaround is to explicitly disable the xml serializer when enabling the json one.
Configure.Serialization.Json();
Feature.Disable<XmlSerialization>(); // hack to make NSB unit tests work
Upvotes: 2