public LoadEventsForStream ( string contextId, string streamId, long fromVersion, long maxVersion = null ) : Res.Core.Storage.EventInStorage[] | ||
contextId | string | |
streamId | string | |
fromVersion | long | |
maxVersion | long | |
Résultat | Res.Core.Storage.EventInStorage[] |
public void should_be_able_to_load_events_for_a_context_and_a_stream() { var storage = new InMemoryEventStorage(); var now = new DateTime(2013, 1, 1); var createEventsDetails = new Dictionary<Guid, CreateEventsMetaData>(); var j = 0; for (var i = 1; i <= 6; i++) { createEventsDetails.Add(Guid.NewGuid(), new CreateEventsMetaData(2, "foo", "stream" + i, new[] { now.AddMilliseconds(++j), now.AddMilliseconds(++j) })); } var commitDetails = new EventsInjector(storage).InsertEvents(createEventsDetails); var reader = new EventStorageReader(10, TimeSpan.FromMinutes(5), storage); for (var i = 1; i <= 6; i++) { var events = reader.LoadEventsForStream("foo", "stream" + i); Assert.That(events.Length, Is.EqualTo(2)); } }
public void Should_load_nothing_when_there_is_no_event() { var storage = new InMemoryEventStorage(); var reader = new EventStorageReader(2000, TimeSpan.FromMinutes(5), storage); var events = reader.LoadEventsForStream("foo", "stream"); Assert.That(events.Length, Is.EqualTo(0), "events list should be empty as there is no events to laod!"); }