public void StoreEvent(IntegrationEvent integrationEvent)
        {
            this.events.Add(integrationEvent);

            // currently used to fake out the database rowversioning
            integrationEvent.SetRowVersion(this.events.Count);
        }
        public void Given_NullByteArrayWhenConstructing_ExceptionIsThrown()
        {
            //arrange
            serializedEvent = null;

            IntegrationEvent @event = new IntegrationEvent(nameSpaceName, serializedEvent);

            serializedEvent = null;
        }
        public void Given_EmptyNameSpace_When_Constructing_ExceptionIsThrown()
        {
            //arrange
            nameSpaceName = "";

            IntegrationEvent @event = new IntegrationEvent(nameSpaceName, serializedEvent);

            serializedEvent = null;
        }
        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);
        }