public void Removing_First_MainDisplayInfoChanged_Invokes_Correct_Members() { var onChangedInvokeCount = 0; var display = new MyDisplay(); DeviceDisplay.SetCurrent(display); DeviceDisplay.MainDisplayInfoChanged += OnChanged; display.ResetCounts(); DeviceDisplay.MainDisplayInfoChanged -= OnChanged; Assert.Equal(0, display.StartedCount); Assert.Equal(1, display.StoppedCount); Assert.Equal(0, display.AddedCount); Assert.Equal(0, display.RemovedCount); Assert.Equal(0, display.SetKeepScreenOnCount); Assert.Equal(0, display.GetKeepScreenOnCount); Assert.Equal(0, display.GetMainDisplayInfoCount); Assert.Equal(0, onChangedInvokeCount); Assert.False(display.KeepScreenOn); void OnChanged(object sender, DisplayInfoChangedEventArgs e) { onChangedInvokeCount++; } }
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); }
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); }
public void Setting_Null_Is_Default() { DeviceDisplay.SetCurrent(new MyDisplay()); DeviceDisplay.SetCurrent(null); Assert.NotNull(DeviceDisplay.Current); Assert.Equal("DeviceDisplayImplementation", DeviceDisplay.Current.GetType().Name); }
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); }
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); }
public void Setting_Custom_Invokes_Correct_Members() { var display = new MyDisplay(); DeviceDisplay.SetCurrent(display); Assert.Equal(0, display.StartedCount); Assert.Equal(0, display.StoppedCount); Assert.Equal(1, display.AddedCount); Assert.Equal(0, display.RemovedCount); Assert.Equal(0, display.SetKeepScreenOnCount); Assert.Equal(0, display.GetKeepScreenOnCount); Assert.Equal(1, display.GetMainDisplayInfoCount); Assert.False(display.KeepScreenOn); }
public void MainDisplayInfo_Invokes_Correct_Members() { var expected = new DisplayInfo(100, 100, 2, DisplayOrientation.Portrait, DisplayRotation.Rotation0); var display = new MyDisplay(expected); DeviceDisplay.SetCurrent(display); display.ResetCounts(); var main = DeviceDisplay.MainDisplayInfo; Assert.Equal(expected, main); Assert.Equal(0, display.StartedCount); Assert.Equal(0, display.StoppedCount); Assert.Equal(0, display.AddedCount); Assert.Equal(0, display.RemovedCount); Assert.Equal(0, display.SetKeepScreenOnCount); Assert.Equal(0, display.GetKeepScreenOnCount); Assert.Equal(1, display.GetMainDisplayInfoCount); Assert.False(display.KeepScreenOn); }
public void Swapping_With_MainDisplayInfoChanged_Invokes_Correct_Members() { var onChangedInvokeCount = 0; var display1 = new MyDisplay(); var display2 = new MyDisplay(); DeviceDisplay.SetCurrent(display1); DeviceDisplay.MainDisplayInfoChanged += OnChanged; display1.ResetCounts(); DeviceDisplay.SetCurrent(display2); // old Assert.Equal(0, display1.StartedCount); Assert.Equal(1, display1.StoppedCount); Assert.Equal(0, display1.AddedCount); Assert.Equal(1, display1.RemovedCount); Assert.Equal(1, display1.GetKeepScreenOnCount); Assert.Equal(0, display1.GetMainDisplayInfoCount); Assert.Equal(0, onChangedInvokeCount); Assert.False(display1.KeepScreenOn); // new Assert.Equal(1, display2.StartedCount); Assert.Equal(0, display2.StoppedCount); Assert.Equal(1, display2.AddedCount); Assert.Equal(0, display2.RemovedCount); Assert.Equal(0, display2.SetKeepScreenOnCount); Assert.Equal(0, display2.GetKeepScreenOnCount); Assert.Equal(1, display2.GetMainDisplayInfoCount); Assert.Equal(0, onChangedInvokeCount); Assert.False(display2.KeepScreenOn); void OnChanged(object sender, DisplayInfoChangedEventArgs e) { onChangedInvokeCount++; } }
public override void Setup() { base.Setup(); Device.PlatformServices = new MockPlatformServices(); DeviceDisplay.SetCurrent(new MockDeviceDisplay()); }
public override void Setup() { base.Setup(); DeviceDisplay.SetCurrent(new MockDeviceDisplay()); }
public override void Setup() { base.Setup(); DeviceDisplay.SetCurrent(mockDeviceDisplay = new MockDeviceDisplay()); DeviceInfo.SetCurrent(mockDeviceInfo = new MockDeviceInfo()); }
public void Dispose() { DeviceDisplay.SetCurrent(null); }
public override void Setup() { base.Setup(); mockDeviceDisplay = new TestDeviceDisplay(); DeviceDisplay.SetCurrent(mockDeviceDisplay); }