コード例 #1
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_Notifications_StopListeningThrowsIfDisposed()
        {
            var deviceLocator = new MockDeviceLocator();

            deviceLocator.Dispose();

            deviceLocator.StopListeningForNotifications();
        }
コード例 #2
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StopListeningNoLongerReceivesNotifications()
        {
            var server        = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);

            deviceLocator.StartListeningForNotifications();
            deviceLocator.StopListeningForNotifications();

            var receivedNotification = false;

            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    receivedNotification = true;
                    eventSignal.Set();
                };

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #3
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_StopListeningNoLongerReceivesNotifications()
        {
            var server = new MockCommsServer();
            var deviceLocator = new MockDeviceLocator(server);
            deviceLocator.StartListeningForNotifications();
            deviceLocator.StopListeningForNotifications();

            var receivedNotification = false;
            using (var eventSignal = new System.Threading.AutoResetEvent(false))
            {
                deviceLocator.DeviceAvailable += (sender, args) =>
                {
                    receivedNotification = true;
                    eventSignal.Set();
                };

                server.MockReceiveBroadcast(GetMockAliveNotification());
                eventSignal.WaitOne(1000);
            }

            Assert.IsFalse(receivedNotification);
        }
コード例 #4
0
ファイル: DeviceLocatorTests.cs プロジェクト: noex/RSSDP
        public void DeviceLocator_Notifications_Notifications_StopListeningThrowsIfDisposed()
        {
            var deviceLocator = new MockDeviceLocator();
            deviceLocator.Dispose();

            deviceLocator.StopListeningForNotifications();
        }