public void should_create_pipe_from_attribute() { var pipe = new FakePipe(); var containerMock = new Mock <IContainer>(); containerMock.Setup(x => x.GetInstance(typeof(FakePipe))).Returns(pipe); var source = new AttributePipeSource(containerMock.Object); var pipes = source.GetPipes(typeof(FakeMessageHandler)); pipes.Single().ShouldEqual(pipe); }
public void should_load_pipes() { var pipe = new FakePipe { IsAutoEnabled = false }; _pipeSource.Pipes.Add(pipe); _pipeManager.EnablePipe(pipe.Name); var enabledPipes = _pipeManager.GetEnabledPipes(typeof(FakeCommandHandler)); enabledPipes.ShouldBeEquivalentTo(new [] { pipe }); }
public void should_build_invocation_with_pipe() { var pipe = new FakePipe { IsAutoEnabled = true }; _pipeSource.Pipes.Add(pipe); var message = new FakeCommand(123); var messageContext = MessageContext.CreateTest("u.name"); var invoker = new TestMessageHandlerInvoker(typeof(FakeCommandHandler), typeof(FakeCommand)); var invocation = _pipeManager.BuildPipeInvocation(invoker, message, messageContext); invocation.Pipes.Single().ShouldEqual(pipe); }
public void should_disable_pipe() { var pipe = new FakePipe { IsAutoEnabled = true }; _pipeSource.Pipes.Add(pipe); var enabledPipes = _pipeManager.GetEnabledPipes(typeof(FakeCommandHandler)); enabledPipes.ShouldContain(pipe); _pipeManager.DisablePipe(pipe.Name); enabledPipes = _pipeManager.GetEnabledPipes(typeof(FakeCommandHandler)); enabledPipes.ShouldNotContain(pipe); }
public void should_enable_pipe() { var pipe = new FakePipe { IsAutoEnabled = false }; _pipeSource.Pipes.Add(pipe); var pipesBeforeEnable = _pipeManager.GetEnabledPipes(typeof(FakeCommandHandler)); pipesBeforeEnable.ShouldNotContain(pipe); _pipeManager.EnablePipe(pipe.Name); var pipesAfterEnable = _pipeManager.GetEnabledPipes(typeof(FakeCommandHandler)); pipesAfterEnable.ShouldContain(pipe); }