Reformat / cleanup
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
using ZB.MOM.WW.CBDD.Core.Indexing;
|
||||
using ZB.MOM.WW.CBDD.Bson;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
public class CursorTests : IDisposable
|
||||
{
|
||||
private readonly string _testFile;
|
||||
private readonly StorageEngine _storage;
|
||||
private readonly BTreeIndex _index;
|
||||
private readonly StorageEngine _storage;
|
||||
private readonly string _testFile;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CursorTests"/> class.
|
||||
/// Initializes a new instance of the <see cref="CursorTests" /> class.
|
||||
/// </summary>
|
||||
public CursorTests()
|
||||
{
|
||||
@@ -25,9 +23,18 @@ public class CursorTests : IDisposable
|
||||
SeedData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_storage.Dispose();
|
||||
if (File.Exists(_testFile)) File.Delete(_testFile);
|
||||
}
|
||||
|
||||
private void SeedData()
|
||||
{
|
||||
var txnId = _storage.BeginTransaction().TransactionId;
|
||||
ulong txnId = _storage.BeginTransaction().TransactionId;
|
||||
|
||||
// Insert 10, 20, 30
|
||||
_index.Insert(IndexKey.Create(10), new DocumentLocation(1, 0), txnId);
|
||||
@@ -38,7 +45,7 @@ public class CursorTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests move to first should position at first.
|
||||
/// Tests move to first should position at first.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MoveToFirst_ShouldPositionAtFirst()
|
||||
@@ -49,7 +56,7 @@ public class CursorTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests move to last should position at last.
|
||||
/// Tests move to last should position at last.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MoveToLast_ShouldPositionAtLast()
|
||||
@@ -60,7 +67,7 @@ public class CursorTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests move next should traverse forward.
|
||||
/// Tests move next should traverse forward.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MoveNext_ShouldTraverseForward()
|
||||
@@ -78,7 +85,7 @@ public class CursorTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests move prev should traverse backward.
|
||||
/// Tests move prev should traverse backward.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MovePrev_ShouldTraverseBackward()
|
||||
@@ -96,7 +103,7 @@ public class CursorTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests seek should position exact or next.
|
||||
/// Tests seek should position exact or next.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Seek_ShouldPositionExact_OrNext()
|
||||
@@ -116,13 +123,4 @@ public class CursorTests : IDisposable
|
||||
// Current should throw invalid
|
||||
Should.Throw<InvalidOperationException>(() => cursor.Current);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_storage.Dispose();
|
||||
if (File.Exists(_testFile)) File.Delete(_testFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user