Example #1
0
            public void RegisterSaga_should_throw_InvalidOperationException_sagas_that_implements_IAmStartedBy_more_than_once()
            {
                var  containerMock  = new Mock <IUnityContainer>().Object;
                var  eventStoreMock = new Mock <IEventStore>().Object;
                IBus bus            = new InMemoryBus(containerMock, eventStoreMock);

                Executing.This(() => bus.RegisterSaga <OverloadedSaga>())
                .Should()
                .Throw <InvalidOperationException>();
            }
Example #2
0
            public void Send()
            {
                var  command        = new InMemoryBusFixture.SendMethod.FakeSaga.StartCommand();
                var  containerMock  = new Mock <IUnityContainer>().Object;
                var  eventStoreMock = new Mock <IEventStore>().Object;
                IBus bus            = new InMemoryBus(containerMock, eventStoreMock);

                bus.RegisterSaga <FakeSaga>();
                bus.Send(command);
            }
Example #3
0
            public void RegisterSaga_should_throw_InvalidOperationException_on_type_arguments_that_do_not_implement_IAmStartedBy_interface()
            {
                var  containerMock  = new Mock <IUnityContainer>().Object;
                var  eventStoreMock = new Mock <IEventStore>().Object;
                IBus bus            = new InMemoryBus(containerMock, eventStoreMock);

                Executing.This(() => bus.RegisterSaga <PretendingSaga>())
                .Should()
                .Throw <InvalidOperationException>();
            }
            public void Send()
            {
                var command       = new InMemoryBusFixture.SendMethod.FakeSaga.StartCommand();
                var containerMock = new Mock <ITypeResolver>();

                containerMock.Setup(o => o.Resolve(typeof(FakeSaga)))
                .Returns(new FakeSaga());
                IBus bus = new InMemoryBus(containerMock.Object);

                bus.RegisterSaga <FakeSaga>();
                bus.Send(command);
            }