Reformat / cleanup
This commit is contained in:
@@ -4,34 +4,43 @@ namespace ZB.MOM.WW.CBDD.Tests;
|
||||
|
||||
public class GeospatialStressTests : IDisposable
|
||||
{
|
||||
private readonly TestDbContext _db;
|
||||
private readonly string _dbPath;
|
||||
private readonly Shared.TestDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes database state for geospatial stress tests.
|
||||
/// Initializes database state for geospatial stress tests.
|
||||
/// </summary>
|
||||
public GeospatialStressTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"geo_stress_{Guid.NewGuid():N}.db");
|
||||
_db = new Shared.TestDbContext(_dbPath);
|
||||
_db = new TestDbContext(_dbPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies spatial index handles node splits and query operations under load.
|
||||
/// Disposes test resources and removes generated files.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_db.Dispose();
|
||||
if (File.Exists(_dbPath)) File.Delete(_dbPath);
|
||||
string wal = Path.ChangeExtension(_dbPath, ".wal");
|
||||
if (File.Exists(wal)) File.Delete(wal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies spatial index handles node splits and query operations under load.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void SpatialIndex_Should_Handle_Node_Splits_And_Queries()
|
||||
{
|
||||
const int count = 350;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
_db.GeoItems.Insert(new GeoEntity
|
||||
{
|
||||
Name = $"pt-{i}",
|
||||
Location = (40.0 + (i * 0.001), -73.0 - (i * 0.001))
|
||||
Location = (40.0 + i * 0.001, -73.0 - i * 0.001)
|
||||
});
|
||||
}
|
||||
|
||||
_db.SaveChanges();
|
||||
|
||||
@@ -45,15 +54,4 @@ public class GeospatialStressTests : IDisposable
|
||||
var near = _db.GeoItems.Near("idx_spatial", (40.10, -73.10), 30.0).ToList();
|
||||
near.Count.ShouldBeGreaterThan(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes test resources and removes generated files.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_db.Dispose();
|
||||
if (File.Exists(_dbPath)) File.Delete(_dbPath);
|
||||
var wal = Path.ChangeExtension(_dbPath, ".wal");
|
||||
if (File.Exists(wal)) File.Delete(wal);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user