AyCode.Blazor/AyCode.Blazor.Components.Tests/Grids/README.md

1.1 KiB

Grids

Grid component integration tests for MgGridBase layout persistence, column rendering, and URL link functionality.

Key Files

  • TestMgGrid.cs -- Test infrastructure for grid testing:
    • TestGridOrderItemDataSource -- DataSource with the 3-parameter constructor required by MgGridBase.OnInitializedAsync via Activator.CreateInstance.
    • DynamicColumnAddingEventArgs -- Event args for customizing dynamically added columns.
    • TestMgGridBase<...> -- Abstract generic test grid that overrides layout persistence with in-memory Dictionary storage and auto-builds columns from TDataItem properties via reflection.
    • TestMgGridOrderItem -- Concrete test grid bound to TestOrderItem entities.
  • MgGridBaseTests.cs -- [TestClass] with tests for:
    • Column width persistence across grid re-renders.
    • Layout storage population after render.
    • Separate layout keys for differently named grids.
    • Master grid detection.
    • Reflection-based column building (verifies Id, ProductName, Quantity columns).
    • MgGridDataColumn.UrlLink rendering with token replacement.