示例#1
0
 public void TearDown()
 {
     _logIndex?.Close();
     if (File.Exists(_sliceFilePath))
     {
         File.Delete(_sliceFilePath);
     }
 }
示例#2
0
        public void When_Starting_Then_IndexIsInitialised()
        {
            byte[] key1 = Encoding.UTF8.GetBytes("key1");
            byte[] key2 = Encoding.UTF8.GetBytes("key2");
            byte[] key3 = Encoding.UTF8.GetBytes("key3");

            _logIndex.UpdateIndex(key1, 1);
            _logIndex.UpdateIndex(key2, 2);
            _logIndex.UpdateIndex(key3, 3);

            _logIndex.Close();

            _logIndex = new LogSliceIndex(_sliceFilePath, _metricsRecorder.Object);

            Assert.AreEqual(1, _logIndex.GetSeekPosition(key1));
            Assert.AreEqual(2, _logIndex.GetSeekPosition(key2));
            Assert.AreEqual(3, _logIndex.GetSeekPosition(key3));
        }