public void EventsAvailable()
        {
            var eventList = new EventList();

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

            eventList.Add(@event);

            eventList.EventsAvailable.Should().BeTrue();
        }
Exemple #2
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 });
        }
        public void FetchSingleEvent()
        {
            var eventList = new EventList();

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

            eventList.Add(@event);

            var events = eventList.Fetch();

            using (new AssertionScope())
            {
                events.Should().HaveCount(1);
                eventList.EventsAvailable.Should().BeFalse();
            }
        }
Exemple #4
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 });
        }
Exemple #5
0
        public void ApplyEvents()
        {
            var mockRepository = new MockRepository(MockBehavior.Strict);

            var entity = mockRepository.Create <TrackedEntityTestClass>(MockBehavior.Loose);

            entity.CallBase = true;

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

            entity.Object.ApplyEvents(new Event[] { @event1, @event2 });

            entity.Verify(x => x.Apply(@event1), Times.Once);
            entity.Verify(x => x.Apply(@event2), Times.Once);

            mockRepository.Verify();
        }
        public void FetchCalledMultipleTimes()
        {
            var eventList = new EventList();

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

            eventList.Add(@event);
            eventList.Add(@event);
            eventList.Add(@event);

            var events  = eventList.Fetch();
            var events2 = eventList.Fetch();

            using (new AssertionScope())
            {
                events.Should().HaveCount(3);
                events2.Should().BeEmpty();
            }
        }
Exemple #7
0
 public virtual void Apply(EventTestClass @event)
 {
 }