Reformat / cleanup
All checks were successful
NuGet Publish / build-and-pack (push) Successful in 46s
NuGet Publish / publish-to-gitea (push) Successful in 56s

This commit is contained in:
Joseph Doherty
2026-02-21 08:10:36 -05:00
parent 4c6aaa5a3f
commit a70d8befae
176 changed files with 50555 additions and 49587 deletions

View File

@@ -1,28 +1,33 @@
using Xunit;
using ZB.MOM.WW.CBDD.Core.Indexing;
using System.IO;
using System.Linq;
using ZB.MOM.WW.CBDD.Core;
using ZB.MOM.WW.CBDD.Shared;
namespace ZB.MOM.WW.CBDD.Tests;
public class GeospatialTests : IDisposable
{
private readonly TestDbContext _db;
private readonly string _dbPath;
private readonly Shared.TestDbContext _db;
/// <summary>
/// Initializes a new instance of the <see cref="GeospatialTests"/> class.
/// Initializes a new instance of the <see cref="GeospatialTests" /> class.
/// </summary>
public GeospatialTests()
{
_dbPath = Path.Combine(Path.GetTempPath(), $"cbdd_geo_{Guid.NewGuid()}.db");
_db = new Shared.TestDbContext(_dbPath);
_db = new TestDbContext(_dbPath);
}
/// <summary>
/// Verifies spatial within queries return expected results.
/// Disposes test resources and removes temporary files.
/// </summary>
public void Dispose()
{
_db.Dispose();
if (File.Exists(_dbPath)) File.Delete(_dbPath);
}
/// <summary>
/// Verifies spatial within queries return expected results.
/// </summary>
[Fact]
public void Can_Insert_And_Search_Within()
@@ -45,7 +50,7 @@ public class GeospatialTests : IDisposable
}
/// <summary>
/// Verifies near queries return expected proximity results.
/// Verifies near queries return expected proximity results.
/// </summary>
[Fact]
public void Can_Search_Near_Proximity()
@@ -69,7 +74,7 @@ public class GeospatialTests : IDisposable
}
/// <summary>
/// Verifies LINQ near integration returns expected results.
/// Verifies LINQ near integration returns expected results.
/// </summary>
[Fact]
public void LINQ_Integration_Near_Works()
@@ -79,8 +84,8 @@ public class GeospatialTests : IDisposable
// LINQ query using .Near() extension
var query = from p in _db.GeoItems.AsQueryable()
where p.Location.Near(milan, 10.0)
select p;
where p.Location.Near(milan, 10.0)
select p;
var results = query.ToList();
@@ -89,7 +94,7 @@ public class GeospatialTests : IDisposable
}
/// <summary>
/// Verifies LINQ within integration returns expected results.
/// Verifies LINQ within integration returns expected results.
/// </summary>
[Fact]
public void LINQ_Integration_Within_Works()
@@ -102,19 +107,10 @@ public class GeospatialTests : IDisposable
// LINQ query using .Within() extension
var results = _db.GeoItems.AsQueryable()
.Where(p => p.Location.Within(min, max))
.ToList();
.Where(p => p.Location.Within(min, max))
.ToList();
results.Count().ShouldBe(1);
results[0].Name.ShouldBe("Milan Office");
}
/// <summary>
/// Disposes test resources and removes temporary files.
/// </summary>
public void Dispose()
{
_db.Dispose();
if (File.Exists(_dbPath)) File.Delete(_dbPath);
}
}
}