How do I Unit Test NServiceBus.Configure.WithWeb()?

社会主义新天地 提交于 2019-12-05 17:47:22

I created a new startup class like so:

public class NonWebRunAtStartup : IRunAtStartup
{
    public void InitializeInfrastructure(object container)
    {
        Configure.With()
            .StructureMapBuilder((IContainer) container)
            .Log4Net()
            .XmlSerializer()
            .MsmqTransport()
            .UnicastBus()
            .LoadMessageHandlers()
            .CreateBus()
            .Start();
    }
}

Then in my test, I ensured that my IOC container would use this one instead of the usual web-based one by adding this to my test:

IoC.Register<IRunAtStartup, NonWebRunAtStartup>(); 

This got me to a different error, which I'm still fighting with, which I'll ask as a separate question (now NSB can't load assemblies that are in NServiceBus.Core.dll, such as Antlr3.Runtime.dll).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!