public void TimeoutUpperBoundIsExclusive() { var timeout = DateTime.Now.AddMinutes(20); var saga = new FakeSaga { Version = 0, Timeout = timeout }; SagaStore.Save(saga, SagaContext); Assert.Equal(0, SagaStore.GetScheduledTimeouts(timeout).Count); }
public void TimeoutContainsAllNonStateData() { var timeout = DateTime.Now.AddMinutes(20); var saga = new FakeSaga { CorrelationId = GuidStrategy.NewGuid(), Version = 0, Timeout = timeout }; SagaStore.Save(saga, SagaContext); var sagaTimeout = SagaStore.GetScheduledTimeouts(timeout.AddMinutes(1)).Single(); Assert.Equal(saga.CorrelationId, sagaTimeout.SagaId); Assert.Equal(saga.GetType(), sagaTimeout.SagaType); Assert.Equal(saga.Timeout, sagaTimeout.Timeout); }
public void ThrowKeyNotFoundIfSagaTypeUnknown() { var timeout = DateTime.Now.AddMinutes(20); var saga = new FakeSaga { CorrelationId = GuidStrategy.NewGuid(), Version = 0, Timeout = timeout }; var state = Serializer.Serialize(saga); using (var command = Dialect.CreateCommand(Dialect.InsertSaga)) { command.Parameters.Add(Dialect.CreateTypeIdParameter(Guid.NewGuid())); command.Parameters.Add(Dialect.CreateIdParameter(saga.CorrelationId)); command.Parameters.Add(Dialect.CreateTimeoutParameter(timeout)); command.Parameters.Add(Dialect.CreateStateParameter(state)); Dialect.ExecuteNonQuery(command); } Assert.Throws <KeyNotFoundException>(() => SagaStore.GetScheduledTimeouts(timeout.AddMinutes(1))); }