public void TestZeroRetries()
        {
            var client = new Mock<IDs3Client>(MockBehavior.Strict);
            MockHelpers.SetupGetObjectWithContentLengthMismatchException(client, "bar", 0L, "ABCDEFGHIJ", 20L, 10L); // The initial request is for all 20 bytes, but only the first 10 will be sent

            try
            {
                var stream = new MemoryStream(200);
                var exceptionTransferrer = new ReadTransferrer();
                var decorator = new PartialDataTransferrerDecorator(exceptionTransferrer, 0);
                decorator.Transfer(client.Object, JobResponseStubs.BucketName, "bar", 0, JobResponseStubs.JobId, new List<Range>(), stream);
                Assert.Fail();
            }
            catch (Ds3NoMoreRetriesException e) {
                Assert.AreEqual(0, e.Retries);   
            }
        }
 public void Test1Retries()
 {
     var client = new Mock<IDs3Client>(MockBehavior.Strict);
     MockHelpers.SetupGetObjectWithContentLengthMismatchException(client, "bar", 0L, "ABCDEFGHIJ", 20L, 10L);
     MockHelpers.SetupGetObjectWithContentLengthMismatchException(client, "bar", 0L, "ABCDEFGHIJ", 20L, 10L, Range.ByPosition(9, 19));
     try
     {
         var stream = new MemoryStream(200);
         var exceptionTransferrer = new ReadTransferrer();
         var decorator = new PartialDataTransferrerDecorator(exceptionTransferrer, 1);
         decorator.Transfer(client.Object, JobResponseStubs.BucketName, "bar", 0, JobResponseStubs.JobId, new List<Range>(), stream);
         Assert.Fail();
     }
     catch (Ds3NoMoreRetriesException e)
     {
         Assert.AreEqual(1, e.Retries);
     }
 }
        public void Test1Retries()
        {
            var client = new Mock<IDs3Client>(MockBehavior.Strict);
            MockHelpers.SetupGetObjectWithContentLengthMismatchException(client, "bar", 0L, "ABCDEFGHIJ", 20L, 10L);
            MockHelpers.SetupGetObjectWithContentLengthMismatchException(client, "bar", 0L, "ABCDEFGHIJ", 20L, 10L, Range.ByPosition(9, 19));
            try
            {
                var stream = new MemoryStream(200);
                var exceptionTransferrer = new ReadTransferrer();
                var retries = 1;
                var decorator = new PartialDataTransferrerDecorator(exceptionTransferrer, retries);
                decorator.Transfer(client.Object, JobResponseStubs.BucketName, "bar", 0, JobResponseStubs.JobId, new List<Range>(), stream, null, null, retries);
                Assert.Fail();
            }
            catch (Ds3NoMoreRetransmitException ex)
            {
                var expectedMessage = string.Format(Resources.NoMoreRetransmitException, "1", "bar", "0");
                Assert.AreEqual(expectedMessage, ex.Message);

                Assert.AreEqual(1, ex.Retries);
            }
        }