예제 #1
0
        public void RewindDataIndex_Remove()
        {
            Mock <IDateTimeProvider> dateTimeProviderMock = new Mock <IDateTimeProvider>();
            Mock <ICoinView>         coinViewMock         = new Mock <ICoinView>();

            this.SetupMockCoinView(coinViewMock);

            RewindDataIndexCache rewindDataIndexCache = new RewindDataIndexCache(dateTimeProviderMock.Object, this.Network);

            rewindDataIndexCache.Initialize(20, coinViewMock.Object);

            rewindDataIndexCache.Remove(19, coinViewMock.Object);
            var items = rewindDataIndexCache.GetMemberValue("items") as ConcurrentDictionary <OutPoint, int>;

            items.Should().HaveCount(22);
            this.CheckCache(items, 19, 9);
        }
        public void RewindDataIndex_Remove()
        {
            Mock <IDateTimeProvider> dateTimeProviderMock = new Mock <IDateTimeProvider>();
            Mock <ICoinView>         coinViewMock         = new Mock <ICoinView>();

            this.SetupMockCoinView(coinViewMock);

            Mock <IFinalizedBlockInfoRepository> finalizedBlockInfoRepositoryMock = new Mock <IFinalizedBlockInfoRepository>();

            finalizedBlockInfoRepositoryMock.Setup(s => s.GetFinalizedBlockInfo()).Returns(new HashHeightPair());

            RewindDataIndexCache rewindDataIndexCache = new RewindDataIndexCache(dateTimeProviderMock.Object, this.Network, finalizedBlockInfoRepositoryMock.Object, new Checkpoints());

            rewindDataIndexCache.Initialize(20, coinViewMock.Object);

            rewindDataIndexCache.Remove(19, coinViewMock.Object);
            var items = rewindDataIndexCache.GetMemberValue("items") as ConcurrentDictionary <OutPoint, int>;

            items.Should().HaveCount(22);
            this.CheckCache(items, 19, 9);
        }