diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/BarChartWithSingleXAxisTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/BarChartWithSingleXAxisTest.razor
index ebd5fb29f7e9..1a04e809fc92 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/BarChartWithSingleXAxisTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/BarChartWithSingleXAxisTest.razor
@@ -7,12 +7,12 @@
private int _index = -1; //default value cannot be 0 -> first selectedindex is 0.
- public List
Series = new List()
- {
- new ChartSeries() { Name = "United States", Data = new double[] { 40} },
- new ChartSeries() { Name = "Germany", Data = new double[] { 19 } },
- new ChartSeries() { Name = "Sweden", Data = new double[] { 8 } },
- };
+ public List Series =
+ [
+ new() { Name = "United States", Data = [40] },
+ new() { Name = "Germany", Data = [19] },
+ new() { Name = "Sweden", Data = [8] }
+ ];
- public string[] XAxisLabels = { "Jan" };
+ public string[] XAxisLabels = ["Jan"];
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomColorsTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomColorsTest.razor
index 83c3c943b159..e70a4367f700 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomColorsTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomColorsTest.razor
@@ -1,21 +1,21 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -23,62 +23,64 @@
@code {
public static string __description__ = "Charts with custom colors using ChartOptions.";
- public double[] Data = { 50, 25, 20, 5, 16, 14, 8, 4, 2, 8, 10, 19, 8, 17, 6, 11, 19, 24, 35, 13, 20, 12 };
+ public double[] Data = [50, 25, 20, 5, 16, 14, 8, 4, 2, 8, 10, 19, 8, 17, 6, 11, 19, 24, 35, 13, 20, 12];
- public string[] Labels = { "Deep Sea Blue", "Venetian Red", "Banana Yellow", "La Salle Green", "Rich Carmine", "Shiraz", "Cloud Burst",
- "Neon Pink", "Ocean", "Orangey Red", "Catalina Blue", "Fountain Blue", "Irish Green", "Wild Strawberry",
- "Geraldine", "Grey Teal", "Baby Pink", "Thunderbird", "Navy", "Aqua Marina", "Lavender Pinocchio", "Deep Sea Blue"
+ public string[] Labels =
+ [
+ "Deep Sea Blue", "Venetian Red", "Banana Yellow", "La Salle Green", "Rich Carmine", "Shiraz", "Cloud Burst",
+ "Neon Pink", "Ocean", "Orangey Red", "Catalina Blue", "Fountain Blue", "Irish Green", "Wild Strawberry",
+ "Geraldine", "Grey Teal", "Baby Pink", "Thunderbird", "Navy", "Aqua Marina", "Lavender Pinocchio", "Deep Sea Blue"
+ ];
- };
+ public List Series1 =
+ [
+ new() { Name = "Deep Sea Blue", Data = [40, 20, 25, 27, 46] },
+ new() { Name = "Venetian Red", Data = [19, 24, 35, 13, 28] },
+ new() { Name = "Banana Yellow", Data = [8, 6, 11, 13, 4] },
+ new() { Name = "La Salle Green", Data = [18, 9, 7, 10, 7] },
+ new() { Name = "Rich Carmine", Data = [9, 14, 6, 15, 20] },
+ new() { Name = "Shiraz", Data = [9, 4, 11, 5, 19] },
+ new() { Name = "Cloud Burst", Data = [14, 9, 20, 16, 6] },
+ new() { Name = "Neon Pink", Data = [14, 8, 4, 14, 8] },
+ new() { Name = "Ocean", Data = [11, 20, 13, 5, 5] },
+ new() { Name = "Orangey Red", Data = [6, 6, 19, 20, 6] },
+ new() { Name = "Catalina Blue", Data = [3, 2, 20, 3, 10] },
+ new() { Name = "Fountain Blue", Data = [3, 18, 11, 12, 3] },
+ new() { Name = "Irish Green", Data = [20, 5, 15, 16, 13] },
+ new() { Name = "Wild Strawberry", Data = [15, 9, 12, 12, 1] },
+ new() { Name = "Geraldine", Data = [5, 13, 19, 15, 8] },
+ new() { Name = "Grey Teal", Data = [12, 16, 20, 16, 17] },
+ new() { Name = "Baby Pink", Data = [1, 18, 10, 19, 8] },
+ new() { Name = "Thunderbird", Data = [15, 16, 10, 8, 5] },
+ new() { Name = "Navy", Data = [16, 2, 3, 5, 5] },
+ new() { Name = "Aqua Marina", Data = [17, 6, 11, 19, 6] },
+ new() { Name = "Lavender Pinocchio", Data = [1, 11, 4, 18, 1] },
+ new() { Name = "Deep Sea Blue", Data = [1, 11, 4, 18, 1] }
+ ];
- public List Series1 = new List()
- {
- new ChartSeries() { Name = "Deep Sea Blue", Data = new double[] { 40, 20, 25, 27, 46 } },
- new ChartSeries() { Name = "Venetian Red", Data = new double[] { 19, 24, 35, 13, 28 } },
- new ChartSeries() { Name = "Banana Yellow", Data = new double[] { 8, 6, 11, 13, 4 } },
- new ChartSeries() { Name = "La Salle Green", Data = new double[] { 18, 9, 7, 10, 7 } },
- new ChartSeries() { Name = "Rich Carmine", Data = new double[] { 9, 14, 6, 15, 20 } },
- new ChartSeries() { Name = "Shiraz", Data = new double[] { 9, 4, 11, 5, 19 } },
- new ChartSeries() { Name = "Cloud Burst", Data = new double[] { 14, 9, 20, 16, 6 } },
- new ChartSeries() { Name = "Neon Pink", Data = new double[] { 14, 8, 4, 14, 8 } },
- new ChartSeries() { Name = "Ocean", Data = new double[] { 11, 20, 13, 5, 5 } },
- new ChartSeries() { Name = "Orangey Red", Data = new double[] { 6, 6, 19, 20, 6 } },
- new ChartSeries() { Name = "Catalina Blue", Data = new double[] { 3, 2, 20, 3, 10 } },
- new ChartSeries() { Name = "Fountain Blue", Data = new double[] { 3, 18, 11, 12, 3 } },
- new ChartSeries() { Name = "Irish Green", Data = new double[] { 20, 5, 15, 16, 13 } },
- new ChartSeries() { Name = "Wild Strawberry", Data = new double[] { 15, 9, 12, 12, 1 } },
- new ChartSeries() { Name = "Geraldine", Data = new double[] { 5, 13, 19, 15, 8 } },
- new ChartSeries() { Name = "Grey Teal", Data = new double[] { 12, 16, 20, 16, 17 } },
- new ChartSeries() { Name = "Baby Pink", Data = new double[] { 1, 18, 10, 19, 8 } },
- new ChartSeries() { Name = "Thunderbird", Data = new double[] { 15, 16, 10, 8, 5 } },
- new ChartSeries() { Name = "Navy", Data = new double[] { 16, 2, 3, 5, 5 } },
- new ChartSeries() { Name = "Aqua Marina", Data = new double[] { 17, 6, 11, 19, 6 } },
- new ChartSeries() { Name = "Lavender Pinocchio", Data = new double[] { 1, 11, 4, 18, 1 } },
- new ChartSeries() { Name = "Deep Sea Blue", Data = new double[] { 1, 11, 4, 18, 1 } }
- };
+ public List Series2 =
+ [
+ new() { Name = "Deep Sea Blue", Data = [40, 20, 25, 27, 46] },
+ new() { Name = "Venetian Red", Data = [19, 24, 35, 13, 28] },
+ new() { Name = "Banana Yellow", Data = [8, 6, 11, 13, 4] }
+ ];
- public List Series2 = new List()
- {
- new ChartSeries() { Name = "Deep Sea Blue", Data = new double[] { 40, 20, 25, 27, 46 } },
- new ChartSeries() { Name = "Venetian Red", Data = new double[] { 19, 24, 35, 13, 28 } },
- new ChartSeries() { Name = "Banana Yellow", Data = new double[] { 8, 6, 11, 13, 4 } },
- };
-
- public string[] XAxisLabels = { "1", "2", "3", "4", "5" };
+ public string[] XAxisLabels = ["1", "2", "3", "4", "5"];
- private ChartOptions Options1 = new ChartOptions()
+ private readonly ChartOptions _options1 = new()
{
- ChartPalette = new string[] { "#015482", "#CC1512", "#FFE135", "#087830", "#D70040", "#B20931", "#202E54", "#F535AA", "#017B92",
- "#FA4224", "#062A78", "#56B4BE", "#207000", "#FF43A4", "#FB8989", "#5E9B8A", "#FFB7CE", "#C02B18",
- "#01153E", "#2EE8BB", "#EBDDE2"
- },
+ ChartPalette =
+ [
+ "#015482", "#CC1512", "#FFE135", "#087830", "#D70040", "#B20931", "#202E54", "#F535AA", "#017B92",
+ "#FA4224", "#062A78", "#56B4BE", "#207000", "#FF43A4", "#FB8989", "#5E9B8A", "#FFB7CE", "#C02B18",
+ "#01153E", "#2EE8BB", "#EBDDE2"
+ ],
};
- private ChartOptions Options2 = new ChartOptions()
+ private readonly ChartOptions _options2 = new()
{
- ChartPalette = new string[] { "#5bdfeb" },
+ ChartPalette = ["#5bdfeb"],
ShowLegend = false
};
-
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomGraphicsTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomGraphicsTest.razor
index e108a71c0d16..f61bf160fc91 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomGraphicsTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/ChartsWithCustomGraphicsTest.razor
@@ -1,6 +1,6 @@
-
+
Chart
DONUT
@@ -8,7 +8,7 @@
-
+
PIE
@@ -42,16 +42,15 @@
@code {
public static string __description__ = "Charts with custom svg graphics using a RenderFragment.";
- public double[] data = { 10, 420, 20, 69 };
- public string[] labels = { "Data 1", "Data 2", "Data 3", "Data 4" };
+ public double[] Data = [10, 420, 20, 69];
+ public string[] Labels = ["Data 1", "Data 2", "Data 3", "Data 4"];
- public List Series = new List()
- {
- new ChartSeries() { Name = "United States", Data = new double[] { 40, 20, 25, 27, 46, 60, 48, 80, 15 } },
- new ChartSeries() { Name = "Germany", Data = new double[] { 19, 24, 35, 13, 28, 15, -4, 16, 31 } },
- new ChartSeries() { Name = "Sweden", Data = new double[] { 8, 6, -11, 13, 4, 16, 10, 16, 18 } },
- };
-
- public string[] XAxisLabels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
+ public List Series =
+ [
+ new() { Name = "United States", Data = [40, 20, 25, 27, 46, 60, 48, 80, 15] },
+ new() { Name = "Germany", Data = [19, 24, 35, 13, 28, 15, -4, 16, 31] },
+ new() { Name = "Sweden", Data = [8, 6, -11, 13, 4, 16, 10, 16, 18] }
+ ];
+ public string[] XAxisLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartSelectionTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartSelectionTest.razor
index f0364244ba63..bd3b0091b73a 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartSelectionTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartSelectionTest.razor
@@ -1,17 +1,18 @@
-
- Selected portion of the chart: @Index
+
+ Selected portion of the chart: @_index
@code {
public static string __description__ = "Clicking the chart series or legend should update the index.";
- private int Index = -1; //default value cannot be 0 -> first selectedindex is 0.
+ private int _index = -1; //default value cannot be 0 -> first selectedindex is 0.
- public List Series = new List()
- {
- new ChartSeries() { Name = "Series 1", Data = new double[] { 90, 79, 72, 69, 62, 62, 55, 65, 70 } },
- new ChartSeries() { Name = "Series 2", Data = new double[] { 10, 41, 35, 51, 49, 62, 69, 91, 148 } },
- };
- public string[] XAxisLabels = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
+ public List Series =
+ [
+ new() { Name = "Series 1", Data = [90, 79, 72, 69, 62, 62, 55, 65, 70] },
+ new() { Name = "Series 2", Data = [10, 41, 35, 51, 49, 62, 69, 91, 148] }
+ ];
+
+ public string[] XAxisLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithBigValuesTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithBigValuesTest.razor
index b0deea7afb82..707c4075055d 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithBigValuesTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithBigValuesTest.razor
@@ -1,16 +1,15 @@
-
+
@code {
public static string __description__ = "Number of horizontal tick lines should be limited to sane values.";
- private int Index = -1; //default value cannot be 0 -> first selectedindex is 0.
+ private int _index = -1; //default value cannot be 0 -> first selectedindex is 0.
- public List Series = new List()
- {
- new ChartSeries() { Name = "Series 1", Data = new double[] { 112368124, 114457907, 108509186, 69, 62, 62, 55, 65, 70 } }
- };
- public string[] XAxisLabels = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
-
+ public List Series =
+ [
+ new() { Name = "Series 1", Data = [112368124, 114457907, 108509186, 69, 62, 62, 55, 65, 70] }
+ ];
+ public string[] XAxisLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithZeroValuesTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithZeroValuesTest.razor
index f74050eb0345..a51ffdd9935c 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithZeroValuesTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Charts/LineChartWithZeroValuesTest.razor
@@ -7,10 +7,10 @@
private int _index = -1; //default value cannot be 0 -> first selectedindex is 0.
- public List Series = new List()
- {
- new ChartSeries() { Name = "Series 1", Data = new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
- };
+ public List Series =
+ [
+ new() { Name = "Series 1", Data = [0, 0, 0, 0, 0, 0, 0, 0, 0] }
+ ];
- public string[] XAxisLabels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
+ public string[] XAxisLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"];
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxFormTest1.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxFormTest1.razor
index 5a1690b4b709..5733c8a5cdca 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxFormTest1.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxFormTest1.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
You agree that MudBlazor is awesome
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest3.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest3.razor
index 6fa2e38f2b46..5177a254c15c 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest3.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest3.razor
@@ -1,10 +1,8 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-Synced
-Synced
+Synced
+Synced
@code {
public static string __description__ = "Clicking any checkbox should toggle both.";
- bool is_checked = true;
+ private bool _isChecked = true;
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest4.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest4.razor
index 352074ebabe7..da984f2d365f 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest4.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxTest4.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-Dense
+Dense
Small
Normal
Large
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxesBindAgainstArrayTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxesBindAgainstArrayTest.razor
index a4ca47d175b6..c7073788e309 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxesBindAgainstArrayTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/CheckBox/CheckBoxesBindAgainstArrayTest.razor
@@ -1,28 +1,19 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
- @for (int i = 0; i < amenities.Length; i++)
+
+ @for (int i = 0; i < _amenities.Length; i++)
{
var local = i;
- @amenities[local]
+ @_amenities[local]
}
- @selected
+ @Selected
@code {
public static string __description__ = "Binding checkboxes two-way against an array of bools";
- private string[] amenities =
- {
- "A", "B", "C", "D", "E"
- };
-
- private bool[] values =
- {
- true, false, true, false, true
- };
- string selected => string.Join(", ", amenities.Zip(values, (a, b)=>$"{a}={b}"));
+ private readonly string[] _amenities = ["A", "B", "C", "D", "E"];
+ private readonly bool[] _values = [true, false, true, false, true];
+ private string Selected => string.Join(", ", _amenities.Zip(_values, (a, b)=>$"{a}={b}"));
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipAvatarContentTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipAvatarContentTest.razor
index 2f01e1c1befd..86e3c8b0853c 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipAvatarContentTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipAvatarContentTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
JD
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipHrefCursorTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipHrefCursorTest.razor
index 3d17b5c1b08f..7b65bf3bdfae 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipHrefCursorTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipHrefCursorTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@code
{
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipLinkTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipLinkTest.razor
index 7fd094c4f3fe..049d407da8dc 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipLinkTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipLinkTest.razor
@@ -1,16 +1,12 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@_event
@code
{
public static string __description__ = "Chip with link";
- private string _event = "";
- private void Click() {
- _event = "OnClick";
- }
-
- private void Close() {
- _event = "OnClose";
- }
+
+ private string _event = string.Empty;
+
+ private void Click() => _event = "OnClick";
+
+ private void Close() => _event = "OnClose";
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipOnClickTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipOnClickTest.razor
index 753516fd919a..9bcecc6ee6ed 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipOnClickTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Chip/ChipOnClickTest.razor
@@ -1,16 +1,13 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@_event
+
@code
{
public static string __description__ = "OnClick or OnClose should be displayed when clicking on the chip.";
- private string _event = "";
- private void Click() {
- _event = "OnClick";
- }
-
- private void Close() {
- _event = "OnClose";
- }
+
+ private string _event = string.Empty;
+
+ private void Click() => _event = "OnClick";
+
+ private void Close() => _event = "OnClose";
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetChipBindingTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetChipBindingTest.razor
index 456a9065c074..86d447700c30 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetChipBindingTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetChipBindingTest.razor
@@ -16,7 +16,7 @@
}
else
{
- Add ingredients to your coctail.
+ Add ingredients to your cocktail.
}
@@ -30,9 +30,8 @@
@code
{
- private string[] _ingredients = ["Vodka", "Tomato Juice", "Olive", "Peppermint", "Vermouth", "Coconut Milk", "Port Wine"];
- private bool[] _included = new bool[7];
- private IReadOnlyCollection _selected;
-
+ private readonly string[] _ingredients = ["Vodka", "Tomato Juice", "Olive", "Peppermint", "Vermouth", "Coconut Milk", "Port Wine"];
+ private readonly bool[] _included = new bool[7];
+ private IReadOnlyCollection? _selected;
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetClearSelectionTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetClearSelectionTest.razor
index 010583273651..bd1c2f0c55ca 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetClearSelectionTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetClearSelectionTest.razor
@@ -1,5 +1,3 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
@@ -10,8 +8,7 @@
-
-@if (_selected != null && _selected.Count > 0) {
+@if (_selected is { Count: > 0 }) {
@string.Join(", ", _selected.OrderBy(x => x))
}
else {
@@ -21,15 +18,9 @@ else {
Set Empty
@code
{
- private IReadOnlyCollection _selected;
+ private IReadOnlyCollection? _selected;
- private void SetNull()
- {
- _selected = null;
- }
+ private void SetNull() => _selected = null;
- private void SetEmpty()
- {
- _selected = Array.Empty();
- }
+ private void SetEmpty() => _selected = Array.Empty();
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetComparerTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetComparerTest.razor
index 49eedf8eb807..383bbf5b7c6e 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetComparerTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetComparerTest.razor
@@ -1,8 +1,6 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
-
+
@@ -20,30 +18,33 @@
@code {
public static string __description__ = "The comparer should be used to compare coffee objects in chipset";
- private CoffeeComparer Comparer { get; } = new();
-
- IReadOnlyCollection Selected { get; set; } = Array.Empty();
+
+ private readonly CoffeeComparer _comparer = new();
+ private IReadOnlyCollection Selected { get; set; } = Array.Empty();
- void SelectedChanged(IEnumerable newSelected)
+ private void SelectedChanged(IEnumerable newSelected)
{
Selected = newSelected.ToHashSet();
}
- void SetSelection()
+ private void SetSelection()
{
- Selected = new[] { new Coffee("lat", "Cafe Latte!"), new Coffee("esp", "Espresso!") };
+ Selected =
+ [
+ new Coffee("lat", "Cafe Latte!"),
+ new Coffee("esp", "Espresso!")
+ ];
}
- class Coffee
+ private class Coffee(string key, string name)
{
- public string Key { get; set; }
- public string Name { get; set; }
- public Coffee(string key, string name) { Key = key; Name = name; }
+ public string Key { get; } = key;
+ public string Name { get; } = name;
}
- class CoffeeComparer : IEqualityComparer
+ private class CoffeeComparer : IEqualityComparer
{
- public bool Equals(Coffee a, Coffee b) => a?.Key == b?.Key;
+ public bool Equals(Coffee? a, Coffee? b) => a?.Key == b?.Key;
public int GetHashCode(Coffee x) => HashCode.Combine(x.Key);
}
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetDefaultChipsTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetDefaultChipsTest.razor
index 33ef25a0f489..c09c41dcd12c 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetDefaultChipsTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetDefaultChipsTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@@ -30,11 +28,11 @@
public SelectionMode SelectionMode { get; set; } = SelectionMode.ToggleSelection;
[Parameter]
- public string[] InitialValues { get; set; }
+ public string[]? InitialValues { get; set; }
private bool _checkMark = false;
- private IReadOnlyCollection _selectedValues;
- private string _selectedValue;
+ private IReadOnlyCollection? _selectedValues;
+ private string? _selectedValue;
protected override void OnInitialized()
{
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetKeyboardNavigationTests.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetKeyboardNavigationTests.razor
index 2d4579857407..9eca4303bdb9 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetKeyboardNavigationTests.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetKeyboardNavigationTests.razor
@@ -22,6 +22,9 @@
@code {
+ private readonly List _chips = [];
+ private IReadOnlyCollection _selectedValues = [];
+
[Parameter]
public bool AreChipsClosable { get; set; }
@@ -34,9 +37,5 @@
[Parameter]
public EventCallback> OnClose { get; set; }
- private readonly List _chips = [];
- private IReadOnlyCollection _selectedValues = [];
-
- private void AddChip()
- => _chips.Add($"Chip {_chips.Count + 1}");
+ private void AddChip() => _chips.Add($"Chip {_chips.Count + 1}");
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetLateDefaultTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetLateDefaultTest.razor
index e144eae13dae..100cff23e713 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetLateDefaultTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetLateDefaultTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@if (_extraItem)
{
@@ -19,7 +17,8 @@ else {
@code
{
- bool _extraItem = false;
+ private bool _extraItem;
+ private IReadOnlyCollection? _selectedValues;
+
public void Enable() => _extraItem = !_extraItem;
- IReadOnlyCollection _selectedValues;
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetMultiSelectionTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetMultiSelectionTest.razor
index 4bac3be4c4a9..889e7cdf0ca4 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetMultiSelectionTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetMultiSelectionTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@@ -24,11 +22,11 @@
@code
{
- [Parameter]
- public string[] InitialValues { get; set; }
+ private string? _selectedValue;
+ private IReadOnlyCollection? _selectedValues;
- private string _selectedValue;
- private IReadOnlyCollection _selectedValues;
+ [Parameter]
+ public string[]? InitialValues { get; set; }
protected override void OnInitialized()
{
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetReadOnlyTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetReadOnlyTest.razor
index 95d783117216..59743e0a237f 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetReadOnlyTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetReadOnlyTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@@ -12,7 +10,5 @@
@code
{
- private static void Close() {
- throw new Exception("OnClose should not be possible with ReadOnly=true.");
- }
+ private static void Close() => throw new Exception("OnClose should not be possible with ReadOnly=true.");
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSelectionTwoWayBindingTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSelectionTwoWayBindingTest.razor
index 974b2cbc8e3f..1909b78de580 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSelectionTwoWayBindingTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSelectionTwoWayBindingTest.razor
@@ -15,6 +15,6 @@
@code {
public static string __description__ = "The chipsets should mirror their respective selections";
- IReadOnlyCollection _selectedValues = [ 1 ];
+ private IReadOnlyCollection _selectedValues = [ 1 ];
}
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSingleSelectionTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSingleSelectionTest.razor
index a2137b65c0eb..28e55ca5a844 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSingleSelectionTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetSingleSelectionTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@@ -28,10 +26,10 @@
public SelectionMode SelectionMode { get; set; } = SelectionMode.ToggleSelection;
[Parameter]
- public string InitialValue { get; set; }
+ public string? InitialValue { get; set; }
- private string _selectedValue;
- private IReadOnlyCollection _selectedValues;
+ private string? _selectedValue;
+ private IReadOnlyCollection? _selectedValues;
protected override void OnInitialized()
{
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetTest.razor
index 159169a03051..67562790bd3b 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ChipSet/ChipSetTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@@ -23,6 +21,10 @@ else {
[Parameter]
public bool MultiSelection { get; set; }
- private bool _checkMark = false;
+ private bool _checkMark;
private IReadOnlyCollection _selected = ["Milk", "Cornflakes"];
+
+ private SelectionMode GetSelectionMod() => MultiSelection
+ ? SelectionMode.MultiSelection
+ : SelectionMode.SingleSelection;
}
\ No newline at end of file
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Collapse/CollapseBindingTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Collapse/CollapseBindingTest.razor
index 6b4f48a9d308..fc097a218d10 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Collapse/CollapseBindingTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Collapse/CollapseBindingTest.razor
@@ -1,6 +1,4 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-
+
@(_expanded ? "Collapse" : "Expand")
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/PickerWithFixedView.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/PickerWithFixedView.razor
index a5544fc284fb..36f86aeba685 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/PickerWithFixedView.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/PickerWithFixedView.razor
@@ -1,9 +1,10 @@
-
+@using MudBlazor.Utilities
+
@code {
- private MudBlazor.Utilities.MudColor _colorValue;
+ private MudColor? _colorValue;
[Parameter]
public ColorPickerView ColorPickerView { get; set; } = ColorPickerView.Grid;
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/SimpleColorPickerTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/SimpleColorPickerTest.razor
index 867f75ed89bd..969657b6f6d3 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/SimpleColorPickerTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/ColorPicker/SimpleColorPickerTest.razor
@@ -1,10 +1,6 @@
-@namespace MudBlazor.UnitTests.TestComponents
+@using MudBlazor.Utilities
-@using MudBlazor.Utilities
-
-
-
-
+
@code {
- private MudColorPicker _picker;
+ private MudColorPicker _picker = null!;
+
+ public int ValueChangeCallbackCounter { get; private set; }
+
+ [Parameter]
+ public MudColor ColorValue { get; set; } = "#594ae2";
+
+ [Parameter]
+ public string TextValue { get; set; } = "#594ae2";
+
+ [Parameter]
+ public IEnumerable Palette { get; set; } = ["#ff4081ff", "#2196f3ff", "#00c853ff", "#ff9800ff", "#f44336ff"];
+
+ [Parameter]
+ public ColorPickerMode ColorPickerMode { get; set; } = ColorPickerMode.RGB;
+
+ [Parameter]
+ public bool ShowToolbar { get; set; }
+
+ [Parameter]
+ public bool ShowColorField { get; set; } = true;
+
+ [Parameter]
+ public bool ShowPreview { get; set; } = true;
+
+ [Parameter]
+ public bool ShowSliders { get; set; } = true;
+
+ [Parameter]
+ public bool DisableInput { get; set; }
+
+ [Parameter]
+ public bool ShowModeSwitch { get; set; } = true;
+
+ [Parameter]
+ public bool ShowAlpha { get; set; } = true;
- public Int32 ValueChangeCallbackCounter { get; private set; } = 0;
+ [Parameter]
+ public bool DragEffect { get; set; } = true;
- [Parameter] public MudColor ColorValue { get; set; } = "#594ae2";
- [Parameter] public string TextValue { get; set; } = "#594ae2";
+ [Parameter]
+ public ColorPickerView ViewMode { get; set; } = ColorPickerView.Spectrum;
- [Parameter] public IEnumerable Palette { get; set; } = new MudColor[] { "#ff4081ff", "#2196f3ff", "#00c853ff", "#ff9800ff", "#f44336ff" };
+ [Parameter]
+ public PickerVariant Variant { get; set; } = PickerVariant.Static;
- [Parameter] public ColorPickerMode ColorPickerMode { get; set; } = ColorPickerMode.RGB;
- [Parameter] public bool ShowToolbar { get; set; } = false;
- [Parameter] public bool ShowColorField { get; set; } = true;
- [Parameter] public bool ShowPreview { get; set; } = true;
- [Parameter] public bool ShowSliders { get; set; } = true;
- [Parameter] public bool DisableInput { get; set; } = false;
- [Parameter] public bool ShowModeSwitch { get; set; } = true;
- [Parameter] public bool ShowAlpha { get; set; } = true;
- [Parameter] public bool DragEffect { get; set; } = true;
- [Parameter] public ColorPickerView ViewMode { get; set; } = ColorPickerView.Spectrum;
- [Parameter] public PickerVariant Variant { get; set; } = PickerVariant.Static;
- [Parameter] public bool Required { get; set; }
+ [Parameter]
+ public bool Required { get; set; }
- public async Task OpenPicker()
+ public Task OpenPicker()
{
- await InvokeAsync(() =>
+ return InvokeAsync(async () =>
{
- _picker.OpenAsync();
+ await _picker.OpenAsync();
});
}
- public async Task ClosePicker()
+ public Task ClosePicker()
{
- await InvokeAsync(async () =>
+ return InvokeAsync(async () =>
{
await _picker.CloseAsync();
});
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridAggregationTest.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridAggregationTest.razor
index f220c23fd6e9..ace097cd01b8 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridAggregationTest.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridAggregationTest.razor
@@ -1,14 +1,15 @@
-@namespace MudBlazor.UnitTests.TestComponents
-
-