Path: redb/redb.Tests.Integration/Tests/Unit/LazyStubSerializationRepro.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/Tests/Unit/LazyStubSerializationRepro.cs ---- using System.Text.Json; using redb.Core.Models.Entities; using redb.Core.Serialization; using redb.Tests.Integration.Models; namespace redb.Tests.Integration.Tests.Unit; /// /// In-memory guard for stub serialization (V4 Л1, L.4) — no database. Born as the bisection that /// caught an StJ stack overflow (a [JsonIgnore]+private-bridge variant); kept because it pins the /// converter contract at the unit level: a stub with and without a graph, with redb Options and /// with default options. /// public class LazyStubSerializationRepro { private static RedbObject RootWithStub() { var stub = new RedbObject { id = 5, scheme_id = 100, hash = Guid.NewGuid() }; return new RedbObject { id = 1, scheme_id = 100, Props = new LazyNodeProps { Label = "root", Next = stub } }; } [Fact] public void A_RootWithStub_RedbOptions() { var json = JsonSerializer.Serialize(RootWithStub(), SystemTextJsonRedbSerializer.Options); json.Should().Contain("\"id\":5"); } [Fact] public void B_RootWithStub_DefaultOptions() { var json = JsonSerializer.Serialize(RootWithStub()); json.Should().Contain("root"); } [Fact] public void C_StubAlone_RedbOptions() { var stub = new RedbObject { id = 5, scheme_id = 100 }; var json = JsonSerializer.Serialize(stub, SystemTextJsonRedbSerializer.Options); json.Should().Contain("\"id\":5"); } [Fact] public void D_RootWithoutRefs_RedbOptions() { var root = new RedbObject { id = 1, Props = new LazyNodeProps { Label = "solo" } }; var json = JsonSerializer.Serialize(root, SystemTextJsonRedbSerializer.Options); json.Should().Contain("solo"); } }