22using System . Linq ;
33using Microsoft . Maui . Controls . Core . UnitTests ;
44using Microsoft . Maui . Graphics ;
5- using NUnit . Framework ;
5+ using Xunit ;
66
77namespace Microsoft . Maui . Controls . Xaml . UnitTests ;
88
@@ -15,33 +15,32 @@ public Maui27202(bool useCompiledXaml)
1515 //this stub will be replaced at compile time
1616 }
1717
18- [ TestFixture ]
19- class Tests
18+ [ Collection ( "Issue" ) ]
19+ public class Tests : IDisposable
2020 {
21- [ SetUp ]
22- public void Setup ( )
21+ public Tests ( )
2322 {
24- Application . Current = new MockApplication ( ) ;
23+ Application . SetCurrentApplication ( new MockApplication ( ) ) ;
2524 }
2625
27- [ TearDown ]
28- public void TearDown ( )
26+ public void Dispose ( )
2927 {
3028 Application . Current = null ;
3129 }
3230
33- [ Test ]
34- public void DerivedStylesInheritVisualStateManager ( [ Values ] XamlInflator inflator )
31+ [ Theory ]
32+ [ XamlInflatorData ]
33+ internal void DerivedStylesInheritVisualStateManager ( XamlInflator inflator )
3534 {
3635 var page = new Maui27202 ( inflator ) ;
3736
3837 // Verify styles are applied
39- Assert . That ( page . EnabledLabel1 . TextColor , Is . EqualTo ( Colors . Green ) ) ;
38+ Assert . Equal ( Colors . Green , page . EnabledLabel1 . TextColor ) ;
4039
4140 // Verify VSG exists
4241 var groups = VisualStateManager . GetVisualStateGroups ( page . DisabledLabel1 ) ;
43- Assert . That ( groups , Is . Not . Null ) ;
44- Assert . That ( groups . Count , Is . GreaterThan ( 0 ) ) ;
42+ Assert . NotNull ( groups ) ;
43+ Assert . True ( groups . Count > 0 ) ;
4544
4645 // Check if GoToState succeeds
4746 var gotoResult = VisualStateManager . GoToState ( page . DisabledLabel1 , "Disabled" ) ;
@@ -51,9 +50,8 @@ public void DerivedStylesInheritVisualStateManager([Values] XamlInflator inflato
5150 Console . WriteLine ( $ "TextColor after GoToState: { page . DisabledLabel1 . TextColor } ") ;
5251 Console . WriteLine ( $ "Expected: Gray ({ Colors . Gray } )") ;
5352
54- Assert . That ( gotoResult , Is . True , "GoToState should succeed" ) ;
55- Assert . That ( page . DisabledLabel1 . TextColor , Is . EqualTo ( Colors . Gray ) ,
56- "VSM Disabled state should override derived style TextColor" ) ;
53+ Assert . True ( gotoResult , "GoToState should succeed" ) ;
54+ Assert . Equal ( Colors . Gray , page . DisabledLabel1 . TextColor ) ;
5755 }
5856 }
5957}
0 commit comments