Fixed tests

This commit is contained in:
Kenneth Skovhede
2025-05-12 13:05:26 +02:00
parent d0fa3b7d87
commit e8e112ffdb
+9 -17
View File
@@ -171,38 +171,30 @@ namespace Duplicati.UnitTest
[Test]
[Category("RestoreHandler")]
public void RestoreWithoutLocalData([Values("true", "false")] string noLocalDb, [Values("true", "false")] string noLocalBlocks, [Values("true", "false")] string patchWithLocalBlocks)
public void RestoreWithoutLocalData([Values("true", "false")] string noLocalDb, [Values("true", "false")] string patchWithLocalBlocks)
{
string file1Path = Path.Combine(this.DATAFOLDER, "file1");
var file1Path = Path.Combine(this.DATAFOLDER, "file1");
File.WriteAllBytes(file1Path, new byte[] { 1, 2, 3 });
string file2Path = Path.Combine(this.DATAFOLDER, "file2");
var file2Path = Path.Combine(this.DATAFOLDER, "file2");
File.WriteAllBytes(file2Path, new byte[] { 3, 4, 6 });
string folderPath = Path.Combine(this.DATAFOLDER, "folder");
var folderPath = Path.Combine(this.DATAFOLDER, "folder");
Directory.CreateDirectory(folderPath);
systemIO.FileCopy(file1Path, Path.Combine(folderPath, "file1 copy"), true);
using (Controller c = new Controller("file://" + this.TARGETFOLDER, new Dictionary<string, string>(this.TestOptions), null))
{
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
Assert.AreEqual(0, backupResults.Errors.Count());
Assert.AreEqual(0, backupResults.Warnings.Count());
}
TestUtils.AssertResults(c.Backup(new[] { this.DATAFOLDER }));
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions)
var restoreOptions = new Dictionary<string, string>(this.TestOptions)
{
["restore-path"] = this.RESTOREFOLDER,
["no-local-db"] = noLocalDb,
["no-local-blocks"] = noLocalBlocks,
["patch-with-local-blocks"] = patchWithLocalBlocks
["restore-with-local-blocks"] = patchWithLocalBlocks
};
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
{
IRestoreResults restoreResults = c.Restore(new[] { "*" });
Assert.AreEqual(0, restoreResults.Errors.Count());
Assert.AreEqual(0, restoreResults.Warnings.Count());
}
TestUtils.AssertResults(c.Restore(new[] { "*" }));
TestUtils.AssertDirectoryTreesAreEquivalent(this.DATAFOLDER, this.RESTOREFOLDER, true, "Restoring without local data");
}