Beispiel #1
0
        public async Task DublicateEventThrowsAsync()
        {
            var es      = new StreamStoneEventStore(table, TypeResolver.FromMap(TypeResolver.GetEventsFromTypes(typeof(TestEvent))));
            var eventid = Guid.NewGuid().ToString();

            var id = Guid.NewGuid();
            var e  = new TestEvent(id)
            {
                Meta = new Dictionary <string, string>()
                {
                    { "EventId", eventid }
                }
            };


            await es.AppendToStreamAsync("testing", 0, new[] { e });

            var e2 = new TestEvent(id)
            {
                Meta = new Dictionary <string, string>()
                {
                    { "EventId", eventid }
                }
            };

            await Assert.ThrowsAsync <DuplicateEventException>(() => es.AppendToStreamAsync("testing", 1, new[] { e2 }));
        }
Beispiel #2
0
        public async Task WriteReadAsync()
        {
            var es = new StreamStoneEventStore(table, TypeResolver.FromMap(TypeResolver.GetEventsFromTypes(typeof(TestEvent))));

            var id = Guid.NewGuid();
            var e  = new TestEvent(id)
            {
                Meta = new Dictionary <string, string>()
                {
                    { "EventId", Guid.NewGuid().ToString() }
                }
            };

            await es.AppendToStreamAsync("testing", 0, new[] { e });

            var r = await es.LoadEventStreamAsync("testing", 1);

            Assert.Equal(1, r.Version);
        }