Ejemplo n.º 1
0
        public void RefreshSegmentNullChangesFetcherResponseShouldNotUpdateCache()
        {
            //Arrange
            var gates     = new InMemoryReadinessGatesCache();
            var apiClient = new Mock <ISegmentSdkApiClient>();

            apiClient
            .Setup(x => x.FetchSegmentChanges(It.IsAny <string>(), It.IsAny <long>()))
            .Throws(new Exception());
            var apiFetcher     = new ApiSegmentChangeFetcher(apiClient.Object);
            var segments       = new ConcurrentDictionary <string, Segment>();
            var cache          = new InMemorySegmentCache(segments);
            var segmentFetcher = new SelfRefreshingSegment("payed", apiFetcher, gates, cache);

            //Act
            segmentFetcher.RefreshSegment();

            //Assert
            Assert.AreEqual(0, segments.Count);
        }