public void When_existing_is_removed_by_saga_id()
        {
            var persister    = new InMemoryTimeoutPersister();
            var newGuid      = Guid.NewGuid();
            var inputTimeout = new TimeoutData
            {
                SagaId = newGuid
            };

            persister.Add(inputTimeout);

            persister.RemoveTimeoutBy(newGuid);
            TimeoutData removedTimeout;
            var         removed = persister.TryRemove(inputTimeout.Id, out removedTimeout);

            Assert.False(removed);
        }
        public async Task When_existing_is_removed_by_saga_id()
        {
            var persister    = new InMemoryTimeoutPersister(() => DateTime.UtcNow);
            var newGuid      = Guid.NewGuid();
            var inputTimeout = new TimeoutData
            {
                SagaId = newGuid
            };

            await persister.Add(inputTimeout, new ContextBag());

            await persister.RemoveTimeoutBy(newGuid, new ContextBag());

            var result = await persister.TryRemove(inputTimeout.Id, new ContextBag());

            Assert.IsFalse(result);
        }
        void RemoveTimeoutBy(InMemoryTimeoutPersister inMemoryTimeoutPersister)
        {
            var sagaId = sagaIdGuids.GetOrAdd(Thread.CurrentThread.ManagedThreadId, new Guid());

            inMemoryTimeoutPersister.RemoveTimeoutBy(sagaId);
        }
        public async Task When_existing_is_removed_by_saga_id()
        {
            var persister = new InMemoryTimeoutPersister(() => DateTime.UtcNow);
            var newGuid = Guid.NewGuid();
            var inputTimeout = new TimeoutData
                               {
                                   SagaId = newGuid
                               };

            await persister.Add(inputTimeout, new ContextBag());
            await persister.RemoveTimeoutBy(newGuid, new ContextBag());
            var result = await persister.TryRemove(inputTimeout.Id, new ContextBag());

            Assert.IsFalse(result);
        }