Fix audit findings for coverage, architecture checks, and XML docs
All checks were successful
NuGet Publish / build-and-pack (push) Successful in 45s
NuGet Publish / publish-to-gitea (push) Successful in 52s

This commit is contained in:
Joseph Doherty
2026-02-20 15:43:25 -05:00
parent 5528806518
commit 3ffd468c79
99 changed files with 23746 additions and 9548 deletions

View File

@@ -9,18 +9,27 @@ public class SetMethodTests : IDisposable
private readonly string _dbPath;
private readonly Shared.TestDbContext _db;
/// <summary>
/// Initializes a new instance of the <see cref="SetMethodTests"/> class.
/// </summary>
public SetMethodTests()
{
_dbPath = Path.Combine(Path.GetTempPath(), $"cbdd_set_{Guid.NewGuid()}.db");
_db = new Shared.TestDbContext(_dbPath);
}
/// <summary>
/// Disposes the resources used by this instance.
/// </summary>
public void Dispose()
{
_db.Dispose();
if (File.Exists(_dbPath)) File.Delete(_dbPath);
}
/// <summary>
/// Tests set object id returns correct collection.
/// </summary>
[Fact]
public void Set_ObjectId_ReturnsCorrectCollection()
{
@@ -29,6 +38,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.Users);
}
/// <summary>
/// Tests set shorthand returns correct collection.
/// </summary>
[Fact]
public void Set_Shorthand_ReturnsCorrectCollection()
{
@@ -37,6 +49,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.Users);
}
/// <summary>
/// Tests set int returns correct collection.
/// </summary>
[Fact]
public void Set_Int_ReturnsCorrectCollection()
{
@@ -45,6 +60,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.People);
}
/// <summary>
/// Tests set string returns correct collection.
/// </summary>
[Fact]
public void Set_String_ReturnsCorrectCollection()
{
@@ -53,6 +71,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.StringEntities);
}
/// <summary>
/// Tests set guid returns correct collection.
/// </summary>
[Fact]
public void Set_Guid_ReturnsCorrectCollection()
{
@@ -61,6 +82,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.GuidEntities);
}
/// <summary>
/// Tests set custom key returns correct collection.
/// </summary>
[Fact]
public void Set_CustomKey_ReturnsCorrectCollection()
{
@@ -69,6 +93,9 @@ public class SetMethodTests : IDisposable
collection.ShouldBeSameAs(_db.Orders);
}
/// <summary>
/// Tests set all object id collections return correct instances.
/// </summary>
[Fact]
public void Set_AllObjectIdCollections_ReturnCorrectInstances()
{
@@ -82,6 +109,9 @@ public class SetMethodTests : IDisposable
_db.Set<ObjectId, GeoEntity>().ShouldBeSameAs(_db.GeoItems);
}
/// <summary>
/// Tests set all int collections return correct instances.
/// </summary>
[Fact]
public void Set_AllIntCollections_ReturnCorrectInstances()
{
@@ -92,24 +122,36 @@ public class SetMethodTests : IDisposable
_db.Set<int, SchemaUser>().ShouldBeSameAs(_db.SchemaUsers);
}
/// <summary>
/// Tests set string key collections return correct instances.
/// </summary>
[Fact]
public void Set_StringKeyCollections_ReturnCorrectInstances()
{
_db.Set<string, CustomKeyEntity>().ShouldBeSameAs(_db.CustomKeyEntities);
}
/// <summary>
/// Tests set unregistered entity throws invalid operation exception.
/// </summary>
[Fact]
public void Set_UnregisteredEntity_ThrowsInvalidOperationException()
{
Should.Throw<InvalidOperationException>(() => _db.Set<ObjectId, Address>());
}
/// <summary>
/// Tests set wrong key type throws invalid operation exception.
/// </summary>
[Fact]
public void Set_WrongKeyType_ThrowsInvalidOperationException()
{
Should.Throw<InvalidOperationException>(() => _db.Set<string, User>());
}
/// <summary>
/// Tests set can perform operations.
/// </summary>
[Fact]
public void Set_CanPerformOperations()
{
@@ -124,6 +166,9 @@ public class SetMethodTests : IDisposable
found.Age.ShouldBe(30);
}
/// <summary>
/// Tests set with int key can perform operations.
/// </summary>
[Fact]
public void Set_WithIntKey_CanPerformOperations()
{
@@ -144,18 +189,27 @@ public class SetMethodInheritanceTests : IDisposable
private readonly string _dbPath;
private readonly Shared.TestExtendedDbContext _db;
/// <summary>
/// Initializes a new instance of the <see cref="SetMethodInheritanceTests"/> class.
/// </summary>
public SetMethodInheritanceTests()
{
_dbPath = Path.Combine(Path.GetTempPath(), $"cbdd_set_inherit_{Guid.NewGuid()}.db");
_db = new Shared.TestExtendedDbContext(_dbPath);
}
/// <summary>
/// Disposes the resources used by this instance.
/// </summary>
public void Dispose()
{
_db.Dispose();
if (File.Exists(_dbPath)) File.Delete(_dbPath);
}
/// <summary>
/// Tests set own collection returns correct instance.
/// </summary>
[Fact]
public void Set_OwnCollection_ReturnsCorrectInstance()
{
@@ -164,6 +218,9 @@ public class SetMethodInheritanceTests : IDisposable
collection.ShouldBeSameAs(_db.ExtendedEntities);
}
/// <summary>
/// Tests set parent collection returns correct instance.
/// </summary>
[Fact]
public void Set_ParentCollection_ReturnsCorrectInstance()
{
@@ -172,6 +229,9 @@ public class SetMethodInheritanceTests : IDisposable
collection.ShouldBeSameAs(_db.Users);
}
/// <summary>
/// Tests set parent shorthand returns correct instance.
/// </summary>
[Fact]
public void Set_ParentShorthand_ReturnsCorrectInstance()
{
@@ -180,6 +240,9 @@ public class SetMethodInheritanceTests : IDisposable
collection.ShouldBeSameAs(_db.Users);
}
/// <summary>
/// Tests set parent int collection returns correct instance.
/// </summary>
[Fact]
public void Set_ParentIntCollection_ReturnsCorrectInstance()
{
@@ -187,6 +250,9 @@ public class SetMethodInheritanceTests : IDisposable
_db.Set<int, Product>().ShouldBeSameAs(_db.Products);
}
/// <summary>
/// Tests set parent custom key returns correct instance.
/// </summary>
[Fact]
public void Set_ParentCustomKey_ReturnsCorrectInstance()
{
@@ -195,12 +261,18 @@ public class SetMethodInheritanceTests : IDisposable
collection.ShouldBeSameAs(_db.Orders);
}
/// <summary>
/// Tests set unregistered entity throws invalid operation exception.
/// </summary>
[Fact]
public void Set_UnregisteredEntity_ThrowsInvalidOperationException()
{
Should.Throw<InvalidOperationException>(() => _db.Set<ObjectId, Address>());
}
/// <summary>
/// Tests set own collection can perform operations.
/// </summary>
[Fact]
public void Set_OwnCollection_CanPerformOperations()
{
@@ -214,6 +286,9 @@ public class SetMethodInheritanceTests : IDisposable
found.Description.ShouldBe("Test");
}
/// <summary>
/// Tests set parent collection can perform operations.
/// </summary>
[Fact]
public void Set_ParentCollection_CanPerformOperations()
{