Ejemplo n.º 1
0
 public void TearDown()
 {
     DebuggerHelper._mockDebuggerIsAttached = debuggerinitialstate;
     DispatcherProvider.SetCurrent(null);
     VisualDiagnostics.VisualTreeChanged -= VTChanged;
     failures = 0;
 }
Ejemplo n.º 2
0
 public void Setup()
 {
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     VisualDiagnostics.VisualTreeChanged += VTChanged;
     debuggerinitialstate = DebuggerHelper._mockDebuggerIsAttached;
     DebuggerHelper._mockDebuggerIsAttached = true;
 }
Ejemplo n.º 3
0
 public void Setup()
 {
     Device.PlatformServices = new MockPlatformServices {
         RuntimePlatform = Device.iOS
     };
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
Ejemplo n.º 4
0
 public virtual void Setup()
 {
     _defaultCulture         = System.Threading.Thread.CurrentThread.CurrentCulture;
     _defaultUICulture       = System.Threading.Thread.CurrentThread.CurrentUICulture;
     Device.PlatformServices = new MockPlatformServices();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceDisplay.SetCurrent(null);
 }
Ejemplo n.º 5
0
 public virtual void TearDown()
 {
     Device.PlatformServices = null;
     DeviceDisplay.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture   = _defaultCulture;
     System.Threading.Thread.CurrentThread.CurrentUICulture = _defaultUICulture;
     DispatcherProvider.SetCurrent(null);
 }
Ejemplo n.º 6
0
        public void SetUp()
        {
            DispatcherProvider.SetCurrent(new DispatcherProviderStub());

            //this should collect the ConditionalWeakTable
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Ejemplo n.º 7
0
 public virtual void TearDown()
 {
     MockPlatformSizeService.Current?.Reset();
     AppInfo.SetCurrent(null);
     DeviceDisplay.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture   = _defaultCulture;
     System.Threading.Thread.CurrentThread.CurrentUICulture = _defaultUICulture;
     DispatcherProvider.SetCurrent(null);
 }
Ejemplo n.º 8
0
 public virtual void Setup()
 {
     Microsoft.Maui.Controls.Hosting.CompatibilityCheck.UseCompatibility();
     _defaultCulture   = System.Threading.Thread.CurrentThread.CurrentCulture;
     _defaultUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
     MockPlatformSizeService.Current?.Reset();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceDisplay.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     AppInfo.SetCurrent(null);
 }
Ejemplo n.º 9
0
        public static MauiAppBuilder ConfigureDispatching(this MauiAppBuilder builder)
        {
            builder.Services.TryAddSingleton <IDispatcherProvider>(svc => new DispatcherProvider());
            builder.Services.TryAddScoped(svc =>
            {
                var provider = svc.GetRequiredService <IDispatcherProvider>();
                if (DispatcherProvider.SetCurrent(provider))
                {
                    svc.CreateLogger <Dispatcher>()?.LogWarning("Replaced an existing DispatcherProvider with one from the service provider.");
                }

                return(Dispatcher.GetForCurrentThread() !);
            });
            builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped <IMauiInitializeScopedService, DispatcherInitializer>());

            return(builder);
        }
Ejemplo n.º 10
0
        public static MauiAppBuilder ConfigureDispatching(this MauiAppBuilder builder)
        {
            builder.Services.TryAddSingleton <IDispatcherProvider>(svc =>
                                                                   // the DispatcherProvider might have already been initialized, so ensure that we are grabbing the
                                                                   // Current and putting it in the DI container.
                                                                   DispatcherProvider.Current);

            builder.Services.TryAddScoped(svc =>
            {
                var provider = svc.GetRequiredService <IDispatcherProvider>();
                if (DispatcherProvider.SetCurrent(provider))
                {
                    svc.CreateLogger <Dispatcher>()?.LogWarning("Replaced an existing DispatcherProvider with one from the service provider.");
                }

                return(Dispatcher.GetForCurrentThread() !);
            });
            builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped <IMauiInitializeScopedService, DispatcherInitializer>());

            return(builder);
        }
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     _dispatcherProvider.StopAllDispatchers();
     _dispatcherProvider = null;
 }
 public void Setup()
 {
     _dispatcherProvider = new MarshalingTestDispatcherProvider();
     DispatcherProvider.SetCurrent(_dispatcherProvider);
 }
Ejemplo n.º 13
0
 [TearDown] public void TearDown() => DispatcherProvider.SetCurrent(null);
Ejemplo n.º 14
0
 public void Setup()
 {
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
Ejemplo n.º 15
0
 [SetUp] public void Setup() => DispatcherProvider.SetCurrent(new DispatcherProviderStub());
Ejemplo n.º 16
0
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     Device.PlatformServices = null;
 }
Ejemplo n.º 17
0
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
 }
Ejemplo n.º 18
0
 public void Setup()
 {
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceInfo.SetCurrent(new MockDeviceInfo(platform: DevicePlatform.iOS));
 }
Ejemplo n.º 19
0
 public void Setup()
 {
     SeverityColorConverter.count = 0;
     InvertBoolenConverter.count  = 0;
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
Ejemplo n.º 20
0
 public void End()
 {
     DispatcherProvider.SetCurrent(null);
 }
Ejemplo n.º 21
0
 public virtual void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture = _defaultCulture;
 }
Ejemplo n.º 22
0
 public virtual void Setup()
 {
     _defaultCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
Ejemplo n.º 23
0
 public DispatcherTests()
 {
     _dispatcherProvider = new DispatcherProviderStub();
     DispatcherProvider.SetCurrent(_dispatcherProvider);
 }
Ejemplo n.º 24
0
 public void Setup()
 {
     Device.PlatformServices = new MockPlatformServices();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
Ejemplo n.º 25
0
 public void Dispose()
 {
     DispatcherProvider.SetCurrent(null);
     _dispatcherProvider.Dispose();
 }
Ejemplo n.º 26
0
 public void TearDown()
 {
     Application.Current = null;
     DispatcherProvider.SetCurrent(null);
 }