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

@@ -12,8 +12,17 @@ namespace ZB.MOM.WW.CBDD.Shared
public class User
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the age.
/// </summary>
public int Age { get; set; }
}
@@ -21,32 +30,62 @@ namespace ZB.MOM.WW.CBDD.Shared
public class ComplexUser
{
/// <summary>
/// Gets or sets the id.
/// </summary>
[BsonId]
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
// Direct nested object
/// <summary>
/// Gets or sets the main address.
/// </summary>
public Address MainAddress { get; set; } = new();
// Collection of nested objects
/// <summary>
/// Gets or sets the other addresses.
/// </summary>
public List<Address> OtherAddresses { get; set; } = new();
// Primitive collection
/// <summary>
/// Gets or sets the tags.
/// </summary>
public List<string> Tags { get; set; } = new();
/// <summary>
/// Gets or sets the secret.
/// </summary>
[BsonIgnore]
public string Secret { get; set; } = "";
}
public class Address
{
/// <summary>
/// Gets or sets the street.
/// </summary>
public string Street { get; set; } = "";
/// <summary>
/// Gets or sets the city.
/// </summary>
public City City { get; set; } = new(); // Depth 2
}
public class City
{
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the zip code.
/// </summary>
public string ZipCode { get; set; } = "";
}
@@ -54,19 +93,37 @@ namespace ZB.MOM.WW.CBDD.Shared
public class IntEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string? Name { get; set; }
}
public class StringEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public required string Id { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
public string? Value { get; set; }
}
public class GuidEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string? Name { get; set; }
}
@@ -75,8 +132,14 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class CustomKeyEntity
{
/// <summary>
/// Gets or sets the code.
/// </summary>
[System.ComponentModel.DataAnnotations.Key]
public required string Code { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
public string? Description { get; set; }
}
@@ -84,121 +147,252 @@ namespace ZB.MOM.WW.CBDD.Shared
public class AutoInitEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
}
public class Person
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the age.
/// </summary>
public int Age { get; set; }
}
public class Product
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string Title { get; set; } = "";
/// <summary>
/// Gets or sets the price.
/// </summary>
public decimal Price { get; set; }
}
public class AsyncDoc
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
}
public class SchemaUser
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the address.
/// </summary>
public Address Address { get; set; } = new();
}
public class VectorEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string Title { get; set; } = "";
/// <summary>
/// Gets or sets the embedding.
/// </summary>
public float[] Embedding { get; set; } = Array.Empty<float>();
}
public class GeoEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the location.
/// </summary>
public (double Latitude, double Longitude) Location { get; set; }
}
public record OrderId(string Value)
{
/// <summary>
/// Initializes a new instance.
/// </summary>
public OrderId() : this(string.Empty) { }
}
public class OrderIdConverter : ValueConverter<OrderId, string>
{
public override string ConvertToProvider(OrderId model) => model?.Value ?? string.Empty;
public override OrderId ConvertFromProvider(string provider) => new OrderId(provider);
/// <inheritdoc />
public override string ConvertToProvider(OrderId model) => model?.Value ?? string.Empty;
/// <inheritdoc />
public override OrderId ConvertFromProvider(string provider) => new OrderId(provider);
}
public class Order
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public OrderId Id { get; set; } = null!;
/// <summary>
/// Gets or sets the customer name.
/// </summary>
public string CustomerName { get; set; } = "";
}
public class TestDocument
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the category.
/// </summary>
public string Category { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the amount.
/// </summary>
public int Amount { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
}
public class OrderDocument
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the item name.
/// </summary>
public string ItemName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the quantity.
/// </summary>
public int Quantity { get; set; }
}
public class OrderItem
{
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the price.
/// </summary>
public int Price { get; set; }
}
public class ComplexDocument
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the shipping address.
/// </summary>
public Address ShippingAddress { get; set; } = new();
/// <summary>
/// Gets or sets the items.
/// </summary>
public List<OrderItem> Items { get; set; } = new();
}
[Table("custom_users", Schema = "test")]
public class AnnotatedUser
{
/// <summary>
/// Gets or sets the id.
/// </summary>
[Key]
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
[Required]
[Column("display_name")]
[StringLength(50, MinimumLength = 3)]
public string Name { get; set; } = "";
/// <summary>
/// Gets or sets the age.
/// </summary>
[Range(0, 150)]
public int Age { get; set; }
/// <summary>
/// Gets the computed info.
/// </summary>
[NotMapped]
public string ComputedInfo => $"{Name} ({Age})";
/// <summary>
/// Gets or sets the location.
/// </summary>
[Column(TypeName = "geopoint")]
public (double Lat, double Lon) Location { get; set; }
}
public class PersonV2
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the age.
/// </summary>
public int Age { get; set; }
}
@@ -207,8 +401,17 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class ExtendedEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the created at.
/// </summary>
public DateTime CreatedAt { get; set; }
}
@@ -219,7 +422,13 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class BaseEntityWithId
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the created at.
/// </summary>
public DateTime CreatedAt { get; set; }
}
@@ -228,7 +437,13 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class DerivedEntity : BaseEntityWithId
{
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the description.
/// </summary>
public string Description { get; set; } = string.Empty;
}
@@ -237,14 +452,35 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class EntityWithComputedProperties
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the first name.
/// </summary>
public string FirstName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the last name.
/// </summary>
public string LastName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the birth year.
/// </summary>
public int BirthYear { get; set; }
// Computed properties - should NOT be serialized
/// <summary>
/// Gets the full name.
/// </summary>
public string FullName => $"{FirstName} {LastName}";
/// <summary>
/// Gets the age.
/// </summary>
public int Age => DateTime.Now.Year - BirthYear;
/// <summary>
/// Gets the display info.
/// </summary>
public string DisplayInfo => $"{FullName} (Age: {Age})";
}
@@ -253,18 +489,45 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class EntityWithAdvancedCollections
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
// Various collection types that should all be recognized
/// <summary>
/// Gets or sets the tags.
/// </summary>
public HashSet<string> Tags { get; set; } = new();
/// <summary>
/// Gets or sets the numbers.
/// </summary>
public ISet<int> Numbers { get; set; } = new HashSet<int>();
/// <summary>
/// Gets or sets the history.
/// </summary>
public LinkedList<string> History { get; set; } = new();
/// <summary>
/// Gets or sets the pending items.
/// </summary>
public Queue<string> PendingItems { get; set; } = new();
/// <summary>
/// Gets or sets the undo stack.
/// </summary>
public Stack<string> UndoStack { get; set; } = new();
// Nested objects in collections
/// <summary>
/// Gets or sets the addresses.
/// </summary>
public HashSet<Address> Addresses { get; set; } = new();
/// <summary>
/// Gets or sets the favorite cities.
/// </summary>
public ISet<City> FavoriteCities { get; set; } = new HashSet<City>();
}
@@ -273,13 +536,30 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class EntityWithPrivateSetters
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; private set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; private set; } = string.Empty;
/// <summary>
/// Gets or sets the age.
/// </summary>
public int Age { get; private set; }
/// <summary>
/// Gets or sets the created at.
/// </summary>
public DateTime CreatedAt { get; private set; }
// Factory method for creation
public static EntityWithPrivateSetters Create(string name, int age)
/// <summary>
/// Executes the create operation.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="age">The age.</param>
public static EntityWithPrivateSetters Create(string name, int age)
{
return new EntityWithPrivateSetters
{
@@ -296,9 +576,21 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class EntityWithInitSetters
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; init; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public required string Name { get; init; }
/// <summary>
/// Gets or sets the age.
/// </summary>
public int Age { get; init; }
/// <summary>
/// Gets or sets the created at.
/// </summary>
public DateTime CreatedAt { get; init; }
}
@@ -313,10 +605,25 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class Employee
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the department.
/// </summary>
public string Department { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the manager id.
/// </summary>
public ObjectId? ManagerId { get; set; } // Reference to manager
/// <summary>
/// Gets or sets the direct report ids.
/// </summary>
public List<ObjectId>? DirectReportIds { get; set; } // References to direct reports (best practice)
}
@@ -327,9 +634,21 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class CategoryRef
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the description.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the product ids.
/// </summary>
public List<ObjectId>? ProductIds { get; set; } // Only IDs - no embedding
}
@@ -340,9 +659,21 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class ProductRef
{
/// <summary>
/// Gets or sets the id.
/// </summary>
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the price.
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// Gets or sets the category ids.
/// </summary>
public List<ObjectId>? CategoryIds { get; set; } // Only IDs - no embedding
}
@@ -358,12 +689,22 @@ namespace ZB.MOM.WW.CBDD.Shared
where TId : IEquatable<TId>
where TEntity : class
{
/// <summary>
/// Gets or sets the id.
/// </summary>
[System.ComponentModel.DataAnnotations.Key]
public virtual TId? Id { get; set; }
/// <summary>
/// Initializes a new instance.
/// </summary>
protected MockBaseEntity() { }
protected MockBaseEntity(TId? id)
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="id">The id.</param>
protected MockBaseEntity(TId? id)
{
Id = id;
}
@@ -377,9 +718,16 @@ namespace ZB.MOM.WW.CBDD.Shared
public abstract class MockUuidEntity<TEntity> : MockBaseEntity<string, TEntity>
where TEntity : class
{
/// <summary>
/// Initializes a new instance.
/// </summary>
protected MockUuidEntity() : base() { }
protected MockUuidEntity(string? id) : base(id) { }
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="id">The id.</param>
protected MockUuidEntity(string? id) : base(id) { }
}
/// <summary>
@@ -388,11 +736,24 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class MockCounter : MockUuidEntity<MockCounter>
{
/// <summary>
/// Initializes a new instance.
/// </summary>
public MockCounter() : base() { }
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="id">The id.</param>
public MockCounter(string? id) : base(id) { }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the value.
/// </summary>
public int Value { get; set; }
}
@@ -401,25 +762,58 @@ namespace ZB.MOM.WW.CBDD.Shared
/// </summary>
public class TemporalEntity
{
/// <summary>
/// Gets or sets the id.
/// </summary>
[Key]
public ObjectId Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; } = string.Empty;
// DateTime types
/// <summary>
/// Gets or sets the created at.
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// Gets or sets the updated at.
/// </summary>
public DateTimeOffset UpdatedAt { get; set; }
/// <summary>
/// Gets or sets the last accessed at.
/// </summary>
public DateTimeOffset? LastAccessedAt { get; set; }
// TimeSpan
/// <summary>
/// Gets or sets the duration.
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// Gets or sets the optional duration.
/// </summary>
public TimeSpan? OptionalDuration { get; set; }
// DateOnly and TimeOnly (.NET 6+)
/// <summary>
/// Gets or sets the birth date.
/// </summary>
public DateOnly BirthDate { get; set; }
/// <summary>
/// Gets or sets the anniversary.
/// </summary>
public DateOnly? Anniversary { get; set; }
/// <summary>
/// Gets or sets the opening time.
/// </summary>
public TimeOnly OpeningTime { get; set; }
/// <summary>
/// Gets or sets the closing time.
/// </summary>
public TimeOnly? ClosingTime { get; set; }
}
}