@@ -21,6 +21,7 @@
|
||||
|
||||
using Duplicati.Library.Encryption;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ using Duplicati.Library.DynamicLoader;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Duplicati.Library.Common.IO;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace Duplicati.UnitTest
|
||||
public void Get()
|
||||
{
|
||||
// Files to create in MB.
|
||||
int[] fileSizes = {10, 20, 30};
|
||||
int[] fileSizes = { 10, 20, 30 };
|
||||
foreach (int size in fileSizes)
|
||||
{
|
||||
var data = new byte[size * 1024 * 1024];
|
||||
@@ -50,7 +50,7 @@ namespace Duplicati.UnitTest
|
||||
var backendURL = "file://" + this.TARGETFOLDER;
|
||||
using (Controller c = new Controller(backendURL, options, null))
|
||||
{
|
||||
var backupResults = c.Backup(new[] {DATAFOLDER});
|
||||
var backupResults = c.Backup(new[] { DATAFOLDER });
|
||||
foreach (var backupResultsWarning in backupResults.Warnings)
|
||||
{
|
||||
TestContext.WriteLine("Backend result warning:" + backupResultsWarning);
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Duplicati.Library.Interface;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.AutoUpdater;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
// Get files list
|
||||
var files = z0.ListFiles(null);
|
||||
Assert.AreEqual(1, files.Length);
|
||||
Assert.That(1, Is.EqualTo(files.Length), "Expected only one file in the archive, but found multiple.");
|
||||
Assert.That(logMessages.Any(x => x.Level == LogMessageType.Warning && x.Message.Contains("duplicate", StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace Duplicati.UnitTest
|
||||
using var logger = new ControllerMultiLogTarget(dest, LogMessageType.Information, null, new HashSet<string> { "ID1" });
|
||||
var entry = new LogEntry("msg", System.Array.Empty<object>(), LogMessageType.Warning, "tag", "ID1", null);
|
||||
logger.WriteMessage(entry);
|
||||
Assert.AreEqual(1, dest.Entries.Count);
|
||||
Assert.AreEqual(LogMessageType.Information, dest.Entries[0].Level);
|
||||
Assert.That(dest.Entries.Count, Is.EqualTo(1));
|
||||
Assert.That(dest.Entries[0].Level, Is.EqualTo(LogMessageType.Information));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -53,8 +53,8 @@ namespace Duplicati.UnitTest
|
||||
var entry = new LogEntry("msg", System.Array.Empty<object>(), LogMessageType.Information, "tag", "id", null);
|
||||
logger.WriteMessage(entry);
|
||||
|
||||
Assert.AreEqual(1, dest1.Entries.Count);
|
||||
Assert.AreEqual(0, dest2.Entries.Count);
|
||||
Assert.That(dest1.Entries.Count, Is.EqualTo(1));
|
||||
Assert.That(dest2.Entries.Count, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.Linq;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -34,12 +35,12 @@ namespace Duplicati.UnitTest
|
||||
public void DeleteAllRemoteFiles()
|
||||
{
|
||||
string filePath = Path.Combine(this.DATAFOLDER, "file");
|
||||
File.WriteAllBytes(filePath, new byte[] {0, 1, 2});
|
||||
File.WriteAllBytes(filePath, new byte[] { 0, 1, 2 });
|
||||
|
||||
Dictionary<string, string> firstOptions = new Dictionary<string, string>(this.TestOptions);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, firstOptions, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
@@ -58,7 +59,7 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
// An exception should be thrown due to unrecognized files in the target folder.
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
Assert.That(() => c.Backup(new[] {this.DATAFOLDER}), Throws.Exception);
|
||||
Assert.That(() => c.Backup(new[] { this.DATAFOLDER }), Throws.Exception);
|
||||
}
|
||||
|
||||
// We should be able to safely remove backend files from the second backup by referring
|
||||
@@ -81,7 +82,7 @@ namespace Duplicati.UnitTest
|
||||
secondOptions["prefix"] = new Options(firstOptions).Prefix + "2";
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, secondOptions, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
@@ -106,7 +107,7 @@ namespace Duplicati.UnitTest
|
||||
// The first backup configuration should still run normally.
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, firstOptions, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ using Duplicati.CommandLine.DatabaseTool;
|
||||
using Duplicati.Library.SQLiteHelper;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Main.Database;
|
||||
using Duplicati.Library.Main.Operation;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Legacy;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -78,10 +79,10 @@ namespace Duplicati.UnitTest
|
||||
// Although version 1 is older than the specified TimeSpan, we do not delete
|
||||
// it because it is the most recent full backup.
|
||||
TimeSpan timeSpan = new TimeSpan(1, 0, 0, 0);
|
||||
IListResultFileset[] expectedFilesetsToRemove = {filesets[0]};
|
||||
IListResultFileset[] expectedFilesetsToRemove = { filesets[0] };
|
||||
|
||||
Random random = new Random();
|
||||
Options options = new Options(new Dictionary<string, string> {{"keep-time", $"{(int) timeSpan.TotalSeconds}s"}});
|
||||
Options options = new Options(new Dictionary<string, string> { { "keep-time", $"{(int)timeSpan.TotalSeconds}s" } });
|
||||
KeepTimeRemover remover = new KeepTimeRemover(options);
|
||||
IListResultFileset[] filesetsToRemove = remover.GetFilesetsToDelete(filesets.OrderBy(x => random.Next())).ToArray();
|
||||
CollectionAssert.AreEquivalent(expectedFilesetsToRemove, filesetsToRemove);
|
||||
@@ -110,7 +111,7 @@ namespace Duplicati.UnitTest
|
||||
new Fileset(5, BackupType.PARTIAL_BACKUP, new DateTime(2000, 1, 6)),
|
||||
};
|
||||
|
||||
Options options = new Options(new Dictionary<string, string> {{"keep-versions", "2"}});
|
||||
Options options = new Options(new Dictionary<string, string> { { "keep-versions", "2" } });
|
||||
IListResultFileset[] expectedFilesetsToRemove =
|
||||
{
|
||||
filesets[0], // Delete; third oldest full backup.
|
||||
@@ -129,7 +130,7 @@ namespace Duplicati.UnitTest
|
||||
[Category("DeleteHandler")]
|
||||
public void RetentionPolicyRemover()
|
||||
{
|
||||
Options options = new Options(new Dictionary<string, string> {{"retention-policy", "1W:U,3M:1D,1Y:1W,U:1M"}});
|
||||
Options options = new Options(new Dictionary<string, string> { { "retention-policy", "1W:U,3M:1D,1Y:1W,U:1M" } });
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
IListResultFileset[] filesets =
|
||||
@@ -207,7 +208,7 @@ namespace Duplicati.UnitTest
|
||||
new Fileset(4, BackupType.FULL_BACKUP, new DateTime(2000, 1, 5))
|
||||
};
|
||||
|
||||
Options options = new Options(new Dictionary<string, string> {{"version", "0,3,4"}});
|
||||
Options options = new Options(new Dictionary<string, string> { { "version", "0,3,4" } });
|
||||
IListResultFileset[] expectedFilesetsToRemove =
|
||||
{
|
||||
filesets[0],
|
||||
|
||||
@@ -33,6 +33,7 @@ using Duplicati.Library.Main.Volumes;
|
||||
using NUnit.Framework;
|
||||
using IFileEntry = Duplicati.Library.Interface.IFileEntry;
|
||||
using Utility = Duplicati.Library.Utility.Utility;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="nunit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="nunit" Version="4.3.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -25,6 +25,7 @@ using Duplicati.Library.Encryption;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
@@ -27,6 +27,7 @@ using Duplicati.Library.Common.IO;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Security.Cryptography;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ using NUnit.Framework;
|
||||
using Duplicati.Library.Common.IO;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ using Duplicati.Server.Serialization.Interface;
|
||||
using Duplicati.WebserverCore.Services;
|
||||
using NUnit.Framework;
|
||||
using Backup = Duplicati.Server.Database.Backup;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Duplicati.Library.Interface;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -34,18 +34,18 @@ namespace Duplicati.UnitTest
|
||||
[Category("Targeted")]
|
||||
public void RunCommands()
|
||||
{
|
||||
var testopts = TestOptions;
|
||||
var testopts = TestOptions;
|
||||
|
||||
var data = new byte[1024 * 1024 * 10];
|
||||
File.WriteAllBytes(Path.Combine(DATAFOLDER, "a"), data);
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new string[] {DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new string[] { DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
@@ -58,12 +58,12 @@ namespace Duplicati.UnitTest
|
||||
File.WriteAllBytes(Path.Combine(DATAFOLDER, "b"), data);
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new string[] {DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new string[] { DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
@@ -73,7 +73,7 @@ namespace Duplicati.UnitTest
|
||||
Assert.AreEqual(3, r.Files.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0, no_local_db = true }), null))
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0, no_local_db = true }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
@@ -100,7 +100,7 @@ namespace Duplicati.UnitTest
|
||||
Assert.AreEqual(listResults.Filesets.Count(), 2);
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 1 }), null))
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 1 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
@@ -109,8 +109,8 @@ namespace Duplicati.UnitTest
|
||||
Console.WriteLine(string.Join(Environment.NewLine, r.Files.Select(x => x.Path)));
|
||||
Assert.AreEqual(2, r.Files.Count());
|
||||
}
|
||||
|
||||
using(var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 0 }), null))
|
||||
{
|
||||
var r = c.List("*");
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
@@ -29,7 +29,7 @@ namespace Duplicati.UnitTest
|
||||
public class Issue1723 : BasicSetupHelper
|
||||
{
|
||||
[Test]
|
||||
[Category("Targeted")]
|
||||
[Category("Targeted")]
|
||||
public void RunCommands()
|
||||
{
|
||||
var testopts = TestOptions;
|
||||
@@ -40,8 +40,7 @@ namespace Duplicati.UnitTest
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts, null))
|
||||
{
|
||||
var r = c.Backup(new string[] { DATAFOLDER });
|
||||
Assert.AreEqual(0, r.Errors.Count());
|
||||
Assert.AreEqual(0, r.Warnings.Count());
|
||||
TestUtils.AssertResults(r);
|
||||
var pr = (Library.Interface.IParsedBackendStatistics)r.BackendStatistics;
|
||||
if (pr.KnownFileSize == 0 || pr.KnownFileCount != 3 || pr.BackupListCount != 1)
|
||||
throw new Exception(string.Format("Failed to get stats from remote backend: {0}, {1}, {2}", pr.KnownFileSize, pr.KnownFileCount, pr.BackupListCount));
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
TestUtils.AssertResults(c.Restore(null));
|
||||
var hash = CalculateFileHash(Path.Combine(DATAFOLDER, "a"));
|
||||
Assert.AreEqual(hashes[version], hash, "Hash mismatch for version " + version);
|
||||
Assert.That(hashes[version], Is.EqualTo(hash), "Hash mismatch for version " + version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
TestUtils.AssertResults(c.Restore(null));
|
||||
var hash = CalculateFileHash(Path.Combine(DATAFOLDER, "a"));
|
||||
Assert.AreEqual(hashes[version], hash, "Hash mismatch for version " + version);
|
||||
Assert.That(hashes[version], Is.EqualTo(hash), "Hash mismatch for version " + version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using Duplicati.Library.Interface;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Duplicati.Library.Main.Volumes;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ using Duplicati.Library.DynamicLoader;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
var res = c.Backup([DATAFOLDER]);
|
||||
TestUtils.AssertResults(res);
|
||||
Assert.AreEqual(i + 1, c.List(null).Filesets.Count());
|
||||
Assert.That(c.List(null).Filesets.Count(), Is.EqualTo(i + 1), "Backup count mismatch after backup " + i);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace Duplicati.UnitTest
|
||||
TestUtils.AssertResults(c.Delete());
|
||||
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts.Expand(new { version = 2, retention_policy = "1s:U" }), null))
|
||||
Assert.AreEqual(1, c.List(null).Filesets.Count());
|
||||
Assert.That(c.List(null).Filesets.Count(), Is.EqualTo(1), "Backup count mismatch after delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Security.AccessControl;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -23,13 +23,13 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Duplicati.Library.Common;
|
||||
using Duplicati.Library.Common.IO;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Utility = Duplicati.Library.Utility.Utility;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace Duplicati.UnitTest
|
||||
if (!OperatingSystem.IsWindows())
|
||||
{
|
||||
SystemIO.IO_OS.DirectoryCreate(dirWithAsterisk);
|
||||
TestUtils.WriteFile(SystemIO.IO_OS.PathCombine(dirWithAsterisk, file), new byte[] {0});
|
||||
TestUtils.WriteFile(SystemIO.IO_OS.PathCombine(dirWithAsterisk, file), new byte[] { 0 });
|
||||
directories.Add(dirWithAsterisk);
|
||||
questionMarkWildcardShouldMatchCount++;
|
||||
verbatimAsteriskShouldMatchCount++;
|
||||
@@ -83,20 +83,20 @@ namespace Duplicati.UnitTest
|
||||
const string dir = "dir";
|
||||
string normalDir = Path.Combine(this.DATAFOLDER, dir);
|
||||
SystemIO.IO_OS.DirectoryCreate(normalDir);
|
||||
TestUtils.WriteFile(SystemIO.IO_OS.PathCombine(normalDir, file), new byte[] {3});
|
||||
TestUtils.WriteFile(SystemIO.IO_OS.PathCombine(normalDir, file), new byte[] { 3 });
|
||||
directories.Add(normalDir);
|
||||
|
||||
// Backup all files.
|
||||
Dictionary<string, string> options = new Dictionary<string, string>(this.TestOptions);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
// Restore all files.
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(options) {["restore-path"] = this.RESTOREFOLDER};
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(options) { ["restore-path"] = this.RESTOREFOLDER };
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
|
||||
{
|
||||
IRestoreResults restoreResults = c.Restore(null);
|
||||
@@ -139,7 +139,7 @@ namespace Duplicati.UnitTest
|
||||
Assert.AreEqual(1, listResults.Files.Count());
|
||||
Assert.AreEqual(expectedFilePath, listResults.Files.Single().Path);
|
||||
|
||||
IRestoreResults restoreResults = c.Restore(new[] {verbatimFilePath});
|
||||
IRestoreResults restoreResults = c.Restore(new[] { verbatimFilePath });
|
||||
Assert.AreEqual(0, restoreResults.Errors.Count());
|
||||
Assert.AreEqual(0, restoreResults.Warnings.Count());
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Duplicati.UnitTest
|
||||
FilterExpression filter = new FilterExpression(dirWithAsterisk);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER}, filter);
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER }, filter);
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
Assert.AreEqual(directories.Count, backupResults.ExaminedFiles);
|
||||
@@ -170,7 +170,7 @@ namespace Duplicati.UnitTest
|
||||
filter = new FilterExpression("@" + SystemIO.IO_OS.PathCombine(dirWithAsterisk, file));
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER}, filter);
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER }, filter);
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
Assert.AreEqual(verbatimAsteriskShouldMatchCount, backupResults.ExaminedFiles);
|
||||
@@ -183,11 +183,11 @@ namespace Duplicati.UnitTest
|
||||
{
|
||||
// A normal path that will be backed up.
|
||||
string normalFilePath = Path.Combine(this.DATAFOLDER, "normal");
|
||||
File.WriteAllBytes(normalFilePath, new byte[] {0, 1, 2});
|
||||
File.WriteAllBytes(normalFilePath, new byte[] { 0, 1, 2 });
|
||||
|
||||
// A long path to exclude.
|
||||
string longFile = SystemIO.IO_OS.PathCombine(this.DATAFOLDER, new string('y', 255));
|
||||
TestUtils.WriteFile(longFile, new byte[] {0, 1});
|
||||
TestUtils.WriteFile(longFile, new byte[] { 0, 1 });
|
||||
|
||||
// A folder that ends with a dot to exclude.
|
||||
string folderWithDot = Path.Combine(this.DATAFOLDER, "folder_with_dot.");
|
||||
@@ -199,11 +199,11 @@ namespace Duplicati.UnitTest
|
||||
|
||||
// A file that ends with a dot to exclude.
|
||||
string fileWithDot = Path.Combine(this.DATAFOLDER, "file_with_dot.");
|
||||
TestUtils.WriteFile(fileWithDot, new byte[] {0, 1});
|
||||
TestUtils.WriteFile(fileWithDot, new byte[] { 0, 1 });
|
||||
|
||||
// A file that ends with a space to exclude.
|
||||
string fileWithSpace = Path.Combine(this.DATAFOLDER, "file_with_space ");
|
||||
TestUtils.WriteFile(fileWithSpace, new byte[] {0, 1});
|
||||
TestUtils.WriteFile(fileWithSpace, new byte[] { 0, 1 });
|
||||
|
||||
FilterExpression filter = new FilterExpression(longFile, false);
|
||||
filter = FilterExpression.Combine(filter, new FilterExpression(Util.AppendDirSeparator(folderWithDot), false));
|
||||
@@ -214,7 +214,7 @@ namespace Duplicati.UnitTest
|
||||
Dictionary<string, string> options = new Dictionary<string, string>(this.TestOptions);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER}, filter);
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER }, filter);
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
@@ -241,21 +241,21 @@ namespace Duplicati.UnitTest
|
||||
|
||||
string fileName = new string('y', 255);
|
||||
string filePath = SystemIO.IO_OS.PathCombine(folderPath, fileName);
|
||||
byte[] fileBytes = {0, 1, 2};
|
||||
byte[] fileBytes = { 0, 1, 2 };
|
||||
TestUtils.WriteFile(filePath, fileBytes);
|
||||
|
||||
Dictionary<string, string> options = new Dictionary<string, string>(this.TestOptions);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions) {["restore-path"] = this.RESTOREFOLDER};
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions) { ["restore-path"] = this.RESTOREFOLDER };
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
|
||||
{
|
||||
IRestoreResults restoreResults = c.Restore(new[] {filePath});
|
||||
IRestoreResults restoreResults = c.Restore(new[] { filePath });
|
||||
Assert.AreEqual(0, restoreResults.Errors.Count());
|
||||
Assert.AreEqual(0, restoreResults.Warnings.Count());
|
||||
}
|
||||
@@ -290,23 +290,23 @@ namespace Duplicati.UnitTest
|
||||
SystemIO.IO_OS.DirectoryCreate(folderPath);
|
||||
|
||||
string filePath = SystemIO.IO_OS.PathCombine(folderPath, pathComponent);
|
||||
byte[] fileBytes = {0, 1, 2};
|
||||
byte[] fileBytes = { 0, 1, 2 };
|
||||
TestUtils.WriteFile(filePath, fileBytes);
|
||||
|
||||
Dictionary<string, string> options = new Dictionary<string, string>(this.TestOptions);
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions) {["restore-path"] = this.RESTOREFOLDER};
|
||||
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions) { ["restore-path"] = this.RESTOREFOLDER };
|
||||
|
||||
// Restore just the file.
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
|
||||
{
|
||||
IRestoreResults restoreResults = c.Restore(new[] {filePath});
|
||||
IRestoreResults restoreResults = c.Restore(new[] { filePath });
|
||||
Assert.AreEqual(0, restoreResults.Errors.Count());
|
||||
Assert.AreEqual(0, restoreResults.Warnings.Count());
|
||||
}
|
||||
@@ -319,7 +319,7 @@ namespace Duplicati.UnitTest
|
||||
string pathSpec = $"[{Regex.Escape(Util.AppendDirSeparator(this.DATAFOLDER))}.*]";
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
|
||||
{
|
||||
IRestoreResults restoreResults = c.Restore(new[] {pathSpec});
|
||||
IRestoreResults restoreResults = c.Restore(new[] { pathSpec });
|
||||
Assert.AreEqual(0, restoreResults.Errors.Count());
|
||||
Assert.AreEqual(0, restoreResults.Warnings.Count());
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
@@ -26,8 +26,8 @@ using System.Linq;
|
||||
using Duplicati.Library.Common.IO;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace Duplicati.UnitTest
|
||||
|
||||
using (var c = new Library.Main.Controller("file://" + TARGETFOLDER, testopts, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new string[] {DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new string[] { DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
@@ -268,7 +268,7 @@ namespace Duplicati.UnitTest
|
||||
}
|
||||
|
||||
// A dry-run should run without exceptions (see issue #4379).
|
||||
Dictionary<string, string> dryRunOptions = new Dictionary<string, string>(testopts) {["dry-run"] = "true"};
|
||||
Dictionary<string, string> dryRunOptions = new Dictionary<string, string>(testopts) { ["dry-run"] = "true" };
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, dryRunOptions, null))
|
||||
{
|
||||
IPurgeBrokenFilesResults purgeResults = c.PurgeBrokenFiles(null);
|
||||
@@ -300,7 +300,7 @@ namespace Duplicati.UnitTest
|
||||
// A subsequent backup should be successful.
|
||||
using (Controller c = new Controller("file://" + this.TARGETFOLDER, testopts, null))
|
||||
{
|
||||
IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER});
|
||||
IBackupResults backupResults = c.Backup(new[] { this.DATAFOLDER });
|
||||
Assert.AreEqual(0, backupResults.Errors.Count());
|
||||
Assert.AreEqual(0, backupResults.Warnings.Count());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.Linq;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@ using Duplicati.Library.Main.Volumes;
|
||||
using Duplicati.Library.SQLiteHelper;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Legacy;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main.Database;
|
||||
using Duplicati.Library.SQLiteHelper;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ using Duplicati.Library.Common.IO;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Duplicati.UnitTest
|
||||
public void TestGetSerializerGivenDuplicatiReturnsDuplicatiSerializer()
|
||||
{
|
||||
IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Duplicati);
|
||||
Assert.AreEqual(typeof(DuplicatiFormatSerializer), serializer.GetType());
|
||||
Assert.That(serializer, Is.InstanceOf<DuplicatiFormatSerializer>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -40,7 +40,7 @@ namespace Duplicati.UnitTest
|
||||
public void TestGetSerializerGivenJsonReturnsJsonSerializer()
|
||||
{
|
||||
IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Json);
|
||||
Assert.AreEqual(typeof(JsonFormatSerializer), serializer.GetType());
|
||||
Assert.That(serializer, Is.InstanceOf<JsonFormatSerializer>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ using System.Linq;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ using Duplicati.Library.Main.Database;
|
||||
using Duplicati.Library.SQLiteHelper;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ using Duplicati.Library.Logging;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using Duplicati.Library.Main;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -26,6 +26,7 @@ using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Main;
|
||||
using Duplicati.Library.Snapshots;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ using System;
|
||||
using System.Linq;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Specialized;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Duplicati.Library.Main;
|
||||
using System.IO;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
using NUnit.Framework.Legacy;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Duplicati.StreamUtil;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
using NUnit.Framework.Legacy;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// Copyright (C) 2025, The Duplicati Team
|
||||
// https://duplicati.com, hello@duplicati.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using NUnit.Framework;
|
||||
using Duplicati.Library.Backend.WebApi;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Duplicati.Library.Utility;
|
||||
using NUnit.Framework;
|
||||
using Assert = NUnit.Framework.Legacy.ClassicAssert;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user