Exemple #1
0
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => Guid.Empty);
     saga.CanStartWith((AlternateFakeEvent e) => Guid.Empty);
     saga.CanStartWith((DerivedFakeEvent e) => Guid.Empty);
     saga.CanHandle((Timeout e) => Guid.Empty);
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((MoneyTransferSent e) => e.TransferId);
     saga.CanStartWith((MoneyTransferReceived e) => e.TransferId);
     saga.CanHandle((MoneyTransferRefunded e) => e.TransferId);
     saga.CanHandle((MoneyTransferFailed e) => e.TransferId);
     saga.CanHandle((Timeout e) => e.CorrelationId);
 }
            public void CanRegisterEventTypeOnlyOnce()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeEvent e) => e.Id);

                Assert.Equal(
                    Exceptions.EventTypeAlreadyConfigured.FormatWith(typeof(FakeSaga), typeof(FakeEvent)),
                    Assert.Throws <ArgumentException>(() => configuration.CanStartWith((FakeEvent e) => e.Id)).Message
                    );
            }
            public void CanRegisterEventTypeOnlyOnce()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeEvent e) => e.Id);

                Assert.Equal(
                    Exceptions.EventTypeAlreadyConfigured.FormatWith(typeof(FakeSaga), typeof(FakeEvent)),
                    Assert.Throws<ArgumentException>(() => configuration.CanStartWith((FakeEvent e) => e.Id)).Message
                );
            }
            public void ReturnFalseIfSagaCannotStartWithEventType()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeInitiatingEvent e) => e.Id);

                Assert.False(configuration.GetMetadata().CanStartWith(typeof(FakeUnhandledEvent)));
            }
            public void EventMarkedAsInitiatingEvent()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeEvent e) => e.Id);

                Assert.True(configuration.GetMetadata().CanStartWith(typeof(FakeEvent)));
            }
Exemple #7
0
            public void ReturnFalseIfSagaCannotStartWithEventType()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeInitiatingEvent e) => e.Id);

                Assert.False(configuration.GetMetadata().CanStartWith(typeof(FakeUnhandledEvent)));
            }
            public void EventMarkedAsInitiatingEvent()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeEvent e) => e.Id);

                Assert.True(configuration.GetMetadata().CanStartWith(typeof(FakeEvent)));
            }
Exemple #9
0
            public WhenGettingEventCorrelationId()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeInitiatingEvent e) => e.Id);
                configuration.CanHandle((FakeHandledEvent e) => e.Id);

                sagaMetadata = configuration.GetMetadata();
            }
            public WhenGettingEventCorrelationId()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                configuration.CanStartWith((FakeInitiatingEvent e) => e.Id);
                configuration.CanHandle((FakeHandledEvent e) => e.Id);

                sagaMetadata = configuration.GetMetadata();
            }
Exemple #11
0
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith(((FakeInitiatingEvent e) => e.Id));
     saga.CanHandle(((FakeHandledEvent e) => e.Id));
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => e.Id);
     saga.CanHandle((Timeout e) => e.CorrelationId);
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith(((FakeInitiatingEvent e) => e.Id));
     saga.CanHandle(((FakeHandledEvent e) => e.Id));
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => e.Id);
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => e.Id);
     saga.CanHandle((Timeout e) => e.CorrelationId);
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((MoneyTransferSent e) => e.TransferId);
     saga.CanStartWith((MoneyTransferReceived e) => e.TransferId);
     saga.CanHandle((MoneyTransferRefunded e) => e.TransferId);
     saga.CanHandle((MoneyTransferFailed e) => e.TransferId);
     saga.CanHandle((Timeout e) => e.CorrelationId);
 }
            public void ResolverCannotBeNull()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                Assert.Throws<ArgumentNullException>(() => configuration.CanStartWith(default(Func<FakeEvent, Guid>)));
            }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => e.Id);
 }
 protected override void Configure(SagaConfiguration saga)
 {
     saga.CanStartWith((FakeEvent e) => Guid.Empty);
     saga.CanStartWith((AlternateFakeEvent e) => Guid.Empty);
     saga.CanStartWith((DerivedFakeEvent e) => Guid.Empty);
     saga.CanHandle((Timeout e) => Guid.Empty);
 }
            public void ResolverCannotBeNull()
            {
                var configuration = new SagaConfiguration(typeof(FakeSaga));

                Assert.Throws <ArgumentNullException>(() => configuration.CanStartWith(default(Func <FakeEvent, Guid>)));
            }