public void HandleIncominEvent_ControlStreamingResumed_ShouldNotDispatchEvent() { // Arrange. _pushEnabled = null; var occupancyNoti = new OccupancyNotification { Channel = "control_pri", Metrics = new OccupancyMetricsData { Publishers = 0 }, Type = NotificationType.OCCUPANCY }; var notification = new ControlNotification { Channel = "control_pri", ControlType = ControlType.STREAMING_RESUMED, Type = NotificationType.CONTROL }; // Act. _notificationManagerKeeper.HandleIncomingEvent(occupancyNoti); _notificationManagerKeeper.HandleIncomingEvent(notification); // Assert. Assert.IsFalse(_pushEnabled.Value); }
public void HandleIncominEvent_ControlStreamingResumed_ShouldNotDispatchEvent() { // Arrange. _event = null; var occupancyNoti = new OccupancyNotification { Channel = "control_pri", Metrics = new OccupancyMetricsData { Publishers = 0 }, Type = NotificationType.OCCUPANCY }; var notification = new ControlNotification { Channel = "control_pri", ControlType = ControlType.STREAMING_RESUMED, Type = NotificationType.CONTROL }; // Act & Assert. _notificationManagerKeeper.HandleIncomingEvent(occupancyNoti); Assert.AreEqual(SSEClientActions.SUBSYSTEM_DOWN, _event.Action); _event = null; _notificationManagerKeeper.HandleIncomingEvent(notification); Assert.IsNull(_event); }
public void HandleIncominEvent_OccupancyWithPublishers_FirstTime_ShouldNotDispatchEvent() { // Arrange. _pushEnabled = null; var notification = new OccupancyNotification { Channel = "control_pri", Type = NotificationType.OCCUPANCY, Metrics = new OccupancyMetricsData { Publishers = 2 } }; // Act. _notificationManagerKeeper.HandleIncomingEvent(notification); // Assert. Assert.IsNull(_pushEnabled); }
public void HandleIncominEvent_OccupancyWithPublishers_ManyEvents_MultiReg() { // Arrange. _event = null; var notificationPri = new OccupancyNotification { Channel = "control_pri", Type = NotificationType.OCCUPANCY, Metrics = new OccupancyMetricsData { Publishers = 2 } }; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationPri); // Assert. Assert.IsNull(_event); // Event control_pri with 0 publishers - should return false // Arrange. notificationPri.Metrics.Publishers = 0; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationPri); // Assert. Assert.AreEqual(SSEClientActions.SUBSYSTEM_DOWN, _event.Action); // Event control_sec with 2 publishers - should return true // Arrange. var notificationSec = new OccupancyNotification { Channel = "control_sec", Type = NotificationType.OCCUPANCY, Metrics = new OccupancyMetricsData { Publishers = 2 } }; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationSec); // Assert. Assert.AreEqual(SSEClientActions.SUBSYSTEM_READY, _event.Action); // Event control_pri with 2 publishers - should return null // Arrange. _event = null; notificationPri.Metrics.Publishers = 2; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationPri); // Assert. Assert.IsNull(_event); // Event control_pri with 0 publishers - should return null // Arrange. notificationPri.Metrics.Publishers = 0; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationPri); // Assert. Assert.IsNull(_event); // Event control_sec with 0 publishers - should return false // Arrange. notificationSec.Metrics.Publishers = 0; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationSec); // Assert. Assert.AreEqual(SSEClientActions.SUBSYSTEM_DOWN, _event.Action); // Event control_sec with 0 publishers - should return null // Arrange. _event = null; notificationSec.Metrics.Publishers = 0; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationSec); // Assert. Assert.IsNull(_event); // Event control_sec with 1 publishers - should return true // Arrange. notificationSec.Metrics.Publishers = 1; // Act. _notificationManagerKeeper.HandleIncomingEvent(notificationSec); // Assert. Assert.AreEqual(SSEClientActions.SUBSYSTEM_READY, _event.Action); }