Пример #1
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);
 }
Пример #2
0
        public void Setting_Null_Is_Default()
        {
            DeviceDisplay.SetCurrent(new MyDisplay());
            DeviceDisplay.SetCurrent(null);

            Assert.NotNull(DeviceDisplay.Current);
            Assert.Equal("DeviceDisplayImplementation", DeviceDisplay.Current.GetType().Name);
        }
Пример #3
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);
 }
Пример #4
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);
 }
Пример #5
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);
 }
Пример #6
0
 public static DeviceDisplay[] GetActiveDevices()
 {
     DeviceDisplay[] deviceDisplayArray = new DeviceDisplay[1];
       string str = NativeMethods.hackrf_board_id_name(1U);
       deviceDisplayArray[0] = new DeviceDisplay()
       {
     Index = 0U,
     Name = str
       };
       return deviceDisplayArray;
 }
Пример #7
0
        public static DeviceDisplay[] GetActiveDevices()
        {
            uint num = NativeMethods.rtlsdr_get_device_count();

            DeviceDisplay[] array = new DeviceDisplay[num];
            for (uint num2 = 0u; num2 < num; num2++)
            {
                string name = NativeMethods.rtlsdr_get_device_name(num2);
                array[num2] = new DeviceDisplay
                {
                    Index = num2,
                    Name  = name
                };
            }
            return(array);
        }
Пример #8
0
        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);
        }
Пример #9
0
        public static DeviceDisplay[] GetActiveDevices()
        {
            uint num = NativeMethods.sdriq_get_device_count();

            DeviceDisplay[] array = new DeviceDisplay[num];
            for (uint num2 = 0u; num2 < num; num2++)
            {
                string name = "SDR-IQ #" + num2 + " S/N: " + NativeMethods.sdriq_get_serial_number(num2);
                array[num2] = new DeviceDisplay
                {
                    Index = num2,
                    Name  = name
                };
            }
            return(array);
        }
Пример #10
0
        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);
        }
Пример #11
0
        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++;
            }
        }
Пример #12
0
 public override void Setup()
 {
     base.Setup();
     Device.PlatformServices = new MockPlatformServices();
     DeviceDisplay.SetCurrent(new MockDeviceDisplay());
 }
Пример #13
0
 public override void Setup()
 {
     base.Setup();
     DeviceDisplay.SetCurrent(new MockDeviceDisplay());
 }
Пример #14
0
 public override void Setup()
 {
     base.Setup();
     DeviceDisplay.SetCurrent(mockDeviceDisplay = new MockDeviceDisplay());
     DeviceInfo.SetCurrent(mockDeviceInfo       = new MockDeviceInfo());
 }
Пример #15
0
 public void Dispose()
 {
     DeviceDisplay.SetCurrent(null);
 }
Пример #16
0
 public override void Setup()
 {
     base.Setup();
     mockDeviceDisplay = new TestDeviceDisplay();
     DeviceDisplay.SetCurrent(mockDeviceDisplay);
 }