Ejemplo n.º 1
0
        public async Task InitializesAtLastSavedValueAsync()
        {
            this.tipsManager.Initialize(this.mainChainHeaders.Last());

            var tipProvider = new testTipProvider();

            this.tipsManager.RegisterTipProvider(tipProvider);
            this.tipsManager.CommitTipPersisted(tipProvider, this.mainChainHeaders[10]);
            Assert.Equal(this.mainChainHeaders[10], this.tipsManager.GetLastCommonTip());

            // Give it some time to save tip in bg.
            await Task.Delay(500);

            this.tipsManager.Dispose();

            var newTipsManager = new TipsManager(this.keyValueRepo, this.loggerFactory);

            newTipsManager.Initialize(this.mainChainHeaders.Last());

            Assert.Equal(this.mainChainHeaders[10], newTipsManager.GetLastCommonTip());
        }