diff --git a/Duplicati.sln b/Duplicati.sln
index 584c610b5..ef8ca312e 100644
--- a/Duplicati.sln
+++ b/Duplicati.sln
@@ -61,6 +61,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Service", "Duplic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.AzureBlob", "Duplicati\Library\Backend\AzureBlob\Duplicati.Library.Backend.AzureBlob.csproj", "{8E4CECFB-0413-4B00-AB93-78D1C3902BD5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.UnitTest", "Duplicati\UnitTest\Duplicati.UnitTest.csproj", "{ECB63D1C-1724-442D-9228-DEABF14F2EA3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -230,6 +232,12 @@ Global
{E93F3DE2-FF3A-4709-96A3-8190AA14FA25}.Release|Any CPU.Build.0 = Release|Any CPU
{E93F3DE2-FF3A-4709-96A3-8190AA14FA25}.Test|Any CPU.ActiveCfg = Debug|Any CPU
{E93F3DE2-FF3A-4709-96A3-8190AA14FA25}.Test|Any CPU.Build.0 = Debug|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Test|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}.Test|Any CPU.Build.0 = Debug|Any CPU
{F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj
index 3478e26cc..7ae44c9e1 100644
--- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj
+++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj
@@ -29,7 +29,6 @@
DEBUG;TRACE
prompt
4
- UNITTEST ~/testdata/DSMCBE/r50 ~/testdata/DSMCBE/r100 ~/testdata/DSMCBE/r150 --no-encryption --debug-output
@@ -57,7 +56,6 @@
-
diff --git a/Duplicati/CommandLine/Program.cs b/Duplicati/CommandLine/Program.cs
index 4c7250640..579862026 100644
--- a/Duplicati/CommandLine/Program.cs
+++ b/Duplicati/CommandLine/Program.cs
@@ -110,28 +110,6 @@ namespace Duplicati.CommandLine
);
}
-#if DEBUG
- if (cargs.Count > 1 && cargs[0].ToLower() == "unittest")
- {
- //The unit test is only enabled in DEBUG builds
- //it works by getting a list of folders, and treats them as
- //if they have the same data, but on different times
-
- //The first folder is used to make a full backup,
- //and each subsequent folder is used to make an incremental backup
-
- //After all backups are made, the files are restored and verified against
- //the original folders.
-
- //The best way to test it, is to use SVN checkouts at different
- //revisions, as this is how a regular folder would evolve
-
- cargs.RemoveAt(0);
- UnitTest.RunTest(cargs.ToArray(), options);
- return 0;
- }
-#endif
-
if (cargs.Count == 1 && string.Equals(cargs[0], "changelog", StringComparison.InvariantCultureIgnoreCase))
{
var path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "changelog.txt");
diff --git a/Duplicati/UnitTest/Duplicati.UnitTest.csproj b/Duplicati/UnitTest/Duplicati.UnitTest.csproj
new file mode 100644
index 000000000..1f91ffdfe
--- /dev/null
+++ b/Duplicati/UnitTest/Duplicati.UnitTest.csproj
@@ -0,0 +1,168 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {ECB63D1C-1724-442D-9228-DEABF14F2EA3}
+ Library
+ Duplicati.UnitTest
+ Duplicati.UnitTest
+ v4.5
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ false
+
+
+ full
+ true
+ bin\Release
+ prompt
+ 4
+ false
+
+
+
+
+ ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll
+
+
+
+
+
+
+
+
+
+
+
+
+ {81765A64-3661-4E3E-B850-2F6F87A51F74}
+ Duplicati.CommandLine
+
+
+ {E7280DCA-7776-4A73-B9B5-41FD77FC8799}
+ Duplicati.CommandLine.BackendTester
+
+
+ {2AF960C0-357D-4D44-A3D5-8B6E89DB0F11}
+ Duplicati.CommandLine.BackendTool
+
+
+ {17566860-3D98-4604-AA5B-47661F75609F}
+ Duplicati.GUI.TrayIcon
+
+
+ {7E119745-1F62-43F0-936C-F312A1912C0B}
+ Duplicati.Library.AutoUpdater
+
+
+ {8E4CECFB-0413-4B00-AB93-78D1C3902BD5}
+ Duplicati.Library.Backend.AzureBlob
+
+
+ {1BFAE226-8364-4086-825C-BB83F6F3EE4C}
+ Duplicati.Library.Backend.CloudFiles
+
+
+ {FC9B7611-836F-4127-8B44-A7C31F506807}
+ Duplicati.Library.Backend.File
+
+
+ {F61679A9-E5DE-468A-B5A4-05F92D0143D2}
+ Duplicati.Library.Backend.FTP
+
+
+ {42C91180-11EB-4590-82EA-80FE9D4DEBEC}
+ Duplicati.Library.Backend.GoogleDocs
+
+
+ {CCD76347-7DC7-4B42-B7E1-E500E624CAC3}
+ Duplicati.Library.Backend.OneDrive
+
+
+ {C03F6DFD-805A-4BE0-9338-64870ADDB4A2}
+ Duplicati.Library.Backend.S3
+
+
+ {FF2BF37C-E502-4C98-BEA0-701671DDFA08}
+ Duplicati.Library.Backend.SSHv2
+
+
+ {C0270709-2A40-43B5-8CF1-69581B9FA2A1}
+ Duplicati.Library.Backend.TahoeLAFS
+
+
+ {BAE27510-8B5D-44B2-B33E-372A98908041}
+ Duplicati.Library.Backend.WEBDAV
+
+
+ {19ECCE09-B5EB-406C-8C57-BAC66997D469}
+ Duplicati.Library.Compression
+
+
+ {0CA86ECF-5BEC-4909-B4F6-110A03B30B92}
+ Duplicati.Library.DynamicLoader
+
+
+ {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}
+ Duplicati.Library.Encryption
+
+
+ {C5899F45-B0FF-483C-9D38-24A9FCAAB237}
+ Duplicati.Library.Interface
+
+
+ {B68F2214-951F-4F78-8488-66E1ED3F50BF}
+ Duplicati.Library.Localization
+
+
+ {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}
+ Duplicati.Library.Logging
+
+
+ {52826615-7964-47FE-B4B3-1B2DBDF605B9}
+ Duplicati.Library.Modules.Builtin
+
+
+ {10D2D1B7-C664-41D8-9B3A-00040C3D421B}
+ Duplicati.Library.Main
+
+
+ {D63E53E4-A458-4C2F-914D-92F715F58ACE}
+ Duplicati.Library.Snapshots
+
+
+ {2C838169-B187-4B09-8768-1C24C2521C8D}
+ Duplicati.Library.SQLiteHelper
+
+
+ {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}
+ Duplicati.Library.Utility
+
+
+ {4D012CB1-4B92-47F4-89B7-BF80A73A2E99}
+ Duplicati.License
+
+
+ {19E661D2-C5DA-4F35-B3EE-7586E5734B5F}
+ Duplicati.Server
+
+
+ {E93F3DE2-FF3A-4709-96A3-8190AA14FA25}
+ Duplicati.Service
+
+
+ {33FD1D24-C28F-4C71-933F-98F1586EA76C}
+ Duplicati.Server.Serialization
+
+
+
\ No newline at end of file
diff --git a/Duplicati/UnitTest/GeneralBlackBoxTesting.cs b/Duplicati/UnitTest/GeneralBlackBoxTesting.cs
new file mode 100644
index 000000000..ad97641f9
--- /dev/null
+++ b/Duplicati/UnitTest/GeneralBlackBoxTesting.cs
@@ -0,0 +1,30 @@
+// Copyright (C) 2015, The Duplicati Team
+// http://www.duplicati.com, info@duplicati.com
+//
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 2.1 of the
+// License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+using NUnit.Framework;
using System.Linq;
using System.IO;
+using System;
using System.Collections.Generic;
+
+namespace Duplicati.UnitTest
+{
+ [TestFixture()]
+ public class GeneralBlackBoxTesting
+ {
private const string SOURCE_FOLDERS = "~/testdata/DSMCBE";
//private static readonly Duplicati.Library.Main.Options opts = new Duplicati.Library.Main.Options(new Dictionary());
private static readonly string HOME_PATH = (Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX)
? Environment.GetEnvironmentVariable("HOME")
: Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
private static string ExpandString(string str)
{
return Environment.ExpandEnvironmentVariables(str.Replace("~", HOME_PATH));
}
private IEnumerable TestFolders
{
get
{
var rx = new System.Text.RegularExpressions.Regex("r(?\\d+)");
return
from n in Directory.EnumerateDirectories(ExpandString(SOURCE_FOLDERS))
let m = rx.Match(n)
where m.Success
orderby int.Parse(m.Groups["number"].Value)
select n;
}
}
private Dictionary TestOptions
{
get
{
return new Dictionary();
}
}
+ [Test()]
+ public void TestWithSVNShort()
+ {
SVNCheckoutTest.RunTest(TestFolders.Take(5).ToArray(), TestOptions);
}
+ }
+}
+
diff --git a/Duplicati/CommandLine/UnitTest.cs b/Duplicati/UnitTest/SVNCheckoutsTest.cs
similarity index 94%
rename from Duplicati/CommandLine/UnitTest.cs
rename to Duplicati/UnitTest/SVNCheckoutsTest.cs
index 93cfc8cc7..c5e3ab5c0 100644
--- a/Duplicati/CommandLine/UnitTest.cs
+++ b/Duplicati/UnitTest/SVNCheckoutsTest.cs
@@ -16,9 +16,10 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
-#endregion
+using NUnit.Framework;
-#if DEBUG
+
+#endregion
using System;
using System.Collections.Generic;
@@ -27,12 +28,12 @@ using Duplicati.Library.Logging;
using Duplicati.Library.Utility;
using System.Linq;
-namespace Duplicati.CommandLine
+namespace Duplicati.UnitTest
{
///
/// This class encapsulates a simple method for testing the correctness of duplicati.
///
- public class UnitTest
+ public class SVNCheckoutTest
{
///
/// A helper class to write debug messages to the log file
@@ -196,8 +197,8 @@ namespace Duplicati.CommandLine
tmp["allow-full-removal"] = "";
using (new Timer("Cleaning up any existing backups"))
- using(var i = new Duplicati.Library.Main.Controller(target, tmp, new ConsoleOutput(options)))
- i.Delete();
+ using(var i = new Duplicati.Library.Main.Controller(target, tmp, new CommandLine.ConsoleOutput(options)))
+ i.Delete();
}
log.Backupset = "Backup " + folders[0];
@@ -244,7 +245,7 @@ namespace Duplicati.CommandLine
}
IList entries;
- using(var i = new Duplicati.Library.Main.Controller(target, options, new ConsoleOutput(options)))
+ using(var i = new Duplicati.Library.Main.Controller(target, options, new CommandLine.ConsoleOutput(options)))
entries = (from n in i.List().Filesets select n.Time.ToLocalTime()).ToList();
if (entries.Count != folders.Length)
@@ -276,7 +277,7 @@ namespace Duplicati.CommandLine
using (new Timer("Extract list of files from" + folders[i]))
{
List sourcefiles;
- using(var inst = new Library.Main.Controller(target, options, new ConsoleOutput(options)))
+ using(var inst = new Library.Main.Controller(target, options, new CommandLine.ConsoleOutput(options)))
sourcefiles = (from n in inst.List("*").Files select n.Path).ToList();
//Remove all folders from list
@@ -453,8 +454,8 @@ namespace Duplicati.CommandLine
{
Console.WriteLine("Backing up the copy: " + sourcename);
using (new Timer("Backup of " + sourcename))
- using(var i = new Duplicati.Library.Main.Controller(target, options, new ConsoleOutput(options)))
- Log.WriteMessage(i.Backup(source.Split(System.IO.Path.PathSeparator)).ToString(), LogMessageType.Information);
+ using(var i = new Duplicati.Library.Main.Controller(target, options, new CommandLine.ConsoleOutput(options)))
+ Log.WriteMessage(i.Backup(source.Split(System.IO.Path.PathSeparator)).ToString(), LogMessageType.Information);
}
private static void RunRestore(string source, string target, string tempfolder, Dictionary options)
@@ -462,8 +463,8 @@ namespace Duplicati.CommandLine
var tops = new Dictionary(options);
tops["restore-path"] = tempfolder;
using (new Timer("Restore of " + source))
- using(var i = new Duplicati.Library.Main.Controller(target, tops, new ConsoleOutput(options)))
- Log.WriteMessage(i.Restore(null).ToString(), LogMessageType.Information);
+ using(var i = new Duplicati.Library.Main.Controller(target, tops, new CommandLine.ConsoleOutput(options)))
+ Log.WriteMessage(i.Restore(null).ToString(), LogMessageType.Information);
}
private static void RunPartialRestore(string source, string target, string tempfolder, Dictionary options, string[] files)
@@ -471,8 +472,8 @@ namespace Duplicati.CommandLine
var tops = new Dictionary(options);
tops["restore-path"] = tempfolder;
using (new Timer("Partial restore of " + source))
- using(var i = new Duplicati.Library.Main.Controller(target, tops, new ConsoleOutput(options)))
- Log.WriteMessage(i.Restore(files).ToString(), LogMessageType.Information);
+ using(var i = new Duplicati.Library.Main.Controller(target, tops, new CommandLine.ConsoleOutput(options)))
+ Log.WriteMessage(i.Restore(files).ToString(), LogMessageType.Information);
}
///
@@ -630,6 +631,4 @@ namespace Duplicati.CommandLine
}
}
}
-}
-
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/Duplicati/UnitTest/packages.config b/Duplicati/UnitTest/packages.config
new file mode 100644
index 000000000..09300da2f
--- /dev/null
+++ b/Duplicati/UnitTest/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file