コード例 #1
0
        public void Interop(int start, int end, int page, string expected)
        {
            // Given
            var advanced = new PersistStreamsMock().MockGetFromTo(GetFromTo);
            var es = new StoreEventsMock().MockAdvanced(advanced);
            var endpoint = new WebHistoryEndpoint(es);
            var downloader = new DownloaderMock().MockDownloadString(url => DownloadString(endpoint, url));
            var reader = new WebHistoryReader("http://localhost:456/Api/History", downloader, page);

            // When
            var actual = reader.Read(NewDateTime(start), NewDateTime(end));

            // Then
            CollectionAssert.AreEqual(ToGuidList(expected), actual.Select(e => e.CommitId).ToArray());
        }
コード例 #2
0
        public void EventDeserialization()
        {
            // Given
            var advanced = new PersistStreamsMock()
                .MockGetFromTo((start, end) => GetFromToWithEvent(start, end, new SomethingHappenedEvent { Data = 123 }));
            var es = new StoreEventsMock().MockAdvanced(advanced);
            var endpoint = new WebHistoryEndpoint(es);
            var downloader = new DownloaderMock().MockDownloadString(url => DownloadString(endpoint, url));
            var reader = new WebHistoryReader("http://localhost:456/Api/History", downloader, 100);

            // When
            var actual = reader.Read(NewDateTime(1), NewDateTime(2)).First();

            // Then
            Assert.That(actual.Events.Count, Is.EqualTo(1));
            Assert.That(actual.Events.First().Body, Is.TypeOf<SomethingHappenedEvent>());
            Assert.That(((SomethingHappenedEvent)actual.Events.First().Body).Data, Is.EqualTo(123));
        }