From 1312ddf0ff7412659650916e2859c3bdefeaca48 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Thu, 28 May 2026 23:26:01 -0700 Subject: [PATCH 1/3] feat(ComboBox): Add dedicated dropdown background brush Introduces `MaterialDesign.Brush.ComboBox.DropDown.Background` to provide specific theming for the ComboBox and DataGridComboBox dropdown. This change moves away from relying on the general `MaterialDesign.Brush.Background` or a complex binding setup, allowing for consistent and explicit control over the dropdown's visual style. It also removes the `RemoveAlphaBrushConverter` usage for applying the background. Fixes #3887. --- .../Themes/MaterialDesignTheme.ComboBox.xaml | 8 ++--- .../Themes/MaterialDesignTheme.Dark.xaml | 1 + ...MaterialDesignTheme.DataGrid.ComboBox.xaml | 8 ++--- .../Themes/MaterialDesignTheme.Light.xaml | 1 + .../ThemeColors.json | 9 +++++ .../WPF/ComboBoxes/ComboBoxTests.cs | 36 +++++++++++++++++++ .../WPF/Theme/ThemeTests.g.cs | 7 ++++ 7 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml index eb43db54f6..5746b3ddd4 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml @@ -534,7 +534,7 @@ PopupAnimation="Fade" RelativeHorizontalOffset="-6" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" - Tag="{DynamicResource MaterialDesign.Brush.Background}" + Tag="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}" UpVerticalOffset="15" UseLayoutRounding="{TemplateBinding UseLayoutRounding}" VerticalOffset="0"> @@ -557,7 +557,7 @@ + Background="Transparent"> @@ -796,8 +796,8 @@ - - + + diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml index c0f104b5c7..ddc770bd20 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml @@ -28,6 +28,7 @@ + diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml index 49840244c0..45e5533fe3 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml @@ -159,7 +159,7 @@ @@ -167,7 +167,7 @@ @@ -285,7 +285,7 @@ @@ -293,7 +293,7 @@ diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml index 68dac171db..8f00d024f1 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml @@ -28,6 +28,7 @@ + diff --git a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json index 9f8172bd23..f3db724322 100644 --- a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json +++ b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json @@ -246,6 +246,15 @@ }, "alternateKeys": [] }, + { + "name": "MaterialDesign.Brush.ComboBox.DropDown.Background", + "themeValues": { + "light": "Neutral900", + "dark": "Neutral100" + }, + "alternateKeys": [], + "obsoleteKeys": [] + }, { "name": "MaterialDesign.Brush.ComboBox.Popup.DarkBackground", "themeValues": { diff --git a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs index e8e423c231..67ecc714ed 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Windows.Media; using MaterialDesignThemes.UITests.WPF.TextBoxes; namespace MaterialDesignThemes.UITests.WPF.ComboBoxes; @@ -269,4 +270,39 @@ public async Task ComboBox_BorderShouldDependOnAppliedStyle(string style, double Thickness thickness = await border.GetBorderThickness(); await Assert.That(thickness).IsEqualTo(new Thickness(left, top, right, bottom)); } + + [Test] + [Description("Issue 3887")] + public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet() + { + await using var recorder = new TestRecorder(App); + + var stackPanel = await LoadXaml($$""" + + + + + + + + + + + """); + + var comboBox = await stackPanel.GetElement("Combo"); + await comboBox.LeftClick(Position.RightCenter); + + var popup = await Wait.For(async () => await comboBox.GetElement("PART_Popup")); + var popupBackground = await popup.GetProperty(Control.BackgroundProperty); + var popupBackgroundBrush = popupBackground as SolidColorBrush; + + await Assert.That(popupBackground).IsNotNull(); + await Assert.That(popupBackgroundBrush).IsNotNull(); + await Assert.That(popupBackgroundBrush!.Color).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699")); + + recorder.Success(); + } } diff --git a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs index b7063d9a20..498b8ffff3 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs @@ -53,6 +53,7 @@ private partial string GetXamlWrapPanel() + @@ -345,6 +346,11 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa Color? textBlockBackground = await textBlock.GetBackgroundColor(); await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ComboBox.OutlineBorder")); } + { + IVisualElement textBlock = await panel.GetElement("[Text=\"ComboBox.DropDown.Background\"]"); + Color? textBlockBackground = await textBlock.GetBackgroundColor(); + await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ComboBox.DropDown.Background")); + } { IVisualElement textBlock = await panel.GetElement("[Text=\"ComboBox.Popup.DarkBackground\"]"); Color? textBlockBackground = await textBlock.GetBackgroundColor(); @@ -955,6 +961,7 @@ private static IEnumerable GetBrushResourceNames() yield return "MaterialDesign.Brush.ComboBox.HoverBorder"; yield return "MaterialDesign.Brush.ComboBox.Border"; yield return "MaterialDesign.Brush.ComboBox.OutlineBorder"; + yield return "MaterialDesign.Brush.ComboBox.DropDown.Background"; yield return "MaterialDesign.Brush.ComboBox.Popup.DarkBackground"; yield return "MaterialDesign.Brush.ComboBox.Popup.DarkForeground"; yield return "MaterialDesign.Brush.ComboBox.Popup.LightBackground"; From f90d3b60b4f5676098e771779acaf7fb6c48e3de Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Thu, 28 May 2026 23:40:07 -0700 Subject: [PATCH 2/3] test(ComboBox): Simplify popup background color assertion Refactors the ComboBox popup background UI test to use a direct helper for retrieving the color value. This eliminates the need for manual casting and null checks on the brush type, making the assertion more concise. --- .../WPF/ComboBoxes/ComboBoxTests.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs index 67ecc714ed..d74644be00 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs @@ -279,11 +279,10 @@ public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet var stackPanel = await LoadXaml($$""" - + + Color="#CC336699" /> @@ -292,16 +291,14 @@ public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet """); - var comboBox = await stackPanel.GetElement("Combo"); + var comboBox = await stackPanel.GetElement(); await comboBox.LeftClick(Position.RightCenter); var popup = await Wait.For(async () => await comboBox.GetElement("PART_Popup")); - var popupBackground = await popup.GetProperty(Control.BackgroundProperty); - var popupBackgroundBrush = popupBackground as SolidColorBrush; + Color? popupBackground = await popup.GetBackgroundColor(); await Assert.That(popupBackground).IsNotNull(); - await Assert.That(popupBackgroundBrush).IsNotNull(); - await Assert.That(popupBackgroundBrush!.Color).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699")); + await Assert.That(popupBackground).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699")); recorder.Success(); } From 4e508eddb9e2f8c5df73a49799f665c50919bc44 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Thu, 11 Jun 2026 21:28:22 -0700 Subject: [PATCH 3/3] Update dependencies and refactor TUnit assertions Updates the .NET SDK and various NuGet packages, including TUnit, Microsoft.CodeAnalysis, and CommunityToolkit.Mvvm. Refactors test assertions to use native TUnit methods like IsTrue, IsFalse, and IsNull for better clarity, and removes custom assertion extensions that are no longer required. --- .editorconfig | 4 ++ Directory.packages.props | 36 +++++----- global.json | 2 +- .../MaterialDesignThemes.UITests.csproj | 1 - .../TUnit/IsCloseToExtensions.cs | 72 ------------------- .../MaterialDesignThemes.UITests/TestBase.cs | 1 + .../WPF/ComboBoxes/ComboBoxTests.cs | 5 +- .../WPF/TabControls/TabControlTests.cs | 4 +- .../ButtonProgressAssistTests.cs | 8 +-- .../DataGridAssistTests.cs | 10 +-- .../DialogHostTests.cs | 4 +- .../MaterialDesignThemes.Wpf.Tests.csproj | 8 --- 12 files changed, 38 insertions(+), 117 deletions(-) delete mode 100644 tests/MaterialDesignThemes.UITests/TUnit/IsCloseToExtensions.cs diff --git a/.editorconfig b/.editorconfig index 6d4b3ee65d..2a83363e25 100644 --- a/.editorconfig +++ b/.editorconfig @@ -132,6 +132,9 @@ csharp_style_expression_bodied_indexers = true:silent csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent +# TUnit0031: Async void methods and lambdas are not allowed +dotnet_diagnostic.TUnit0031.severity = suggestion + [*.{cs,vb}] #### Naming styles #### @@ -188,3 +191,4 @@ dotnet_style_prefer_auto_properties = true:silent dotnet_style_object_initializer = true:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_prefer_simplified_boolean_expressions = true:suggestion + diff --git a/Directory.packages.props b/Directory.packages.props index 3dc3a40120..7b6068480f 100644 --- a/Directory.packages.props +++ b/Directory.packages.props @@ -6,37 +6,37 @@ - + - + - - - - - + + + + + - + - - + + - - - - + + + + - + - - - + + + diff --git a/global.json b/global.json index c461cbf6c0..472c185ad7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.102", + "version": "10.0.301", "rollForward": "latestMinor" }, "test": { diff --git a/tests/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj b/tests/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj index 7e8746ae2c..cc91938039 100644 --- a/tests/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj +++ b/tests/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj @@ -19,7 +19,6 @@ - diff --git a/tests/MaterialDesignThemes.UITests/TUnit/IsCloseToExtensions.cs b/tests/MaterialDesignThemes.UITests/TUnit/IsCloseToExtensions.cs deleted file mode 100644 index e70a7fc67a..0000000000 --- a/tests/MaterialDesignThemes.UITests/TUnit/IsCloseToExtensions.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Numerics; -using System.Runtime.CompilerServices; -using TUnit.Assertions.Core; - -namespace MaterialDesignThemes.Tests.TUnit; - -public static class IsCloseToExtensions -{ - public static IsCloseToAssertion IsCloseTo( - this IAssertionSource source, double expected, double precision, - [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, - [CallerArgumentExpression(nameof(precision))] string? precisionExpression = null) - { - source.Context.ExpressionBuilder.Append(".IsCloseTo("); - source.Context.ExpressionBuilder.Append(expectedExpression); - source.Context.ExpressionBuilder.Append(", "); - source.Context.ExpressionBuilder.Append(precisionExpression); - source.Context.ExpressionBuilder.Append(')'); - return new IsCloseToAssertion(source.Context, expected, precision); - } - - public static IsCloseToAssertion IsCloseTo( - this IAssertionSource source, float expected, float precision, - [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, - [CallerArgumentExpression(nameof(precision))] string? precisionExpression = null) - { - source.Context.ExpressionBuilder.Append(".IsCloseTo("); - source.Context.ExpressionBuilder.Append(expectedExpression); - source.Context.ExpressionBuilder.Append(", "); - source.Context.ExpressionBuilder.Append(precisionExpression); - source.Context.ExpressionBuilder.Append(')'); - return new IsCloseToAssertion(source.Context, expected, precision); - } -} - -public class IsCloseToAssertion(AssertionContext context, TValue expected, TValue precision) : Assertion(context) - where TValue : IFloatingPoint, INumberBase -{ - protected override string GetExpectation() - { - DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new(15, 1); - defaultInterpolatedStringHandler.AppendLiteral("to be within "); - defaultInterpolatedStringHandler.AppendFormatted($"\"{precision}\""); - defaultInterpolatedStringHandler.AppendLiteral(" of "); - defaultInterpolatedStringHandler.AppendFormatted($"\"{expected}\""); - return defaultInterpolatedStringHandler.ToStringAndClear(); - } - - protected override Task CheckAsync(EvaluationMetadata metadata) - { - TValue? actualValue = metadata.Value; - Exception? exception = metadata.Exception; - if (exception != null) - { - return Task.FromResult(AssertionResult.Failed("threw " + exception.GetType().FullName)); - } - if (actualValue is null) - { - return Task.FromResult(AssertionResult.Failed($"found ")); - } - - TValue difference = actualValue - expected; - TValue absoluteDifference = TValue.Abs(difference); - bool isInRange = absoluteDifference <= precision; - - if (isInRange) - { - return Task.FromResult(AssertionResult.Passed); - } - return Task.FromResult(AssertionResult.Failed($"found {actualValue}")); - } -} diff --git a/tests/MaterialDesignThemes.UITests/TestBase.cs b/tests/MaterialDesignThemes.UITests/TestBase.cs index 93e6ccae1c..b80e7288e7 100644 --- a/tests/MaterialDesignThemes.UITests/TestBase.cs +++ b/tests/MaterialDesignThemes.UITests/TestBase.cs @@ -16,6 +16,7 @@ [assembly: GenerateHelpers(typeof(DrawerHost))] [assembly: GenerateHelpers(typeof(NumericUpDown))] [assembly: GenerateHelpers(typeof(PopupBox))] +[assembly: GenerateHelpers(typeof(ComboBoxPopup))] [assembly: GenerateHelpers(typeof(SmartHint))] [assembly: GenerateHelpers(typeof(TimePicker))] [assembly: GenerateHelpers(typeof(TreeListView))] diff --git a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs index d74644be00..c784351d2e 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs @@ -275,8 +275,6 @@ public async Task ComboBox_BorderShouldDependOnAppliedStyle(string style, double [Description("Issue 3887")] public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet() { - await using var recorder = new TestRecorder(App); - var stackPanel = await LoadXaml($$""" @@ -294,12 +292,11 @@ public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet var comboBox = await stackPanel.GetElement(); await comboBox.LeftClick(Position.RightCenter); + var popup = await Wait.For(async () => await comboBox.GetElement("PART_Popup")); Color? popupBackground = await popup.GetBackgroundColor(); await Assert.That(popupBackground).IsNotNull(); await Assert.That(popupBackground).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699")); - - recorder.Success(); } } diff --git a/tests/MaterialDesignThemes.UITests/WPF/TabControls/TabControlTests.cs b/tests/MaterialDesignThemes.UITests/WPF/TabControls/TabControlTests.cs index bfd6e48b78..ca4e7a320d 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/TabControls/TabControlTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/TabControls/TabControlTests.cs @@ -284,7 +284,7 @@ public async Task ScrollingTabs_WithNavigationPanelLeft_ShouldCorrectlySetIsOver Visibility navigationPanelVisibility = await navigationPanel.GetVisibility(); // Assert - await Assert.That(isOverflowing).IsEqualTo(true); + await Assert.That(isOverflowing).IsTrue(); await Assert.That(navigationPanelVisibility).IsEqualTo(Visibility.Visible); recorder.Success(); @@ -322,7 +322,7 @@ public async Task ScrollingTabs_WithNavigationPanelRight_ShouldCorrectlySetIsOve Visibility navigationPanelVisibility = await navigationPanel.GetVisibility(); // Assert - await Assert.That(isOverflowing).IsEqualTo(true); + await Assert.That(isOverflowing).IsTrue(); await Assert.That(navigationPanelVisibility).IsEqualTo(Visibility.Visible); recorder.Success(); diff --git a/tests/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs b/tests/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs index d7b1e72aa8..69a46665b5 100644 --- a/tests/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs +++ b/tests/MaterialDesignThemes.Wpf.Tests/ButtonProgressAssistTests.cs @@ -52,7 +52,7 @@ public async Task TestIsIndeterminateProperty() Button testElement = new(); // Assert defaults await Assert.That(ButtonProgressAssist.IsIndeterminateProperty.Name).IsEqualTo("IsIndeterminate"); - await Assert.That(ButtonProgressAssist.GetIsIndeterminate(testElement)).IsEqualTo(default(bool)); + await Assert.That(ButtonProgressAssist.GetIsIndeterminate(testElement)).IsFalse(); // Assert setting works ButtonProgressAssist.SetIsIndeterminate(testElement, false); @@ -65,7 +65,7 @@ public async Task TestIndicatorForegroundProperty() Button testElement = new(); // Assert defaults await Assert.That(ButtonProgressAssist.IndicatorForegroundProperty.Name).IsEqualTo("IndicatorForeground"); - await Assert.That(ButtonProgressAssist.GetIndicatorForeground(testElement)).IsEqualTo(default(Brush)); + await Assert.That(ButtonProgressAssist.GetIndicatorForeground(testElement)).IsNull(); // Assert setting works ButtonProgressAssist.SetIndicatorForeground(testElement, Brushes.LightBlue); @@ -78,7 +78,7 @@ public async Task TestIndicatorBackgroundProperty() Button testElement = new(); // Assert defaults await Assert.That(ButtonProgressAssist.IndicatorBackgroundProperty.Name).IsEqualTo("IndicatorBackground"); - await Assert.That(ButtonProgressAssist.GetIndicatorBackground(testElement)).IsEqualTo(default(Brush)); + await Assert.That(ButtonProgressAssist.GetIndicatorBackground(testElement)).IsNull(); // Assert setting works ButtonProgressAssist.SetIndicatorBackground(testElement, Brushes.DarkGoldenrod); @@ -91,7 +91,7 @@ public async Task TestIsIndicatorVisibleProperty() Button testElement = new(); // Assert defaults await Assert.That(ButtonProgressAssist.IsIndicatorVisibleProperty.Name).IsEqualTo("IsIndicatorVisible"); - await Assert.That(ButtonProgressAssist.GetIsIndicatorVisible(testElement)).IsEqualTo(default(bool)); + await Assert.That(ButtonProgressAssist.GetIsIndicatorVisible(testElement)).IsFalse(); // Assert setting works ButtonProgressAssist.SetIsIndicatorVisible(testElement, true); diff --git a/tests/MaterialDesignThemes.Wpf.Tests/DataGridAssistTests.cs b/tests/MaterialDesignThemes.Wpf.Tests/DataGridAssistTests.cs index 4160426dc8..e131f1bec3 100644 --- a/tests/MaterialDesignThemes.Wpf.Tests/DataGridAssistTests.cs +++ b/tests/MaterialDesignThemes.Wpf.Tests/DataGridAssistTests.cs @@ -10,7 +10,7 @@ public async Task TestAutoGeneratedCheckBoxStyleProperty() DataGrid testElement = new(); // Assert defaults await Assert.That(DataGridAssist.AutoGeneratedCheckBoxStyleProperty.Name).IsEqualTo("AutoGeneratedCheckBoxStyle"); - await Assert.That(DataGridAssist.GetAutoGeneratedCheckBoxStyle(testElement)).IsEqualTo(default(Style)); + await Assert.That(DataGridAssist.GetAutoGeneratedCheckBoxStyle(testElement)).IsNull(); // Assert setting works var style = new Style(); @@ -24,7 +24,7 @@ public async Task TestAutoGeneratedEditingCheckBoxStyleProperty() DataGrid testElement = new(); // Assert defaults await Assert.That(DataGridAssist.AutoGeneratedEditingCheckBoxStyleProperty.Name).IsEqualTo("AutoGeneratedEditingCheckBoxStyle"); - await Assert.That(DataGridAssist.GetAutoGeneratedEditingCheckBoxStyle(testElement)).IsEqualTo(default(Style)); + await Assert.That(DataGridAssist.GetAutoGeneratedEditingCheckBoxStyle(testElement)).IsNull(); // Assert setting works var style = new Style(); @@ -38,7 +38,7 @@ public async Task TestAutoGeneratedTextStyleProperty() DataGrid testElement = new(); // Assert defaults await Assert.That(DataGridAssist.AutoGeneratedTextStyleProperty.Name).IsEqualTo("AutoGeneratedTextStyle"); - await Assert.That(DataGridAssist.GetAutoGeneratedTextStyle(testElement)).IsEqualTo(default(Style)); + await Assert.That(DataGridAssist.GetAutoGeneratedTextStyle(testElement)).IsNull(); // Assert setting works var style = new Style(); @@ -52,7 +52,7 @@ public async Task TestAutoGeneratedEditingTextStyleProperty() DataGrid testElement = new(); // Assert defaults await Assert.That(DataGridAssist.AutoGeneratedEditingTextStyleProperty.Name).IsEqualTo("AutoGeneratedEditingTextStyle"); - await Assert.That(DataGridAssist.GetAutoGeneratedEditingTextStyle(testElement)).IsEqualTo(default(Style)); + await Assert.That(DataGridAssist.GetAutoGeneratedEditingTextStyle(testElement)).IsNull(); // Assert setting works var style = new Style(); @@ -96,7 +96,7 @@ public async Task TestEnableEditBoxAssistProperty() DataGrid testElement = new(); // Assert defaults await Assert.That(DataGridAssist.EnableEditBoxAssistProperty.Name).IsEqualTo("EnableEditBoxAssist"); - await Assert.That(DataGridAssist.GetEnableEditBoxAssist(testElement)).IsEqualTo(default(bool)); + await Assert.That(DataGridAssist.GetEnableEditBoxAssist(testElement)).IsFalse(); // Assert setting works DataGridAssist.SetEnableEditBoxAssist(testElement, true); diff --git a/tests/MaterialDesignThemes.Wpf.Tests/DialogHostTests.cs b/tests/MaterialDesignThemes.Wpf.Tests/DialogHostTests.cs index 17247e6d90..a3c403ccb6 100644 --- a/tests/MaterialDesignThemes.Wpf.Tests/DialogHostTests.cs +++ b/tests/MaterialDesignThemes.Wpf.Tests/DialogHostTests.cs @@ -136,12 +136,12 @@ public async Task CannotShowDialogWhileItIsAlreadyOpen() dialogHost.Identifier = id; await DialogHost.Show("Content", id, - new DialogOpenedEventHandler((async (sender, args) => + new DialogOpenedEventHandler(async (sender, args) => { var ex = await Assert.ThrowsAsync(() => DialogHost.Show("Content", id)); args.Session.Close(); await Assert.That(ex?.Message).IsEqualTo("DialogHost is already open."); - }))); + })); } [Test] diff --git a/tests/MaterialDesignThemes.Wpf.Tests/MaterialDesignThemes.Wpf.Tests.csproj b/tests/MaterialDesignThemes.Wpf.Tests/MaterialDesignThemes.Wpf.Tests.csproj index d16a480ca6..f5db9f99b1 100644 --- a/tests/MaterialDesignThemes.Wpf.Tests/MaterialDesignThemes.Wpf.Tests.csproj +++ b/tests/MaterialDesignThemes.Wpf.Tests/MaterialDesignThemes.Wpf.Tests.csproj @@ -5,9 +5,6 @@ Exe true - - - @@ -18,11 +15,6 @@ - - - - -