Ver Fonte

Removed some more unused variables.

Steven Kirk há 9 anos atrás
pai
commit
61393d8b22

+ 1 - 2
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs

@@ -337,7 +337,6 @@ namespace Avalonia.Base.UnitTests
         [Fact]
         public void Property_Notifies_Initialized()
         {
-            Class1 target;
             bool raised = false;
 
             Class1.FooProperty.Initialized.Subscribe(e =>
@@ -346,7 +345,7 @@ namespace Avalonia.Base.UnitTests
                          (string)e.NewValue == "initial" &&
                          e.Priority == BindingPriority.Unset);
 
-            target = new Class1();
+            var target = new Class1();
 
             Assert.True(raised);
         }

+ 39 - 59
tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Arrows.cs

@@ -13,7 +13,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Continue_Returns_Down_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -21,7 +20,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -30,7 +29,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
@@ -52,7 +51,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Continue_Returns_First_Control_In_Down_Sibling_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -60,7 +58,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -69,7 +67,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
@@ -91,7 +89,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Continue_Returns_Down_Sibling()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -99,7 +96,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -108,7 +105,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     (next = new Button { Name = "Button4" }),
                 }
             };
@@ -121,7 +118,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Continue_Returns_First_Control_In_Down_Uncle_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -133,7 +129,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                 Children = new Controls
@@ -142,7 +138,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     (current = new Button { Name = "Button3" }),
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -185,7 +181,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Continue_Wraps()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -199,7 +194,7 @@ namespace Avalonia.Input.UnitTests
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                 Children = new Controls
@@ -208,7 +203,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     new Button { Name = "Button3" },
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -232,7 +227,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Cycle_Returns_Down_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -240,7 +234,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -249,7 +243,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -270,7 +264,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Cycle_Wraps_To_First()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -278,7 +271,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -287,7 +280,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -308,7 +301,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Contained_Returns_Down_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -316,7 +308,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
@@ -325,7 +317,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
@@ -347,24 +339,22 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_Contained_Stops_At_End()
         {
-            StackPanel container;
             Button current;
-            Button next;
 
             var top = new StackPanel
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
                         {
-                            (next = new Button { Name = "Button1" }),
+                            new Button { Name = "Button1" },
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
@@ -386,14 +376,13 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Down_None_Does_Nothing()
         {
-            StackPanel container;
             Button current;
 
             var top = new StackPanel
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.None,
                         Children = new Controls
@@ -402,7 +391,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
@@ -424,7 +413,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Continue_Returns_Up_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -432,7 +420,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -441,7 +429,7 @@ namespace Avalonia.Input.UnitTests
                             (next = new Button { Name = "Button2" }),
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
@@ -463,7 +451,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Continue_Returns_Last_Control_In_Up_Sibling_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -471,7 +458,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -480,7 +467,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
@@ -502,7 +489,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Continue_Returns_Last_Child_Of_Sibling()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -511,7 +497,7 @@ namespace Avalonia.Input.UnitTests
                 [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                         Children = new Controls
@@ -520,7 +506,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     (current = new Button { Name = "Button4" }),
                 }
             };
@@ -533,7 +519,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Continue_Returns_Last_Control_In_Up_Nephew_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -545,7 +530,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                 Children = new Controls
@@ -554,7 +539,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     (next = new Button { Name = "Button3" }),
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -578,7 +563,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Continue_Wraps()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -590,7 +574,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                 Children = new Controls
@@ -599,7 +583,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     new Button { Name = "Button3" },
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -643,7 +627,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Cycle_Returns_Up_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -651,7 +634,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -660,7 +643,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
@@ -682,7 +665,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Cycle_Wraps_To_Last()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -690,7 +672,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -699,7 +681,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
@@ -721,7 +703,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Contained_Returns_Up_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -729,7 +710,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
@@ -738,7 +719,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
@@ -760,14 +741,13 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Up_Contained_Stops_At_Beginning()
         {
-            StackPanel container;
             Button current;
 
             var top = new StackPanel
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
@@ -776,7 +756,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,

+ 48 - 73
tests/Avalonia.Input.UnitTests/KeyboardNavigationTests_Tab.cs

@@ -13,7 +13,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Returns_Next_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -21,7 +20,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -29,7 +28,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -50,7 +49,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Returns_First_Control_In_Next_Sibling_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -58,7 +56,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -66,7 +64,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -87,7 +85,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Doesnt_Enter_Panel_With_TabNavigation_None()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -95,7 +92,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -103,7 +100,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.None,
@@ -131,7 +128,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Returns_Next_Sibling()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -139,7 +135,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -147,7 +143,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     (next = new Button { Name = "Button4" }),
                 }
             };
@@ -160,7 +156,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Returns_First_Control_In_Next_Uncle_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -172,7 +167,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 Children = new Controls
                                 {
@@ -180,7 +175,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     (current = new Button { Name = "Button3" }),
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -221,7 +216,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Continue_Wraps()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -233,7 +227,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 Children = new Controls
                                 {
@@ -241,7 +235,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     new Button { Name = "Button3" },
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -264,7 +258,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Cycle_Returns_Next_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -272,7 +265,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -281,7 +274,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -302,7 +295,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Cycle_Wraps_To_First()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -310,7 +302,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -319,7 +311,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -340,7 +332,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Contained_Returns_Next_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -348,7 +339,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
@@ -357,7 +348,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -378,24 +369,22 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Contained_Stops_At_End()
         {
-            StackPanel container;
             Button current;
-            Button next;
 
             var top = new StackPanel
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
                         {
-                            (next = new Button { Name = "Button1" }),
+                            new Button { Name = "Button1" },
                             new Button { Name = "Button2" },
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -416,7 +405,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_Once_Moves_To_Next_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -424,7 +412,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
                         Children = new Controls
@@ -433,7 +421,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -494,7 +482,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Next_None_Moves_To_Next_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -502,7 +489,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.None,
                         Children = new Controls
@@ -511,7 +498,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -572,7 +559,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Continue_Returns_Previous_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -580,7 +566,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -588,7 +574,7 @@ namespace Avalonia.Input.UnitTests
                             (next = new Button { Name = "Button2" }),
                             (current = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -609,7 +595,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Continue_Returns_Last_Control_In_Previous_Sibling_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -617,7 +602,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -625,7 +610,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -646,7 +631,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Continue_Returns_Last_Child_Of_Sibling()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -654,7 +638,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -662,7 +646,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     (current = new Button { Name = "Button4" }),
                 }
             };
@@ -675,7 +659,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Continue_Returns_Last_Control_In_Previous_Nephew_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -687,7 +670,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 Children = new Controls
                                 {
@@ -695,7 +678,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     (next = new Button { Name = "Button3" }),
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -718,7 +701,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Continue_Wraps()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -730,7 +712,7 @@ namespace Avalonia.Input.UnitTests
                     {
                         Children = new Controls
                         {
-                            (container = new StackPanel
+                            new StackPanel
                             {
                                 Children = new Controls
                                 {
@@ -738,7 +720,7 @@ namespace Avalonia.Input.UnitTests
                                     new Button { Name = "Button2" },
                                     new Button { Name = "Button3" },
                                 }
-                            }),
+                            },
                         },
                     },
                     new StackPanel
@@ -780,7 +762,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Cycle_Returns_Previous_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -788,7 +769,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -797,7 +778,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -818,7 +799,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Cycle_Wraps_To_Last()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -826,7 +806,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
                         Children = new Controls
@@ -835,7 +815,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -856,7 +836,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Contained_Returns_Previous_Control_In_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -864,7 +843,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
@@ -873,7 +852,7 @@ namespace Avalonia.Input.UnitTests
                             (current = new Button { Name = "Button2" }),
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -894,24 +873,22 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Contained_Stops_At_Beginning()
         {
-            StackPanel container;
             Button current;
-            Button next;
 
             var top = new StackPanel
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Contained,
                         Children = new Controls
                         {
                             (current = new Button { Name = "Button1" }),
                             new Button { Name = "Button2" },
-                            (next = new Button { Name = "Button3" }),
+                            new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls
@@ -932,7 +909,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Once_Moves_To_Previous_Container()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -940,7 +916,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         Children = new Controls
                         {
@@ -948,7 +924,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             (next = new Button { Name = "Button3" }),
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
@@ -1010,7 +986,6 @@ namespace Avalonia.Input.UnitTests
         [Fact]
         public void Previous_Once_Moves_To_First_Element()
         {
-            StackPanel container;
             Button current;
             Button next;
 
@@ -1018,7 +993,7 @@ namespace Avalonia.Input.UnitTests
             {
                 Children = new Controls
                 {
-                    (container = new StackPanel
+                    new StackPanel
                     {
                         [KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
                         Children = new Controls
@@ -1027,7 +1002,7 @@ namespace Avalonia.Input.UnitTests
                             new Button { Name = "Button2" },
                             new Button { Name = "Button3" },
                         }
-                    }),
+                    },
                     new StackPanel
                     {
                         Children = new Controls