Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public async Task RestoreFromBackupAsync_ValidUnencryptedBackup_RunsImportButFai
var backupService = Substitute.For<IBackupManagementService>();
var sut = CreateSut(targetFactory, NewTempDir(), backupService: backupService);
var progressEvents = new List<RestoreProgress>();
var progress = new Progress<RestoreProgress>(p => progressEvents.Add(p));
IProgress<RestoreProgress> progress = new SyncProgress<RestoreProgress>(p => progressEvents.Add(p));

var result = await sut.RestoreFromBackupAsync(new MemoryStream(zipBytes), progress: progress);

Expand Down Expand Up @@ -528,6 +528,11 @@ public async Task CreateSafetyBackupAsync_CreatesSafetyDirectoryAndDelegatesToBa

path.Should().StartWith(Path.Combine(webRoot, "backups", "safety"));
Directory.Exists(Path.Combine(webRoot, "backups", "safety")).Should().BeTrue();
await backupService.Received(1).CreateBackupAsync(Arg.Any<CancellationToken>());
}
}

/// <summary>Invokes the progress handler synchronously on the calling thread, avoiding the async dispatch of <see cref="Progress{T}"/>.</summary>
file sealed class SyncProgress<T>(Action<T> handler) : IProgress<T>
{
public void Report(T value) => handler(value);
}
Loading