public void Test_ReturnsCorrectValueOnNoErrors()
        {
            // Arrange
            int expected  = 5;
            var queryMock = new Mock <IQuery <int, int> >();

            queryMock.SetupSequence(x => x.Execute(It.IsAny <int>()))
            .Returns(expected);

            var sut = new RetryQueryDecorator <int, int>(queryMock.Object);

            // Act
            var actual = sut.Execute(0);

            // Assert
            Assert.Equal(expected, actual);
            queryMock.Verify(x => x.Execute(It.IsAny <int>()), Times.Exactly(1));
        }
        public void Test_ThrowsAfterRetriesOnErrors()
        {
            // Arrange
            var queryMock = new Mock <IQuery <int, int> >();

            queryMock.SetupSequence(x => x.Execute(It.IsAny <int>()))
            .Throws(new ArgumentException())
            .Throws(new ArgumentException())
            .Throws(new ArgumentException())
            .Throws(new ArgumentException())
            .Throws(new ArgumentException())
            .Throws(new ArgumentException());

            var sut = new RetryQueryDecorator <int, int>(queryMock.Object);

            // Act
            Assert.Throws <ArgumentException>(() => sut.Execute(0));
            queryMock.Verify(x => x.Execute(It.IsAny <int>()), Times.Exactly(5));
        }