Permalink
Browse files

Fixed failing tests from a dumb oversight

  • Loading branch information...
1 parent 563a41c commit 56f8c3824de941c91fed9805457089b1d0b0dbff @CoreyKaylor CoreyKaylor committed Apr 19, 2013
View
@@ -9,6 +9,7 @@ nuget/
*.sln.cache
_ReSharper.*/
AssemblyInfo.cs
+*DotSettings*
*.user
push.cmd
*.metaproj
@@ -55,7 +55,10 @@ public void RegisterDefaultServices(IEnumerable<Assembly> assemblies)
foreach (var messageModule in config.MessageModules)
{
Type module = messageModule;
- c.For(typeof(IMessageModule)).Singleton().Use(module).Named(typeof(IMessageModule).FullName);
+ if (!container.Model.HasImplementationsFor(module))
+ {
+ c.For(typeof(IMessageModule)).Singleton().Use(module).Named(typeof(IMessageModule).FullName);
+ }
}
c.For<IReflection>().Singleton().Use<DefaultReflection>();
@@ -138,8 +141,8 @@ public void RegisterLoggingEndpoint(Uri logEndpoint)
{
container.Configure(c =>
{
- c.For<IMessageModule>().Singleton()
- .Use(ctx => new MessageLoggingModule(ctx.GetInstance<IEndpointRouter>(), logEndpoint));
+ c.ForSingletonOf<MessageLoggingModule>().Use(ctx => new MessageLoggingModule(ctx.GetInstance<IEndpointRouter>(), logEndpoint));
+ c.Forward<MessageLoggingModule, IMessageModule>();
c.For<IDeploymentAction>().Use<CreateLogQueueAction>();
});
}
@@ -19,7 +19,7 @@ public class ContainerTests
[Fact]
public void Consumer_must_be_transient()
{
- var container = ObjectFactory.Container;
+ var container = new Container();
container.Configure(c => c.For<TestConsumer>().Singleton().Use<TestConsumer>());
new RhinoServiceBusConfiguration()
.UseStructureMap(container)
@@ -38,18 +38,20 @@ public void Consumer_must_be_transient()
[Fact]
public void Can_register_log_endpoint()
{
- var host = new DefaultHost();
- host.BusConfiguration(x => x.Bus("rhino.queues://localhost/test_queue", "test_queue")
- .AddAssembly(typeof (ServiceBus.RhinoQueues.RhinoQueuesTransport).Assembly)
- .Receive("Rhino", "rhino.queues://localhost/test_queue")
- .Logging("rhino.queues://localhost/log_queue"));
- host.Start<SimpleBootStrapper>();
+ using (var host = new DefaultHost())
+ {
+ host.BusConfiguration(x => x.Bus("rhino.queues://localhost/test_queue", "test_queue")
+ .AddAssembly(typeof(ServiceBus.RhinoQueues.RhinoQueuesTransport).Assembly)
+ .Receive("Rhino", "rhino.queues://localhost/test_queue")
+ .Logging("rhino.queues://localhost/log_queue"));
+ host.Start<SimpleBootStrapper>();
+ }
}
[Fact]
public void Bus_instance_is_singleton()
{
- var container = ObjectFactory.Container;
+ var container = new Container();
new RhinoServiceBusConfiguration()
.UseStructureMap(container)
.Configure();
@@ -62,7 +64,7 @@ public void Bus_instance_is_singleton()
[Fact]
public void Oneway_bus_is_singleton()
{
- var container = ObjectFactory.Container;
+ var container = new Container();
new OnewayRhinoServiceBusConfiguration()
.UseStructureMap(container)
.Configure();
@@ -2,6 +2,7 @@
using System.Configuration;
using Rhino.ServiceBus.Impl;
using Rhino.ServiceBus.Internal;
+using Rhino.ServiceBus.MessageModules;
namespace Rhino.ServiceBus.Config
{
@@ -23,6 +24,7 @@ public void Configure(AbstractRhinoServiceBusConfiguration config, IBusContainer
"Attribute 'logEndpoint' on 'bus' has an invalid value '" + uriString + "'");
builder.RegisterLoggingEndpoint(logEndpoint);
+ busConfig.InsertMessageModuleAtFirst<MessageLoggingModule>();
}
}
}

0 comments on commit 56f8c38

Please sign in to comment.