public TryStartUpdateSession ( string applicationId ) : Task |
||
applicationId | string | |
return | Task |
public async Task TestThatNotAllExceptionsAreRetried() { string appId = "appId"; var updateSessionStub = new StubIUpdateSessionManager() .TryStartUpdateSession(id => AsyncUtils.AsyncTaskThatThrows<bool>(new Exception())); IUpdateSessionManager retryDecorator = new UpdateSessionManagerRetryDecorator( updateSessionStub, new FixedInterval(1, TimeSpan.Zero), new StorageExceptionErrorDetectionStrategy()); await Assert.ThrowsAsync<Exception>(async () => await retryDecorator.TryStartUpdateSession(appId)); }
public async Task TestThatExceptionIsThrownIfMaxRetryCountIsReached() { string appId = "appId"; var sequence = StubsUtils.Sequence<StubIUpdateSessionManager.TryStartUpdateSession_String_Delegate>() .Twice(id => AsyncUtils.AsyncTaskThatThrows<bool>(new StorageException())) .Once(id => AsyncUtils.AsyncTaskWithResult(true)); var updateSessionStub = new StubIUpdateSessionManager() .TryStartUpdateSession(id => sequence.Next(id)); IUpdateSessionManager retryDecorator = new UpdateSessionManagerRetryDecorator( updateSessionStub, new FixedInterval(1, TimeSpan.Zero), new StorageExceptionErrorDetectionStrategy()); await Assert.ThrowsAsync<StorageException>(async () => await retryDecorator.TryStartUpdateSession(appId)); }