5454 }
5555
5656 [Fact ]
57- public void DataGridCell_Columns_Property_AccessibleAndContainsExpectedColumns ()
57+ public void DataGridCell_Column_Property_AccessibleAndContainsExpectedColumn ()
5858 {
5959 // Arrange & Act
6060 var cut = Render (
7272
7373 Assert .True (dataCells .Count >= 9 , " Should have at least 9 data cells (3 items × 3 columns)" );
7474
75- // Test the Columns property on the first data cell
76- var firstCell = dataCells .First ();
77- var columns = firstCell .Instance .Columns ;
75+ // Test the Column property on cells in the first row
76+ var firstRowCells = dataCells .Take (3 ).ToList (); // First 3 cells belong to first row
7877
79- Assert .NotNull (columns );
80- Assert .Equal (3 , columns .Count );
78+ // Verify each cell has access to its specific column
79+ Assert .NotNull (firstRowCells [0 ].Instance .Column );
80+ Assert .Equal (" ID" , firstRowCells [0 ].Instance .Column ? .Title );
8181
82- // Verify column titles are accessible
83- Assert .Equal (" ID" , columns [0 ].Title );
84- Assert .Equal (" Name" , columns [1 ].Title );
85- Assert .Equal (" Category" , columns [2 ].Title );
82+ Assert .NotNull (firstRowCells [1 ].Instance .Column );
83+ Assert .Equal (" Name" , firstRowCells [1 ].Instance .Column ? .Title );
84+
85+ Assert .NotNull (firstRowCells [2 ].Instance .Column );
86+ Assert .Equal (" Category" , firstRowCells [2 ].Instance .Column ? .Title );
8687 }
8788
8889 [Fact ]
89- public void DataGridRow_And_DataGridCell_Columns_PropertyReturnsConsistentData ()
90+ public void DataGridRow_Columns_And_DataGridCell_Column_PropertyReturnsConsistentData ()
9091 {
9192 // Arrange & Act
9293 var cut = Render (
103104 var firstCell = cut .FindComponents <FluentDataGridCell <TestItem >>()
104105 .First (cell => cell .Instance .CellType == DataGridCellType .Default );
105106
106- // Assert both return the same columns data
107+ // Assert row has all columns and cell has access to its specific column
107108 var rowColumns = firstRow .Instance .Columns ;
108- var cellColumns = firstCell .Instance .Columns ;
109+ var cellColumn = firstCell .Instance .Column ;
110+
111+ Assert .NotNull (rowColumns );
112+ Assert .Equal (2 , rowColumns .Count );
109113
110- Assert .Equal ( rowColumns . Count , cellColumns . Count );
114+ Assert .NotNull ( cellColumn );
111115
112- for (int i = 0 ; i < rowColumns .Count ; i ++ )
113- {
114- Assert .Equal (rowColumns [i ].Title , cellColumns [i ].Title );
115- }
116+ // The first cell should correspond to the first column in the row
117+ Assert .Equal (rowColumns [0 ].Title , cellColumn .Title );
116118 }
117119}
0 commit comments