public void GivenARepository_Adding_To_The_EventRepository_IncreasesTheEventsRowVersion()
        {
            // arrange
            repository = new EventIntegrationRepositoryFake(); // making sure it is empty
            var newEvent = new IntegrationEvent("test", new byte[1]);

            // act
            repository.StoreEvent(newEvent);

            // assert
            Assert.IsTrue(newEvent.RowVersion == 1);
        }
        public void GivenANamespaceAndALastProcessedNumber_TheRepositoryReturnsTheCorrectEntries()
        {
            // arrange
            repository = new EventIntegrationRepositoryFake(); // making sure it is empty
            var newEvent = new IntegrationEvent("test", new byte[1]);
            var newEvent2 = new IntegrationEvent("test", new byte[1]);
            var newEvent3 = new IntegrationEvent("test", new byte[1]);
            repository.StoreEvent(newEvent);
            repository.StoreEvent(newEvent2);
            repository.StoreEvent(newEvent3);

            // act
            IEnumerable<IntegrationEvent> events = repository.GetLatestEvents(1, "test");

            // assert
            Assert.IsTrue(events.Count() == 2);
        }
        public EventIntegrationService(IEventAggregator eventAggregator,
            BinaryEventSerializer eventSerializer,
            BinaryEventDeSerializer binaryEventDeSerializer,
            EventIntegrationRepositoryFake eventIntegrationRepositoryFake)
        {
            this.eventAggregator = eventAggregator;
            this.eventSerializer = eventSerializer;
            this.binaryEventDeSerializer = binaryEventDeSerializer;
            this.eventIntegrationRepositoryFake = eventIntegrationRepositoryFake;
            this.eventAggregator.Subscribe(this);

            subscriptions = new List<string>();
            cancellationToken = new CancellationToken(false);

            Task.Factory.StartNew(StartPolling, cancellationToken);

            Thread.Sleep(1000);
        }