Reformat / cleanup
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
using ZB.MOM.WW.CBDD.Bson;
|
||||
using ZB.MOM.WW.CBDD.Core.Collections;
|
||||
using ZB.MOM.WW.CBDD.Core.Indexing;
|
||||
using ZB.MOM.WW.CBDD.Core.Storage;
|
||||
using ZB.MOM.WW.CBDD.Core.Transactions;
|
||||
using ZB.MOM.WW.CBDD.Shared;
|
||||
using ZB.MOM.WW.CBDD.Shared.TestDbContext_TestDbContext_Mappers;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
@@ -15,7 +12,7 @@ public class MetadataPersistenceTests : IDisposable
|
||||
private readonly string _walPath;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataPersistenceTests"/> class.
|
||||
/// Initializes a new instance of the <see cref="MetadataPersistenceTests" /> class.
|
||||
/// </summary>
|
||||
public MetadataPersistenceTests()
|
||||
{
|
||||
@@ -24,7 +21,16 @@ public class MetadataPersistenceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests index definitions are persisted and reloaded.
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (File.Exists(_dbPath)) File.Delete(_dbPath);
|
||||
if (File.Exists(_walPath)) File.Delete(_walPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests index definitions are persisted and reloaded.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void IndexDefinitions_ArePersisted_AndReloaded()
|
||||
@@ -66,19 +72,19 @@ public class MetadataPersistenceTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests ensure index does not recreate if index exists.
|
||||
/// Tests ensure index does not recreate if index exists.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EnsureIndex_DoesNotRecreate_IfIndexExists()
|
||||
{
|
||||
// 1. Create index
|
||||
using (var context = new Shared.TestDbContext(_dbPath))
|
||||
using (var context = new TestDbContext(_dbPath))
|
||||
{
|
||||
context.Users.EnsureIndex(u => u.Age);
|
||||
}
|
||||
|
||||
// 2. Re-open and EnsureIndex again - should be fast/no-op
|
||||
using (var context = new Shared.TestDbContext(_dbPath))
|
||||
using (var context = new TestDbContext(_dbPath))
|
||||
{
|
||||
var mapper = new ZB_MOM_WW_CBDD_Shared_UserMapper();
|
||||
|
||||
@@ -99,13 +105,4 @@ public class MetadataPersistenceTests : IDisposable
|
||||
results.Count().ShouldBe(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the resources used by this instance.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (File.Exists(_dbPath)) File.Delete(_dbPath);
|
||||
if (File.Exists(_walPath)) File.Delete(_walPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user