Skip to content

Commit

Permalink
Switch test project files to file-scoped namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKeepCoding committed Dec 13, 2024
1 parent de62e54 commit 2bab199
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 178 deletions.
37 changes: 18 additions & 19 deletions WinUIGalleryUnitTests/UnitTestApp.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,31 @@
using Windows.Foundation;
using Windows.Foundation.Collections;

namespace WinUIGalleryUnitTests
namespace WinUIGalleryUnitTests;

public partial class UnitTestApp : Application
{
public partial class UnitTestApp : Application
public UnitTestApp()
{
public UnitTestApp()
{
this.InitializeComponent();
}
this.InitializeComponent();
}

protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();

s_window = new UnitTestAppWindow();
s_window.Activate();
s_window = new UnitTestAppWindow();
s_window.Activate();

UITestMethodAttribute.DispatcherQueue = s_window.DispatcherQueue;
UITestMethodAttribute.DispatcherQueue = s_window.DispatcherQueue;

Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(Environment.CommandLine);
}
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(Environment.CommandLine);
}

private static UnitTestAppWindow s_window;
private static UnitTestAppWindow s_window;

public static UnitTestAppWindow UnitTestAppWindow
{
get { return s_window; }
}
public static UnitTestAppWindow UnitTestAppWindow
{
get { return s_window; }
}
}
37 changes: 18 additions & 19 deletions WinUIGalleryUnitTests/UnitTestAppWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@
using Windows.Foundation;
using Windows.Foundation.Collections;

namespace WinUIGalleryUnitTests
namespace WinUIGalleryUnitTests;

public sealed partial class UnitTestAppWindow : Window
{
public sealed partial class UnitTestAppWindow : Window
public UnitTestAppWindow()
{
public UnitTestAppWindow()
{
this.InitializeComponent();
}
this.InitializeComponent();
}

public Grid RootGrid
public Grid RootGrid
{
get
{
get
{
return rootGrid;
}
return rootGrid;
}
}

public void AddToVisualTree(UIElement element)
{
this.RootGrid.Children.Add(element);
}
public void AddToVisualTree(UIElement element)
{
this.RootGrid.Children.Add(element);
}

public void CleanupVisualTree()
{
this.RootGrid.Children.Clear();
}
public void CleanupVisualTree()
{
this.RootGrid.Children.Clear();
}
}
Loading

0 comments on commit 2bab199

Please sign in to comment.