@@ -32,18 +32,65 @@ public async Task Should_Filter_By_Status(Status status)
3232 }
3333 await Task . CompletedTask ;
3434 }
35-
35+
3636 [ Test ]
3737 [ MatrixDataSource ]
3838 [ MatrixExclusion ( Status . Draft ) ] // This should work with the base attribute
3939 public async Task Should_Filter_By_Status_Base ( Status status )
4040 {
4141 // Should generate 4 tests (all statuses except Draft)
42- // If this test runs with Status.Draft, the bug is NOT fixed
42+ // If this test runs with Status.Draft, the bug is NOT fixed
4343 if ( status == Status . Draft )
4444 {
4545 throw new InvalidOperationException ( "Draft status should have been excluded but was not!" ) ;
4646 }
4747 await Task . CompletedTask ;
4848 }
49+
50+ // Issue #3320: Test Matrix attribute with explicit enum values + MatrixExclusion
51+ [ Test ]
52+ [ MatrixDataSource ]
53+ [ MatrixExclusion ( Status . Draft ) ]
54+ public async Task Matrix_With_Explicit_Enums_Should_Respect_Exclusion (
55+ [ Matrix ( Status . Draft , Status . Pending , Status . Published ) ] Status status )
56+ {
57+ // Should generate 2 tests (Pending and Published only, Draft is excluded)
58+ await Assert . That ( status ) . IsNotEqualTo ( Status . Draft ) ;
59+ }
60+
61+ // Issue #3320: Test with multiple enum parameters and exclusion
62+ [ Test ]
63+ [ MatrixDataSource ]
64+ [ MatrixExclusion ( Status . Draft , Status . Pending ) ]
65+ public async Task Multiple_Enum_Matrix_With_Exclusion (
66+ [ Matrix ( Status . Draft , Status . Published ) ] Status status1 ,
67+ [ Matrix ( Status . Pending , Status . Archived ) ] Status status2 )
68+ {
69+ // Should exclude (Draft, Pending) combination
70+ // Should generate 3 tests: (Draft,Archived), (Published,Pending), (Published,Archived)
71+ await Assert . That ( ( status1 , status2 ) ) . IsNotEqualTo ( ( Status . Draft , Status . Pending ) ) ;
72+ }
73+
74+ // Issue #3320: Test with int cast exclusion (this was already working)
75+ [ Test ]
76+ [ MatrixDataSource ]
77+ [ MatrixExclusion ( ( int ) Status . Draft ) ]
78+ public async Task Matrix_Enum_With_Int_Exclusion (
79+ [ Matrix ( Status . Draft , Status . Pending , Status . Published ) ] Status status )
80+ {
81+ // Should generate 2 tests (Pending and Published only)
82+ await Assert . That ( status ) . IsNotEqualTo ( Status . Draft ) ;
83+ }
84+
85+ // Issue #3320: Test mixing auto-generated and explicit Matrix enums
86+ [ Test ]
87+ [ MatrixDataSource ]
88+ [ MatrixExclusion ( Status . Draft , Status . Pending ) ]
89+ public async Task Mixed_Auto_And_Explicit_Matrix_Enums (
90+ Status autoGenerated ,
91+ [ Matrix ( Status . Pending , Status . Published ) ] Status explicitMatrix )
92+ {
93+ // Should exclude (Draft, Pending) combination
94+ await Assert . That ( ( autoGenerated , explicitMatrix ) ) . IsNotEqualTo ( ( Status . Draft , Status . Pending ) ) ;
95+ }
4996}
0 commit comments