public void CanReIndex() { var source = new BlockStore(TestDataLocations.DataFolder(@"blocks"), Network.StratisMain); BlockStore store = CreateBlockStore("CanReIndexFolder"); store.AppendAll(source.Enumerate(false).Take(100).Select(b => b.Item)); var test = new IndexedBlockStore(new InMemoryNoSqlRepository(), store); var reIndexed = test.ReIndex(); Assert.Equal(100, reIndexed); int i = 0; foreach (StoredBlock b in store.Enumerate(true)) { Block result = test.Get(b.Item.GetHash()); Assert.Equal(result.GetHash(), b.Item.GetHash()); i++; } Assert.Equal(100, i); StoredBlock last = source.Enumerate(false).Skip(100).FirstOrDefault(); store.Append(last.Item); reIndexed = test.ReIndex(); Assert.Equal(1, reIndexed); reIndexed = test.ReIndex(); Assert.Equal(0, reIndexed); }