diff --git a/Duplicati/UnitTest/AESStringEncryptionTests.cs b/Duplicati/UnitTest/AESStringEncryptionTests.cs index b659ded32..e072f1a9e 100644 --- a/Duplicati/UnitTest/AESStringEncryptionTests.cs +++ b/Duplicati/UnitTest/AESStringEncryptionTests.cs @@ -21,6 +21,7 @@ using Duplicati.Library.Encryption; using NUnit.Framework; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Duplicati.UnitTest { diff --git a/Duplicati/UnitTest/ArchiveAttributeTests.cs b/Duplicati/UnitTest/ArchiveAttributeTests.cs index bc294de9e..66661bf2a 100644 --- a/Duplicati/UnitTest/ArchiveAttributeTests.cs +++ b/Duplicati/UnitTest/ArchiveAttributeTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/BackendToolTests.cs b/Duplicati/UnitTest/BackendToolTests.cs index 402cf4e67..139330912 100755 --- a/Duplicati/UnitTest/BackendToolTests.cs +++ b/Duplicati/UnitTest/BackendToolTests.cs @@ -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); diff --git a/Duplicati/UnitTest/BorderTests.cs b/Duplicati/UnitTest/BorderTests.cs index 4c65c032b..cb5413f98 100644 --- a/Duplicati/UnitTest/BorderTests.cs +++ b/Duplicati/UnitTest/BorderTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/CLIDatabaseLocatorTests.cs b/Duplicati/UnitTest/CLIDatabaseLocatorTests.cs index 4357e6be7..b731b6aa3 100644 --- a/Duplicati/UnitTest/CLIDatabaseLocatorTests.cs +++ b/Duplicati/UnitTest/CLIDatabaseLocatorTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/CompactDisruptionTests.cs b/Duplicati/UnitTest/CompactDisruptionTests.cs index 8a8f9328c..072df9a1c 100644 --- a/Duplicati/UnitTest/CompactDisruptionTests.cs +++ b/Duplicati/UnitTest/CompactDisruptionTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/CompressionTests.cs b/Duplicati/UnitTest/CompressionTests.cs index c7bb355f9..da9baee37 100644 --- a/Duplicati/UnitTest/CompressionTests.cs +++ b/Duplicati/UnitTest/CompressionTests.cs @@ -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))); } } diff --git a/Duplicati/UnitTest/ControllerMultiLogTargetTests.cs b/Duplicati/UnitTest/ControllerMultiLogTargetTests.cs index 707a4ae72..f517823d6 100644 --- a/Duplicati/UnitTest/ControllerMultiLogTargetTests.cs +++ b/Duplicati/UnitTest/ControllerMultiLogTargetTests.cs @@ -35,8 +35,8 @@ namespace Duplicati.UnitTest using var logger = new ControllerMultiLogTarget(dest, LogMessageType.Information, null, new HashSet { "ID1" }); var entry = new LogEntry("msg", System.Array.Empty(), 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(), 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)); } } } diff --git a/Duplicati/UnitTest/ControllerTests.cs b/Duplicati/UnitTest/ControllerTests.cs index 1a4108be1..2738c0474 100644 --- a/Duplicati/UnitTest/ControllerTests.cs +++ b/Duplicati/UnitTest/ControllerTests.cs @@ -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 firstOptions = new Dictionary(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()); } diff --git a/Duplicati/UnitTest/DatabaseToolTests.cs b/Duplicati/UnitTest/DatabaseToolTests.cs index 11c069733..778f33146 100644 --- a/Duplicati/UnitTest/DatabaseToolTests.cs +++ b/Duplicati/UnitTest/DatabaseToolTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/DeleteHandlerTests.cs b/Duplicati/UnitTest/DeleteHandlerTests.cs index 2a60ee65e..68a8f200d 100644 --- a/Duplicati/UnitTest/DeleteHandlerTests.cs +++ b/Duplicati/UnitTest/DeleteHandlerTests.cs @@ -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 {{"keep-time", $"{(int) timeSpan.TotalSeconds}s"}}); + Options options = new Options(new Dictionary { { "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 {{"keep-versions", "2"}}); + Options options = new Options(new Dictionary { { "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 {{"retention-policy", "1W:U,3M:1D,1Y:1W,U:1M"}}); + Options options = new Options(new Dictionary { { "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 {{"version", "0,3,4"}}); + Options options = new Options(new Dictionary { { "version", "0,3,4" } }); IListResultFileset[] expectedFilesetsToRemove = { filesets[0], diff --git a/Duplicati/UnitTest/DisruptionTests.cs b/Duplicati/UnitTest/DisruptionTests.cs index c4a8f53e2..6123b2ece 100644 --- a/Duplicati/UnitTest/DisruptionTests.cs +++ b/Duplicati/UnitTest/DisruptionTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/Duplicati.UnitTest.csproj b/Duplicati/UnitTest/Duplicati.UnitTest.csproj index 399d277cf..ae1023f3d 100644 --- a/Duplicati/UnitTest/Duplicati.UnitTest.csproj +++ b/Duplicati/UnitTest/Duplicati.UnitTest.csproj @@ -10,9 +10,9 @@ - - - + + + diff --git a/Duplicati/UnitTest/EncryptedFieldHelperTests.cs b/Duplicati/UnitTest/EncryptedFieldHelperTests.cs index 4fa1ea4b1..fa8a94977 100644 --- a/Duplicati/UnitTest/EncryptedFieldHelperTests.cs +++ b/Duplicati/UnitTest/EncryptedFieldHelperTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/FilterTest.cs b/Duplicati/UnitTest/FilterTest.cs index b63e77fe8..9f9928c68 100644 --- a/Duplicati/UnitTest/FilterTest.cs +++ b/Duplicati/UnitTest/FilterTest.cs @@ -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 { diff --git a/Duplicati/UnitTest/HasherTests.cs b/Duplicati/UnitTest/HasherTests.cs index 35588b6a7..4e9e17a74 100644 --- a/Duplicati/UnitTest/HasherTests.cs +++ b/Duplicati/UnitTest/HasherTests.cs @@ -21,6 +21,7 @@ using NUnit.Framework; using System.Security.Cryptography; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Duplicati.UnitTest { diff --git a/Duplicati/UnitTest/IOTests.cs b/Duplicati/UnitTest/IOTests.cs index 0be6d3de7..d24729b1f 100644 --- a/Duplicati/UnitTest/IOTests.cs +++ b/Duplicati/UnitTest/IOTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/ImportExportTests.cs b/Duplicati/UnitTest/ImportExportTests.cs index 1d61312f3..3d8fe743f 100644 --- a/Duplicati/UnitTest/ImportExportTests.cs +++ b/Duplicati/UnitTest/ImportExportTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/Issue1410.cs b/Duplicati/UnitTest/Issue1410.cs index c47e48aee..6c4fe4b47 100644 --- a/Duplicati/UnitTest/Issue1410.cs +++ b/Duplicati/UnitTest/Issue1410.cs @@ -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()); diff --git a/Duplicati/UnitTest/Issue1723.cs b/Duplicati/UnitTest/Issue1723.cs index ed75df07c..514d62171 100644 --- a/Duplicati/UnitTest/Issue1723.cs +++ b/Duplicati/UnitTest/Issue1723.cs @@ -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)); diff --git a/Duplicati/UnitTest/Issue4312.cs b/Duplicati/UnitTest/Issue4312.cs index cbfa60e63..a357b9de3 100644 --- a/Duplicati/UnitTest/Issue4312.cs +++ b/Duplicati/UnitTest/Issue4312.cs @@ -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; diff --git a/Duplicati/UnitTest/Issue4988.cs b/Duplicati/UnitTest/Issue4988.cs index d0298d7fa..0d2b57ca5 100644 --- a/Duplicati/UnitTest/Issue4988.cs +++ b/Duplicati/UnitTest/Issue4988.cs @@ -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; diff --git a/Duplicati/UnitTest/Issue5066.cs b/Duplicati/UnitTest/Issue5066.cs index 354573f0e..60197e4fb 100644 --- a/Duplicati/UnitTest/Issue5066.cs +++ b/Duplicati/UnitTest/Issue5066.cs @@ -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); } } } diff --git a/Duplicati/UnitTest/Issue5097.cs b/Duplicati/UnitTest/Issue5097.cs index a02f83238..4f3018c7a 100644 --- a/Duplicati/UnitTest/Issue5097.cs +++ b/Duplicati/UnitTest/Issue5097.cs @@ -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 { diff --git a/Duplicati/UnitTest/Issue5196.cs b/Duplicati/UnitTest/Issue5196.cs index aa2eb106b..e04fdd7d4 100644 --- a/Duplicati/UnitTest/Issue5196.cs +++ b/Duplicati/UnitTest/Issue5196.cs @@ -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; diff --git a/Duplicati/UnitTest/Issue5845.cs b/Duplicati/UnitTest/Issue5845.cs index 82f7311a1..969b32325 100644 --- a/Duplicati/UnitTest/Issue5845.cs +++ b/Duplicati/UnitTest/Issue5845.cs @@ -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 { diff --git a/Duplicati/UnitTest/Issue6127.cs b/Duplicati/UnitTest/Issue6127.cs index 2b2c441b8..8e212bdbd 100644 --- a/Duplicati/UnitTest/Issue6127.cs +++ b/Duplicati/UnitTest/Issue6127.cs @@ -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"); } } } diff --git a/Duplicati/UnitTest/IssueTests.cs b/Duplicati/UnitTest/IssueTests.cs index 3b405e1f2..d49c4abae 100644 --- a/Duplicati/UnitTest/IssueTests.cs +++ b/Duplicati/UnitTest/IssueTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/ProblematicPathTests.cs b/Duplicati/UnitTest/ProblematicPathTests.cs index 0403f0da7..b815ef0f4 100644 --- a/Duplicati/UnitTest/ProblematicPathTests.cs +++ b/Duplicati/UnitTest/ProblematicPathTests.cs @@ -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 options = new Dictionary(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 restoreOptions = new Dictionary(options) {["restore-path"] = this.RESTOREFOLDER}; + Dictionary restoreOptions = new Dictionary(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 options = new Dictionary(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 options = new Dictionary(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 restoreOptions = new Dictionary(this.TestOptions) {["restore-path"] = this.RESTOREFOLDER}; + Dictionary restoreOptions = new Dictionary(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 options = new Dictionary(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 restoreOptions = new Dictionary(this.TestOptions) {["restore-path"] = this.RESTOREFOLDER}; + Dictionary restoreOptions = new Dictionary(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()); } diff --git a/Duplicati/UnitTest/PurgeTesting.cs b/Duplicati/UnitTest/PurgeTesting.cs index bbbc54c5c..af1986867 100644 --- a/Duplicati/UnitTest/PurgeTesting.cs +++ b/Duplicati/UnitTest/PurgeTesting.cs @@ -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 dryRunOptions = new Dictionary(testopts) {["dry-run"] = "true"}; + Dictionary dryRunOptions = new Dictionary(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()); } diff --git a/Duplicati/UnitTest/RecoveryToolTests.cs b/Duplicati/UnitTest/RecoveryToolTests.cs index 8c1da1241..e4a4a68cd 100644 --- a/Duplicati/UnitTest/RecoveryToolTests.cs +++ b/Duplicati/UnitTest/RecoveryToolTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/RepairHandlerTests.cs b/Duplicati/UnitTest/RepairHandlerTests.cs index 98d636c85..907d5ccae 100644 --- a/Duplicati/UnitTest/RepairHandlerTests.cs +++ b/Duplicati/UnitTest/RepairHandlerTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/RepairWithMissingRemoteFiles.cs b/Duplicati/UnitTest/RepairWithMissingRemoteFiles.cs index 827f23fc3..bc2425d9b 100644 --- a/Duplicati/UnitTest/RepairWithMissingRemoteFiles.cs +++ b/Duplicati/UnitTest/RepairWithMissingRemoteFiles.cs @@ -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 { diff --git a/Duplicati/UnitTest/RestoreHandlerTests.cs b/Duplicati/UnitTest/RestoreHandlerTests.cs index f3bb198ae..e82945292 100644 --- a/Duplicati/UnitTest/RestoreHandlerTests.cs +++ b/Duplicati/UnitTest/RestoreHandlerTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/ResultFormatSerializerProviderTest.cs b/Duplicati/UnitTest/ResultFormatSerializerProviderTest.cs index 97b6e5f5b..6fa23918c 100644 --- a/Duplicati/UnitTest/ResultFormatSerializerProviderTest.cs +++ b/Duplicati/UnitTest/ResultFormatSerializerProviderTest.cs @@ -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()); } [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()); } } } diff --git a/Duplicati/UnitTest/RunScriptTests.cs b/Duplicati/UnitTest/RunScriptTests.cs index 99c302a0c..2822c69cd 100644 --- a/Duplicati/UnitTest/RunScriptTests.cs +++ b/Duplicati/UnitTest/RunScriptTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/SQLiteTests.cs b/Duplicati/UnitTest/SQLiteTests.cs index 95b78b0ba..50ab02888 100755 --- a/Duplicati/UnitTest/SQLiteTests.cs +++ b/Duplicati/UnitTest/SQLiteTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/SecretProviderHelperTests.cs b/Duplicati/UnitTest/SecretProviderHelperTests.cs index dfdffb841..3719163ab 100644 --- a/Duplicati/UnitTest/SecretProviderHelperTests.cs +++ b/Duplicati/UnitTest/SecretProviderHelperTests.cs @@ -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; diff --git a/Duplicati/UnitTest/StatisticsTests.cs b/Duplicati/UnitTest/StatisticsTests.cs index ffd56f208..178e4a6b6 100644 --- a/Duplicati/UnitTest/StatisticsTests.cs +++ b/Duplicati/UnitTest/StatisticsTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/SymLinkTests.cs b/Duplicati/UnitTest/SymLinkTests.cs index bd7e5f7a0..d023e9b99 100755 --- a/Duplicati/UnitTest/SymLinkTests.cs +++ b/Duplicati/UnitTest/SymLinkTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/TimeSpanParserTests.cs b/Duplicati/UnitTest/TimeSpanParserTests.cs index e612ffeb1..27b8183ef 100644 --- a/Duplicati/UnitTest/TimeSpanParserTests.cs +++ b/Duplicati/UnitTest/TimeSpanParserTests.cs @@ -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; diff --git a/Duplicati/UnitTest/TimeZoneHelperTests.cs b/Duplicati/UnitTest/TimeZoneHelperTests.cs index 7c9c3f6f1..b12b72779 100644 --- a/Duplicati/UnitTest/TimeZoneHelperTests.cs +++ b/Duplicati/UnitTest/TimeZoneHelperTests.cs @@ -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; diff --git a/Duplicati/UnitTest/ToolTests.cs b/Duplicati/UnitTest/ToolTests.cs index e5ec55dad..8d8a8935c 100644 --- a/Duplicati/UnitTest/ToolTests.cs +++ b/Duplicati/UnitTest/ToolTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/UriUtilityTests.cs b/Duplicati/UnitTest/UriUtilityTests.cs index 4790d7da1..31d7d463c 100644 --- a/Duplicati/UnitTest/UriUtilityTests.cs +++ b/Duplicati/UnitTest/UriUtilityTests.cs @@ -21,6 +21,7 @@ using NUnit.Framework; using System.Collections.Specialized; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace Duplicati.UnitTest { diff --git a/Duplicati/UnitTest/UtilityExtraTests.cs b/Duplicati/UnitTest/UtilityExtraTests.cs index 551b3ab4f..90425f1e3 100644 --- a/Duplicati/UnitTest/UtilityExtraTests.cs +++ b/Duplicati/UnitTest/UtilityExtraTests.cs @@ -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 diff --git a/Duplicati/UnitTest/UtilityTests.cs b/Duplicati/UnitTest/UtilityTests.cs index d7b4f2911..21aff0ee5 100644 --- a/Duplicati/UnitTest/UtilityTests.cs +++ b/Duplicati/UnitTest/UtilityTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/WebApiTests.cs b/Duplicati/UnitTest/WebApiTests.cs index a708df93c..123c9b37a 100644 --- a/Duplicati/UnitTest/WebApiTests.cs +++ b/Duplicati/UnitTest/WebApiTests.cs @@ -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 { diff --git a/Duplicati/UnitTest/ZipFallbackTest.cs b/Duplicati/UnitTest/ZipFallbackTest.cs index 40399cc8b..ea89584a0 100644 --- a/Duplicati/UnitTest/ZipFallbackTest.cs +++ b/Duplicati/UnitTest/ZipFallbackTest.cs @@ -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 {