diff --git a/.nuspec/maui-blazor.aotprofile.txt b/.nuspec/maui-blazor.aotprofile.txt
index 596241e80f7d..fcf567a3542e 100644
--- a/.nuspec/maui-blazor.aotprofile.txt
+++ b/.nuspec/maui-blazor.aotprofile.txt
@@ -1697,8 +1697,8 @@ Methods:
Microsoft.Maui.Controls.IVisual Microsoft.Maui.Controls.VisualMarker:get_MatchParent ()
Microsoft.Maui.Controls.LayoutOptions Microsoft.Maui.Controls.View:get_HorizontalOptions ()
Microsoft.Maui.Controls.LayoutOptions Microsoft.Maui.Controls.View:get_VerticalOptions ()
- Microsoft.Maui.Controls.OSAppTheme Microsoft.Maui.Controls.Application:get_RequestedTheme ()
- Microsoft.Maui.Controls.OSAppTheme Microsoft.Maui.Controls.Compatibility.Forms/AndroidPlatformServices:get_RequestedTheme ()
+ Microsoft.Maui.Controls.AppTheme Microsoft.Maui.Controls.Application:get_RequestedTheme ()
+ Microsoft.Maui.Controls.AppTheme Microsoft.Maui.Controls.Compatibility.Forms/AndroidPlatformServices:get_RequestedTheme ()
Microsoft.Maui.Controls.Page Microsoft.Maui.Controls.Application:get_MainPage ()
Microsoft.Maui.Controls.Page Microsoft.Maui.Controls.Window:get_Page ()
Microsoft.Maui.Controls.ResourceDictionary Microsoft.Maui.Controls.Application:get_Resources ()
diff --git a/.nuspec/maui.aotprofile.txt b/.nuspec/maui.aotprofile.txt
index 88958727ea9c..147deb4e9100 100644
--- a/.nuspec/maui.aotprofile.txt
+++ b/.nuspec/maui.aotprofile.txt
@@ -1395,8 +1395,8 @@ Methods:
Microsoft.Maui.Controls.IVisual Microsoft.Maui.Controls.VisualMarker:get_MatchParent ()
Microsoft.Maui.Controls.LayoutOptions Microsoft.Maui.Controls.View:get_HorizontalOptions ()
Microsoft.Maui.Controls.LayoutOptions Microsoft.Maui.Controls.View:get_VerticalOptions ()
- Microsoft.Maui.Controls.OSAppTheme Microsoft.Maui.Controls.Application:get_RequestedTheme ()
- Microsoft.Maui.Controls.OSAppTheme Microsoft.Maui.Controls.Compatibility.Forms/AndroidPlatformServices:get_RequestedTheme ()
+ Microsoft.Maui.Controls.AppTheme Microsoft.Maui.Controls.Application:get_RequestedTheme ()
+ Microsoft.Maui.Controls.AppTheme Microsoft.Maui.Controls.Compatibility.Forms/AndroidPlatformServices:get_RequestedTheme ()
Microsoft.Maui.Controls.Page Microsoft.Maui.Controls.Application:get_MainPage ()
Microsoft.Maui.Controls.Page Microsoft.Maui.Controls.Window:get_Page ()
Microsoft.Maui.Controls.ResourceDictionary Microsoft.Maui.Controls.Application:get_Resources ()
diff --git a/src/Compatibility/Core/src/Android/AppCompat/FormsAppCompatActivity.cs b/src/Compatibility/Core/src/Android/AppCompat/FormsAppCompatActivity.cs
index 51813f30a219..ae422c97098c 100644
--- a/src/Compatibility/Core/src/Android/AppCompat/FormsAppCompatActivity.cs
+++ b/src/Compatibility/Core/src/Android/AppCompat/FormsAppCompatActivity.cs
@@ -80,7 +80,7 @@ public override void OnConfigurationChanged(Configuration newConfig)
base.OnConfigurationChanged(newConfig);
ConfigurationChanged?.Invoke(this, new EventArgs());
- Microsoft.Maui.Controls.Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(Microsoft.Maui.Controls.Application.Current.RequestedTheme));
+ Microsoft.Maui.Controls.Application.Current?.ThemeChanged();
}
public override bool OnOptionsItemSelected(IMenuItem item)
diff --git a/src/Compatibility/Core/src/Android/Forms.cs b/src/Compatibility/Core/src/Android/Forms.cs
index 79650ed2bab9..b6449540aed0 100644
--- a/src/Compatibility/Core/src/Android/Forms.cs
+++ b/src/Compatibility/Core/src/Android/Forms.cs
@@ -227,9 +227,7 @@ static void SetupInit(
// because AndroidPlatformServices needs a current activity to launch URIs from
Profile.FramePartition("Device.PlatformServices");
- var androidServices = new AndroidPlatformServices(activity);
-
- Device.PlatformServices = androidServices;
+ Device.DefaultRendererAssembly = typeof(Forms).Assembly;
Profile.FramePartition("RegisterAll");
@@ -317,32 +315,5 @@ protected override Expression VisitMember(MemberExpression node)
return base.VisitMember(node);
}
}
-
- class AndroidPlatformServices : IPlatformServices
- {
- readonly Context _context;
-
- public AndroidPlatformServices(Context context)
- {
- _context = context;
- }
-
- public OSAppTheme RequestedTheme
- {
- get
- {
- var nightMode = _context.Resources.Configuration.UiMode & UiMode.NightMask;
- switch (nightMode)
- {
- case UiMode.NightYes:
- return OSAppTheme.Dark;
- case UiMode.NightNo:
- return OSAppTheme.Light;
- default:
- return OSAppTheme.Unspecified;
- };
- }
- }
- }
}
}
diff --git a/src/Compatibility/Core/src/GTK/GtkPlatformServices.cs b/src/Compatibility/Core/src/GTK/GtkPlatformServices.cs
index b9b0d4b8e9cb..a4caea8fc84e 100644
--- a/src/Compatibility/Core/src/GTK/GtkPlatformServices.cs
+++ b/src/Compatibility/Core/src/GTK/GtkPlatformServices.cs
@@ -68,6 +68,6 @@ public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, dou
return Platform.GetNativeSize(view, widthConstraint, heightConstraint);
}
- public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
+ public AppTheme RequestedTheme => AppTheme.Unspecified;
}
}
\ No newline at end of file
diff --git a/src/Compatibility/Core/src/Handlers/Shell/Android/ShellRenderer.cs b/src/Compatibility/Core/src/Handlers/Shell/Android/ShellRenderer.cs
index d0d85d11c112..d6906ef2d1d8 100644
--- a/src/Compatibility/Core/src/Handlers/Shell/Android/ShellRenderer.cs
+++ b/src/Compatibility/Core/src/Handlers/Shell/Android/ShellRenderer.cs
@@ -10,6 +10,7 @@
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Platform;
using Microsoft.Maui.Controls.Platform.Compatibility;
+using Microsoft.Maui.Essentials;
using Microsoft.Maui.Graphics;
using AColor = Android.Graphics.Color;
using ARect = Android.Graphics.Rect;
@@ -98,7 +99,7 @@ void IAppearanceObserver.OnAppearanceChanged(ShellAppearance appearance)
public static readonly Color DefaultUnselectedColor = Color.FromRgba(255, 255, 255, 180);
internal static Color DefaultBottomNavigationViewBackgroundColor => ResolveThemeColor(Colors.White, Color.FromArgb("#1B3147"));
- internal static bool IsDarkTheme => (Application.Current?.RequestedTheme == OSAppTheme.Dark);
+ internal static bool IsDarkTheme => (Application.Current?.RequestedTheme == AppTheme.Dark);
static Color ResolveThemeColor(Color light, Color dark)
{
diff --git a/src/Compatibility/Core/src/Tizen/TizenPlatformServices.cs b/src/Compatibility/Core/src/Tizen/TizenPlatformServices.cs
index d2fd2206ec73..208c8fa63fb3 100644
--- a/src/Compatibility/Core/src/Tizen/TizenPlatformServices.cs
+++ b/src/Compatibility/Core/src/Tizen/TizenPlatformServices.cs
@@ -108,7 +108,7 @@ public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, dou
return Platform.GetNativeSize(view, widthConstraint, heightConstraint);
}
- public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
+ public AppTheme RequestedTheme => AppTheme.Unspecified;
static MD5 CreateChecksum()
{
diff --git a/src/Compatibility/Core/src/WPF/WPFPlatformServices.cs b/src/Compatibility/Core/src/WPF/WPFPlatformServices.cs
index 8aebe19b9971..02b6cac38f67 100644
--- a/src/Compatibility/Core/src/WPF/WPFPlatformServices.cs
+++ b/src/Compatibility/Core/src/WPF/WPFPlatformServices.cs
@@ -92,6 +92,6 @@ public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, dou
return Platform.GetNativeSize(view, widthConstraint, heightConstraint);
}
- public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
+ public AppTheme RequestedTheme => AppTheme.Unspecified;
}
}
\ No newline at end of file
diff --git a/src/Compatibility/Core/src/Windows/Forms.cs b/src/Compatibility/Core/src/Windows/Forms.cs
index 427c4dc923c5..9670e1940b04 100644
--- a/src/Compatibility/Core/src/Windows/Forms.cs
+++ b/src/Compatibility/Core/src/Windows/Forms.cs
@@ -56,9 +56,7 @@ static void SetupInit(
Registrar.ExtraAssemblies = rendererAssemblies?.ToArray();
- var platformServices = new WindowsPlatformServices();
-
- Device.PlatformServices = platformServices;
+ Device.DefaultRendererAssembly = typeof(Forms).Assembly;
if (mainWindow != null)
{
diff --git a/src/Compatibility/Core/src/Windows/WindowsPlatformServices.cs b/src/Compatibility/Core/src/Windows/WindowsPlatformServices.cs
deleted file mode 100644
index 30b34a4f4689..000000000000
--- a/src/Compatibility/Core/src/Windows/WindowsPlatformServices.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Net.Http;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Maui.Controls.Internals;
-using Microsoft.Maui.Controls.Platform;
-using Microsoft.Maui.Graphics;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Media;
-using Windows.ApplicationModel;
-using Windows.Storage;
-using Windows.Storage.Search;
-using Windows.UI.ViewManagement;
-
-namespace Microsoft.Maui.Controls.Compatibility.Platform.UWP
-{
- internal class WindowsPlatformServices : IPlatformServices
- {
- readonly UISettings _uiSettings = new UISettings();
-
- public WindowsPlatformServices()
- {
- _uiSettings.ColorValuesChanged += UISettingsColorValuesChanged;
- }
-
- void UISettingsColorValuesChanged(UISettings sender, object args)
- {
- Application.Current.Dispatcher.DispatchIfRequired(() =>
- Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(Application.Current.RequestedTheme)));
- }
-
- public OSAppTheme RequestedTheme =>
- Microsoft.UI.Xaml.Application.Current.RequestedTheme == ApplicationTheme.Dark
- ? OSAppTheme.Dark
- : OSAppTheme.Light;
- }
-}
\ No newline at end of file
diff --git a/src/Compatibility/Core/src/iOS/Forms.cs b/src/Compatibility/Core/src/iOS/Forms.cs
index 11b34571e02d..e7c180aa2a97 100644
--- a/src/Compatibility/Core/src/iOS/Forms.cs
+++ b/src/Compatibility/Core/src/iOS/Forms.cs
@@ -159,7 +159,7 @@ static void SetupInit(IMauiContext context, InitializationOptions? maybeOptions
var aquaAppearance = NSAppearance.GetAppearance(interfaceStyle == "Dark" ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
NSApplication.SharedApplication.Appearance = aquaAppearance;
- Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(interfaceStyle == "Dark" ? OSAppTheme.Dark : OSAppTheme.Light));
+ Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(interfaceStyle == "Dark" ? AppTheme.Dark : AppTheme.Light));
});
}
@@ -172,9 +172,8 @@ static void SetupInit(IMauiContext context, InitializationOptions? maybeOptions
NSApplication.SharedApplication.Appearance = aquaAppearance;
}
#endif
- var platformServices = new IOSPlatformServices();
- Device.PlatformServices = platformServices;
+ Device.DefaultRendererAssembly = typeof(Forms).Assembly;
if (maybeOptions?.Flags.HasFlag(InitializationFlags.SkipRenderers) != true)
RegisterCompatRenderers(context);
@@ -234,87 +233,5 @@ protected override Expression VisitMember(MemberExpression node)
return base.VisitMember(node);
}
}
-
- class IOSPlatformServices : IPlatformServices
- {
- public OSAppTheme RequestedTheme
- {
- get
- {
-#if __IOS__ || __TVOS__
- if (!IsiOS13OrNewer)
- return OSAppTheme.Unspecified;
- var uiStyle = GetCurrentUIViewController()?.TraitCollection?.UserInterfaceStyle ??
- UITraitCollection.CurrentTraitCollection.UserInterfaceStyle;
-
- switch (uiStyle)
- {
- case UIUserInterfaceStyle.Light:
- return OSAppTheme.Light;
- case UIUserInterfaceStyle.Dark:
- return OSAppTheme.Dark;
- default:
- return OSAppTheme.Unspecified;
- };
-#else
- return AppearanceIsDark() ? OSAppTheme.Dark : OSAppTheme.Light;
-#endif
- }
- }
-
-#if __MACOS__
- bool AppearanceIsDark()
- {
- if (IsMojaveOrNewer)
- {
- var appearance = NSApplication.SharedApplication.EffectiveAppearance;
- var matchedAppearance = appearance.FindBestMatch(new string[] { NSAppearance.NameAqua, NSAppearance.NameDarkAqua });
-
- return matchedAppearance == NSAppearance.NameDarkAqua;
- }
- else
- {
- return false;
- }
- }
-#endif
-
-#if __IOS__ || __TVOS__
-
- static UIViewController GetCurrentUIViewController() =>
- GetCurrentViewController(false);
-
- static UIViewController GetCurrentViewController(bool throwIfNull = true)
- {
- UIViewController viewController = null;
-
- var window = UIApplication.SharedApplication.GetKeyWindow();
-
- if (window != null && window.WindowLevel == UIWindowLevel.Normal)
- viewController = window.RootViewController;
-
- if (viewController == null)
- {
- window = UIApplication.SharedApplication
- .Windows
- .OrderByDescending(w => w.WindowLevel)
- .FirstOrDefault(w => w.RootViewController != null && w.WindowLevel == UIWindowLevel.Normal);
-
- if (window == null && throwIfNull)
- throw new InvalidOperationException("Could not find current view controller.");
- else
- viewController = window?.RootViewController;
- }
-
- while (viewController?.PresentedViewController != null)
- viewController = viewController.PresentedViewController;
-
- if (throwIfNull && viewController == null)
- throw new InvalidOperationException("Could not find current view controller.");
-
- return viewController;
- }
-#endif
- }
}
}
diff --git a/src/Compatibility/Core/src/iOS/Renderers/PageRenderer.cs b/src/Compatibility/Core/src/iOS/Renderers/PageRenderer.cs
index 58d2dcd45181..4a75358602f6 100644
--- a/src/Compatibility/Core/src/iOS/Renderers/PageRenderer.cs
+++ b/src/Compatibility/Core/src/iOS/Renderers/PageRenderer.cs
@@ -322,7 +322,7 @@ public override void TraitCollectionDidChange(UITraitCollection previousTraitCol
if (Forms.IsiOS13OrNewer &&
previousTraitCollection.UserInterfaceStyle != TraitCollection.UserInterfaceStyle &&
UIApplication.SharedApplication.ApplicationState != UIApplicationState.Background)
- Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(Application.Current.RequestedTheme));
+ Application.Current?.ThemeChanged();
}
bool ShouldUseSafeArea()
diff --git a/src/Controls/DualScreen/test/MockPlatformServices.cs b/src/Controls/DualScreen/test/MockPlatformServices.cs
index d5e29479d4a7..792d01c694e3 100644
--- a/src/Controls/DualScreen/test/MockPlatformServices.cs
+++ b/src/Controls/DualScreen/test/MockPlatformServices.cs
@@ -126,7 +126,7 @@ public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, dou
return new SizeRequest(new Size(100, 20));
}
- public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
+ public AppTheme RequestedTheme => AppTheme.Unspecified;
}
internal class MockDeserializer : Internals.IDeserializer
diff --git a/src/Controls/samples/Controls.Sample/XamlApp.xaml.cs b/src/Controls/samples/Controls.Sample/XamlApp.xaml.cs
index 31d6cbc2436b..494b357f1941 100644
--- a/src/Controls/samples/Controls.Sample/XamlApp.xaml.cs
+++ b/src/Controls/samples/Controls.Sample/XamlApp.xaml.cs
@@ -19,6 +19,8 @@ public XamlApp(IServiceProvider services, ITextService textService)
Debug.WriteLine($"The injected text service had a message: '{textService.GetText()}'");
+ Debug.WriteLine($"Current app theme: {RequestedTheme}");
+
RequestedThemeChanged += (sender, args) =>
{
// Respond to the theme change
diff --git a/src/Controls/src/Core/AppThemeBinding.cs b/src/Controls/src/Core/AppThemeBinding.cs
index 7f3389d770e8..d938c7b35ab3 100644
--- a/src/Controls/src/Core/AppThemeBinding.cs
+++ b/src/Controls/src/Core/AppThemeBinding.cs
@@ -1,4 +1,5 @@
using System;
+using Microsoft.Maui.Essentials;
namespace Microsoft.Maui.Controls
{
@@ -79,9 +80,9 @@ object GetValue()
switch (Application.Current.RequestedTheme)
{
default:
- case OSAppTheme.Light:
+ case AppTheme.Light:
return _isLightSet ? Light : Default;
- case OSAppTheme.Dark:
+ case AppTheme.Dark:
return _isDarkSet ? Dark : Default;
}
}
diff --git a/src/Controls/src/Core/AppThemeChangedEventArgs.cs b/src/Controls/src/Core/AppThemeChangedEventArgs.cs
index f39c0c80403b..5c3fa8b825a5 100644
--- a/src/Controls/src/Core/AppThemeChangedEventArgs.cs
+++ b/src/Controls/src/Core/AppThemeChangedEventArgs.cs
@@ -1,4 +1,5 @@
using System;
+using Microsoft.Maui.Essentials;
namespace Microsoft.Maui.Controls
{
@@ -6,10 +7,10 @@ namespace Microsoft.Maui.Controls
public class AppThemeChangedEventArgs : EventArgs
{
///
- public AppThemeChangedEventArgs(OSAppTheme appTheme) =>
+ public AppThemeChangedEventArgs(AppTheme appTheme) =>
RequestedTheme = appTheme;
///
- public OSAppTheme RequestedTheme { get; }
+ public AppTheme RequestedTheme { get; }
}
}
\ No newline at end of file
diff --git a/src/Controls/src/Core/Application.cs b/src/Controls/src/Core/Application.cs
index 6529e9ea68e2..23d13395b8ad 100644
--- a/src/Controls/src/Core/Application.cs
+++ b/src/Controls/src/Core/Application.cs
@@ -9,6 +9,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Internals;
+using Microsoft.Maui.Essentials;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
@@ -47,11 +48,6 @@ internal Application(bool setCurrentApplication)
_platformConfigurationRegistry = new Lazy>(() => new PlatformConfigurationRegistry(this));
}
- internal void PlatformServicesSet()
- {
- _lastAppTheme = RequestedTheme;
- }
-
///
public void Quit()
{
@@ -175,7 +171,7 @@ public ResourceDictionary Resources
}
///
- public OSAppTheme UserAppTheme
+ public AppTheme UserAppTheme
{
get => _userAppTheme;
set
@@ -185,7 +181,7 @@ public OSAppTheme UserAppTheme
}
}
///
- public OSAppTheme RequestedTheme => UserAppTheme == OSAppTheme.Unspecified ? Device.PlatformServices.RequestedTheme : UserAppTheme;
+ public AppTheme RequestedTheme => AppInfo.RequestedTheme;
///
public static Color? AccentColor { get; set; }
@@ -197,18 +193,8 @@ public event EventHandler RequestedThemeChanged
}
bool _themeChangedFiring;
- OSAppTheme _lastAppTheme;
- OSAppTheme _userAppTheme = OSAppTheme.Unspecified;
-
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void TriggerThemeChanged(AppThemeChangedEventArgs args)
- {
- if (UserAppTheme != OSAppTheme.Unspecified)
- return;
- TriggerThemeChangedActual(args);
- }
+ AppTheme _lastAppTheme = AppTheme.Unspecified;
+ AppTheme _userAppTheme = AppTheme.Unspecified;
void TriggerThemeChangedActual(AppThemeChangedEventArgs args)
{
diff --git a/src/Controls/src/Core/Device.cs b/src/Controls/src/Core/Device.cs
index dca86d1d46d8..98c57090259e 100644
--- a/src/Controls/src/Core/Device.cs
+++ b/src/Controls/src/Core/Device.cs
@@ -12,6 +12,10 @@ namespace Microsoft.Maui.Controls
///
public static class Device
{
+ // this is just for those cases where the runtime needs to pre-load renderers
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Assembly DefaultRendererAssembly { get; set; }
+
///
public const string iOS = "iOS";
///
@@ -29,8 +33,6 @@ public static class Device
public const string MacCatalyst = "MacCatalyst";
public const string tvOS = "tvOS";
- static IPlatformServices s_platformServices;
-
///
public static TargetIdiom Idiom
{
@@ -60,23 +62,6 @@ public static TargetIdiom Idiom
///
public static FlowDirection FlowDirection { get; internal set; }
- ///
- internal static IPlatformServices PlatformServices
- {
- get
- {
- if (s_platformServices == null)
- throw new InvalidOperationException($"You must call Microsoft.Maui.Controls.Compatibility.Forms.Init(); prior to using this property ({nameof(PlatformServices)}).");
- return s_platformServices;
- }
- set
- {
- s_platformServices = value;
- if (s_platformServices != null)
- Application.Current?.PlatformServicesSet();
- }
- }
-
//[Obsolete("Use BindableObject.Dispatcher instead.")]
///
public static bool IsInvokeRequired =>
diff --git a/src/Controls/src/Core/HandlerImpl/Application.Impl.cs b/src/Controls/src/Core/HandlerImpl/Application.Impl.cs
index f689abb24531..363bebb7cd61 100644
--- a/src/Controls/src/Core/HandlerImpl/Application.Impl.cs
+++ b/src/Controls/src/Core/HandlerImpl/Application.Impl.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
+using Microsoft.Maui.Essentials;
using Microsoft.Maui.Handlers;
namespace Microsoft.Maui.Controls
@@ -108,7 +109,10 @@ public virtual void CloseWindow(Window window)
///
public void ThemeChanged()
{
- Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(Current.RequestedTheme));
+ if (UserAppTheme != AppTheme.Unspecified)
+ return;
+
+ TriggerThemeChangedActual(new AppThemeChangedEventArgs(RequestedTheme));
}
protected virtual Window CreateWindow(IActivationState? activationState)
diff --git a/src/Controls/src/Core/IPlatformServices.cs b/src/Controls/src/Core/IPlatformServices.cs
deleted file mode 100644
index d55bc1f2a95d..000000000000
--- a/src/Controls/src/Core/IPlatformServices.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Maui.Animations;
-using Microsoft.Maui.Controls.Internals;
-using Microsoft.Maui.Graphics;
-
-namespace Microsoft.Maui.Controls.Internals
-{
- internal interface IPlatformServices
- {
- OSAppTheme RequestedTheme { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Controls/src/Core/OSAppTheme.cs b/src/Controls/src/Core/OSAppTheme.cs
deleted file mode 100644
index dd64017d0f6f..000000000000
--- a/src/Controls/src/Core/OSAppTheme.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Microsoft.Maui.Controls
-{
- ///
- public enum OSAppTheme
- {
- ///
- Unspecified,
- ///
- Light,
- ///
- Dark
- }
-}
\ No newline at end of file
diff --git a/src/Controls/src/Core/RadioButton.cs b/src/Controls/src/Core/RadioButton.cs
index 49aee86b5f5b..8c869b291f9f 100644
--- a/src/Controls/src/Core/RadioButton.cs
+++ b/src/Controls/src/Core/RadioButton.cs
@@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Shapes;
+using Microsoft.Maui.Essentials;
using Microsoft.Maui.Graphics;
namespace Microsoft.Maui.Controls
@@ -372,7 +373,7 @@ static Brush ResolveThemeColor(string key)
return (Brush)color;
}
- if (Application.Current?.RequestedTheme == OSAppTheme.Dark)
+ if (Application.Current?.RequestedTheme == AppTheme.Dark)
{
return Brush.White;
}
diff --git a/src/Controls/src/Core/Registrar.cs b/src/Controls/src/Core/Registrar.cs
index b954076f44e4..d844fb4fc132 100644
--- a/src/Controls/src/Core/Registrar.cs
+++ b/src/Controls/src/Core/Registrar.cs
@@ -394,7 +394,7 @@ public static void RegisterAll(Type[] attrTypes, InitializationFlags flags, IFon
{
RegisterAll(
AppDomain.CurrentDomain.GetAssemblies(),
- Device.PlatformServices.GetType().GetTypeInfo().Assembly,
+ Device.DefaultRendererAssembly,
attrTypes,
flags,
null,
@@ -411,16 +411,17 @@ internal static void RegisterAll(
{
Profile.FrameBegin();
-
if (ExtraAssemblies != null)
assemblies = assemblies.Union(ExtraAssemblies).ToArray();
- int indexOfExecuting = Array.IndexOf(assemblies, defaultRendererAssembly);
-
- if (indexOfExecuting > 0)
+ if (defaultRendererAssembly != null)
{
- assemblies[indexOfExecuting] = assemblies[0];
- assemblies[0] = defaultRendererAssembly;
+ int indexOfExecuting = Array.IndexOf(assemblies, defaultRendererAssembly);
+ if (indexOfExecuting > 0)
+ {
+ assemblies[indexOfExecuting] = assemblies[0];
+ assemblies[0] = defaultRendererAssembly;
+ }
}
if (fontRegistrar == null)
diff --git a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs
index a953be04570b..691f95a168bb 100644
--- a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs
+++ b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs
@@ -1,4 +1,5 @@
using System;
+using Microsoft.Maui.Essentials;
using Microsoft.Maui.Graphics;
using NUnit.Framework;
@@ -6,13 +7,23 @@ namespace Microsoft.Maui.Controls.Core.UnitTests
{
public class AppThemeTests : BaseTestFixture
{
+ MockAppInfo mockAppInfo;
+
[SetUp]
public override void Setup()
{
base.Setup();
+ AppInfo.SetCurrent(mockAppInfo = new MockAppInfo());
Application.Current = new MockApplication();
}
+ [TearDown]
+ public override void TearDown()
+ {
+ Application.Current = null;
+ base.TearDown();
+ }
+
[Test]
public void ThemeChangeUsingSetAppThemeColor()
{
@@ -24,7 +35,7 @@ public void ThemeChangeUsingSetAppThemeColor()
label.SetAppThemeColor(Label.TextColorProperty, Colors.Green, Colors.Red);
Assert.AreEqual(Colors.Green, label.TextColor);
- SetAppTheme(OSAppTheme.Dark);
+ SetAppTheme(AppTheme.Dark);
Assert.AreEqual(Colors.Red, label.TextColor);
}
@@ -40,7 +51,7 @@ public void ThemeChangeUsingSetAppTheme()
label.SetOnAppTheme(Label.TextColorProperty, Colors.Green, Colors.Red);
Assert.AreEqual(Colors.Green, label.TextColor);
- SetAppTheme(OSAppTheme.Dark);
+ SetAppTheme(AppTheme.Dark);
Assert.AreEqual(Colors.Red, label.TextColor);
}
@@ -56,15 +67,15 @@ public void ThemeChangeUsingSetBinding()
label.SetBinding(Label.TextColorProperty, new AppThemeBinding { Light = Colors.Green, Dark = Colors.Red });
Assert.AreEqual(Colors.Green, label.TextColor);
- SetAppTheme(OSAppTheme.Dark);
+ SetAppTheme(AppTheme.Dark);
Assert.AreEqual(Colors.Red, label.TextColor);
}
- void SetAppTheme(OSAppTheme theme)
+ void SetAppTheme(AppTheme theme)
{
- ((MockPlatformServices)Device.PlatformServices).RequestedTheme = theme;
- Application.Current.TriggerThemeChanged(new AppThemeChangedEventArgs(theme));
+ mockAppInfo.RequestedTheme = theme;
+ Application.Current.ThemeChanged();
}
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/Core.UnitTests/BaseTestFixture.cs b/src/Controls/tests/Core.UnitTests/BaseTestFixture.cs
index c4b2dac69a08..794ea350df66 100644
--- a/src/Controls/tests/Core.UnitTests/BaseTestFixture.cs
+++ b/src/Controls/tests/Core.UnitTests/BaseTestFixture.cs
@@ -19,18 +19,18 @@ public virtual void Setup()
{
_defaultCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
_defaultUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
- Device.PlatformServices = new MockPlatformServices();
MockPlatformSizeService.Current?.Reset();
DispatcherProvider.SetCurrent(new DispatcherProviderStub());
DeviceDisplay.SetCurrent(null);
DeviceInfo.SetCurrent(null);
+ AppInfo.SetCurrent(null);
}
[TearDown]
public virtual void TearDown()
{
- Device.PlatformServices = null;
MockPlatformSizeService.Current?.Reset();
+ AppInfo.SetCurrent(null);
DeviceDisplay.SetCurrent(null);
DeviceInfo.SetCurrent(null);
System.Threading.Thread.CurrentThread.CurrentCulture = _defaultCulture;
diff --git a/src/Controls/tests/Core.UnitTests/MarginTests.cs b/src/Controls/tests/Core.UnitTests/MarginTests.cs
index b01f00fcd558..bc2ddac6f3cb 100644
--- a/src/Controls/tests/Core.UnitTests/MarginTests.cs
+++ b/src/Controls/tests/Core.UnitTests/MarginTests.cs
@@ -16,13 +16,6 @@ public override void Setup()
MockPlatformSizeService.Current.GetPlatformSizeFunc = (b, d, e) => new SizeRequest(new Size(100, 50));
}
- [TearDown]
- public override void TearDown()
- {
- base.TearDown();
- Device.PlatformServices = null;
- }
-
[Test]
public void GetSizeRequestIncludesMargins()
{
diff --git a/src/Controls/tests/Core.UnitTests/MockPlatformServices.cs b/src/Controls/tests/Core.UnitTests/MockPlatformServices.cs
index f16eeb9e5086..0a0f26505b3a 100644
--- a/src/Controls/tests/Core.UnitTests/MockPlatformServices.cs
+++ b/src/Controls/tests/Core.UnitTests/MockPlatformServices.cs
@@ -17,11 +17,6 @@
namespace Microsoft.Maui.Controls.Core.UnitTests
{
- internal class MockPlatformServices : Internals.IPlatformServices
- {
- public OSAppTheme RequestedTheme { get; set; }
- }
-
internal class MockDeserializer : Internals.IDeserializer
{
public Task> DeserializePropertiesAsync()
@@ -247,6 +242,27 @@ public TargetIdiom TargetIdiom
public DeviceType DeviceType { get; set; }
}
+ class MockAppInfo : IAppInfo
+ {
+ public string PackageName { get; set; }
+
+ public string Name { get; set; }
+
+ public string VersionString { get; set; }
+
+ public Version Version { get; set; }
+
+ public string BuildString { get; set; }
+
+ public void ShowSettingsUI()
+ {
+ }
+
+ public AppTheme RequestedTheme { get; set; }
+
+ public AppPackagingModel PackagingModel { get; set; }
+ }
+
class MockPlatformSizeService : IPlatformSizeService
{
public static MockPlatformSizeService Current =>
diff --git a/src/Controls/tests/Core.UnitTests/ShellTestBase.cs b/src/Controls/tests/Core.UnitTests/ShellTestBase.cs
index 611a7537eafe..7dd8fc0c26d3 100644
--- a/src/Controls/tests/Core.UnitTests/ShellTestBase.cs
+++ b/src/Controls/tests/Core.UnitTests/ShellTestBase.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Maui.Controls.Internals;
+using Microsoft.Maui.Essentials;
using NUnit.Framework;
namespace Microsoft.Maui.Controls.Core.UnitTests
@@ -17,7 +18,7 @@ public class ShellTestBase : BaseTestFixture
public override void Setup()
{
base.Setup();
-
+ AppInfo.SetCurrent(new MockAppInfo());
}
[TearDown]
diff --git a/src/Controls/tests/Core.UnitTests/StyleSheets/IStylableTest.cs b/src/Controls/tests/Core.UnitTests/StyleSheets/IStylableTest.cs
index dcb1b49a0ebf..88520b8a1a54 100644
--- a/src/Controls/tests/Core.UnitTests/StyleSheets/IStylableTest.cs
+++ b/src/Controls/tests/Core.UnitTests/StyleSheets/IStylableTest.cs
@@ -7,18 +7,6 @@ namespace Microsoft.Maui.Controls.StyleSheets.UnitTests
[TestFixture]
public class IStylableTest
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase]
public void GetPropertyDefinedOnParent()
{
diff --git a/src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs b/src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs
index 35be15d32c22..9ae3da946522 100644
--- a/src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs
+++ b/src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs
@@ -14,14 +14,12 @@ public class StyleTests
[SetUp]
public void SetUp()
{
- Device.PlatformServices = new MockPlatformServices();
ApplicationExtensions.CreateAndSetMockApplication();
}
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.ClearCurrent();
}
diff --git a/src/Controls/tests/Core.UnitTests/ViewUnitTests.cs b/src/Controls/tests/Core.UnitTests/ViewUnitTests.cs
index 12ba5dd7889d..bd3710fd307c 100644
--- a/src/Controls/tests/Core.UnitTests/ViewUnitTests.cs
+++ b/src/Controls/tests/Core.UnitTests/ViewUnitTests.cs
@@ -547,7 +547,6 @@ public void StartTimerSimple()
task.Task.Wait();
Assert.False(task.Task.Result);
- Device.PlatformServices = null;
}
[Test]
@@ -567,7 +566,6 @@ public void StartTimerMultiple()
task.Task.Wait();
Assert.AreEqual(2, task.Task.Result);
- Device.PlatformServices = null;
}
[Test]
diff --git a/src/Controls/tests/Core.UnitTests/VisualTests.cs b/src/Controls/tests/Core.UnitTests/VisualTests.cs
index 27fb698bc3d0..020ba5b8b651 100644
--- a/src/Controls/tests/Core.UnitTests/VisualTests.cs
+++ b/src/Controls/tests/Core.UnitTests/VisualTests.cs
@@ -470,13 +470,6 @@ public void SetParentUsingCtorAndInheritParentValue()
Assert.AreEqual(Maui.Controls.VisualMarker.MatchParent, ((View)view).Visual);
}
- [TearDown]
- public override void TearDown()
- {
- base.TearDown();
- Device.PlatformServices = null;
- }
-
static void AddExplicitLTRToScrollView(ScrollView parent, View child)
{
parent.Content = child;
diff --git a/src/Controls/tests/Xaml.UnitTests/AcceptEmptyServiceProvider.xaml.cs b/src/Controls/tests/Xaml.UnitTests/AcceptEmptyServiceProvider.xaml.cs
index e1d4e0450aa8..38367f92efd5 100644
--- a/src/Controls/tests/Xaml.UnitTests/AcceptEmptyServiceProvider.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/AcceptEmptyServiceProvider.xaml.cs
@@ -37,18 +37,6 @@ public AcceptEmptyServiceProvider(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void ServiceProviderIsNullOnAttributedExtensions(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/AutoMergedResourceDictionaries.xaml.cs b/src/Controls/tests/Xaml.UnitTests/AutoMergedResourceDictionaries.xaml.cs
index 52640dbae369..0f9d88e5fc7f 100644
--- a/src/Controls/tests/Xaml.UnitTests/AutoMergedResourceDictionaries.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/AutoMergedResourceDictionaries.xaml.cs
@@ -20,18 +20,6 @@ public AutoMergedResourceDictionaries(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false)]
[TestCase(true)]
public void AutoMergedRd(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml.cs b/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml.cs
index bde676ed3efd..0f5310fd7a0b 100644
--- a/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml.cs
@@ -22,14 +22,12 @@ public class Tests
[SetUp]
public void Setup()
{
- Device.PlatformServices = new MockPlatformServices();
Application.Current = new MockApplication();
}
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/BindablePropertiesAccessModifiers.xaml.cs b/src/Controls/tests/Xaml.UnitTests/BindablePropertiesAccessModifiers.xaml.cs
index fe51e1f9a8db..84ff1688c886 100644
--- a/src/Controls/tests/Xaml.UnitTests/BindablePropertiesAccessModifiers.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/BindablePropertiesAccessModifiers.xaml.cs
@@ -49,18 +49,6 @@ public BindablePropertiesAccessModifiers(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void BindProperties(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/BindingDiagnosticsTests.xaml.cs b/src/Controls/tests/Xaml.UnitTests/BindingDiagnosticsTests.xaml.cs
index 1ab87de48d99..b5b8a2d0c5e6 100644
--- a/src/Controls/tests/Xaml.UnitTests/BindingDiagnosticsTests.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/BindingDiagnosticsTests.xaml.cs
@@ -24,10 +24,6 @@ public BindingDiagnosticsTests(bool useCompiledXaml)
#endif
public class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(false)]
//[TestCase(true)]
public void Test(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Border.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Border.xaml.cs
index 2bd5232da26d..7feae77cfdbb 100644
--- a/src/Controls/tests/Xaml.UnitTests/Border.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Border.xaml.cs
@@ -15,9 +15,6 @@ public Border(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(false)]
[TestCase(true)]
public void InitializeStrokeShape(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/BuiltInConversions.xaml.cs b/src/Controls/tests/Xaml.UnitTests/BuiltInConversions.xaml.cs
index d8ec8ad74a78..43db9ec4bc22 100644
--- a/src/Controls/tests/Xaml.UnitTests/BuiltInConversions.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/BuiltInConversions.xaml.cs
@@ -19,18 +19,6 @@ public BuiltInConversions(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false)]
[TestCase(true)]
public void Datetime(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/ButtonCornerRadius.xaml.cs b/src/Controls/tests/Xaml.UnitTests/ButtonCornerRadius.xaml.cs
index df59728ec593..90316e36868c 100644
--- a/src/Controls/tests/Xaml.UnitTests/ButtonCornerRadius.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/ButtonCornerRadius.xaml.cs
@@ -18,18 +18,6 @@ public ButtonCornerRadius(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false)]
[TestCase(true)]
public void EscapedStringsAreTreatedAsLiterals(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/ConstraintExpression.xaml.cs b/src/Controls/tests/Xaml.UnitTests/ConstraintExpression.xaml.cs
index 94dc03fd4088..85e20fac3ebb 100644
--- a/src/Controls/tests/Xaml.UnitTests/ConstraintExpression.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/ConstraintExpression.xaml.cs
@@ -22,12 +22,6 @@ public ConstraintExpression(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
[TestCase(true)]
public void ConstantConstraint(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/DataTemplateExtension.xaml.cs b/src/Controls/tests/Xaml.UnitTests/DataTemplateExtension.xaml.cs
index a1e80acea1df..1e3bf0557304 100644
--- a/src/Controls/tests/Xaml.UnitTests/DataTemplateExtension.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/DataTemplateExtension.xaml.cs
@@ -14,9 +14,6 @@ public DataTemplateExtension(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void DataTemplateExtension(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/DefinitionCollectionTests.xaml.cs b/src/Controls/tests/Xaml.UnitTests/DefinitionCollectionTests.xaml.cs
index 8f8fba860709..2666f26e65ab 100644
--- a/src/Controls/tests/Xaml.UnitTests/DefinitionCollectionTests.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/DefinitionCollectionTests.xaml.cs
@@ -19,9 +19,6 @@ public DefinitionCollectionTests(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void DefinitionCollectionsParsedFromMarkup([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/DesignPropertiesTests.cs b/src/Controls/tests/Xaml.UnitTests/DesignPropertiesTests.cs
index a4d57b07342c..b106d58efa01 100644
--- a/src/Controls/tests/Xaml.UnitTests/DesignPropertiesTests.cs
+++ b/src/Controls/tests/Xaml.UnitTests/DesignPropertiesTests.cs
@@ -7,9 +7,6 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests
[TestFixture]
public class DesignPropertiesTests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void DesignProperties()
{
diff --git a/src/Controls/tests/Xaml.UnitTests/DynamicResource.xaml.cs b/src/Controls/tests/Xaml.UnitTests/DynamicResource.xaml.cs
index 7ef77ab8a602..aaf85b896b5a 100644
--- a/src/Controls/tests/Xaml.UnitTests/DynamicResource.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/DynamicResource.xaml.cs
@@ -21,18 +21,6 @@ public DynamicResource(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void TestDynamicResources(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingCtor.xaml.cs b/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingCtor.xaml.cs
index e2513365e1a7..4401c74b5b32 100644
--- a/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingCtor.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingCtor.xaml.cs
@@ -16,9 +16,6 @@ public FactoryMethodMissingCtor(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void Throw([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingMethod.xaml.cs b/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingMethod.xaml.cs
index 50a9fd77dff5..540cb1fa034d 100644
--- a/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingMethod.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/FactoryMethodMissingMethod.xaml.cs
@@ -20,12 +20,6 @@ public FactoryMethodMissingMethod(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
[TestCase(true)]
public void Throw(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/FactoryMethods.xaml.cs b/src/Controls/tests/Xaml.UnitTests/FactoryMethods.xaml.cs
index 013922d232bc..0a4a7c386ab0 100644
--- a/src/Controls/tests/Xaml.UnitTests/FactoryMethods.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/FactoryMethods.xaml.cs
@@ -77,12 +77,6 @@ public FactoryMethods(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
[TestCase(true)]
public void TestDefaultCtor(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/FontConverterTests.cs b/src/Controls/tests/Xaml.UnitTests/FontConverterTests.cs
index a4db54e0bb59..4a7e47698ec2 100644
--- a/src/Controls/tests/Xaml.UnitTests/FontConverterTests.cs
+++ b/src/Controls/tests/Xaml.UnitTests/FontConverterTests.cs
@@ -16,8 +16,6 @@ public void FontAttributes(string attributeString, FontAttributes result)
xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" FontAttributes=""" + result + @""" />";
- Device.PlatformServices = new MockPlatformServices();
-
var label = new Label().LoadFromXaml(xaml);
Assert.AreEqual(result, label.FontAttributes);
diff --git a/src/Controls/tests/Xaml.UnitTests/FontImageExtension.xaml.cs b/src/Controls/tests/Xaml.UnitTests/FontImageExtension.xaml.cs
index 254546b227bf..31d09768fe30 100644
--- a/src/Controls/tests/Xaml.UnitTests/FontImageExtension.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/FontImageExtension.xaml.cs
@@ -20,9 +20,6 @@ public FontImageExtension(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void FontImageExtension_Positive(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/HRTests.cs b/src/Controls/tests/Xaml.UnitTests/HRTests.cs
index dd2bb633d003..36f18e082173 100644
--- a/src/Controls/tests/Xaml.UnitTests/HRTests.cs
+++ b/src/Controls/tests/Xaml.UnitTests/HRTests.cs
@@ -7,16 +7,9 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests
[TestFixture]
public class HRTests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Maui.Controls.Internals.ResourceLoader.ExceptionHandler2 = null;
Application.ClearCurrent();
}
diff --git a/src/Controls/tests/Xaml.UnitTests/I8.xaml.cs b/src/Controls/tests/Xaml.UnitTests/I8.xaml.cs
index 05c7525118ae..c728c4a41f52 100644
--- a/src/Controls/tests/Xaml.UnitTests/I8.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/I8.xaml.cs
@@ -38,18 +38,6 @@ public I8(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false)]
[TestCase(true)]
public void I8AreConverted(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/ImplicitResourceDictionaries.xaml.cs b/src/Controls/tests/Xaml.UnitTests/ImplicitResourceDictionaries.xaml.cs
index 6b677554330a..4f77461472bd 100644
--- a/src/Controls/tests/Xaml.UnitTests/ImplicitResourceDictionaries.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/ImplicitResourceDictionaries.xaml.cs
@@ -20,18 +20,6 @@ public ImplicitResourceDictionaries(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false)]
[TestCase(true)]
public void ImplicitRDonContentViews(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/InlineCSS.xaml.cs b/src/Controls/tests/Xaml.UnitTests/InlineCSS.xaml.cs
index 60ddef0a3a95..09fc3917b66e 100644
--- a/src/Controls/tests/Xaml.UnitTests/InlineCSS.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/InlineCSS.xaml.cs
@@ -20,18 +20,6 @@ public InlineCSS(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void InlineCSSParsed(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
index 3ede07029aaf..3b7c3343f9be 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/BPNotResolvedOnSubClass.xaml.cs
@@ -30,18 +30,6 @@ public BPNotResolvedOnSubClass(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void CorrectlyResolveBPOnSubClasses(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz27299.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz27299.xaml.cs
index 91a7f29ef10c..f0c3e1012bcd 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz27299.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz27299.xaml.cs
@@ -45,13 +45,6 @@ class Tests
public void SetUp()
{
Bz27299ViewModelLocator.Count = 0;
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
}
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz34037.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz34037.xaml.cs
index 2d4b90ed7be2..8a3272ea5f0a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz34037.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz34037.xaml.cs
@@ -73,7 +73,6 @@ class Tests
[SetUp]
public void Setup()
{
- Device.PlatformServices = new MockPlatformServices();
Bz34037Converter0.Invoked = 0;
Bz34037Converter1.Invoked = 0;
}
@@ -81,7 +80,6 @@ public void Setup()
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz40906.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz40906.xaml.cs
index a3d34b36a629..0c72bc8e0f30 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz40906.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz40906.xaml.cs
@@ -21,18 +21,6 @@ public Bz40906(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void ParsingCDATA(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz41048.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz41048.xaml.cs
index be95a461b02d..409412bf0045 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz41048.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz41048.xaml.cs
@@ -22,17 +22,10 @@ public Bz41048(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
Application.Current = null;
- Device.PlatformServices = null;
}
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43450.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43450.xaml.cs
index a68571f8aea4..84d67a339cb7 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43450.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43450.xaml.cs
@@ -20,18 +20,6 @@ public Bz43450(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void DoesNotAllowGridRowDefinition(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43694.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43694.xaml.cs
index 29dc40ef3222..16186808c6de 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43694.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43694.xaml.cs
@@ -22,18 +22,6 @@ public Bz43694(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void xStaticWithOnPlatformChildInRD(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43733.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43733.xaml.cs
index 65c7427e787b..5b07e5257b2d 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz43733.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz43733.xaml.cs
@@ -29,18 +29,6 @@ public Bz43733(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void ThrowOnMissingDictionary(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz44216.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz44216.xaml.cs
index 748b98243d7d..78a6aa66e079 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz44216.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz44216.xaml.cs
@@ -33,18 +33,6 @@ public Bz44216(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void DonSetValueOnPrivateBP(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz45179.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz45179.xaml.cs
index 3b937c525175..cb7b5e2e617c 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz45179.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz45179.xaml.cs
@@ -30,18 +30,6 @@ public Bz45179(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void DTDoNotInstantiateTheirContent(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz45299.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz45299.xaml.cs
index 9e7f5a6d85b0..b14d81a71743 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz45299.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz45299.xaml.cs
@@ -120,18 +120,6 @@ public Bz45299(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void XamlCCustomTypeConverter(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz47950.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz47950.xaml.cs
index 5139a5916d4f..d261af95b8f5 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz47950.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz47950.xaml.cs
@@ -31,9 +31,6 @@ public Bz47950(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BehaviorAndStaticResource([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz51567.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz51567.xaml.cs
index 83ef9e0794df..96c655050617 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz51567.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz51567.xaml.cs
@@ -21,18 +21,6 @@ public Bz51567(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void SetterWithElementValue(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53203.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53203.xaml.cs
index a83898969333..7c82555fce73 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53203.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53203.xaml.cs
@@ -42,18 +42,6 @@ public Bz53203(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
public void MarkupOnAttachedBPDoesNotThrowAtCompileTime(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53275.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53275.xaml.cs
index d25a48e2ef5a..a96539a29b35 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53275.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53275.xaml.cs
@@ -31,18 +31,6 @@ public Bz53275(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
[TestCase(false)]
public void TargetPropertyIsSetOnMarkups(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53318.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53318.xaml.cs
index 3eebab3e2ffe..d009949837f7 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53318.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53318.xaml.cs
@@ -22,18 +22,6 @@ public Bz53318()
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[Test]
public void DoesCompilesArgsInsideDataTemplate()
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53350.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53350.xaml.cs
index 7a09d71a7920..145583375e59 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz53350.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz53350.xaml.cs
@@ -37,17 +37,10 @@ public Bz53350(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
Application.Current = null;
- Device.PlatformServices = null;
}
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz54334.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz54334.xaml.cs
index dbe92d0419eb..67ccb312e326 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz54334.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz54334.xaml.cs
@@ -59,17 +59,10 @@ public Bz54334(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
Application.Current = null;
- Device.PlatformServices = null;
}
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz54717.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz54717.xaml.cs
index 976084da5f83..91f8fae4815c 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz54717.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz54717.xaml.cs
@@ -20,16 +20,9 @@ public Bz54717(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz55347.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz55347.xaml.cs
index 46bbcc890031..5f049eb2f2dd 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz55347.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz55347.xaml.cs
@@ -18,16 +18,9 @@ public Bz55347(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz55862.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz55862.xaml.cs
index 6cab8771864f..a9d35d376f69 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz55862.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz55862.xaml.cs
@@ -28,18 +28,6 @@ public Bz55862(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[Test]
public void BindingContextWithConverter([Values(false/*, true*/)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz56852.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz56852.xaml.cs
index c55a57937151..6c0e39d8faa3 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz56852.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz56852.xaml.cs
@@ -19,16 +19,9 @@ public Bz56852(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz57574.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz57574.xaml.cs
index b1b962b1cc0c..63034f09d5c6 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz57574.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz57574.xaml.cs
@@ -42,16 +42,9 @@ public void OnNotified(object sender, Bz57574NotificationEventArgs args)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TearDown]
public void TearDown()
{
- Device.PlatformServices = null;
Application.Current = null;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz58922.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz58922.xaml.cs
index dc6e7253d344..901a1c9b8d49 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz58922.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz58922.xaml.cs
@@ -31,7 +31,6 @@ public void Setup()
public void TearDown()
{
DeviceInfo.SetCurrent(null);
- Device.PlatformServices = null;
}
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60203.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60203.xaml.cs
index 66feb464bb0f..b1ab2b626b51 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60203.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60203.xaml.cs
@@ -21,18 +21,6 @@ public Bz60203(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void CanCompileMultiTriggersWithDifferentConditions(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60575.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60575.xaml.cs
index a0326efa230a..e2091425f857 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60575.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60575.xaml.cs
@@ -67,18 +67,6 @@ public IList Collection2
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void CollectionProperties(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60788.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60788.xaml.cs
index db1175d130c6..84f37a86afb0 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Bz60788.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Bz60788.xaml.cs
@@ -20,18 +20,6 @@ public Bz60788(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void KeyedRDWithImplicitStyles(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/DO817710.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/DO817710.xaml.cs
index 37bc45068282..e4097ddea6cc 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/DO817710.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/DO817710.xaml.cs
@@ -16,9 +16,6 @@ public DO817710(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void EmptyResourcesElement([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11061.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11061.xaml.cs
index 5321225a42cf..0e2fecc62aac 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11061.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11061.xaml.cs
@@ -21,9 +21,6 @@ public Gh11061(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void XamlCBindingOnNonBP([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11334.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11334.xaml.cs
index 5e5352aa09a6..e0466f68f0a7 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11334.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11334.xaml.cs
@@ -35,7 +35,6 @@ class Tests
[SetUp]
public void Setup()
{
- Device.PlatformServices = new MockPlatformServices();
_debuggerinitialstate = DebuggerHelper._mockDebuggerIsAttached;
DebuggerHelper._mockDebuggerIsAttached = true;
}
@@ -44,7 +43,6 @@ public void Setup()
public void TearDown()
{
DebuggerHelper._mockDebuggerIsAttached = _debuggerinitialstate;
- Device.PlatformServices = null;
VisualDiagnostics.VisualTreeChanged -= OnVTChanged;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11335.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11335.xaml.cs
index 50e47bb4761f..f6f289c1e333 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11335.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11335.xaml.cs
@@ -30,7 +30,6 @@ class Tests
[SetUp]
public void Setup()
{
- Device.PlatformServices = new MockPlatformServices();
_debuggerinitialstate = DebuggerHelper._mockDebuggerIsAttached;
DebuggerHelper._mockDebuggerIsAttached = true;
}
@@ -39,7 +38,6 @@ public void Setup()
public void TearDown()
{
DebuggerHelper._mockDebuggerIsAttached = _debuggerinitialstate;
- Device.PlatformServices = null;
VisualDiagnostics.VisualTreeChanged -= OnVTChanged;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11541.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11541.xaml.cs
index 018dd0fa695c..835dc9278d05 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11541.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11541.xaml.cs
@@ -17,10 +17,6 @@ public Gh11541(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void RectangleGeometryDoesntThrow([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11551.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11551.xaml.cs
index 3d8f61065a15..aa153ab25fe5 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11551.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11551.xaml.cs
@@ -20,10 +20,6 @@ public Gh11551(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void RectBoundsDoesntThrow([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11620.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11620.xaml.cs
index bb07e18ca1e1..b4dacc1a728d 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11620.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11620.xaml.cs
@@ -17,9 +17,6 @@ public Gh11620(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BoxOnAdd([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11711.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11711.xaml.cs
index 251f0fcbcfaf..3501fb70765c 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh11711.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh11711.xaml.cs
@@ -19,9 +19,6 @@ public Gh11711(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void FormatExceptionAreCaught([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12025.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12025.xaml.cs
index 5bf4511ad67c..d84b703064c7 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12025.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12025.xaml.cs
@@ -25,9 +25,6 @@ public Gh12025(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void FindMostDerivedABP([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12763.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12763.xaml.cs
index fd17d0db1fe3..a7f3b78d9165 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12763.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12763.xaml.cs
@@ -19,9 +19,6 @@ public Gh12763(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void QuotesInStringFormat([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12874.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12874.xaml.cs
index 7ca7beb2f574..4e2b5766c4f1 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh12874.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh12874.xaml.cs
@@ -17,9 +17,6 @@ public Gh12874(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void RevertToStyleValue([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh13209.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh13209.xaml.cs
index 449bf10e0534..a0561bc49f2e 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh13209.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh13209.xaml.cs
@@ -18,11 +18,6 @@ public Gh13209(bool useCompiledXaml)
[TestFixture]
class Tests
{
-
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void RdWithSource(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1346.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1346.xaml.cs
index ed4dbaef3f84..5525a17b74ed 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1346.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1346.xaml.cs
@@ -22,18 +22,6 @@ public Gh1346(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void xStaticInStyle(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1497.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1497.xaml.cs
index 1129a149f031..b9bf4ba56eb9 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1497.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1497.xaml.cs
@@ -27,18 +27,6 @@ public Gh1497(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void GenericsIssue(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1554.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1554.xaml.cs
index 863aee1362fb..721414e65f64 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1554.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1554.xaml.cs
@@ -20,18 +20,6 @@ public Gh1554(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void NestedRDAreOnlyProcessedOnce(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1566.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1566.xaml.cs
index d03de23ecf06..03f6507e6e37 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1566.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1566.xaml.cs
@@ -20,18 +20,6 @@ public Gh1566(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void ObsoletePropsDoNotThrow(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1766.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1766.xaml.cs
index 2c9836792d81..70a2014371ca 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh1766.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh1766.xaml.cs
@@ -22,18 +22,6 @@ public Gh1766(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void CSSPropertiesNotInerited(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2007.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2007.xaml.cs
index 7baa5b57d67d..3bfd2c3f40e3 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2007.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2007.xaml.cs
@@ -21,18 +21,6 @@ public Gh2007(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void UsefullxResourceErrorMessages(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2130.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2130.xaml.cs
index 069b846e9dbb..d09be2275f24 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2130.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2130.xaml.cs
@@ -40,18 +40,6 @@ public Gh2130(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void AttachedBPWithEventName(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2171.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2171.xaml.cs
index 1f41954b89d3..bd72e9bcff51 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2171.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2171.xaml.cs
@@ -19,18 +19,6 @@ public Gh2171(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void ParsingNestedMarkups(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2483.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2483.xaml.cs
index 7aadf177ae1f..6e757ff8d05e 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2483.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2483.xaml.cs
@@ -35,18 +35,6 @@ public Gh2483(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void DupeKeyRd(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2508.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2508.xaml.cs
index 5c63b7cc37f1..8c317d80cdf7 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2508.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2508.xaml.cs
@@ -35,18 +35,6 @@ public Gh2508(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void UintProperties(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml.cs
index 00f97505ecac..1dd79a33df8a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml.cs
@@ -23,18 +23,6 @@ public Gh2517(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
public void ErrorOnMissingBindingTarget(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2549.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2549.xaml.cs
index 70b5a2870549..e32ecbd8b182 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2549.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2549.xaml.cs
@@ -24,18 +24,6 @@ public Gh2549(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
public void ErrorOnUnknownXmlnsForDataType(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2574.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2574.xaml.cs
index b26a24f0d238..2065480cd3cb 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2574.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2574.xaml.cs
@@ -19,18 +19,6 @@ public Gh2574(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void xNameOnRoot(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2678.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2678.xaml.cs
index c6ecee7e80f7..897f47e78b08 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2678.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2678.xaml.cs
@@ -20,14 +20,6 @@ public Gh2678(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void StyleClassCanBeChanged([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2752.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2752.xaml.cs
index b9d7392acc6e..be0ded5c72aa 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh2752.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh2752.xaml.cs
@@ -32,9 +32,6 @@ public Gh2752(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void FallbcakToDefaultValueCreator(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3082.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3082.xaml.cs
index f0ace1a2c595..1ad08d30ffd2 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3082.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3082.xaml.cs
@@ -30,18 +30,6 @@ async Task OnClicked(object sender, EventArgs e)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void ThrowsOnWrongEventHandlerSignature(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3260.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3260.xaml.cs
index bed01fcf82f1..d2f2dcd64107 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3260.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3260.xaml.cs
@@ -38,18 +38,6 @@ public Gh3260(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void AssignContentWithNoContentAttributeDoesNotThrow(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3280.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3280.xaml.cs
index 58f984c9cc7a..108434d61d59 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3280.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3280.xaml.cs
@@ -25,18 +25,6 @@ public Gh3280(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void SizeHasConverter(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3512.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3512.xaml.cs
index ded290a732cc..c1b2e139e97b 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3512.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3512.xaml.cs
@@ -24,18 +24,6 @@ public Gh3512(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void ThrowsOnDuplicateXKey(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3539.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3539.xaml.cs
index 0a22fc62b3df..17d7c65755bf 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3539.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3539.xaml.cs
@@ -220,18 +220,6 @@ public Gh3539(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true)]
public void CompiledBindingCodeIsValid(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3847.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3847.xaml.cs
index 338962cbcb45..1ae3f1580807 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3847.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3847.xaml.cs
@@ -21,18 +21,6 @@ public Gh3847(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void RelativeSourceSelfBinding(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4099.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4099.xaml.cs
index 842a5196101b..8ff895e313c6 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4099.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4099.xaml.cs
@@ -20,9 +20,6 @@ public Gh4099(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true)]
[Ignore("Ignore for now, Compiled Converters are disabled")]
public void BetterExceptionReport(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4102.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4102.xaml.cs
index e61cd7c21800..56586d45fc2f 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4102.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4102.xaml.cs
@@ -24,9 +24,6 @@ public Gh4102(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void CompiledBindingsNullInPath(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4103.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4103.xaml.cs
index 048446129aa7..1dcbf62fe166 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4103.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4103.xaml.cs
@@ -23,9 +23,6 @@ public Gh4103(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void CompiledBindingsTargetNullValue(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4130.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4130.xaml.cs
index ee9409288c21..0e3e0f3d1b29 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4130.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4130.xaml.cs
@@ -39,18 +39,6 @@ void OnTextChanged(object sender, EventArgs e)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(false), TestCase(true)]
public void NonGenericEventHanlders(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4215.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4215.xaml.cs
index dbdcd96ca492..6abbddabc80a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4215.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4215.xaml.cs
@@ -30,18 +30,6 @@ public Gh4215(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void AvoidAmbiguousMatch(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4227.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4227.xaml.cs
index 62b51994c1ee..d1385ce26dd2 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4227.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4227.xaml.cs
@@ -37,18 +37,6 @@ public Gh4227(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void FindMemberOnInterfaces(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4319.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4319.xaml.cs
index 9bb0b28925e0..64dbef7be8d9 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4319.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4319.xaml.cs
@@ -24,14 +24,12 @@ class Tests
public void Setup()
{
DeviceInfo.SetCurrent(mockDeviceInfo = new MockDeviceInfo());
- Device.PlatformServices = new MockPlatformServices();
}
[TearDown]
public void TearDown()
{
DeviceInfo.SetCurrent(null);
- Device.PlatformServices = null;
}
[TestCase(true), TestCase(false)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4326.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4326.xaml.cs
index df9b48634500..a2865a94d349 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4326.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4326.xaml.cs
@@ -24,18 +24,6 @@ public Gh4326(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void FindStaticInternal(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4348.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4348.xaml.cs
index 7eeaa6ca7e20..b2a895aa1355 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4348.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4348.xaml.cs
@@ -31,18 +31,6 @@ public Gh4348(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void GenericBaseClassResolution(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4438.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4438.xaml.cs
index 1d0ee3c36e3c..88fde57438af 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4438.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4438.xaml.cs
@@ -37,18 +37,6 @@ public Gh4438(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void GenericBaseClassResolution(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4446.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4446.xaml.cs
index 2d244ecc469c..fa0edd8c838b 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4446.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4446.xaml.cs
@@ -30,18 +30,6 @@ public Gh4446(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void BindingThrowsOnWrongConverterParameter(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4516.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4516.xaml.cs
index 232d22174b66..9f2c72b21ba5 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4516.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4516.xaml.cs
@@ -22,9 +22,6 @@ public Gh4516(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void BindingToEmptyCollection(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4572.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4572.xaml.cs
index 4ac9ccce8792..d1a1c6e90c4e 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4572.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4572.xaml.cs
@@ -14,9 +14,6 @@ public Gh4572(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[TestCase(true), TestCase(false)]
public void BindingAsElement(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4751.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4751.xaml.cs
index 94ccbb23822c..f2dd08f630bb 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4751.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4751.xaml.cs
@@ -24,9 +24,6 @@ public Gh4751(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void ErrorOnMissingDefaultCtor([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4760.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4760.xaml.cs
index 0f4cf893172f..9973e140e8ca 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh4760.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh4760.xaml.cs
@@ -31,9 +31,6 @@ public Gh4760(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void GenericBaseClassForMarkups([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5095.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5095.xaml.cs
index bb66797e0adc..22e5021e1323 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5095.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5095.xaml.cs
@@ -19,9 +19,6 @@ public Gh5095(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void ThrowsOnInvalidXaml([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5240.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5240.xaml.cs
index 3ba79225712f..82583f126649 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5240.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5240.xaml.cs
@@ -18,9 +18,6 @@ public Gh5240(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void FailOnUnresolvedDataType([Values(true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5242.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5242.xaml.cs
index ae3b0fb2697c..0744ac7099ba 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5242.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5242.xaml.cs
@@ -25,9 +25,6 @@ public Gh5242(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BindingToNullable([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5254.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5254.xaml.cs
index e45d9da033c9..dbe462806d5d 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5254.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5254.xaml.cs
@@ -23,9 +23,6 @@ public Gh5254(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BindToIntIndexer([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5256.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5256.xaml.cs
index e5d6d2410732..616324944571 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5256.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5256.xaml.cs
@@ -32,9 +32,6 @@ public Gh5256(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void EventOverriding([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5290.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5290.xaml.cs
index e019fa88012e..51c95ebbd572 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5290.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5290.xaml.cs
@@ -29,9 +29,6 @@ public Gh5290(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void TwoWayBindingToNullable([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5330.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5330.xaml.cs
index 114db003ef2e..8ab6e1d0173a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5330.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5330.xaml.cs
@@ -14,9 +14,6 @@ public Gh5330(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void DoesntFailOnxType([Values(true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_1.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_1.xaml.cs
index 28a430639c7c..02406d511443 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_1.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_1.xaml.cs
@@ -19,9 +19,6 @@ public Gh5378_1(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void ReportSyntaxError([Values(false/*, true*/)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_2.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_2.xaml.cs
index 2743b582a6c9..d7b4dcd67d2a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_2.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5378_2.xaml.cs
@@ -23,9 +23,6 @@ public Gh5378_2(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void ReportSyntaxError([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5486.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5486.xaml.cs
index 2dd4bee1f792..dc773f81d522 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5486.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5486.xaml.cs
@@ -51,18 +51,6 @@ public Gh5486(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void GenericBaseInterfaceResolution(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5651.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5651.xaml.cs
index 891872001463..4da900d8dc84 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5651.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5651.xaml.cs
@@ -38,18 +38,6 @@ public Gh5651(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[TestCase(true), TestCase(false)]
public void GenericBaseInterfaceResolution(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5705.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5705.xaml.cs
index 683cfa885a4d..94ecbd7f2072 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh5705.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh5705.xaml.cs
@@ -18,18 +18,6 @@ public Gh5705(bool useCompiledXaml)
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[Test]
public void SearchHandlerIneritBC([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6176.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6176.xaml.cs
index 1e4cb53e53d0..3720c70e8be8 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6176.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6176.xaml.cs
@@ -27,9 +27,6 @@ public Gh6176(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void XamlCDoesntFail([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6361.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6361.xaml.cs
index f508c1bd6874..1d69fc2cc0fb 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6361.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6361.xaml.cs
@@ -17,14 +17,6 @@ public Gh6361(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void CSSBorderRadiusDoesNotFail([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6648.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6648.xaml.cs
index 1cc6461396e1..940a97d4fa20 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6648.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6648.xaml.cs
@@ -17,9 +17,6 @@ public Gh6648(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void DoesntFailOnNullDataType([Values(true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6996.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6996.xaml.cs
index ae6e0345738c..67ad62fc3413 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh6996.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh6996.xaml.cs
@@ -20,9 +20,6 @@ public Gh6996(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void FontImageSourceColorWithDynamicResource([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7097.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7097.xaml.cs
index 57b797d4672f..e0d1150273d0 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7097.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7097.xaml.cs
@@ -23,7 +23,6 @@ class Tests
[SetUp]
public void Setup()
{
- Device.PlatformServices = new MockPlatformServices();
DispatcherProvider.SetCurrent(new DispatcherProviderStub());
}
@@ -31,7 +30,6 @@ public void Setup()
public void TearDown()
{
DispatcherProvider.SetCurrent(null);
- Device.PlatformServices = null;
}
[Test]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7187.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7187.xaml.cs
index 03ad2c505c86..33790849f282 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7187.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7187.xaml.cs
@@ -19,9 +19,6 @@ public Gh7187(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void InvalidMarkupAssignmentThrowsXPE([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7531.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7531.xaml.cs
index f1640d16b83b..2b1c397bfb6a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7531.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7531.xaml.cs
@@ -16,9 +16,6 @@ public Gh7531(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void XamlOnlyResourceResolvesLocalAssembly([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7559.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7559.xaml.cs
index 0d8e87399c35..1f51598b2485 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7559.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7559.xaml.cs
@@ -19,9 +19,6 @@ public Gh7559(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void GenericBPCompiles([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7837.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7837.xaml.cs
index f258c8a3baaa..812fbe8fca77 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh7837.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh7837.xaml.cs
@@ -31,9 +31,6 @@ public Gh7837(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BindingWithMultipleIndexers([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh8221.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh8221.xaml.cs
index 9a002caf97d4..6a026c2c894e 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh8221.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh8221.xaml.cs
@@ -24,9 +24,6 @@ public Gh8221(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void BindingWithMultipleIndexers([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh8936.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh8936.xaml.cs
index 619e219384ed..39d8c3efd106 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh8936.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh8936.xaml.cs
@@ -26,9 +26,6 @@ public Gh8936(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void IndexerBindingOnSubclasses([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh9212.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh9212.xaml.cs
index 413ce582b3f1..f4e2e386bc96 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh9212.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh9212.xaml.cs
@@ -26,9 +26,6 @@ public Gh9212(bool useCompiledXaml)
[TestFixture]
class Tests
{
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
[Test]
public void SingleQuoteAndTrailingSpaceInMarkupValue([Values(false, true)] bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1438.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1438.xaml.cs
index 0c71bc5b247d..f1cd6bb3caa2 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1438.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1438.xaml.cs
@@ -22,12 +22,6 @@ public Issue1438(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
[TestCase(true)]
public void XNameForwardDeclaration(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1493.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1493.cs
index 98aa0d540768..7bda3d67b535 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1493.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1493.cs
@@ -13,14 +13,11 @@ public class Issue1493
public virtual void Setup()
{
_defaultCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- Device.PlatformServices = new MockPlatformServices();
}
[TearDown]
public virtual void TearDown()
{
- Device.PlatformServices = null;
System.Threading.Thread.CurrentThread.CurrentCulture = _defaultCulture;
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1497.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1497.cs
index c7d84d00ff66..b893d83b72ae 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue1497.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue1497.cs
@@ -7,18 +7,6 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests
[TestFixture]
public class Issue1497
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
- [TearDown]
- public void TearDown()
- {
- Device.PlatformServices = null;
- }
-
[Test]
public void BPCollectionsWithSingleElement()
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2114.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2114.xaml.cs
index 24045b038c1c..250bb173bfcf 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2114.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2114.xaml.cs
@@ -24,9 +24,7 @@ public class Tests
[SetUp]
public void SetUp()
{
- Device.PlatformServices = new MockPlatformServices();
-
- Current = null;
+ Application.Current = null;
}
[TestCase(false)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2450.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2450.xaml.cs
index 01c30a9dcafb..601523b91e3c 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2450.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2450.xaml.cs
@@ -21,12 +21,6 @@ public Issue2450(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
public void ThrowMeaningfulExceptionOnDuplicateXName(bool useCompiledXaml)
{
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2489.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2489.xaml.cs
index 090790da8565..8e211924ac0b 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2489.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2489.xaml.cs
@@ -22,12 +22,6 @@ public Issue2489(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void SetUp()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[TestCase(false)]
[TestCase(true)]
public void DataTriggerTargetType(bool useCompiledXaml)
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2578.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2578.xaml.cs
index 6c60f964fb6f..d7347e205cf4 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2578.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2578.xaml.cs
@@ -22,12 +22,6 @@ public Issue2578(bool useCompiledXaml)
[TestFixture]
public class Tests
{
- [SetUp]
- public void Setup()
- {
- Device.PlatformServices = new MockPlatformServices();
- }
-
[Ignore("[Bug] NamedSizes don't work in triggers: https://github.com/xamarin/Microsoft.Maui.Controls/issues/13831")]
[TestCase(false)]
[TestCase(true)]
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2659.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2659.xaml.cs
index 46bab72e38c9..103afe50d11a 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Issue2659.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Issue2659.xaml.cs
@@ -65,12 +65,6 @@ void EnumerateButtons(Action