public void When_no_raw_keys_and_no_time_are_included_it_must_raise_event_without_keys_and_time()
        {
            // Arrange
            var deviceAction = new DeviceAction(Source, null, NullTime);
            var tracker = new RemoteKeyTracker();

            // Act
            using (var listener = new TrackerEventListener(tracker))
            {
                tracker.ProcessDeviceAction(deviceAction);

                // Assert
                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeMissingKeyFor(Source, NullTime);
            }
        }
        public void Scenario1()
        {
            var tracker = new RemoteKeyTracker();
            var rawKeysDown = RawDeviceKeys.None;

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.EnterCurrentCompetitor);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeModifierKeyDownFor(Source, RemoteKeyModifier.EnterCurrentCompetitor);
            }

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.EnterCurrentCompetitor);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeModifierKeyUpFor(Source, RemoteKeyModifier.EnterCurrentCompetitor);
            }
        }
        public void Scenario5()
        {
            var tracker = new RemoteKeyTracker();
            var rawKeysDown = RawDeviceKeys.None;

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.EnterCurrentCompetitor);
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.EnterNextCompetitor);
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.Key1OrPlaySoundA);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(3);
                listener.EventsCollected[0].ShouldBeModifierKeyDownFor(Source, RemoteKeyModifier.EnterNextCompetitor);
                listener.EventsCollected[1].ShouldBeModifierKeyDownFor(Source, RemoteKeyModifier.EnterCurrentCompetitor);
                listener.EventsCollected[2].ShouldBeKeyDownFor(Source, RemoteKey.Key1OrPlaySoundA);
            }

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.Key1OrPlaySoundA);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeKeyUpFor(Source, RemoteKey.Key1OrPlaySoundA);
            }

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.Key2OrPassIntermediate);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeKeyDownFor(Source, RemoteKey.Key2OrPassIntermediate);
            }

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.Key2OrPassIntermediate);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(1);
                listener.EventsCollected[0].ShouldBeKeyUpFor(Source, RemoteKey.Key2OrPassIntermediate);
            }

            using (var listener = new TrackerEventListener(tracker))
            {
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.EnterCurrentCompetitor);
                rawKeysDown = rawKeysDown.Push(RawDeviceKeys.Key3OrToggleElimination);
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.Key3OrToggleElimination);
                rawKeysDown = rawKeysDown.Release(RawDeviceKeys.EnterNextCompetitor);
                tracker.ProcessDeviceAction(new DeviceAction(Source, rawKeysDown, NullTime));

                listener.EventsCollected.Should().HaveCount(2);
                listener.EventsCollected[0].ShouldBeModifierKeyUpFor(Source, RemoteKeyModifier.EnterNextCompetitor);
                listener.EventsCollected[1].ShouldBeModifierKeyUpFor(Source, RemoteKeyModifier.EnterCurrentCompetitor);
            }
        }