StyleTests.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Runtime.CompilerServices;
  6. using System.Xml;
  7. using Avalonia.Controls;
  8. using Avalonia.Markup.Xaml.Styling;
  9. using Avalonia.Markup.Xaml.Templates;
  10. using Avalonia.Media;
  11. using Avalonia.Styling;
  12. using Avalonia.UnitTests;
  13. using Xunit;
  14. namespace Avalonia.Markup.Xaml.UnitTests.Xaml
  15. {
  16. public class StyleTests : XamlTestBase
  17. {
  18. [Fact]
  19. public void Color_Can_Be_Added_To_Style_Resources()
  20. {
  21. using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
  22. {
  23. var xaml = @"
  24. <UserControl xmlns='https://github.com/avaloniaui'
  25. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  26. <UserControl.Styles>
  27. <Style>
  28. <Style.Resources>
  29. <Color x:Key='color'>#ff506070</Color>
  30. </Style.Resources>
  31. </Style>
  32. </UserControl.Styles>
  33. </UserControl>";
  34. var userControl = (UserControl)AvaloniaRuntimeXamlLoader.Load(xaml);
  35. var color = (Color)((Style)userControl.Styles[0]).Resources["color"];
  36. Assert.Equal(0xff506070, color.ToUInt32());
  37. }
  38. }
  39. [Fact]
  40. public void DataTemplate_Can_Be_Added_To_Style_Resources()
  41. {
  42. using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
  43. {
  44. var xaml = @"
  45. <UserControl xmlns='https://github.com/avaloniaui'
  46. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  47. <UserControl.Styles>
  48. <Style>
  49. <Style.Resources>
  50. <DataTemplate x:Key='dataTemplate'><TextBlock/></DataTemplate>
  51. </Style.Resources>
  52. </Style>
  53. </UserControl.Styles>
  54. </UserControl>";
  55. var userControl = (UserControl)AvaloniaRuntimeXamlLoader.Load(xaml);
  56. var dataTemplate = (DataTemplate)((Style)userControl.Styles[0]).Resources["dataTemplate"];
  57. Assert.NotNull(dataTemplate);
  58. }
  59. }
  60. [Fact]
  61. public void ControlTemplate_Can_Be_Added_To_Style_Resources()
  62. {
  63. using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
  64. {
  65. var xaml = @"
  66. <UserControl xmlns='https://github.com/avaloniaui'
  67. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  68. <UserControl.Styles>
  69. <Style>
  70. <Style.Resources>
  71. <ControlTemplate x:Key='controlTemplate' TargetType='{x:Type Button}'>
  72. <ContentPresenter Content='{TemplateBinding Content}'/>
  73. </ControlTemplate>
  74. </Style.Resources>
  75. </Style>
  76. </UserControl.Styles>
  77. </UserControl>";
  78. var userControl = (UserControl)AvaloniaRuntimeXamlLoader.Load(xaml);
  79. var controlTemplate = (ControlTemplate)((Style)userControl.Styles[0]).Resources["controlTemplate"];
  80. Assert.NotNull(controlTemplate);
  81. Assert.Equal(typeof(Button), controlTemplate.TargetType);
  82. }
  83. }
  84. [Fact]
  85. public void SolidColorBrush_Can_Be_Added_To_Style_Resources()
  86. {
  87. using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
  88. {
  89. var xaml = @"
  90. <UserControl xmlns='https://github.com/avaloniaui'
  91. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  92. <UserControl.Styles>
  93. <Style>
  94. <Style.Resources>
  95. <SolidColorBrush x:Key='brush'>#ff506070</SolidColorBrush>
  96. </Style.Resources>
  97. </Style>
  98. </UserControl.Styles>
  99. </UserControl>";
  100. var userControl = (UserControl)AvaloniaRuntimeXamlLoader.Load(xaml);
  101. var brush = (ISolidColorBrush)((Style)userControl.Styles[0]).Resources["brush"];
  102. Assert.Equal(0xff506070, brush.Color.ToUInt32());
  103. }
  104. }
  105. [Fact]
  106. public void Setter_Can_Contain_Template()
  107. {
  108. using (UnitTestApplication.Start(TestServices.StyledWindow))
  109. {
  110. var xaml = @"
  111. <Window xmlns='https://github.com/avaloniaui'
  112. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  113. <Window.Styles>
  114. <Style Selector='ContentControl'>
  115. <Setter Property='Content'>
  116. <Template>
  117. <TextBlock>Hello World!</TextBlock>
  118. </Template>
  119. </Setter>
  120. </Style>
  121. </Window.Styles>
  122. <ContentControl Name='target'/>
  123. </Window>";
  124. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  125. var target = window.Find<ContentControl>("target");
  126. Assert.IsType<TextBlock>(target.Content);
  127. Assert.Equal("Hello World!", ((TextBlock)target.Content).Text);
  128. }
  129. }
  130. [Fact]
  131. public void Setter_Value_Is_Bound_Directly_If_The_Target_Type_Derives_From_ITemplate()
  132. {
  133. using (UnitTestApplication.Start(TestServices.StyledWindow))
  134. {
  135. var xaml = @"
  136. <Window xmlns='https://github.com/avaloniaui'
  137. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  138. <Window.Styles>
  139. <Style Selector=':is(Control)'>
  140. <Setter Property='FocusAdorner'>
  141. <FocusAdornerTemplate>
  142. <Rectangle Stroke='Black'
  143. StrokeThickness='1'
  144. StrokeDashArray='1,2'/>
  145. </FocusAdornerTemplate>
  146. </Setter>
  147. </Style>
  148. </Window.Styles>
  149. <TextBlock Name='target'/>
  150. </Window>";
  151. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  152. var target = window.Find<TextBlock>("target");
  153. Assert.NotNull(target.FocusAdorner);
  154. }
  155. }
  156. [Fact]
  157. public void Setter_Can_Set_Attached_Property()
  158. {
  159. using (UnitTestApplication.Start(TestServices.StyledWindow))
  160. {
  161. var xaml = @"
  162. <Window xmlns='https://github.com/avaloniaui'
  163. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
  164. xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Xaml;assembly=Avalonia.Markup.Xaml.UnitTests'>
  165. <Window.Styles>
  166. <Style Selector='TextBlock'>
  167. <Setter Property='DockPanel.Dock' Value='Right'/>
  168. </Style>
  169. </Window.Styles>
  170. <TextBlock/>
  171. </Window>";
  172. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  173. var textBlock = (TextBlock)window.Content;
  174. window.ApplyTemplate();
  175. Assert.Equal(Dock.Right, DockPanel.GetDock(textBlock));
  176. }
  177. }
  178. [Fact(Skip = "The animation system currently needs to be able to set any property on any object")]
  179. public void Disallows_Setting_Non_Registered_Property()
  180. {
  181. using (UnitTestApplication.Start(TestServices.StyledWindow))
  182. {
  183. var xaml = @"
  184. <Window xmlns='https://github.com/avaloniaui'
  185. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
  186. xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Xaml;assembly=Avalonia.Markup.Xaml.UnitTests'>
  187. <Window.Styles>
  188. <Style Selector='TextBlock'>
  189. <Setter Property='Button.IsDefault' Value='True'/>
  190. </Style>
  191. </Window.Styles>
  192. <TextBlock/>
  193. </Window>";
  194. var ex = Assert.Throws<XmlException>(() => AvaloniaRuntimeXamlLoader.Load(xaml));
  195. Assert.Equal(
  196. "Property 'Button.IsDefault' is not registered on 'Avalonia.Controls.TextBlock'.",
  197. ex.InnerException.Message);
  198. }
  199. }
  200. [Fact]
  201. public void Style_Can_Use_Not_Selector()
  202. {
  203. using (UnitTestApplication.Start(TestServices.StyledWindow))
  204. {
  205. var xaml = @"
  206. <Window xmlns='https://github.com/avaloniaui'
  207. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  208. <Window.Styles>
  209. <Style Selector='Border:not(.foo)'>
  210. <Setter Property='Background' Value='Red'/>
  211. </Style>
  212. </Window.Styles>
  213. <StackPanel>
  214. <Border Name='foo' Classes='foo bar'/>
  215. <Border Name='notFoo' Classes='bar'/>
  216. </StackPanel>
  217. </Window>";
  218. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  219. var foo = window.FindControl<Border>("foo");
  220. var notFoo = window.FindControl<Border>("notFoo");
  221. Assert.Null(foo.Background);
  222. Assert.Equal(Colors.Red, ((ISolidColorBrush)notFoo.Background).Color);
  223. }
  224. }
  225. [Fact]
  226. public void Style_Can_Use_NthChild_Selector()
  227. {
  228. using (UnitTestApplication.Start(TestServices.StyledWindow))
  229. {
  230. var xaml = @"
  231. <Window xmlns='https://github.com/avaloniaui'
  232. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  233. <Window.Styles>
  234. <Style Selector='Border.foo:nth-child(2n+1)'>
  235. <Setter Property='Background' Value='Red'/>
  236. </Style>
  237. </Window.Styles>
  238. <StackPanel>
  239. <Border x:Name='b1' Classes='foo'/>
  240. <Border x:Name='b2' />
  241. </StackPanel>
  242. </Window>";
  243. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  244. var b1 = window.FindControl<Border>("b1");
  245. var b2 = window.FindControl<Border>("b2");
  246. Assert.Equal(Brushes.Red, b1.Background);
  247. Assert.Null(b2.Background);
  248. }
  249. }
  250. [Fact]
  251. public void Style_Can_Use_NthChild_Selector_After_Reorder()
  252. {
  253. using (UnitTestApplication.Start(TestServices.StyledWindow))
  254. {
  255. var xaml = @"
  256. <Window xmlns='https://github.com/avaloniaui'
  257. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  258. <Window.Styles>
  259. <Style Selector='Border:nth-child(2n)'>
  260. <Setter Property='Background' Value='Red'/>
  261. </Style>
  262. </Window.Styles>
  263. <StackPanel x:Name='parent'>
  264. <Border x:Name='b1' />
  265. <Border x:Name='b2' />
  266. </StackPanel>
  267. </Window>";
  268. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  269. var parent = window.FindControl<StackPanel>("parent");
  270. var b1 = window.FindControl<Border>("b1");
  271. var b2 = window.FindControl<Border>("b2");
  272. Assert.Null(b1.Background);
  273. Assert.Equal(Brushes.Red, b2.Background);
  274. parent.Children.Remove(b1);
  275. Assert.Null(b1.Background);
  276. Assert.Null(b2.Background);
  277. parent.Children.Add(b1);
  278. Assert.Equal(Brushes.Red, b1.Background);
  279. Assert.Null(b2.Background);
  280. }
  281. }
  282. [Fact]
  283. public void Style_Can_Use_NthLastChild_Selector_After_Reorder()
  284. {
  285. using (UnitTestApplication.Start(TestServices.StyledWindow))
  286. {
  287. var xaml = @"
  288. <Window xmlns='https://github.com/avaloniaui'
  289. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  290. <Window.Styles>
  291. <Style Selector='Border:nth-last-child(2n)'>
  292. <Setter Property='Background' Value='Red'/>
  293. </Style>
  294. </Window.Styles>
  295. <StackPanel x:Name='parent'>
  296. <Border x:Name='b1' />
  297. <Border x:Name='b2' />
  298. </StackPanel>
  299. </Window>";
  300. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  301. var parent = window.FindControl<StackPanel>("parent");
  302. var b1 = window.FindControl<Border>("b1");
  303. var b2 = window.FindControl<Border>("b2");
  304. Assert.Equal(Brushes.Red, b1.Background);
  305. Assert.Null(b2.Background);
  306. parent.Children.Remove(b1);
  307. Assert.Null(b1.Background);
  308. Assert.Null(b2.Background);
  309. parent.Children.Add(b1);
  310. Assert.Null(b1.Background);
  311. Assert.Equal(Brushes.Red, b2.Background);
  312. }
  313. }
  314. [Fact]
  315. public void Style_Can_Use_NthChild_Selector_With_ListBox()
  316. {
  317. using (UnitTestApplication.Start(TestServices.StyledWindow))
  318. {
  319. var xaml = @"
  320. <Window xmlns='https://github.com/avaloniaui'
  321. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  322. <Window.Styles>
  323. <Style Selector='ListBoxItem:nth-child(2n)'>
  324. <Setter Property='Background' Value='{Binding}'/>
  325. </Style>
  326. </Window.Styles>
  327. <ListBox x:Name='list' />
  328. </Window>";
  329. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  330. var collection = new ObservableCollection<IBrush>()
  331. {
  332. Brushes.Red, Brushes.Green, Brushes.Blue
  333. };
  334. var list = window.FindControl<ListBox>("list");
  335. list.ItemsSource = collection;
  336. window.Show();
  337. IEnumerable<IBrush> GetColors() => list.GetRealizedContainers().Cast<ListBoxItem>().Select(t => t.Background);
  338. Assert.Equal(new[] { Brushes.Transparent, Brushes.Green, Brushes.Transparent }, GetColors());
  339. collection.Remove(Brushes.Green);
  340. window.UpdateLayout();
  341. Assert.Equal(new[] { Brushes.Transparent, Brushes.Blue }, GetColors());
  342. collection.Add(Brushes.Violet);
  343. collection.Add(Brushes.Black);
  344. window.UpdateLayout();
  345. Assert.Equal(new[] { Brushes.Transparent, Brushes.Blue, Brushes.Transparent, Brushes.Black }, GetColors());
  346. }
  347. }
  348. [Fact]
  349. public void Style_Can_Use_Or_Selector_1()
  350. {
  351. using (UnitTestApplication.Start(TestServices.StyledWindow))
  352. {
  353. var xaml = @"
  354. <Window xmlns='https://github.com/avaloniaui'
  355. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  356. <Window.Styles>
  357. <Style Selector='Border.foo, Border.bar'>
  358. <Setter Property='Background' Value='Red'/>
  359. </Style>
  360. </Window.Styles>
  361. <StackPanel>
  362. <Border Name='foo' Classes='foo'/>
  363. <Border Name='bar' Classes='bar'/>
  364. <Border Name='baz' Classes='baz'/>
  365. </StackPanel>
  366. </Window>";
  367. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  368. var foo = window.FindControl<Border>("foo");
  369. var bar = window.FindControl<Border>("bar");
  370. var baz = window.FindControl<Border>("baz");
  371. Assert.Equal(Brushes.Red, foo.Background);
  372. Assert.Equal(Brushes.Red, bar.Background);
  373. Assert.Null(baz.Background);
  374. }
  375. }
  376. [Fact]
  377. public void Style_Can_Use_Or_Selector_2()
  378. {
  379. using (UnitTestApplication.Start(TestServices.StyledWindow))
  380. {
  381. var xaml = @"
  382. <Window xmlns='https://github.com/avaloniaui'
  383. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  384. <Window.Styles>
  385. <Style Selector='Button,Carousel,ListBox'>
  386. <Setter Property='Background' Value='Red'/>
  387. </Style>
  388. </Window.Styles>
  389. <StackPanel>
  390. <Button Name='button'/>
  391. <Carousel Name='carousel'/>
  392. <ListBox Name='listBox'/>
  393. </StackPanel>
  394. </Window>";
  395. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  396. var button = window.FindControl<Button>("button");
  397. var carousel = window.FindControl<Carousel>("carousel");
  398. var listBox = window.FindControl<ListBox>("listBox");
  399. Assert.Equal(Brushes.Red, button.Background);
  400. Assert.Equal(Brushes.Red, carousel.Background);
  401. Assert.Equal(Brushes.Red, listBox.Background);
  402. }
  403. }
  404. [Fact]
  405. public void Transitions_Can_Be_Styled()
  406. {
  407. using (UnitTestApplication.Start(TestServices.StyledWindow))
  408. {
  409. var xaml = @"
  410. <Window xmlns='https://github.com/avaloniaui'
  411. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  412. <Window.Styles>
  413. <Style Selector='Border'>
  414. <Setter Property='Transitions'>
  415. <Transitions>
  416. <DoubleTransition Property='Width' Duration='0:0:1'/>
  417. </Transitions>
  418. </Setter>
  419. </Style>
  420. <Style Selector='Border.foo'>
  421. <Setter Property='Transitions'>
  422. <Transitions>
  423. <DoubleTransition Property='Height' Duration='0:0:1'/>
  424. </Transitions>
  425. </Setter>
  426. </Style>
  427. </Window.Styles>
  428. <Border/>
  429. </Window>";
  430. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  431. var border = (Border)window.Content;
  432. Assert.Equal(1, border.Transitions.Count);
  433. Assert.Equal(Border.WidthProperty, border.Transitions[0].Property);
  434. border.Classes.Add("foo");
  435. Assert.Equal(1, border.Transitions.Count);
  436. Assert.Equal(Border.HeightProperty, border.Transitions[0].Property);
  437. border.Classes.Remove("foo");
  438. Assert.Equal(1, border.Transitions.Count);
  439. Assert.Equal(Border.WidthProperty, border.Transitions[0].Property);
  440. }
  441. }
  442. [Fact]
  443. public void Style_Can_Use_Class_Selector_With_Dash()
  444. {
  445. using (UnitTestApplication.Start(TestServices.StyledWindow))
  446. {
  447. var xaml = @"
  448. <Window xmlns='https://github.com/avaloniaui'
  449. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  450. <Window.Styles>
  451. <Style Selector='Border.foo-bar'>
  452. <Setter Property='Background' Value='Red'/>
  453. </Style>
  454. </Window.Styles>
  455. <StackPanel>
  456. <Border Name='foo' Classes='foo-bar'/>
  457. </StackPanel>
  458. </Window>";
  459. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  460. var foo = window.FindControl<Border>("foo");
  461. Assert.Equal(Colors.Red, ((ISolidColorBrush)foo.Background).Color);
  462. }
  463. }
  464. [Fact]
  465. public void Style_Can_Use_Pseudolass_Selector_With_Dash()
  466. {
  467. using (UnitTestApplication.Start(TestServices.StyledWindow))
  468. {
  469. var xaml = @"
  470. <Window xmlns='https://github.com/avaloniaui'
  471. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  472. <Window.Styles>
  473. <Style Selector='Border:foo-bar'>
  474. <Setter Property='Background' Value='Red'/>
  475. </Style>
  476. </Window.Styles>
  477. <StackPanel>
  478. <Border Name='foo'/>
  479. </StackPanel>
  480. </Window>";
  481. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  482. var foo = window.FindControl<Border>("foo");
  483. Assert.Null(foo.Background);
  484. ((IPseudoClasses)foo.Classes).Add(":foo-bar");
  485. Assert.Equal(Colors.Red, ((ISolidColorBrush)foo.Background).Color);
  486. }
  487. }
  488. [Fact]
  489. public void Can_Use_Nested_Styles()
  490. {
  491. using (UnitTestApplication.Start(TestServices.StyledWindow))
  492. {
  493. var xaml = @"
  494. <Window xmlns='https://github.com/avaloniaui'
  495. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  496. <Window.Styles>
  497. <Style Selector='Border'>
  498. <Style Selector='^.foo'>
  499. <Setter Property='Background' Value='Red'/>
  500. </Style>
  501. </Style>
  502. </Window.Styles>
  503. <StackPanel>
  504. <Border Name='foo'/>
  505. </StackPanel>
  506. </Window>";
  507. var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
  508. var foo = window.FindControl<Border>("foo");
  509. Assert.Null(foo.Background);
  510. foo.Classes.Add("foo");
  511. Assert.Equal(Colors.Red, ((ISolidColorBrush)foo.Background).Color);
  512. }
  513. }
  514. [Fact]
  515. public void Multiple_Errors_Are_Reported()
  516. {
  517. using (UnitTestApplication.Start(TestServices.StyledWindow))
  518. {
  519. var xaml = @"
  520. <Window xmlns='https://github.com/avaloniaui'
  521. xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  522. <Window.Styles>
  523. <Style Selector='5' />
  524. <Style Selector='NonExistentType' />
  525. <Style Selector='Border:normal' />
  526. <Style Selector='Border+invalid' />
  527. </Window.Styles>
  528. </Window>";
  529. var ex = Assert.Throws<AggregateException>(() => (Window)AvaloniaRuntimeXamlLoader.Load(xaml));
  530. Assert.Collection(
  531. ex.InnerExceptions,
  532. inner => Assert.IsAssignableFrom<XmlException>(inner),
  533. inner => Assert.IsAssignableFrom<XmlException>(inner),
  534. inner => Assert.IsAssignableFrom<XmlException>(inner));
  535. }
  536. }
  537. }
  538. }