Example #1
0
        public void get_max_sequence_if_events_exists()
        {
            var id    = Guid.NewGuid();
            var store = new SqlEventStore(new DomainEventJsonEventSerializer(), new FakeEventStamping());

            store.Save(new SqlTestEvent(id, 1, "test"));
            store.Save(new SqlTestEvent(id, 2, "test2"));
            store.Save(new SqlTestEvent(id, 3, "test3"));
            var lastSequence = store.GetLastSequence(id);

            lastSequence.Should().Be(3);
        }
Example #2
0
        public void retrieve_events_for_registered_aggregate()
        {
            var id    = Guid.NewGuid();
            var store = new SqlEventStore(new DomainEventJsonEventSerializer(new DomainEventTypeBinder(Assembly.GetExecutingAssembly())), new FakeEventStamping());

            store.Save(new SqlTestEvent(id, 1, "test"));
            store.Save(new SqlTestEvent(id, 2, "test2"));
            store.Save(new SqlTestEvent(id, 3, "test3"));

            var events = store.GetEvents(id);

            events.Should().HaveCount(3);
            events.Should().Contain(new SqlTestEvent(id, 1, "test"));
        }
Example #3
0
        public void save_event_in_database()
        {
            var store = new SqlEventStore(new DomainEventJsonEventSerializer(), new FakeEventStamping());

            store.Save(new SqlTestEvent(Guid.NewGuid(), 1, "test"));
        }