public void DeviceLocator_Notifications_Notifications_StopListeningThrowsIfDisposed() { var deviceLocator = new MockDeviceLocator(); deviceLocator.Dispose(); deviceLocator.StopListeningForNotifications(); }
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); }