diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2020-07-20 05:51:05 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2020-07-20 05:51:05 +0300 |
commit | 27c5b9ef5a24299032287ba3aeab33cafea4cf77 (patch) | |
tree | aaecbe3826c583dbf7d21eee8a34b7b30c49e7a4 /Duplicati/UnitTest | |
parent | 47df16063ff1a9ba377807d77a83735c9016ca44 (diff) |
Check for errors and warnings in unit tests.
Diffstat (limited to 'Duplicati/UnitTest')
-rw-r--r-- | Duplicati/UnitTest/RestoreHandlerTests.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Duplicati/UnitTest/RestoreHandlerTests.cs b/Duplicati/UnitTest/RestoreHandlerTests.cs index 4c5ce91ea..1b1d310f2 100644 --- a/Duplicati/UnitTest/RestoreHandlerTests.cs +++ b/Duplicati/UnitTest/RestoreHandlerTests.cs @@ -1,12 +1,12 @@ -using Duplicati.Library.Common; -using Duplicati.Library.Main; -using NUnit.Framework; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.AccessControl; -using Duplicati.Library.Interface; +using Duplicati.Library.Common; using Duplicati.Library.Common.IO; +using Duplicati.Library.Interface; +using Duplicati.Library.Main; +using NUnit.Framework; namespace Duplicati.UnitTest { @@ -19,12 +19,14 @@ namespace Duplicati.UnitTest string folderPath = Path.Combine(this.DATAFOLDER, "folder"); Directory.CreateDirectory(folderPath); string filePath = Path.Combine(folderPath, "empty_file"); - File.WriteAllBytes(filePath, new byte[] {}); + File.WriteAllBytes(filePath, new byte[] { }); Dictionary<string, string> options = new Dictionary<string, string>(this.TestOptions); using (Controller c = new Controller("file://" + this.TARGETFOLDER, options, null)) { - c.Backup(new[] {this.DATAFOLDER}); + IBackupResults backupResults = c.Backup(new[] {this.DATAFOLDER}); + Assert.AreEqual(0, backupResults.Errors.Count()); + Assert.AreEqual(0, backupResults.Warnings.Count()); } // Issue #4148 described a situation where the folders containing the empty file were not recreated properly. @@ -35,7 +37,9 @@ namespace Duplicati.UnitTest }; using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null)) { - c.Restore(new[] {filePath}); + IRestoreResults restoreResults = c.Restore(new[] {filePath}); + Assert.AreEqual(0, restoreResults.Errors.Count()); + Assert.AreEqual(0, restoreResults.Warnings.Count()); } // We need to strip the root part of the path. Otherwise, Path.Combine will simply return the second argument |