Ejemplo n.º 1
0
        public void FetchMultpleEvents()
        {
            var entity = new TrackedEntityTestClass();

            var @event1 = new EventTestClass(Guid.NewGuid(), 0);

            entity.AddEvent(@event1);

            var @event2 = new EventTestClass(Guid.NewGuid(), 0);

            entity.AddEvent(@event2);

            var events = entity.FetchEvents();

            events.Should().Equal(new Event[] { @event1, @event2 });
        }
Ejemplo n.º 2
0
        public void UpdateExistingEntity()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var entityId = Guid.NewGuid();
            var events   = new Event[]
            {
                new EventTestClass(Guid.NewGuid(), 0)
            };
            var trackedEntity = new TrackedEntityTestClass(entityId);

            trackedEntity.AddEvent(events[0]);

            var eventStream = mockRepository.Create <IEventStream <TrackedEntityTestClass> >();

            eventStream.Setup(x => x.AppendEvents(entityId, events));

            var entityFactory = mockRepository.Create <ITrackedEntityFactory <TrackedEntityTestClass> >();

            var repository = new Repository <TrackedEntityTestClass>(eventStream.Object, entityFactory.Object);

            repository.Update(trackedEntity);

            mockRepository.Verify();
        }
Ejemplo n.º 3
0
        public void FetchSingleEvents()
        {
            var entity = new TrackedEntityTestClass();

            var @event = new EventTestClass(Guid.NewGuid(), 0);

            entity.AddEvent(@event);

            var events = entity.FetchEvents();

            events.Should().Equal(new Event[] { @event });
        }