public async Task GivenFailedToStoreFile_WhenStoringFile_ThenCleanupShouldBeAttempted() { _fileStore.StoreFileAsync( Arg.Is <VersionedInstanceIdentifier>(identifier => DefaultVersionedInstanceIdentifier.Equals(identifier)), _stream, cancellationToken: DefaultCancellationToken) .Throws(new Exception()); _indexDataStore.ClearReceivedCalls(); await Assert.ThrowsAsync <Exception>(() => _storeOrchestrator.StoreDicomInstanceEntryAsync(_dicomInstanceEntry, DefaultCancellationToken)); await ValidateCleanupAsync(); await _indexDataStore.DidNotReceiveWithAnyArgs().UpdateInstanceIndexStatusAsync(default, default, default);