public void event_store_should_save_events() { var settings = FakeDatabase.ArrangeSettings(); var testBus = new TestServiceBus(); var @event = FakeUser.ArrangeCreated(); var events = new List<DomainEvent> { @event }; var serializer = FakeDatabase.ArrangeSerializer(events); var snapshotStore = FakeDatabase.ArrangeSnapshotStore(); settings.GetConnection().CreateCommand().ExecuteScalar().ReturnsForAnyArgs((decimal)1); var store = new SimpleEventStore(settings, testBus, serializer, snapshotStore); store.SaveEvents(events, Guid.NewGuid()); testBus[0].Should().Be(@event); }
public void event_store_should_load_events() { var data = FakeDatabase.ArrangeCommitsTable(1); var settings = FakeDatabase.ArrangeSettings(); var testBus = new TestServiceBus(); var snapshotStore = FakeDatabase.ArrangeSnapshotStore(); var @event = FakeUser.ArrangeCreated(); var events = new List<DomainEvent> { @event }; var serializer = FakeDatabase.ArrangeSerializer(events); settings.GetConnection().CreateCommand().ExecuteReader().Returns(data.CreateDataReader()); var store = new SimpleEventStore(settings, testBus, serializer, snapshotStore); store.FetchAllEvents(); testBus[0].Should().Be(@event); }