Initialize CBDD solution and add a .NET-focused gitignore for generated artifacts.

This commit is contained in:
Joseph Doherty
2026-02-20 12:54:07 -05:00
commit b8ed5ec500
214 changed files with 101452 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using ZB.MOM.WW.CBDD.Bson;
using ZB.MOM.WW.CBDD.Core.Collections;
using Xunit;
using System.Linq;
namespace ZB.MOM.WW.CBDD.Tests;
public class VisibilityTests
{
public class VisibilityEntity
{
// Should be included
public int NormalProp { get; set; }
// Should be included (serialization usually writes it)
public int PrivateSetProp { get; private set; }
// Should be included
public int InitProp { get; init; }
// Fields - typically included in BSON if public, but reflection need GetFields
public string PublicField = string.Empty;
// Should NOT be included
private int _privateField;
// Helper to set private
public void SetPrivate(int val) => _privateField = val;
}
[Fact]
public void GenerateSchema_VisibilityChecks()
{
var schema = BsonSchemaGenerator.FromType<VisibilityEntity>();
schema.Fields.ShouldContain(f => f.Name == "normalprop");
schema.Fields.ShouldContain(f => f.Name == "privatesetprop");
schema.Fields.ShouldContain(f => f.Name == "initprop");
// Verify assumption about fields
// Current implementation uses GetProperties, so publicfield might be missing.
// We will assert current status and then fix if requested/failed.
schema.Fields.ShouldContain(f => f.Name == "publicfield"); // This will likely fail currently
schema.Fields.ShouldNotContain(f => f.Name == "_privatefield");
}
}