public void CanCreateIndexOnFilledTable() { var recordFile = new RecordFile(tableInfo, _transaction); recordFile.BeforeFirst(); for (int i = 0; i < 10; ++i) { recordFile.Insert(); recordFile.SetInt("Id", i - 1); } recordFile.Close(); metadataManager = new MetadataManager(_fileManager, tableManager, viewManager, indexManager, statisticsManager); Assert.DoesNotThrow(() => { metadataManager.CreateIndex(RandomFilename, tableName, "Id", _transaction); }); var index = metadataManager.GetIndexInfo(tableName, _transaction); Assert.IsNotNull(index); Assert.AreEqual(0, index["Id"].BlocksAccessed()); Assert.AreEqual(2, index["Id"].RecordsOutput()); }
public void CanCreateIndexAndGetInfo() { metadataManager = new MetadataManager(_fileManager, tableManager, viewManager, indexManager, statisticsManager); Assert.DoesNotThrow(() => { metadataManager.CreateIndex(RandomFilename, tableName, "Id", _transaction); }); var index = metadataManager.GetIndexInfo(tableName, _transaction); Assert.IsNotNull(index); Assert.AreEqual(0, index["Id"].BlocksAccessed()); Assert.AreEqual(0, index["Id"].RecordsOutput()); }