public void TestBaseRepositorySpatialsNullCrud() { // Setup var entity = new SpatialsClass { SessionId = Guid.NewGuid(), ColumnGeography = null, ColumnGeometry = null }; using (var repository = new SpatialsClassRepository(Database.ConnectionStringForRepoDb)) { // Act Insert var id = repository.Insert(entity); // Act Query var data = repository.Query(e => e.SessionId == (Guid)id).FirstOrDefault(); // Assert Assert.IsNotNull(data); Assert.IsNull(data.ColumnGeography); Assert.IsNull(data.ColumnGeometry); } }
public void TestBaseRepositorySpatialsCrud() { // Setup var entity = new SpatialsClass { SessionId = Guid.NewGuid(), ColumnGeography = "POLYGON ((0 0, 50 0, 50 50, 0 50, 0 0))", ColumnGeometry = "LINESTRING (-122.36 47.656, -122.343 47.656)" }; using (var repository = new SpatialsClassRepository(Database.ConnectionStringForRepoDb)) { // Act Insert var id = repository.Insert(entity); // Act Query var data = repository.Query(e => e.SessionId == (Guid)id).FirstOrDefault(); // Assert Assert.IsNotNull(data); Assert.AreEqual(entity.ColumnGeography.ToString(), data.ColumnGeography?.ToString()); Assert.AreEqual(entity.ColumnGeometry.ToString(), data.ColumnGeometry?.ToString()); } }