Path: redb/redb.Tests.Integration/Models/TestModels.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Models/TestModels.cs ---- using redb.Core.Attributes; using redb.Core.Models.Entities; namespace redb.Tests.Integration.Models; // ─────────────────────────────────────────────── // Simple model for basic CRUD tests // ─────────────────────────────────────────────── [RedbScheme("TestSimple")] public class SimpleProps { public string Title { get; set; } = string.Empty; public int Count { get; set; } public decimal Price { get; set; } public DateTime CreatedAt { get; set; } public bool IsActive { get; set; } public Guid Code { get; set; } public string? Description { get; set; } public long? OptionalNumber { get; set; } } // ─────────────────────────────────────────────── // Employee model (main test model, matching Examples) // ─────────────────────────────────────────────── public class TestAddress { public string City { get; set; } = string.Empty; public string Street { get; set; } = string.Empty; public TestBuildingInfo? Building { get; set; } } public class TestBuildingInfo { public int Floor { get; set; } public string Name { get; set; } = string.Empty; public string[]? Amenities { get; set; } } public class TestContact { public string Type { get; set; } = string.Empty; public string Value { get; set; } = string.Empty; public bool IsVerified { get; set; } public TestContactDetail[]? Metadata { get; set; } } public class TestContactDetail { public string Label { get; set; } = string.Empty; public string Value { get; set; } = string.Empty; } public class TestTag { public string Name { get; set; } = string.Empty; public int Priority { get; set; } } public class TestDepartment { public string Name { get; set; } = string.Empty; public int HeadCount { get; set; } public string[] Projects { get; set; } = []; public TestTag[] Leaders { get; set; } = []; public Dictionary? BudgetByYear { get; set; } } [RedbScheme("TestEmployee")] public class EmployeeProps { public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; public int Age { get; set; } public DateTime HireDate { get; set; } public string Position { get; set; } = string.Empty; public decimal Salary { get; set; } public string Department { get; set; } = string.Empty; public string? EmployeeCode { get; set; } public bool IsRemote { get; set; } public double? Rating { get; set; } // Arrays public string[]? Skills { get; set; } public int[]? SkillLevels { get; set; } // Nested objects public TestAddress? HomeAddress { get; set; } public TestAddress? WorkAddress { get; set; } // Array of business objects public TestContact[]? Contacts { get; set; } // RedbObject reference public RedbObject? CurrentProject { get; set; } // Dictionaries public Dictionary? PhoneDirectory { get; set; } public Dictionary? OfficeLocations { get; set; } public Dictionary? BonusByYear { get; set; } public Dictionary? DepartmentHistory { get; set; } public Dictionary<(int Year, string Quarter), string>? PerformanceReviews { get; set; } } [RedbScheme("TestProjectMetrics")] public class ProjectMetricsProps { public long ProjectId { get; set; } public long? TasksCompleted { get; set; } public long? TasksTotal { get; set; } public long? BugsFixed { get; set; } public double? Budget { get; set; } public long? TeamSize { get; set; } public string[]? Technologies { get; set; } } // ─────────────────────────────────────────────── // Department model (tree hierarchy — mirrors redb.Examples.Models.DepartmentProps) // ─────────────────────────────────────────────── [RedbScheme("TestDepartment")] public class DepartmentProps { public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public bool IsActive { get; set; } = true; public decimal Budget { get; set; } public string Code { get; set; } = string.Empty; } // ─────────────────────────────────────────────── // Tree node model // ─────────────────────────────────────────────── [RedbScheme("TestTreeNode")] public class TreeNodeProps { public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public bool IsActive { get; set; } = true; public decimal Budget { get; set; } public string Code { get; set; } = string.Empty; } // ─────────────────────────────────────────────── // Polymorphic tree models (3 different scheme types in one tree) // ─────────────────────────────────────────────── [RedbScheme("TestOrgRoot")] public class OrgRootProps { public string OrgName { get; set; } = string.Empty; public string Country { get; set; } = string.Empty; public int FoundedYear { get; set; } } [RedbScheme("TestDivision")] public class DivisionProps { public string DivisionName { get; set; } = string.Empty; public string Head { get; set; } = string.Empty; public decimal AnnualBudget { get; set; } } [RedbScheme("TestTeam")] public class TeamProps { public string TeamName { get; set; } = string.Empty; public int MemberCount { get; set; } public string[] Technologies { get; set; } = []; } // ─────────────────────────────────────────────── // List-related models // ─────────────────────────────────────────────── [RedbScheme("TestPerson")] public class PersonProps { public string Name { get; set; } = string.Empty; public int Age { get; set; } public string Email { get; set; } = string.Empty; public RedbListItem? Status { get; set; } public List? Roles { get; set; } } [RedbScheme("TestCity")] public class CityProps { public string Name { get; set; } = string.Empty; public int Population { get; set; } public string Region { get; set; } = string.Empty; public bool IsCapital { get; set; } public double[]? Coordinates { get; set; } } // ─────────────────────────────────────────────── // Temporal model — exercises every temporal type REDB supports. // The rest of the suite only ever uses DateTime with Kind=Utc, where the // zone-less and the instant reading coincide, so none of the temporal // conversion paths were reachable from a test before this model existed. // ─────────────────────────────────────────────── [RedbScheme("TestTemporal")] public class TemporalProps { /// Zone-less clock reading. 14:00 written is 14:00 read, on any host. public DateTime When { get; set; } /// Native .NET semantics: a real instant with an offset. public DateTimeOffset Moment { get; set; } public DateOnly Day { get; set; } public TimeOnly Clock { get; set; } public TimeSpan Span { get; set; } public string Label { get; set; } = string.Empty; } /// /// Same shape as , own scheme. Round-trip tests insert ad-hoc rows and /// must not pollute the deterministic row set the comparison tests count on. /// [RedbScheme("TestTemporalRoundTrip")] public class TemporalRoundTripProps { public DateTime When { get; set; } public DateTimeOffset Moment { get; set; } public DateOnly Day { get; set; } public TimeOnly Clock { get; set; } public TimeSpan Span { get; set; } public string Label { get; set; } = string.Empty; } // ─────────────────────────────────────────────── // Case-folding model. Text in several scripts, so a search can be checked // against languages whose case mapping behaves differently. // ─────────────────────────────────────────────── [RedbScheme("TestCollation")] public class CollationProps { /// The searched text. public string Text { get; set; } = string.Empty; /// Stable identity of the row, ASCII only so it is never itself affected. public string Label { get; set; } = string.Empty; }