public void registering_a_new_timeout()
        {
            Guid correlationId   = Guid.NewGuid();
            int  timeoutPeriodMS = 500;
            var  waitHandle      = new ManualResetEvent(false);

            IEventStore eventStore      = new FakeEventStore(new List <IEvent>());
            var         timeoutRegistry = new TimeoutRegistry(eventStore, @event => { });

            var newTimeoutCommand = new StartTimeout
            {
                CorrelationId = correlationId.ToString(),
                ElapsesInMS   = timeoutPeriodMS,
            };
        }
        public void RegisterTimeout(StartTimeout command)
        {
            //critical region that can have potentially many threads running through it
            lock (_lockObject)
            {
                if (_idExpiresMap.ContainsKey(command.CorrelationId) == false)
                {
                    _idExpiresMap.Add(command.CorrelationId, CalculateExpiration(command.ElapsesInMS));
                }
                else
                {
                    _idExpiresMap[command.CorrelationId] = CalculateExpiration(command.ElapsesInMS);
                }

                if (_idTimerMap.ContainsKey(command.CorrelationId) == false)
                {
                    _idTimerMap.Add(command.CorrelationId, NewTimer(command.ElapsesInMS));
                }
                else
                {
                    _idTimerMap[command.CorrelationId] = NewTimer(command.ElapsesInMS);
                }
            }
        }