@@ -128,16 +128,18 @@ public void Test_NullableBool_Test_TestObject()
128128 Assert . AreEqual ( null , obj . NullableBool , "Expected obj value to be null." ) ;
129129 }
130130
131+ #pragma warning disable SA1124 // Do not use regions
132+ #region System-based Unit Tests, See Issue #3198
133+ #pragma warning restore SA1124 // Do not use regions
134+ [ Ignore ] // This test has trouble running on CI in release mode for some reason, we should re-enable when we test WinUI 3 Issue #3106
131135 [ TestCategory ( "NullableBoolMarkupExtension" ) ]
136+
132137 [ UITestMethod ]
133- public void Test_NullableBool_DependencyProperty_SystemTrueValueFails ( )
138+ public void Test_NullableBool_DependencyProperty_SystemTrue ( )
134139 {
135140 // This is the failure case in the OS currently which causes us to need
136141 // this markup extension.
137- var exception = Assert . ThrowsException < XamlParseException > (
138- ( ) =>
139- {
140- var treeroot = XamlReader . Load ( @"<Page
142+ var treeroot = XamlReader . Load ( @"<Page
141143 xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
142144 xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
143145 xmlns:ex=""using:Microsoft.Toolkit.Uwp.UI.Extensions""
@@ -146,12 +148,61 @@ public void Test_NullableBool_DependencyProperty_SystemTrueValueFails()
146148 <helpers:ObjectWithNullableBoolProperty x:Key=""OurObject"" NullableBool=""True""/>
147149 </Page.Resources>
148150</Page>" ) as FrameworkElement ;
149- } , "Expected assignment failure during parsing, OS now supports, update documentation." ) ;
150151
151- Assert . IsNotNull ( exception ) ;
152+ var obj = treeroot . Resources [ "OurObject" ] as ObjectWithNullableBoolProperty ;
153+
154+ Assert . IsNotNull ( obj , "Could not find object in resources." ) ;
155+
156+ Assert . AreEqual ( true , obj . NullableBool , "Expected obj value to be true." ) ;
157+ }
158+
159+ [ Ignore ] // This test has trouble running on CI in release mode for some reason, we should re-enable when we test WinUI 3 Issue #3106
160+ [ TestCategory ( "NullableBoolMarkupExtension" ) ]
161+ [ UITestMethod ]
162+ public void Test_NullableBool_DependencyProperty_SystemFalse ( )
163+ {
164+ // This is the failure case in the OS currently which causes us to need
165+ // this markup extension.
166+ var treeroot = XamlReader . Load ( @"<Page
167+ xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
168+ xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
169+ xmlns:ex=""using:Microsoft.Toolkit.Uwp.UI.Extensions""
170+ xmlns:helpers=""using:UnitTests.Extensions.Helpers"">
171+ <Page.Resources>
172+ <helpers:ObjectWithNullableBoolProperty x:Key=""OurObject"" NullableBool=""False""/>
173+ </Page.Resources>
174+ </Page>" ) as FrameworkElement ;
175+
176+ var obj = treeroot . Resources [ "OurObject" ] as ObjectWithNullableBoolProperty ;
177+
178+ Assert . IsNotNull ( obj , "Could not find object in resources." ) ;
179+
180+ Assert . AreEqual ( false , obj . NullableBool , "Expected obj value to be true." ) ;
181+ }
182+
183+ [ TestCategory ( "NullableBoolMarkupExtension" ) ]
184+ [ UITestMethod ]
185+ public void Test_NullableBool_DependencyProperty_SystemNull ( )
186+ {
187+ // This is the failure case in the OS currently which causes us to need
188+ // this markup extension.
189+ var treeroot = XamlReader . Load ( @"<Page
190+ xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
191+ xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
192+ xmlns:ex=""using:Microsoft.Toolkit.Uwp.UI.Extensions""
193+ xmlns:helpers=""using:UnitTests.Extensions.Helpers"">
194+ <Page.Resources>
195+ <helpers:ObjectWithNullableBoolProperty x:Key=""OurObject"" NullableBool=""{x:Null}""/>
196+ </Page.Resources>
197+ </Page>" ) as FrameworkElement ;
198+
199+ var obj = treeroot . Resources [ "OurObject" ] as ObjectWithNullableBoolProperty ;
200+
201+ Assert . IsNotNull ( obj , "Could not find object in resources." ) ;
152202
153- Assert . IsTrue ( exception . Message . Contains ( "Failed to create a 'Windows.Foundation.IReference`1<Boolean>' from the text 'True'." ) ) ;
203+ Assert . IsNull ( obj . NullableBool , "Expected obj value to be null." ) ;
154204 }
205+ #endregion
155206
156207 [ TestCategory ( "NullableBoolMarkupExtension" ) ]
157208 [ UITestMethod ]
0 commit comments