diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin.sln b/src/AcaciaZPushPlugin/AcaciaZPushPlugin.sln
index 62867b8..905ae8e 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin.sln
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin.sln
@@ -5,12 +5,6 @@ VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AcaciaZPushPlugin", "AcaciaZPushPlugin\AcaciaZPushPlugin.csproj", "{1A7427A5-F814-4B07-98B2-C67D758B65D6}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{3BAA09C4-9E3C-4088-901C-E03489366468}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginUnitTests", "Test\PluginUnitTests\PluginUnitTests.csproj", "{1862C3CA-3347-4180-B076-D018BAA70F40}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutlookIntegrationTests", "Test\OutlookIntegrationTests\OutlookIntegrationTests.csproj", "{A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginDebugger", "PluginDebugger\PluginDebugger.csproj", "{9258AD17-0A25-4669-A95C-93EC70882551}"
EndProject
Global
@@ -35,30 +29,6 @@ Global
{1A7427A5-F814-4B07-98B2-C67D758B65D6}.Release|x64.Build.0 = Release|Any CPU
{1A7427A5-F814-4B07-98B2-C67D758B65D6}.Release|x86.ActiveCfg = Release|Any CPU
{1A7427A5-F814-4B07-98B2-C67D758B65D6}.Release|x86.Build.0 = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|x64.Build.0 = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Debug|x86.Build.0 = Debug|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|Any CPU.Build.0 = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|x64.ActiveCfg = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|x64.Build.0 = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|x86.ActiveCfg = Release|Any CPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}.Release|x86.Build.0 = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|x64.Build.0 = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Debug|x86.Build.0 = Debug|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|Any CPU.Build.0 = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|x64.ActiveCfg = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|x64.Build.0 = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|x86.ActiveCfg = Release|Any CPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}.Release|x86.Build.0 = Release|Any CPU
{9258AD17-0A25-4669-A95C-93EC70882551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9258AD17-0A25-4669-A95C-93EC70882551}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9258AD17-0A25-4669-A95C-93EC70882551}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -75,8 +45,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {1862C3CA-3347-4180-B076-D018BAA70F40} = {3BAA09C4-9E3C-4088-901C-E03489366468}
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7} = {3BAA09C4-9E3C-4088-901C-E03489366468}
- EndGlobalSection
EndGlobal
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Config.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Config.cs
deleted file mode 100644
index 723b58e..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Config.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- ///
- /// TODO: These need to be injected
- ///
- public static class Config
- {
- public static readonly string[] OUTLOOK_PATHS =
- {
- @"C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE",
- @"C:\Program Files\Microsoft Office\Office15\OUTLOOK.EXE"
- };
-
- public const string OUTLOOK_DEFAULT_PROFILE = "Test";
-
- public const int OUTLOOK_START_TIMEOUT = 10000;
- public const int OUTLOOK_STOP_TIMEOUT = 5000;
-
- public const string OUTLOOK_RIBBON_TAB_NAME = "Kopano";
- public const string OUTLOOK_RIBBON_GROUP_NAME = "Kopano";
-
- public const string MAIL_SERVER = "zarafa.demo";
- public const string MAIL_SERVER_USER = "root";
- public const string MAIL_SERVER_PASS = "zardemo";
-
- public const string MAIL_ACCOUNT_PREFIX = "demo";
-
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/AutomationExtensions.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/AutomationExtensions.cs
deleted file mode 100644
index 1d9053e..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/AutomationExtensions.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.Test.Input;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Automation;
-
-namespace AcaciaTest.Framework
-{
- public static class AutomationExtensions
- {
- #region Searching
-
- public static AutomationElement DescendantByName(this AutomationElement element, params string[] path)
- {
- return element.DescendantByCondition(
- path.Select(value => new PropertyCondition(AutomationElement.NameProperty, value, PropertyConditionFlags.IgnoreCase)));
- }
-
- public static AutomationElement DescendantByCondition(this AutomationElement element, IEnumerable conditionPath)
- {
- if (!conditionPath.Any())
- return element;
-
- var result = conditionPath.Aggregate(
- element,
- (parentElement, nextCondition) => parentElement == null
- ? null
- : parentElement.FindFirst(TreeScope.Children, nextCondition));
-
- return result;
- }
-
- #endregion
-
- #region Mouse
-
- ///
- /// Performs a mouse click in the center of the element.
- ///
- public static AutomationElement MouseClick(this AutomationElement element, MouseButton button = MouseButton.Left)
- {
- Rect r = element.Current.BoundingRectangle;
- Mouse.MoveTo(new System.Drawing.Point((int)(r.X + r.Width / 2), (int)(r.Y + r.Height / 2)));
- Mouse.Click(button);
- return element;
- }
-
- #endregion
-
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/KopanoPython.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/KopanoPython.cs
deleted file mode 100644
index b59704d..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/KopanoPython.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- ///
- /// A simple builder for kopano python
- ///
- public class KopanoPython
- {
- private readonly MailServer server;
- private readonly StringBuilder code = new StringBuilder();
-
- public KopanoPython(MailServer server)
- {
- this.server = server;
-
- // Add the defaults
- code
- .AppendLine("from MAPI.Util import *")
- .AppendLine("import kopano")
- .AppendLine("k = kopano.Server()");
- }
-
- public KopanoPython User(string name)
- {
- code.Append("k.user('").Append(name).Append("')");
- return this;
- }
-
- public KopanoPython Append(string text, bool line = true)
- {
- code.Append(text);
- if (line)
- code.AppendLine();
- return this;
- }
-
- public string Exec()
- {
- string code = this.code.ToString();
- return server.ExecuteCommand("python 2>&1", code);
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailAccount.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailAccount.cs
deleted file mode 100644
index ac8ec43..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailAccount.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- ///
- /// A mail account. This combines both the server-side and client-side accounts and provides methods to manipulate and
- /// access both.
- ///
- public class MailAccount : IDisposable
- {
- private readonly MailServer _server;
- private readonly string _username;
-
- public string EmailAddress
- {
- get
- {
- // TODO
- return "k.stiedemann@zarafa.demo";
- //return _username + "@" + _server.ServerURL;
- }
- }
- public string FullName
- {
- get
- {
- // TODO
- return "Kayla Stiedemann";
- }
- }
-
- internal MailAccount(MailServer server, string username)
- {
- this._server = server;
- this._username = username;
- }
-
- public void Dispose()
- {
- }
-
- ///
- /// Clears any data in the account
- ///
- public void Clear()
- {
- _server.Python().User(_username).Append(".store.inbox.empty()").Exec();
- }
-
- ///
- /// Delivers a message to the account
- ///
- public void DeliverMessage(MailMessage message, bool unread = true)
- {
- string cmd = "zarafa-dagent " + (unread ? "" : "-r ") + _username;
- string messageContent = message.ToMessage();
- _server.ExecuteCommand(cmd, messageContent);
- }
-
- ///
- /// Registers the account in the outlook profile.
- ///
- ///
- public void Register(OutlookTester outlook)
- {
- throw new NotImplementedException(); // TODO
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailMessage.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailMessage.cs
deleted file mode 100644
index 42a5f50..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailMessage.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- public struct MailMessage
- {
- public string Subject;
- public string From;
- public string To;
- public DateTime? Date;
- public string Body;
-
- private Dictionary _headers;
- public Dictionary Headers
- {
- get
- {
- if (_headers == null)
- _headers = new Dictionary();
- return _headers;
- }
- set { _headers = value; }
- }
-
- public string ToMessage()
- {
- Dictionary allHeaders = new Dictionary();
-
- // Default headers
- allHeaders["Mime-Version"] = "1.0";
- allHeaders["Content-Type"] = "text/plain";
- allHeaders["X-Priority"] = "3 (Normal)";
- allHeaders["X-Mailer"] = "Zarafa 7.2.1-51970";
- allHeaders["X-Original-Mailer"] = "Zarafa 7.2.1-51970";
- allHeaders["X-Original-To"] = "";
- allHeaders["Message-Id"] = "";
-
- // Add specified fields
- allHeaders["Subject"] = Subject ?? "Subject";
- allHeaders["From"] = From ?? "sender@zarafa.demo";
- allHeaders["To"] = To ?? "recipient@zarafa.demo";
- allHeaders["Date"] = (Date ?? DateTime.Now).ToString("r");
-
- // Add any custom headers
- if (_headers != null)
- {
- foreach (var entry in _headers)
- allHeaders[entry.Key] = entry.Value;
- }
-
- StringBuilder s = new StringBuilder();
- foreach(var entry in allHeaders)
- {
- s.Append(entry.Key).Append(": ").Append(entry.Value).AppendLine();
- }
- s.AppendLine().Append(Body ?? "Message body").AppendLine();
-
-
- return s.ToString();
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailServer.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailServer.cs
deleted file mode 100644
index 003db0a..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/MailServer.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Acacia;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- public class MailServer : IDisposable
- {
- private readonly SshClient ssh;
-
- #region Construction / destruction
-
- public MailServer()
- {
- ssh = new SshClient(Config.MAIL_SERVER, Config.MAIL_SERVER_USER, Config.MAIL_SERVER_PASS);
- ssh.Connect();
- }
-
- public void Dispose()
- {
- if (ssh != null)
- {
- ssh.Disconnect();
- ssh.Dispose();
- }
- }
-
- public string ServerURL
- {
- get { return ssh.ConnectionInfo.Host; }
- }
-
- #endregion
-
- #region Account management
-
- private int _nextAllocationId = 2;
-
- ///
- /// Allocates a mail account. The allocated account is cleared, unless specified otherwise
- ///
- ///
- public MailAccount AllocateAccount(bool clear = true)
- {
- string accountName = Config.MAIL_ACCOUNT_PREFIX + _nextAllocationId;
- ++_nextAllocationId;
- MailAccount account = new MailAccount(this, accountName);
- if (clear)
- account.Clear();
- return account;
- }
-
- #endregion
-
- #region Helpers
-
- ///
- /// Executes the command on the mail server.
- /// If the command returns an error, an assert failure is raised.
- ///
- /// The command.
- /// The input for the command, or null if no input is to be specified
- /// The command's output
- internal string ExecuteCommand(string command, string stdin = null)
- {
- if (stdin != null)
- {
- const string EOF_SEP = "____E_O_F____";
- command = command + "<<" + EOF_SEP + "\n" + stdin + "\n" + EOF_SEP + "\n";
- }
- SshCommand cmd = ssh.CreateCommand(command);
- string reply = cmd.Execute();
- Logger.Instance.Trace(this, "SSH: {0} -> {1}", command, reply);
- Assert.AreEqual(0, cmd.ExitStatus);
- return reply;
- }
-
- internal KopanoPython Python()
- {
- return new KopanoPython(this);
- }
-
- #endregion
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookConstants.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookConstants.cs
deleted file mode 100644
index 392048e..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookConstants.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- class OutlookConstants
- {
- internal static readonly string[] PATH_RIBBON = { "MsoDockTop", "Ribbon", "Ribbon", "", "", "Ribbon" };
- internal static readonly string[] PATH_RIBBON_BUTTONS = { "Ribbon Tabs" };
- internal static readonly string[] PATH_RIBBON_CONTENT = { "Lower Ribbon" };
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookRibbon.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookRibbon.cs
deleted file mode 100644
index d6d8940..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookRibbon.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.Test.Input;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Automation;
-
-namespace AcaciaTest.Framework
-{
- public class OutlookRibbon
- {
- private readonly OutlookTester outlook;
- private readonly AutomationElement element;
- private readonly AutomationElement tabs;
- private readonly AutomationElement contentMain;
- public AutomationElement Content
- {
- get;
- private set;
- }
-
- public OutlookRibbon(OutlookTester outlook, AutomationElement element)
- {
- Assert.IsNotNull(outlook);
- this.outlook = outlook;
-
- Assert.IsNotNull(element);
- Assert.AreEqual("Ribbon", element.Current.Name);
- this.element = element;
-
- this.tabs = element.DescendantByName(OutlookConstants.PATH_RIBBON_BUTTONS);
- Assert.IsNotNull(this.tabs);
-
- this.contentMain = element.DescendantByName(OutlookConstants.PATH_RIBBON_CONTENT);
- Assert.IsNotNull(this.contentMain);
- }
-
- public bool SelectTab(string name)
- {
- // Find the tab
- var tabItem = tabs.DescendantByName(name);
- if (tabItem == null)
- return false;
-
- // Click it
- tabItem.MouseClick();
-
- // Make sure the content is shown
- this.Content = Util.WaitFor(() => this.contentMain.DescendantByName(name), 1000);
- Assert.IsNotNull(Content);
-
- return true;
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookTester.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookTester.cs
deleted file mode 100644
index a1fdb20..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/OutlookTester.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Automation;
-
-namespace AcaciaTest.Framework
-{
- ///
- /// Helper class to run tests using Outlook. Starts outlook and sets up the UI Automation Framework for it.
- ///
- public class OutlookTester : IDisposable
- {
- #region State
-
- private System.Diagnostics.Process outlookProcess;
- private AutomationElement mainWindow;
-
- #endregion
-
- public string Profile
- {
- get;
- set;
- }
-
- #region Construction / destruction
-
- public OutlookTester()
- {
- Profile = Config.OUTLOOK_DEFAULT_PROFILE;
- }
-
- public string OutlookExe
- {
- get
- {
- return Config.OUTLOOK_PATHS.FirstOrDefault((possiblePath) => new FileInfo(possiblePath).Exists);
- }
- }
-
- private static readonly Regex RE_VERSION = new Regex(@"\\Office(\d{2})\\");
-
- public string OutlookVersion
- {
- get
- {
- string exe = OutlookExe;
- if (exe == null)
- return null;
- Match match = RE_VERSION.Match(exe);
- return match.Groups[1].Value;
- }
- }
-
- public void Open()
- {
- try
- {
- // Find the executable
- Assert.IsNotNull(OutlookExe);
-
- // Start Outlook
- var processStartInfo = new System.Diagnostics.ProcessStartInfo(OutlookExe, "/profile " + Profile);
- outlookProcess = System.Diagnostics.Process.Start(processStartInfo);
- outlookProcess.WaitForInputIdle();
-
- // Wait for the main window to become visible
- mainWindow = Util.WaitFor(
- () =>
- {
- // Find the process' main window and make sure it has the correct class.
- // The splash screen is the main window first.
- // rctrl_renwnd32 is the main window's classname, has been for decades, so should be safe
- var win = AutomationElement.RootElement.FindFirst(TreeScope.Children,
- new PropertyCondition(AutomationElement.ProcessIdProperty, outlookProcess.Id));
- if (win != null && win.Current.ClassName == "rctrl_renwnd32")
- return win;
- return null;
- }, Config.OUTLOOK_START_TIMEOUT);
-
- // Make sure we found the window, otherwise abort
- Assert.IsNotNull(mainWindow, "Unable to find Outlook main window");
- }
- finally
- {
- // An exception in the constructor means Dispose will not be invoked, kill the process now
- if (mainWindow == null)
- {
- outlookProcess.Kill();
- outlookProcess = null;
- }
- }
- }
-
- public void Close()
- {
- if (outlookProcess != null)
- {
- // Close the main window and wait for clean shutdown
- outlookProcess.CloseMainWindow();
- if (!outlookProcess.WaitForExit(Config.OUTLOOK_STOP_TIMEOUT))
- {
- // Force close if not responding
- outlookProcess.Kill();
- }
-
- // Clean up resources
- outlookProcess.Dispose();
- outlookProcess = null;
- }
- }
-
- public void Dispose()
- {
- Close();
- }
-
- #endregion
-
- #region Ribbon
-
- public OutlookRibbon Ribbon
- {
- get
- {
- return new OutlookRibbon(this, mainWindow.DescendantByName(OutlookConstants.PATH_RIBBON));
- }
- }
-
- #endregion
-
- #region Helpers
-
- public void WaitForInputIdle()
- {
- outlookProcess.WaitForInputIdle();
- }
-
- #endregion
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/TestBase.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/TestBase.cs
deleted file mode 100644
index 892dc01..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/TestBase.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- [TestClass]
- public class TestBase
- {
- #region Test components
-
- private MailServer _server;
- private OutlookTester _outlook;
-
- ///
- /// Provides access to the mail server, creating it if required.
- ///
- public MailServer Server
- {
- get
- {
- if (_server == null)
- _server = new MailServer();
- return _server;
- }
- }
-
- ///
- /// Provides access to Outlook. If the component has not been created yet, it will be. It will not
- /// be started automatically.
- ///
- public OutlookTester Outlook
- {
- get
- {
- if (_outlook == null)
- _outlook = new OutlookTester();
- return _outlook;
- }
- }
-
- #endregion
-
- #region Setup / Teardown
-
- [TestInitialize()]
- public void Initialize()
- {
- }
-
- [TestCleanup()]
- public void Cleanup()
- {
- if (_outlook != null)
- {
- _outlook.Dispose();
- _outlook = null;
- }
- if (_server != null)
- {
- _server.Dispose();
- _server = null;
- }
- }
-
- #endregion
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/Util.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/Util.cs
deleted file mode 100644
index ad00d01..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Framework/Util.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Framework
-{
- public static class Util
- {
- ///
- /// Waits for the function to return a value, by polling.
- ///
- /// The function. If this returns a value, wait is finished and the value is returned.
- /// If null is returned, another attempt will be made, unless the timeout has been reached
- /// The timeout, in milliseconds.
- /// The functions return value, or null if the timeout elapsed
- public static Type WaitFor(Func func, long timeout)
- {
- System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
- stopWatch.Start();
- var result = default(Type);
- while (stopWatch.ElapsedMilliseconds < timeout)
- {
- result = func();
- if (result != null)
- break;
-
- // Sleep and try again
- Thread.Sleep(100);
- }
-
- return result;
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/OutlookIntegrationTests.csproj b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/OutlookIntegrationTests.csproj
deleted file mode 100644
index 386b227..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/OutlookIntegrationTests.csproj
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {A1AA144C-ABCE-462D-ADB4-6EC25AC062B7}
- Library
- Properties
- AcaciaTest
- OutlookIntegrationTests
- v4.5.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
- true
- full
- false
- ..\..\Build\Test\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
-
-
- pdbonly
- true
- ..\..\Build\Test\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
- ..\..\packages\SSH.NET.2013.4.7\lib\net40\Renci.SshNet.dll
- True
-
-
-
-
- ..\..\packages\Microsoft.TestApi.0.6.0.0\lib\net40\TestApiCore.dll
- True
-
-
- ..\..\packages\Microsoft.TestApi.0.6.0.0\lib\net40\TestApiWpf.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {1a7427a5-f814-4b07-98b2-c67d758b65d6}
- AcaciaZPushPlugin
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Properties/AssemblyInfo.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Properties/AssemblyInfo.cs
deleted file mode 100644
index f888d7e..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("OutlookIntegrationTests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OutlookIntegrationTests")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("a1aa144c-abce-462d-adb4-6ec25ac062b7")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/ReplyFlagsTest.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/ReplyFlagsTest.cs
deleted file mode 100644
index b0ce192..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/ReplyFlagsTest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using AcaciaTest.Framework;
-using System.Threading;
-
-namespace AcaciaTest.Tests
-{
- [TestClass]
- public class ReplyFlagsTest : TestBase
- {
- [TestMethod]
- public void ReplyFlags()
- {
- using (MailAccount account = Server.AllocateAccount())
- {
- // Deliver a message with a reply status
- DateTime yesterday = DateTime.Now.AddDays(-1);
- DateTime twoDaysAgo = DateTime.Now.AddDays(-2);
- // TODO: this header is out of date
- account.DeliverMessage(new MailMessage()
- {
- Date = twoDaysAgo,
- Headers = { { "X-Zarafa-Messagestatus", "reply=" + yesterday.ToString("r") } }
- }, false);
-
- // Open outlook
- //Outlook.Open();
- }
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/RibbonTest.cs b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/RibbonTest.cs
deleted file mode 100644
index 4d22286..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/Tests/RibbonTest.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using AcaciaTest.Framework;
-using System.Threading;
-
-namespace AcaciaTest.Tests
-{
- [TestClass]
- public class RibbonTest : TestBase
- {
- [TestMethod]
- public void RibbonVisible()
- {
- Outlook.Open();
-
- var ribbon = Outlook.Ribbon;
- // Select the tab that should have the plugin
- Assert.IsTrue(ribbon.SelectTab(Config.OUTLOOK_RIBBON_TAB_NAME));
-
- // Make sure the group is there
- var group = ribbon.Content.DescendantByName(Config.OUTLOOK_RIBBON_GROUP_NAME);
- Assert.IsNotNull(group);
- Assert.IsFalse(group.Current.IsOffscreen);
- Assert.IsTrue(group.Current.IsEnabled);
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/packages.config b/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/packages.config
deleted file mode 100644
index 8a874d0..0000000
--- a/src/AcaciaZPushPlugin/Test/OutlookIntegrationTests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AddressBook.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AddressBook.cs
deleted file mode 100644
index 0557e72..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AddressBook.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- public class AddressBook : Folder, IAddressBook
- {
- public IEnumerable Contacts { get { return Items.Cast(); } }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AppointmentItem.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AppointmentItem.cs
deleted file mode 100644
index e039b8c..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/AppointmentItem.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- public class AppointmentItem : Item, IAppointmentItem
- {
-
- #region IAppointmentItem implementation
- public DateTime Start
- {
- get { return BuiltinProperty("Start"); }
- set { BuiltinProperty("Start", value); }
- }
- public DateTime End
- {
- get { return BuiltinProperty("End"); }
- set { BuiltinProperty("End", value); }
- }
- public string Location
- {
- get { return BuiltinProperty("Location"); }
- set { BuiltinProperty("Location", value); }
- }
- #endregion
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Base.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Base.cs
deleted file mode 100644
index 2a28fff..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Base.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-using System.Runtime.CompilerServices;
-
-namespace AcaciaTest.Mocks
-{
- abstract public class Base : IBase
- {
- public bool MustRelease { get; set; }
-
- #region Builtin properties
-
- private Dictionary _builtins = new Dictionary();
-
- protected PropType BuiltinProperty(string name)
- {
- if (!_builtins.ContainsKey(name))
- {
- _builtins.Add(name, DefaultValues.Get());
- }
- return (PropType)_builtins[name];
- }
-
- protected void BuiltinProperty(string name, Type value)
- {
- _builtins[name] = value;
- IsDirty = true;
- }
-
- public object GetBuiltinPropertyValue(string name)
- {
- object value;
- _builtins.TryGetValue(name, out value);
- return value;
- }
-
- public bool AttrHidden
- {
- get { return BuiltinProperty("AttrHidden"); }
- set { BuiltinProperty("AttrHidden", value); }
- }
-
- #endregion
-
- private bool _isDirty;
- public bool IsDirty
- {
- get { return _isDirty; }
- set
- {
- _isDirty = value;
- _builtins["LastModificationTime"] = DateTime.Now;
- }
- }
-
- public DateTime LastModificationTime
- {
- get { return BuiltinProperty("LastModificationTime"); }
- }
-
- virtual public IFolder Parent
- {
- get;
- set;
- }
- virtual public string ParentEntryId
- {
- get { return Parent?.EntryId; }
- }
-
- public string EntryId { get { return RuntimeHelpers.GetHashCode(this).ToString("X8"); } }
-
- public IStore Store
- {
- get
- {
- return Mocks.Store.INSTANCE;
- }
- }
- public string StoreId
- {
- get
- {
- return Store.StoreID;
- }
- }
- public string StoreDisplayName
- {
- get
- {
- return Store.DisplayName;
- }
- }
-
- public void Dispose()
- {
- // TODO: record?
- }
-
- abstract public void Delete();
-
- public dynamic GetProperty(string property)
- {
- throw new NotImplementedException();
- }
-
- public void SetProperties(string[] properties, object[] values)
- {
- throw new NotImplementedException();
- }
-
- public void SetProperty(string property, object value)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ContactItem.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ContactItem.cs
deleted file mode 100644
index 038d909..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ContactItem.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- public class ContactItem : Item, IContactItem
- {
- private readonly AddressBook _addressBook;
- private readonly int _id;
-
- internal ContactItem(AddressBook addressBook, int id)
- {
- this._addressBook = addressBook;
- this._id = id;
- }
-
- override public IFolder Parent
- {
- get { return _addressBook; }
- }
-
- #region IContactItem
-
- public string CustomerID
- {
- get { return BuiltinProperty("CustomerID"); }
- set { BuiltinProperty("CustomerID", value); }
- }
-
- public string FullName
- {
- get { return BuiltinProperty("FullName"); }
- set { BuiltinProperty("FullName", value); }
- }
-
- public string FirstName
- {
- get { return BuiltinProperty("FirstName"); }
- set { BuiltinProperty("FirstName", value); }
- }
-
- public string LastName
- {
- get { return BuiltinProperty("LastName"); }
- set { BuiltinProperty("LastName", value); }
- }
-
- public string Initials
- {
- get { return BuiltinProperty("Initials"); }
- set { BuiltinProperty("Initials", value); }
- }
-
- public string Title
- {
- get { return BuiltinProperty("Title"); }
- set { BuiltinProperty("Title", value); }
- }
-
- public string Email1Address
- {
- get { return BuiltinProperty("Email1Address"); }
- set { BuiltinProperty("Email1Address", value); }
- }
-
- public string Email1AddressType
- {
- get { return BuiltinProperty("Email1AddressType"); }
- set { BuiltinProperty("Email1AddressType", value); }
- }
-
- public string CompanyName
- {
- get { return BuiltinProperty("CompanyName"); }
- set { BuiltinProperty("CompanyName", value); }
- }
-
- public string JobTitle
- {
- get { return BuiltinProperty("JobTitle"); }
- set { BuiltinProperty("JobTitle", value); }
- }
-
- public string OfficeLocation
- {
- get { return BuiltinProperty("OfficeLocation"); }
- set { BuiltinProperty("OfficeLocation", value); }
- }
-
- public string BusinessTelephoneNumber
- {
- get { return BuiltinProperty("BusinessTelephoneNumber"); }
- set { BuiltinProperty("BusinessTelephoneNumber", value); }
- }
-
- public string MobileTelephoneNumber
- {
- get { return BuiltinProperty("MobileTelephoneNumber"); }
- set { BuiltinProperty("MobileTelephoneNumber", value); }
- }
-
- public string HomeTelephoneNumber
- {
- get { return BuiltinProperty("HomeTelephoneNumber"); }
- set { BuiltinProperty("HomeTelephoneNumber", value); }
- }
-
- public string PagerNumber
- {
- get { return BuiltinProperty("PagerNumber"); }
- set { BuiltinProperty("PagerNumber", value); }
- }
-
- public string BusinessFaxNumber
- {
- get { return BuiltinProperty("BusinessFaxNumber"); }
- set { BuiltinProperty("BusinessFaxNumber", value); }
- }
-
- public string OrganizationalIDNumber
- {
- get { return BuiltinProperty("OrganizationalIDNumber"); }
- set { BuiltinProperty("OrganizationalIDNumber", value); }
- }
-
- public string BusinessAddress
- {
- get { return BuiltinProperty("BusinessAddress"); }
- set { BuiltinProperty("BusinessAddress", value); }
- }
-
- public string BusinessAddressCity
- {
- get { return BuiltinProperty("BusinessAddressCity"); }
- set { BuiltinProperty("BusinessAddressCity", value); }
- }
-
- public string BusinessAddressPostalCode
- {
- get { return BuiltinProperty("BusinessAddressPostalCode"); }
- set { BuiltinProperty("BusinessAddressPostalCode", value); }
- }
-
- public string BusinessAddressPostOfficeBox
- {
- get { return BuiltinProperty("BusinessAddressPostOfficeBox"); }
- set { BuiltinProperty("BusinessAddressPostOfficeBox", value); }
- }
-
- public string BusinessAddressState
- {
- get { return BuiltinProperty("BusinessAddressState"); }
- set { BuiltinProperty("BusinessAddressState", value); }
- }
-
- public string Language
- {
- get { return BuiltinProperty("Language"); }
- set { BuiltinProperty("Language", value); }
- }
-
- public void SetPicture(string path)
- {
- // TODO
- }
-
- #endregion
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/DefaultValues.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/DefaultValues.cs
deleted file mode 100644
index 4ffcecf..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/DefaultValues.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Mocks
-{
- class DefaultValues
- {
- internal static PropType Get()
- {
- return (PropType)GetImpl();
- }
-
- private static object GetImpl()
- {
- if (typeof(PropType) == typeof(string))
- return "";
- else if (typeof(PropType) == typeof(DateTime))
- return new DateTime(0); // TODO
- else if (typeof(PropType) == typeof(int))
- return (int)0;
- else if (typeof(PropType).IsEnum)
- return typeof(PropType).GetEnumValues().GetValue(0);
- else
- throw new NotImplementedException(); // TODO
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Folder.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Folder.cs
deleted file mode 100644
index 816b01a..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Folder.cs
+++ /dev/null
@@ -1,321 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-using Acacia.ZPush;
-
-namespace AcaciaTest.Mocks
-{
- public class Folder : Base, IFolder
- {
- private readonly List _items = new List();
-
- public void Clear()
- {
- _items.Clear();
- IsDirty = true;
- }
-
- override public void Delete()
- {
- throw new NotImplementedException();
- }
-
- public void Add(IItem item)
- {
- _items.Add(item);
- ((Item)item).Parent = this;
- }
-
- public bool IsAtDepth(int depth)
- {
- IFolder current = this;
- for (int i = 0; i < depth; ++i)
- {
- IFolder parent = current.Parent;
- if (parent == null)
- return false;
- current = parent;
- }
-
- return current == null;
- }
-
- public ItemType ItemType
- {
- get
- {
- throw new NotImplementedException(); // TODO
- }
- }
-
- public SyncId SyncId
- {
- get
- {
- throw new NotImplementedException(); // TODO
- }
- }
-
- public IEnumerable Items
- {
- get{ return _items; }
- }
-
- public IItem GetItemById(string entryId)
- {
- return _items.Find((item) => item.EntryId == entryId);
- }
-
- public int Count { get { return _items.Count; } }
-
- public IEnumerable ItemsSorted(string field, bool descending)
- {
- List copy = new List(_items);
- copy.Sort((x, y) =>
- {
- int sign = descending ? -1 : 1;
- Item xi = (Item)x;
- Item yi = (Item)y;
-
- object valueX = xi.GetBuiltinPropertyValue(field);
- object valueY = yi.GetBuiltinPropertyValue(field);
- if (valueX == null || valueY == null)
- {
- return (valueX == null && valueY == null) ? 0 : (valueX == null ? -sign : sign);
- }
- return sign * ((IComparable)valueX).CompareTo(valueY);
- }
- );
- return copy;
- }
-
- public string Name
- {
- get;
- set;
- }
-
- public string Description
- {
- get;
- set;
- }
-
- public string DefaultMessageClass
- {
- get;
- set;
- }
-
- public bool ShowAsOutlookAB
- {
- get;
- set;
- }
-
- virtual public void Delete(IItem child)
- {
- _items.Remove(child);
- }
-
- #region Item creation
-
- public ItemType Create()
- where ItemType : IItem
- {
- ItemType item = MockFactory.Create(this, Count);
- Add(item);
- IsDirty = true;
- return item;
- }
-
- #endregion
-
- #region Searching
-
- private class SearchField
- :
- ISearchField
- {
- public string Name { get; set; }
- public bool IsUserField { get; set; }
- public SearchOperation Operation { get; set; }
- public dynamic Parameter { get; set; }
-
- public SearchField(string name, bool isUserField)
- {
- this.Name = name;
- this.IsUserField = isUserField;
- }
-
- public void SetOperation(SearchOperation operation, object param)
- {
- this.Operation = operation;
- this.Parameter = param;
- }
-
- internal bool Matches(Item item)
- {
- dynamic value;
- if (IsUserField)
- {
- if (!item.GetUserPropertyRaw(Name, out value))
- return false;
- }
- else
- {
- value = ((Base)item).GetBuiltinPropertyValue(Name);
- }
-
- switch(Operation)
- {
- case SearchOperation.Equal:
- return value == Parameter;
- case SearchOperation.NotEqual:
- return value != Parameter;
- case SearchOperation.SmallerEqual:
- return value <= Parameter;
- case SearchOperation.Smaller:
- return value < Parameter;
- case SearchOperation.GreaterEqual:
- return value >= Parameter;
- case SearchOperation.Greater:
- return value > Parameter;
- }
-
- return false;
- }
- }
-
- private class FolderSearch
- :
- ISearch
- where Type : IItem
- {
- private readonly Folder _folder;
- private readonly List _fields = new List();
-
- public FolderSearch(Folder folder)
- {
- this._folder = folder;
- }
-
- public ISearchField AddField(string name, bool isUserField = false)
- {
- SearchField field = new SearchField(name, isUserField);
- _fields.Add(field);
- return field;
- }
-
- public IEnumerable Search(int maxResults)
- {
- return DoSearch(maxResults);
- }
-
- public Type SearchOne()
- {
- List results = DoSearch();
- if (results.Count > 0)
- return results[0];
- return default(Type);
- }
-
- private List DoSearch(int maxResults = int.MaxValue)
- {
- // TODO: handle maxResults
- List results = new List();
- foreach(IItem item in _folder.Items)
- {
- // TODO: check type?
- bool match = true;
- foreach(SearchField field in _fields)
- {
- if (!field.Matches((Item)item))
- {
- match = false;
- break;
- }
- }
- if (match)
- results.Add((Type)item);
- }
- return results;
- }
-
- public ISearchOperator AddOperator(SearchOperator oper)
- {
- throw new NotImplementedException();
- }
- }
-
- public ISearch Search()
- where ItemType: IItem
- {
- return new FolderSearch(this);
- }
-
- public FolderType CreateFolder(string name) where FolderType : IFolder
- {
- throw new NotImplementedException();
- }
-
- public FolderType GetSubFolder(string name) where FolderType : IFolder
- {
- throw new NotImplementedException();
- }
-
- public IEnumerable GetSubFolders() where FolderType : IFolder
- {
- throw new NotImplementedException();
- }
-
- #endregion
-
-
- #region Index item
-
- private readonly Dictionary _storageItems = new Dictionary();
-
- public IStorageItem GetStorageItem(string name)
- {
- StorageItem item;
- if (!_storageItems.TryGetValue(name, out item))
- {
- item = new StorageItem();
- _storageItems.Add(name, item);
- }
- return item;
- }
-
- #endregion
-
- public event IFolder_BeforeItemMove BeforeItemMove
- {
- add { }
- remove { }
- }
-
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Item.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Item.cs
deleted file mode 100644
index 4c861b9..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Item.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- public class Item : Base, IItem
- {
- #region Builtin properties
-
- public string[] AttrCategories
- {
- get { return BuiltinProperty("AttrCategories"); }
- set { BuiltinProperty("AttrCategories", value); }
- }
-
- public string Body
- {
- get { return BuiltinProperty("Body"); }
- set { BuiltinProperty("Body", value); }
- }
-
- public string Subject
- {
- get { return BuiltinProperty("Subject"); }
- set { BuiltinProperty("Subject", value); }
- }
-
- #endregion
-
- #region User properties
-
- private readonly Dictionary _userProperties = new Dictionary();
-
- public IUserProperty GetUserProperty(string name, bool create = false)
- {
- if (!_userProperties.ContainsKey(name))
- {
- if (!create)
- return null;
- _userProperties.Add(name, new UserProperty());
- }
- return (IUserProperty)_userProperties[name];
- }
-
- public bool GetUserPropertyRaw(string name, out object value)
- {
- if (!_userProperties.ContainsKey(name))
- {
- value = null;
- return false;
- }
- value = ((UserPropertyBase)_userProperties[name]).RawValue;
- return true;
- }
-
- #endregion
-
- override public void Delete()
- {
- // TODO: mark deleted?
- if (Parent is Folder)
- ((Folder) Parent).Delete(this);
- }
-
- public int SaveCount { get; set; }
- public object Tag { get; set; }
-
- virtual public void Save()
- {
- IsDirty = false;
- ++SaveCount;
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/MockFactory.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/MockFactory.cs
deleted file mode 100644
index 3a6d0de..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/MockFactory.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Acacia;
-using Acacia.Stubs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Mocks
-{
- static class MockFactory
- {
- public static ItemType Create(Folder parent, int id)
- where ItemType : IItem
- {
- if (typeof(ItemType) == typeof(IContactItem))
- return (ItemType)(IItem)new ContactItem((AddressBook)parent, id);
- Logger.Instance.Debug(typeof(MockFactory), "CREATE: " + typeof(ItemType));
- throw new NotImplementedException(); // TODO
- }
- }
-}
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/StorageItem.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/StorageItem.cs
deleted file mode 100644
index 968248f..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/StorageItem.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- class StorageItem : Item, IStorageItem
- {
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Store.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Store.cs
deleted file mode 100644
index b5f5530..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/Store.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Acacia.Stubs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AcaciaTest.Mocks
-{
- public class Store : IStore
- {
- public static readonly Store INSTANCE = new Store();
-
- public string DisplayName
- {
- get
- {
- return "";
- }
- }
-
- public string StoreID
- {
- get
- {
- return "";
- }
- }
-
- public void Dispose()
- {
- }
-
- public IFolder GetDefaultFolder(object folder)
- {
- throw new NotImplementedException();
- }
-
- public IItem GetItemFromID(string id)
- {
- throw new NotImplementedException();
- }
-
- public IFolder GetRootFolder()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/UserProperty.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/UserProperty.cs
deleted file mode 100644
index fb92eae..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/UserProperty.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- internal interface UserPropertyBase
- {
- object RawValue { get; }
- }
-
- internal class UserProperty : IUserProperty, UserPropertyBase
- {
- internal UserProperty()
- {
- Value = DefaultValues.Get();
- }
-
- public PropType Value
- {
- get;
- set;
- }
-
- public object RawValue { get { return Value; } }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ZPushItem.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ZPushItem.cs
deleted file mode 100644
index 089ff6b..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Mocks/ZPushItem.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-
-namespace AcaciaTest.Mocks
-{
- public class ZPushItem : AppointmentItem, IZPushItem
- {
- public ZPushItem()
- {
-
- }
-
- ///
- /// Convenience constructor
- ///
- public ZPushItem(string subject, string body)
- {
- this.Subject = subject;
- this.Body = body;
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/PluginUnitTests.csproj b/src/AcaciaZPushPlugin/Test/PluginUnitTests/PluginUnitTests.csproj
deleted file mode 100644
index 1c1bc62..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/PluginUnitTests.csproj
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {1862C3CA-3347-4180-B076-D018BAA70F40}
- Library
- Properties
- AcaciaTest
- PluginUnitTests
- v4.5.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
- true
- full
- false
- ..\..\Build\Test\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- ..\..\Build\Test\Release\
- TRACE
- prompt
- 4
-
-
-
-
- ..\packages\SSH.NET.2013.4.7\lib\net40\Renci.SshNet.dll
- True
-
-
-
-
- ..\packages\Microsoft.TestApi.0.6.0.0\lib\net40\TestApiCore.dll
- True
-
-
- ..\packages\Microsoft.TestApi.0.6.0.0\lib\net40\TestApiWpf.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {1a7427a5-f814-4b07-98b2-c67d758b65d6}
- AcaciaZPushPlugin
-
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Properties/AssemblyInfo.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 82b674c..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("PluginUnitTests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("PluginUnitTests")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1862c3ca-3347-4180-b076-d018baa70f40")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/GABTest.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/GABTest.cs
deleted file mode 100644
index 70ff147..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/GABTest.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Features.GAB;
-using AcaciaTest.Mocks;
-using System.Threading;
-using Acacia;
-using Acacia.Utils;
-
-namespace AcaciaTest.Tests.GAB
-{
- [TestClass]
- public class GABTest
- {
- private readonly AddressBook gab;
- private readonly GABHandler handler;
- private Folder chunks;
-
- public GABTest()
- {
- DebugOptions.ReturnDefaults = true;
- gab = new AddressBook();
- chunks = new Folder();
- handler = new GABHandler(new FeatureGAB(), (f) => gab, null);
- handler.AddAccount(null, chunks);
- Tasks.Executor = new TasksSynchronous();
- }
-
- internal static string MakeChunkSubject(int sequence, int chunk)
- {
- return string.Format("account-{0}/{1}", sequence, chunk);
- }
-
- [TestMethod]
- public void MultipleChunks()
- {
- TestChunks chunks = new TestChunks(10);
- chunks.GenerateChunks(this.chunks, 2);
- handler.Process(null);
- Assert.AreEqual(10, gab.Count);
- HashSet seen = new HashSet();
- foreach(ContactItem item in gab.Items)
- {
- int id = int.Parse(item.CustomerID.Substring(4));
- seen.Add(id);
- Assert.AreEqual(string.Format("{0} 0", id), item.FullName);
- Assert.AreEqual(1, item.SaveCount);
-
- // Set a tag to ensure it is not replaced.
- item.Tag = "ABC";
- }
- Assert.AreEqual(10, seen.Count);
-
- // Touch a contact in the first chunk
- chunks.TouchContact(1);
-
- // Regenerate the chunks
- chunks.GenerateChunks(this.chunks, 2);
- handler.Process(null);
- seen.Clear();
- foreach (ContactItem item in gab.Items)
- {
- int id = int.Parse(item.CustomerID.Substring(4));
- seen.Add(id);
- Assert.AreEqual(string.Format("{0} {1}", id, id == 1 ? 1 : 0), item.FullName);
-
- if (id >= 5)
- {
- // Make sure items in the second chunk aren't touched.
- Assert.AreEqual("ABC", item.Tag);
- Assert.AreEqual(1, item.SaveCount);
- }
- else
- {
- // Items in the first chunk should have been replaced.
- Assert.IsNull(item.Tag);
- Assert.AreEqual(1, item.SaveCount);
- }
- }
- Assert.AreEqual(10, seen.Count);
- }
-
- [TestMethod]
- public void CheckCurrentSequence()
- {
- // The resolution of the timer is less than 10ms, hence the sleeps
- chunks.Add(new ZPushItem(MakeChunkSubject(1, 0), "{'user1': {} }")); Thread.Sleep(10);
- chunks.Add(new ZPushItem(MakeChunkSubject(4, 0), "{'user4': {} }")); Thread.Sleep(10);
- chunks.Add(new ZPushItem(MakeChunkSubject(5, 0), "{'user5': {} }")); Thread.Sleep(10);
- chunks.Add(new ZPushItem(MakeChunkSubject(2, 0), "{'user2': {} }"));
- handler.DetermineSequence();
-
- Assert.AreEqual(2, handler.CurrentSequence);
-
- handler.Process(null);
- Assert.AreEqual(2, handler.CurrentSequence);
- Assert.AreEqual(false, ((StorageItem)gab.GetStorageItem(Constants.ZPUSH_GAB_INDEX)).IsDirty);
- }
-
- ///
- /// Tests creating a GAB from an empty starting point with access to the full chunks.
- ///
- [TestMethod]
- public void FullLoadOnce()
- {
- ZPushItem chunk = new ZPushItem();
- chunk.Subject = MakeChunkSubject(1, 0);
- chunk.Body = "{'user1': {\"displayName\": \"Version 0\", \"type\": \"contact\"} }";
- chunk.Location = "Version 0";
- chunk.Start = DateTime.Now;
- chunks.Add(chunk);
-
- // Process the chunk
- handler.Process(null);
-
- // Make sure we have a single contact
- Assert.AreEqual(1, gab.Count);
- Assert.AreEqual(true, gab.IsDirty);
-
- // Make sure it is correct
- ContactItem item = gab.Contacts.First();
- Assert.AreEqual(false, item.IsDirty);
- Assert.AreEqual("user1", item.CustomerID);
- Assert.AreEqual("Version 0", item.FullName);
-
- // Make sure it has the correct ids
- Assert.AreEqual(1, item.GetUserProperty(GABHandler.PROP_SEQUENCE).Value);
- Assert.AreEqual(0, item.GetUserProperty(GABHandler.PROP_CHUNK).Value);
- }
-
- ///
- /// Tests processing a modified message correctly updates the contacts
- ///
- [TestMethod]
- public void FullLoadModify()
- {
- FullLoadOnce();
-
- ZPushItem chunk = (ZPushItem)chunks.Items.First();
- chunk.Body = "{'user1': {\"displayName\": \"Version 1\", \"type\": \"contact\"} }";
- chunk.Start = DateTime.Now;
- chunk.Location = "Version 1";
- gab.IsDirty = false;
- handler.Process(chunk);
-
- // Make sure we have a single contact
- Assert.AreEqual(1, gab.Count);
- Assert.AreEqual(true, gab.IsDirty);
-
- // Make sure it is correct
- ContactItem item = gab.Contacts.First();
- Assert.AreEqual(false, item.IsDirty);
- Assert.AreEqual("user1", item.CustomerID);
- Assert.AreEqual("Version 1", item.FullName);
-
- // Make sure it has the correct ids
- Assert.AreEqual(1, item.GetUserProperty(GABHandler.PROP_SEQUENCE).Value);
- Assert.AreEqual(0, item.GetUserProperty(GABHandler.PROP_CHUNK).Value);
- }
-
- ///
- /// Tests processing already processed messages does nothing
- ///
- [TestMethod]
- public void FullLoadMultiProcess()
- {
- FullLoadOnce();
- // Make sure processing the messages again does nothing
- gab.IsDirty = false;
- handler.Process(null);
- Assert.AreEqual(false, gab.IsDirty);
- Assert.AreEqual(false, gab.Contacts.First().IsDirty);
- }
-
- ///
- /// Tests that all item values are propagated properly.
- ///
- [TestMethod]
- public void ItemProperties()
- {
- ZPushItem chunk0 = new ZPushItem();
- chunk0.Subject = MakeChunkSubject(1, 0);
- chunk0.Body =
-@"{""test1"":{""account"":""test1"",""displayName"":""Test One"",""givenName"":""Test"",""surname"":""One""," +
-@"""smtpAddress"":""onetest@example.com"",""title"":""Dr"",""companyName"":""Business"",""officeLocation"":""The moon""," +
-@"""businessTelephoneNumber"":""+ 1 408 555 2320"",""mobileTelephoneNumber"":""7"",""homeTelephoneNumber"":""8""," +
-@"""beeperTelephoneNumber"":""9"",""primaryFaxNumber"":""+ 1 408 555 7472"",""organizationalIdNumber"":""23""," +
-@"""postalAddress"":""Multiline
-Address"",""businessAddressCity"":""Santa Clara"",""businessAddressPostalCode"":""1234AB""," +
-@"""businessAddressPostOfficeBox"":""56"",""businessAddressStateOrProvince"":""Iowa"",""initials"":""1""," +
-@"""language"":""Lang"",""thumbnailPhoto"":null, ""type"": ""contact""}}";
- handler.CurrentSequence = 1;
- handler.Process(chunk0);
-
- // Make sure we have a single contact
- Assert.AreEqual(1, gab.Count);
-
- // Make sure it is correct
- ContactItem item = gab.Contacts.First();
- Assert.AreEqual(false, item.IsDirty);
- Assert.AreEqual("test1", item.CustomerID);
- Assert.AreEqual("Test One", item.FullName);
- Assert.AreEqual("Test", item.FirstName);
- Assert.AreEqual("One", item.LastName);
- Assert.AreEqual("1", item.Initials);
- Assert.AreEqual("Dr", item.JobTitle);
-
- Assert.AreEqual("Lang", item.Language);
- Assert.AreEqual("onetest@example.com", item.Email1Address);
- Assert.AreEqual("SMTP", item.Email1AddressType);
- Assert.AreEqual("Business", item.CompanyName);
- Assert.AreEqual("The moon", item.OfficeLocation);
- Assert.AreEqual("+ 1 408 555 2320", item.BusinessTelephoneNumber);
- Assert.AreEqual("7", item.MobileTelephoneNumber);
- Assert.AreEqual("8", item.HomeTelephoneNumber);
- Assert.AreEqual("9", item.PagerNumber);
- Assert.AreEqual("+ 1 408 555 7472", item.BusinessFaxNumber);
- Assert.AreEqual("23", item.OrganizationalIDNumber);
- Assert.AreEqual("Multiline\r\nAddress", item.BusinessAddress);
- Assert.AreEqual("Santa Clara", item.BusinessAddressCity);
- Assert.AreEqual("1234AB", item.BusinessAddressPostalCode);
- Assert.AreEqual("56", item.BusinessAddressPostOfficeBox);
- Assert.AreEqual("Iowa", item.BusinessAddressState);
- }
- }
-}
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/TestChunks.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/TestChunks.cs
deleted file mode 100644
index 9da4904..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/GAB/TestChunks.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Acacia.Stubs;
-using AcaciaTest.Mocks;
-using Acacia;
-
-namespace AcaciaTest.Tests.GAB
-{
- class TestChunks
- {
- private class ContactInfo
- {
- public int id;
- public int version;
-
- public string ToJSON()
- {
- return string.Format(" \"user{0}\":{{\"account\": \"user{0}\", \"displayName\": \"{0} {1}\", \"type\": \"contact\"}}", id, version);
- }
- }
-
- private readonly List contacts = new List();
- private int lastSequence = -1;
- private int lastContactVersion = -1;
-
- public TestChunks(int numberOfContacts)
- {
- for (int i = 0; i < numberOfContacts; ++i)
- {
- contacts.Add(new ContactInfo()
- {
- id = i,
- version = 0
- });
- }
- }
-
- public void TouchContact(int index)
- {
- ++contacts[index].version;
- }
-
- public void GenerateChunks(Folder folder, int numberOfChunks)
- {
- if (numberOfChunks != lastSequence)
- folder.Clear();
-
- int chunksPerContact = (int)Math.Ceiling(contacts.Count / (double)numberOfChunks);
- int chunksRemaining = contacts.Count;
- int contactVersion = -1;
- for (int i = 0; i < numberOfChunks; ++i)
- {
- int thisChunkCount = Math.Min(chunksRemaining, chunksPerContact);
- int chunkContactVersion = -1;
- // Create the body
- string body = "{\n";
- for (int j = 0; j < thisChunkCount; ++j)
- {
- ContactInfo contact = contacts[contacts.Count - chunksRemaining];
- body += contact.ToJSON();
- chunkContactVersion = Math.Max(chunkContactVersion, contact.version);
-
- --chunksRemaining;
- if (j < thisChunkCount - 1)
- body += ",\n";
- else
- body += "\n";
- }
- body += "}\n";
-
- string subject = GABTest.MakeChunkSubject(numberOfChunks, i);
-
- if (chunkContactVersion <= lastContactVersion)
- {
- continue;
- }
- contactVersion = Math.Max(contactVersion, chunkContactVersion);
-
- // See if the message exists
- ISearch search = folder.Search();
- search.AddField("Subject").SetOperation(SearchOperation.Equal, subject);
- ZPushItem item = search.SearchOne();
- if (item == null)
- {
- item = new ZPushItem(subject, body);
- folder.Add(item);
- }
- item.Body = body;
- item.Location = "Version:" + chunkContactVersion;
- item.Save();
- }
-
- lastSequence = numberOfChunks;
- lastContactVersion = contactVersion;
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/PasswordEncryptionTest.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/PasswordEncryptionTest.cs
deleted file mode 100644
index 3089582..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/PasswordEncryptionTest.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Acacia;
-using Acacia.Utils;
-using System.Security;
-
-namespace AcaciaTest.Tests
-{
- [TestClass]
- public class PasswordEncryptionTest
- {
- [TestMethod]
- public void Encrypt()
- {
- // As the encryption depends on the machine, we cannot test the actual encryption,
- // just check some metadata
- byte[] cipher = PasswordEncryption.Encrypt("demo1");
- Assert.AreEqual(255, cipher.Length);
- Assert.AreEqual(2, cipher[0]);
- }
-
- [TestMethod]
- public void RoundTrip()
- {
- // Test a few different lengths, including some block boundaries at 8, 16 and empty string
- string sin = "";
- for (int i = 0; i <= 16; ++i)
- {
- sin += i;
- SecureString sout = PasswordEncryption.Decrypt(PasswordEncryption.Encrypt(sin));
- Assert.AreEqual(sin, sout.ConvertToUnsecureString());
- }
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/ReplyFlagsTest.cs b/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/ReplyFlagsTest.cs
deleted file mode 100644
index b9915c1..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/Tests/ReplyFlagsTest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/// Project : Kopano OL Extension
-
-///
-/// Copyright 2016 Kopano b.v.
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License, version 3,
-/// as published by the Free Software Foundation.
-///
-/// This program 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 Affero General Public License for more details.
-///
-/// You should have received a copy of the GNU Affero General Public License
-/// along with this program.If not, see.
-///
-/// Consult LICENSE file for details
-
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Threading;
-
-namespace AcaciaTest.Tests
-{
- [TestClass]
- public class ReplyFlagsTest
- {
- [TestMethod]
- public void ReplyFlags()
- {
- }
- }
-}
diff --git a/src/AcaciaZPushPlugin/Test/PluginUnitTests/packages.config b/src/AcaciaZPushPlugin/Test/PluginUnitTests/packages.config
deleted file mode 100644
index 8a874d0..0000000
--- a/src/AcaciaZPushPlugin/Test/PluginUnitTests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file