public void TryRemoveShouldSucceedAndReturnDataForOneTimeoutAndLeaveTheOther( MongoTimeoutPersister sut, MongoDatabaseFactory factory, Timeout.Core.TimeoutData timeoutData1, Timeout.Core.TimeoutData timeoutData2) { factory.ResetTimeoutCollection(); sut.Add(timeoutData1); sut.Add(timeoutData2); Timeout.Core.TimeoutData returnedTimeoutData; var timeouts = factory.RetrieveAllTimeouts(); var result = sut.TryRemove(timeouts.First().Id.ToString(), out returnedTimeoutData); result.Should().BeTrue(); returnedTimeoutData.ShouldBeEquivalentTo(timeoutData1); var remainingTimeout = factory.RetrieveAllTimeouts().ToList(); remainingTimeout.Should().HaveCount(1); remainingTimeout.First().ShouldBeEquivalentTo(timeoutData2); }
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); }