public void EndlessFail() { Stream LocalGet() { throw new IOException(); } var stream = new RetryStream(0).Retry(LocalGet); Assert.AreEqual(0, stream.Length); }
public override IBStream CreateStream(string path, StreamAccess access) { //one remote connection each file; each remote connection has its own inner cache, //two connections for one file, some cache will not update automatically. RetryStream o; if (dict.TryGetValue(path, out o)) { return(o); } o = new RetryStream(this, BoxFileStreamConfig.RootPath + path, access); dict.Add(path, o); return(o); }
public void ReturnedThe3TimeAnStream() { var i = 0; Stream LocalGet() { i++; if (i != 3) { throw new IOException(); } return(new MemoryStream(CreateAnImageNoExif.Bytes)); } var stream = new RetryStream(0).Retry(LocalGet); Assert.IsTrue(stream.Length != 0); }