예제 #1
0
        public void TestRawEventAppendingAndFetching()
        {
            var eventStore = new InMemEventStore(null) as IEventStore;

            var streamId     = Guid.NewGuid();
            var eventsToSave = new object[] { new DogBorn("Snoopy"), new DogBorn("Pluto") };

            eventStore.AppendStream(streamId, 0, eventsToSave);

            var eventsFetched = eventStore.FetchStream(streamId);

            eventsFetched.Should().BeEquivalentTo(eventsToSave);
        }
예제 #2
0
        public void TestAggregateHydrationAndDehydration()
        {
            var eventStore = new InMemEventStore(null) as IEventStore;

            var aggregateBeforeHydration = new DogAggregate(Guid.NewGuid(), "Snoopy");

            aggregateBeforeHydration.Bark(100);
            aggregateBeforeHydration.Poop(1500);

            eventStore.Aggregates.Store(aggregateBeforeHydration);

            var dehydratedAggregate = eventStore.Aggregates.Load <DogAggregate>(aggregateBeforeHydration.Id);

            dehydratedAggregate.Should().BeEquivalentTo(aggregateBeforeHydration);
        }