public void Proccess(IncomingNotification notification) { try { switch (notification.Type) { case NotificationType.SPLIT_UPDATE: var scn = (SplitChangeNotifiaction)notification; _splitsWorker.AddToQueue(scn.ChangeNumber); break; case NotificationType.SPLIT_KILL: var skn = (SplitKillNotification)notification; _splitsWorker.KillSplit(skn.ChangeNumber, skn.SplitName, skn.DefaultTreatment); _splitsWorker.AddToQueue(skn.ChangeNumber); break; case NotificationType.SEGMENT_UPDATE: var sc = (SegmentChangeNotification)notification; _segmentsWorker.AddToQueue(sc.ChangeNumber, sc.SegmentName); break; default: _log.Debug($"Incorrect Event type: {notification}"); break; } } catch (Exception ex) { _log.Error($"Processor: {ex.Message}"); } }
public void Kill_ShouldTriggerFetch() { // Arrange. var changeNumber = 1585956698457; var splitName = "split-test"; var defaultTreatment = "off"; _splitCache .Setup(mock => mock.GetChangeNumber()) .Returns(1585956698447); _splitsWorker.Start(); // Act. _splitsWorker.KillSplit(changeNumber, splitName, defaultTreatment); Thread.Sleep(1000); // Assert. _splitCache.Verify(mock => mock.Kill(changeNumber, splitName, defaultTreatment), Times.Once); }