public void TryRemoveEmptyTimeoutCollectionShouldReturnFalseAndNullData(
            MongoTimeoutPersister sut,
            MongoDatabaseFactory factory,
            string timeoutId,
            ContextBag context)
        {
            factory.ResetTimeoutCollection();

            var result = sut.TryRemove(timeoutId, context).Result;

            result.Should().BeFalse();
            factory.RetrieveAllTimeouts().Should().HaveCount(0);
        }
Esempio n. 2
0
        public void TryRemoveEmptyTimeoutCollectionShouldReturnFalseAndNullData(
            MongoTimeoutPersister sut,
            MongoDatabaseFactory factory,
            string timeoutId)
        {
            factory.ResetTimeoutCollection();

            Timeout.Core.TimeoutData timeoutData;

            var result = sut.TryRemove(timeoutId, out timeoutData);

            result.Should().BeFalse();
            timeoutData.Should().BeNull();

            factory.RetrieveAllTimeouts().Should().HaveCount(0);
        }
        public void TryRemoveShouldSucceedAndReturnData(
            MongoTimeoutPersister sut,
            MongoDatabaseFactory factory,
            Timeout.Core.TimeoutData timeoutData,
            ContextBag context)
        {
            factory.ResetTimeoutCollection();

            sut.Add(timeoutData, context).Wait();

            var timeouts = factory.RetrieveAllTimeouts();

            var result = sut.TryRemove(timeouts.First().Id, context).Result;

            result.Should().BeTrue();
            factory.RetrieveAllTimeouts().Should().HaveCount(0);
        }
Esempio n. 4
0
        public void TryRemoveShouldSucceedAndReturnData(
            MongoTimeoutPersister sut,
            MongoDatabaseFactory factory,
            Timeout.Core.TimeoutData timeoutData)
        {
            factory.ResetTimeoutCollection();

            sut.Add(timeoutData);
            Timeout.Core.TimeoutData returnedTimeoutData;

            var timeouts = factory.RetrieveAllTimeouts();

            var result = sut.TryRemove(timeouts.First().Id.ToString(), out returnedTimeoutData);

            result.Should().BeTrue();
            returnedTimeoutData.ShouldBeEquivalentTo(timeoutData);

            factory.RetrieveAllTimeouts().Should().HaveCount(0);
        }
        public void TryRemoveShouldSucceedAndReturnDataForOneTimeoutAndLeaveTheOther(
            MongoTimeoutPersister sut,
            MongoDatabaseFactory factory,
            Timeout.Core.TimeoutData timeoutData1,
            Timeout.Core.TimeoutData timeoutData2,
            ContextBag context)
        {
            factory.ResetTimeoutCollection();

            sut.Add(timeoutData1, context).Wait();
            sut.Add(timeoutData2, context).Wait();

            var timeouts = factory.RetrieveAllTimeouts();

            var result = sut.TryRemove(timeouts.First().Id, context).Result;

            result.Should().BeTrue();

            var remainingTimeout = factory.RetrieveAllTimeouts().ToList();

            remainingTimeout.Should().HaveCount(1);
            remainingTimeout.First().Id.Should().Be(timeouts.Last().Id);
        }