static void TestLoad(object o) { TestLoadData data = (TestLoadData)o; IAppendOnlyStore appendOnlyStore = data.Store; { ISerializer serializer = new JsonNetSerializer(); EventStoreDB store = new EventStoreDB(appendOnlyStore, serializer); UserId id = new UserId(data.N); EventStream s = store.Load(id); System.Threading.Thread.Sleep(Rand.GetInts(100, 500, 1)[0]); Assert.AreEqual(s.Version, 0); List<IEvent> events = new List<IEvent>() { new UserCreatedEvent(id, "John") }; store.Append(id, 0, events); } }
/// <summary> /// Use JSON for event serialization. /// </summary> /// <param name="cfg"></param> /// <returns></returns> public static EventStoreConfiguration WithJsonEventSerializer(this EventStoreConfiguration cfg) { ISerializer serializer = new JsonNetSerializer(); Xyperico.Agres.EventStore.EventStoreConfigurationExtensions.SetMessageSerializer(cfg, serializer); return cfg; }
protected override void SetUp() { base.SetUp(); // Get concrete implementation from inheriting test class AppendOnlyStore = BuildAppendOnlyStore(); // Use a simple serializer that works for just about everything ISerializer serializer = new JsonNetSerializer(); EventStore = new EventStoreDB(AppendOnlyStore, serializer); }