public void when_enumerate_messages() { var records = _store.EnumerateMessages("stream3", 0, Int32.MaxValue).ToArray(); Assert.AreEqual(1, records.Length); Assert.AreEqual(3, records[0].Items.Length); Assert.AreEqual("msg1", (records[0].Items[0] as SerializerTest1).Name); Assert.AreEqual("msg2", (records[0].Items[1] as SerializerTest1).Name); Assert.AreEqual("msg3", (records[0].Items[2] as SerializerTest1).Name); }
public EventStream LoadEventStream(string name) { var list = new List <Event>(); var streamVersion = 0L; foreach (var record in _msgStore.EnumerateMessages(name, 0, int.MaxValue)) { list.AddRange(record.Items.Cast <Event>()); streamVersion = record.StreamVersion; } return(new EventStream(streamVersion, new ReadOnlyCollection <Event>(list))); }
public void when_append_to_store() { var store = new MessageStore(_appendOnlyStore, _serializer); store.AppendToStore("stream5", MessageAttribute.Empty, -1, new[] { new SerializerTest1 { Name = "name1" } }); var records = store.EnumerateMessages("stream5", 0, Int32.MaxValue).ToArray(); Assert.AreEqual(1, records.Length); Assert.AreEqual(1, records[0].Items.Length); Assert.AreEqual("name1", (records[0].Items[0] as SerializerTest1).Name); }
public void when_append_to_store() { var store = new MessageStore(_appendOnlyStore, _serializer); store.AppendToStore("stream5", MessageAttribute.Empty, -1, new[] { "msg1", "msg2", "msg3" }); var records = store.EnumerateMessages("stream5", 0, Int32.MaxValue).ToArray(); Assert.AreEqual(1, records.Length); Assert.AreEqual(3, records[0].Items.Length); //todo simple types are not properly deserialize //Assert.AreEqual("msg1", records[0].Items[0].ToString()); //Assert.AreEqual("msg2", records[0].Items[1].ToString()); //Assert.AreEqual("msg3", records[0].Items[2].ToString()); }
public EventStream LoadEventStream(IIdentity id) { var key = IdentityToKey(id); // TODO: make this lazy somehow? var stream = new EventStream(); foreach (var record in _store.EnumerateMessages(key, 0, int.MaxValue)) { stream.Events.AddRange(record.Items.Cast <IEvent>()); stream.StreamVersion = record.StreamVersion; } return(stream); }