public void ReturnFalseIfSagaCannotStartWithEventType() { var configuration = new SagaConfiguration(typeof(FakeSaga)); configuration.CanHandle((FakeHandledEvent e) => e.Id); Assert.False(configuration.GetMetadata().CanHandle(typeof(FakeUnhandledEvent))); }
public void EventMarkedAsInitiatingEvent() { var configuration = new SagaConfiguration(typeof(FakeSaga)); configuration.CanStartWith((FakeEvent e) => e.Id); Assert.True(configuration.GetMetadata().CanStartWith(typeof(FakeEvent))); }
public void ReturnTrueIfSagaCanStartWithEventType() { var configuration = new SagaConfiguration(typeof(FakeSaga)); configuration.CanStartWith((FakeInitiatingEvent e) => e.Id); Assert.True(configuration.GetMetadata().CanStartWith(typeof(FakeInitiatingEvent))); }
public void EventMarkedAsInitiatingEvent() { var configuration = new SagaConfiguration(typeof(FakeSaga)); configuration.CanHandle((FakeEvent e) => e.Id); Assert.True(configuration.GetMetadata().CanHandle(typeof(FakeEvent))); }
public WhenGettingEventCorrelationId() { var configuration = new SagaConfiguration(typeof(FakeSaga)); configuration.CanStartWith((FakeInitiatingEvent e) => e.Id); configuration.CanHandle((FakeHandledEvent e) => e.Id); sagaMetadata = configuration.GetMetadata(); }
/// <summary> /// Gets the saga metadata for this saga instance. /// </summary> /// <remarks>Called once during saga discovery.</remarks> internal SagaMetadata GetMetadata() { Type sagaType = GetType(); SagaMetadata sagaMetadata; if (!SagaMetadataCache.TryGetValue(sagaType, out sagaMetadata)) { var configuration = new SagaConfiguration(GetType()); Configure(configuration); SagaMetadataCache[sagaType] = sagaMetadata = configuration.GetMetadata(); } return sagaMetadata; }