Path: redb/redb.Tests.Integration/Tests/Unit/WalkerPropertyRuleTests.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/WalkerPropertyRuleTests.cs
----
using System.Reflection;
using redb.Core.Attributes;
using redb.Core.Models.Contracts;
using redb.Core.Models.Entities;
using redb.Core.Pro.Materialization;
using redb.Core.Providers;
using redb.Core.Utils;
namespace redb.Tests.Integration.Tests.Unit;
///
/// The
/// scheme and the save take every public instance property except and read it without
/// a catch - a throwing getter fails the save. The graph walkers of a load read [RedbIgnore] properties too and
/// swallowed whatever a getter threw. Now they walk the save's property set and let a getter's exception surface.
///
public class WalkerPropertyRuleTests
{
private sealed class Counter { public int Value; }
private sealed class PropsWithIgnoredGetter
{
public string Label { get; set; } = "props";
[RedbIgnore] public Counter Reads { get; } = new();
[RedbIgnore]
public string Technical
{
get { Reads.Value++; return "technical"; }
}
}
public sealed class PropsWithThrowingGetter
{
public string Label { get; set; } = "props";
public int Total => throw new InvalidOperationException("computed getter");
}
private static void InvokeCollectBareStubs(object node)
{
var method = typeof(ProLazyPropsLoader).GetMethod("CollectBareStubs", BindingFlags.NonPublic | BindingFlags.Static)
?? throw new InvalidOperationException("ProLazyPropsLoader.CollectBareStubs not found - update this test");
method.Invoke(null, new object[]
{
node,
new Dictionary>(),
new HashSet