diff --git a/SharedLibraryNG/bin/Debug/SharedLibraryNG.dll b/SharedLibraryNG/bin/Debug/SharedLibraryNG.dll index c34ec1bb..5b8fa80d 100644 Binary files a/SharedLibraryNG/bin/Debug/SharedLibraryNG.dll and b/SharedLibraryNG/bin/Debug/SharedLibraryNG.dll differ diff --git a/SharedLibraryNG/bin/Debug/SharedLibraryNG.pdb b/SharedLibraryNG/bin/Debug/SharedLibraryNG.pdb index 838e9e47..ed132cc6 100644 Binary files a/SharedLibraryNG/bin/Debug/SharedLibraryNG.pdb and b/SharedLibraryNG/bin/Debug/SharedLibraryNG.pdb differ diff --git a/SharedLibraryNG/obj/Debug/SharedLibraryNG.csproj.FileListAbsolute.txt b/SharedLibraryNG/obj/Debug/SharedLibraryNG.csproj.FileListAbsolute.txt index eac2f01d..c097e42a 100644 --- a/SharedLibraryNG/obj/Debug/SharedLibraryNG.csproj.FileListAbsolute.txt +++ b/SharedLibraryNG/obj/Debug/SharedLibraryNG.csproj.FileListAbsolute.txt @@ -1,5 +1,10 @@ C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.dll C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.pdb -C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.dll C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.pdb +C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.dll +C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\bin\Debug\SharedLibraryNG.pdb +C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache +C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.dll +C:\Users\David\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.pdb +C:\Users\vsparda\Documents\Repositories\mRemoteNG_MyFork\SharedLibraryNG\obj\Debug\SharedLibraryNG.csprojResolveAssemblyReference.cache diff --git a/SharedLibraryNG/obj/Debug/SharedLibraryNG.csprojResolveAssemblyReference.cache b/SharedLibraryNG/obj/Debug/SharedLibraryNG.csprojResolveAssemblyReference.cache deleted file mode 100644 index 14bcd3f7..00000000 Binary files a/SharedLibraryNG/obj/Debug/SharedLibraryNG.csprojResolveAssemblyReference.cache and /dev/null differ diff --git a/SharedLibraryNG/obj/Debug/SharedLibraryNG.dll b/SharedLibraryNG/obj/Debug/SharedLibraryNG.dll index c34ec1bb..5b8fa80d 100644 Binary files a/SharedLibraryNG/obj/Debug/SharedLibraryNG.dll and b/SharedLibraryNG/obj/Debug/SharedLibraryNG.dll differ diff --git a/SharedLibraryNG/obj/Debug/SharedLibraryNG.pdb b/SharedLibraryNG/obj/Debug/SharedLibraryNG.pdb index 838e9e47..ed132cc6 100644 Binary files a/SharedLibraryNG/obj/Debug/SharedLibraryNG.pdb and b/SharedLibraryNG/obj/Debug/SharedLibraryNG.pdb differ diff --git a/UI_tests.playlist b/UI_tests.playlist new file mode 100644 index 00000000..1133effe --- /dev/null +++ b/UI_tests.playlist @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mRemoteNGTests/App/LoggerTests.cs b/mRemoteNGTests/App/LoggerTests.cs new file mode 100644 index 00000000..56a995cd --- /dev/null +++ b/mRemoteNGTests/App/LoggerTests.cs @@ -0,0 +1,25 @@ +using System; +using NUnit.Framework; +using mRemoteNG.App; +using log4net; + +namespace mRemoteNGTests.App +{ + [TestFixture] + public class LoggerTests + { + [Test] + public void GetSingletonInstanceReturnsAnILogObject() + { + Assert.That(Logger.GetSingletonInstance(), Is.InstanceOf()); + } + + [Test] + public void SingletonOnlyEverReturnsTheSameInstance() + { + ILog log1 = Logger.GetSingletonInstance(); + ILog log2 = Logger.GetSingletonInstance(); + Assert.That(log1, Is.EqualTo(log2)); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/Config/Connections/SqlConnectionUpdateCheckerTests.cs b/mRemoteNGTests/Config/Connections/SqlConnectionUpdateCheckerTests.cs new file mode 100644 index 00000000..56d06f33 --- /dev/null +++ b/mRemoteNGTests/Config/Connections/SqlConnectionUpdateCheckerTests.cs @@ -0,0 +1,44 @@ +using System; +using NUnit.Framework; +using mRemoteNG.Config; +using mRemoteNG.Config.Connections; +using NSubstitute; + +namespace mRemoteNGTests.Config.Connections +{ + [TestFixture] + public class SqlConnectionUpdateCheckerTests + { + SqlConnectionsUpdateChecker _updateChecker; + + [SetUp] + public void Setup() + { + _updateChecker = new SqlConnectionsUpdateChecker(); + } + + [TearDown] + public void Teardown() + { + _updateChecker.Dispose(); + _updateChecker = null; + } + + [Test] + [Ignore("Need to find a way to mock SqlConnector")] + public void ReturnTrueIfUpdateIsAvailable() + { + Substitute.For(); + bool updateIsAvailable = _updateChecker.IsDatabaseUpdateAvailable(); + Assert.AreEqual(true,updateIsAvailable); + } + + [Test] + [Ignore("Need to find a way to mock SqlConnector")] + public void ReturnFalseIfUpdateIsNotAvailable() + { + bool updateIsAvailable = _updateChecker.IsDatabaseUpdateAvailable(); + Assert.AreEqual(false, updateIsAvailable); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/Config/Connections/SqlUpdateQueryBuilderTest.cs b/mRemoteNGTests/Config/Connections/SqlUpdateQueryBuilderTest.cs new file mode 100644 index 00000000..2fa59045 --- /dev/null +++ b/mRemoteNGTests/Config/Connections/SqlUpdateQueryBuilderTest.cs @@ -0,0 +1,32 @@ +using System; +using NUnit.Framework; +using mRemoteNG.Config.Connections; +using System.Data.SqlClient; + +namespace mRemoteNGTests.Config.Connections +{ + [TestFixture] + public class SqlUpdateQueryBuilderTest + { + private SqlUpdateQueryBuilder _sqlUpdateQueryBuilder; + + [SetUp] + public void Setup() + { + _sqlUpdateQueryBuilder = new SqlUpdateQueryBuilder(); + } + + [TearDown] + public void Teardown() + { + _sqlUpdateQueryBuilder = null; + } + + [Test] + public void SqlUpdateQueryBuilderReturnsSomeCommand() + { + SqlCommand command = _sqlUpdateQueryBuilder.BuildCommand(); + Assert.AreNotEqual(command.CommandText, ""); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/Config/Connections/SqlUpdateTimerTests.cs b/mRemoteNGTests/Config/Connections/SqlUpdateTimerTests.cs new file mode 100644 index 00000000..ffc18948 --- /dev/null +++ b/mRemoteNGTests/Config/Connections/SqlUpdateTimerTests.cs @@ -0,0 +1,40 @@ +using mRemoteNG.Config.Connections; +using NUnit.Framework; + +namespace mRemoteNGTests.Config.Connections +{ + [TestFixture] + public class SqlUpdateTimerTests + { + private SqlUpdateTimer sqlUpdateChecker; + + [SetUp] + public void SetupSqlUpdateChecker() + { + sqlUpdateChecker = new SqlUpdateTimer(); + } + + [TearDown] + public void TearDownSqlUpdateChecker() + { + sqlUpdateChecker.Dispose(); + sqlUpdateChecker = null; + } + + [Test] + public void EnableSQLUpdating() + { + sqlUpdateChecker.Enable(); + Assert.AreEqual(true, sqlUpdateChecker.IsUpdateCheckingEnabled()); + } + + [Test] + public void DisableSQLUpdating() + { + sqlUpdateChecker.Enable(); + Assert.AreEqual(true, sqlUpdateChecker.IsUpdateCheckingEnabled()); + sqlUpdateChecker.Disable(); + Assert.AreEqual(false, sqlUpdateChecker.IsUpdateCheckingEnabled()); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/ListViewTester.cs b/mRemoteNGTests/ListViewTester.cs new file mode 100644 index 00000000..a0e558b6 --- /dev/null +++ b/mRemoteNGTests/ListViewTester.cs @@ -0,0 +1,250 @@ +#region Copyright (c) 2003-2005, Luke T. Maxon + +/******************************************************************************************************************** +' +' Copyright (c) 2003-2005, Luke T. Maxon +' All rights reserved. +' +' Redistribution and use in source and binary forms, with or without modification, are permitted provided +' that the following conditions are met: +' +' * Redistributions of source code must retain the above copyright notice, this list of conditions and the +' following disclaimer. +' +' * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and +' the following disclaimer in the documentation and/or other materials provided with the distribution. +' +' * Neither the name of the author nor the names of its contributors may be used to endorse or +' promote products derived from this software without specific prior written permission. +' +' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +' WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +' PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +' ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +' LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +' IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +' +'*******************************************************************************************************************/ + +#endregion + +//Contributed by: Ian Cooper + +using System.Collections; +using System.Windows.Forms; + +namespace NUnit.Extensions.Forms +{ + /// + /// A ControlTester for testing List Views. + /// + /// + /// It includes helper methods for selecting items from the list + /// and for clearing those selections. + public class ListViewTester : ControlTester + { + /// + /// Creates a ControlTester from the control name and the form instance. + /// + /// + /// It is best to use the overloaded Constructor that requires just the name + /// parameter if possible. + /// + /// The Control name. + /// The Form instance. + public ListViewTester(string name, Form form) + : base(name, form) + { + } + + /// + /// Creates a ControlTester from the control name and the form name. + /// + /// + /// It is best to use the overloaded Constructor that requires just the name + /// parameter if possible. + /// + /// The Control name. + /// The Form name.. + public ListViewTester(string name, string formName) + : base(name, formName) + { + } + + /// + /// Creates a ControlTester from the control name. + /// + /// + /// This is the best constructor. + /// The Control name. + public ListViewTester(string name) + : base(name) + { + } + + /// + /// Creates a ControlTester from a ControlTester and an index where the + /// original tester's name is not unique. + /// + /// + /// It is best to use the overloaded Constructor that requires just the name + /// parameter if possible. + /// + /// The ControlTester. + /// The index to test. + public ListViewTester(ControlTester tester, int index) + : base(tester, index) + { + } + + /// + /// Allows you to find a ListViewTester by index where the name is not unique. + /// + /// + /// This was added to support the ability to find controls where their name is + /// not unique. If all of your controls are uniquely named (I recommend this) then + /// you will not need this. + /// + /// The ControlTester at the specified index. + /// The index of the ListViewTester. + public new ListViewTester this[int index] + { + get + { + return new ListViewTester(this, index); + } + } + + /// + /// Provides access to all of the Properties of the ListBox. + /// + /// + /// Allows typed access to all of the properties of the underlying control. + /// + /// The underlying control. + public ListView Properties + { + get + { + return (ListView)Control; + } + } + + /// + /// Helper method to return the List View's Items property + /// + public ListView.ListViewItemCollection Items + { + get + { + return Properties.Items; + } + } + + /// + /// Helper method to return the columns of the list view + /// + public ListView.ColumnHeaderCollection Columns + { + get + { + return Properties.Columns; + } + } + + /// + /// Clears the selections from the list box. + /// + public void ClearSelected() + { + foreach (ListViewItem item in Properties.Items) + { + item.Selected = false; + } + } + + /// + /// Selects an item in the ListBox according to its index. + /// + /// the index to select. + public void Select(int i) + { + Properties.Items[i].Selected = true; + FireEvent("ItemActivate"); + } + + /// + /// Selects an item in the list according to its string value. + /// + /// The item to select. + public void Select(string text) + { + int index = FindItemByString(text); + + if (ItemFound(index)) + { + Select(index); + } + } + + /// + /// Multiple selection of a range of items + /// + /// + public void SelectItems(string[] items) + { + foreach (string item in items) + { + Select(item); + } + } + + /// + /// Test that only the indicated items are selected + /// + /// + public bool SelectedItemsMatch(string[] matches) + { + ArrayList matchList = new ArrayList(matches); + + if (matchList.Count != Properties.SelectedItems.Count) + { + return false; + } + + foreach (ListViewItem item in Properties.SelectedItems) + { + if (!matchList.Contains(item.Text)) + { + return false; + } + } + + return true; + } + + #region Implementation + + private bool ItemFound(int index) + { + return index != -1; + } + + private int FindItemByString(string text) + { + for (int i = 0; i < Properties.Items.Count; i++) + { + if (Properties.Items[i].Text == text) + { + return i; + } + } + + return -1; + } + + #endregion + } +} \ No newline at end of file diff --git a/mRemoteNGTests/Properties/AssemblyInfo.cs b/mRemoteNGTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b7cdbe8e --- /dev/null +++ b/mRemoteNGTests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("mRemoteNGTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("mRemoteNGTests")] +[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("4e9583d3-2b1b-419d-bda5-f06e70e03b50")] + +// 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/mRemoteNGTests/UI/Controls/CustomListViewTests.cs b/mRemoteNGTests/UI/Controls/CustomListViewTests.cs new file mode 100644 index 00000000..5042b6e8 --- /dev/null +++ b/mRemoteNGTests/UI/Controls/CustomListViewTests.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using mRemoteNG.Controls; +using NUnit.Framework; +using NUnit.Extensions.Forms; +using System.Windows.Forms; + +namespace mRemoteNGTests.UI.Controls +{ + public class CustomListViewTests + { + TestForm _testForm; + mRemoteNG.Controls.ListView _listView; + + [SetUp] + public void Setup() + { + _listView = new mRemoteNG.Controls.ListView(); + _listView.Name = "myTestListView"; + _listView.View = System.Windows.Forms.View.Tile; + } + + [TearDown] + public void Teardown() + { + _listView.Dispose(); + while (_listView.Disposing) ; + _listView = null; + } + + [Test] + public void a() + { + _testForm = new TestForm(); + _testForm.Controls.Add(_listView); + _listView.Items.Add(new ListViewItem("mytestitem")); + _testForm.Show(); + ListViewTester listviewTester = new ListViewTester("myTestListView", _testForm); + while (true) ; + Assert.That(listviewTester.Items.Count, Is.EqualTo(1)); + + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Controls/TestForm.Designer.cs b/mRemoteNGTests/UI/Controls/TestForm.Designer.cs new file mode 100644 index 00000000..3a5a7b7a --- /dev/null +++ b/mRemoteNGTests/UI/Controls/TestForm.Designer.cs @@ -0,0 +1,48 @@ +namespace mRemoteNGTests.UI.Controls +{ + partial class TestForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // TestForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 262); + this.Name = "TestForm"; + this.Text = "TestForm"; + this.ResumeLayout(false); + + } + + #endregion + + + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Controls/TestForm.cs b/mRemoteNGTests/UI/Controls/TestForm.cs new file mode 100644 index 00000000..3c70a2e9 --- /dev/null +++ b/mRemoteNGTests/UI/Controls/TestForm.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace mRemoteNGTests.UI.Controls +{ + public partial class TestForm : Form + { + public TestForm() + { + InitializeComponent(); + } + + private void listView1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/mRemoteNGTests/UI/Controls/TestForm.resx b/mRemoteNGTests/UI/Controls/TestForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/mRemoteNGTests/UI/Controls/TestForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsFormSetupAndTeardown.cs b/mRemoteNGTests/UI/Forms/OptionsFormSetupAndTeardown.cs new file mode 100644 index 00000000..e4f6466a --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsFormSetupAndTeardown.cs @@ -0,0 +1,41 @@ +using mRemoteNG.App; +using mRemoteNG.Forms; +using mRemoteNG.Messages; +using mRemoteNG.UI.Window; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WeifenLuo.WinFormsUI.Docking; + +namespace mRemoteNGTests.UI.Forms +{ + public class OptionsFormSetupAndTeardown + { + protected OptionsForm _optionsForm; + + [OneTimeSetUp] + public void OnetimeSetup() + { + Runtime.MessageCollector = new MessageCollector(new ErrorAndInfoWindow(new DockContent())); + Runtime.Log = Logger.GetSingletonInstance(); + } + + [SetUp] + public void Setup() + { + _optionsForm = new OptionsForm(); + _optionsForm.Show(); + } + + [TearDown] + public void Teardown() + { + _optionsForm.Dispose(); + while (_optionsForm.Disposing) ; + _optionsForm = null; + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsFormTests.cs b/mRemoteNGTests/UI/Forms/OptionsFormTests.cs new file mode 100644 index 00000000..5f15aa50 --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsFormTests.cs @@ -0,0 +1,44 @@ +using mRemoteNG.App; +using mRemoteNG.Controls; +using mRemoteNG.Forms; +using mRemoteNG.Messages; +using mRemoteNG.UI.Window; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using System; +using System.Threading; +using WeifenLuo.WinFormsUI.Docking; + +namespace mRemoteNGTests.UI.Forms +{ + [TestFixture] + public class OptionsFormTests : OptionsFormSetupAndTeardown + { + [Test] + public void ClickingCloseButtonClosesTheForm() + { + bool eventFired = false; + _optionsForm.FormClosed += (o, e) => eventFired = true; + ButtonTester cancelButton = new ButtonTester("CancelButtonControl", _optionsForm); + cancelButton.Click(); + Assert.That(eventFired, Is.True); + } + + [Test] + public void ClickingOKButtonClosesTheForm() + { + bool eventFired = false; + _optionsForm.FormClosed += (o, e) => eventFired = true; + ButtonTester cancelButton = new ButtonTester("OkButton", _optionsForm); + cancelButton.Click(); + Assert.That(eventFired, Is.True); + } + + [Test] + public void ListViewContainsOptionsPages() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items.Count, Is.EqualTo(9)); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAdvancedPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAdvancedPageTests.cs new file mode 100644 index 00000000..f5e88e4f --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAdvancedPageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsAdvancedPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void AdvancedPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[8].Text, Does.Match("Advanced")); + } + + [Test] + public void AdvancedIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[8].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingAdvancedPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Advanced"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkWriteLogFile", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Write log file")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAppearancePageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAppearancePageTests.cs new file mode 100644 index 00000000..dc07bb69 --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsAppearancePageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsAppearancePageTests : OptionsFormSetupAndTeardown + { + [Test] + public void AppearancePageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[1].Text, Does.Match("Appearance")); + } + + [Test] + public void IconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[1].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingAppearancePageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Appearance"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkShowSystemTrayIcon", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("show notification area icon")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsConnectionsPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsConnectionsPageTests.cs new file mode 100644 index 00000000..321ae8ad --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsConnectionsPageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsConnectionsPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void ConnectionsPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[3].Text, Does.Match("Connections")); + } + + [Test] + public void ConnectionsIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[3].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingConnectionsPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Connections"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkSingleClickOnConnectionOpensIt", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Single click on connection")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsKeyboardPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsKeyboardPageTests.cs new file mode 100644 index 00000000..31b4935f --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsKeyboardPageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsKeyboardPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void KeyboardPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[7].Text, Does.Match("Keyboard")); + } + + [Test] + public void KeyboardIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[7].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingKeyboardPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Keyboard"); + ButtonTester buttonTester = new ButtonTester("btnResetKeyboardShortcuts", _optionsForm); + Assert.That(buttonTester.Text, Does.Match("Reset")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsSQLPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsSQLPageTests.cs new file mode 100644 index 00000000..b88b64bb --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsSQLPageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsSQLPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void SQLPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[4].Text, Does.Match("SQL Server")); + } + + [Test] + public void SQLIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[4].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingSQLPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("SQL Server"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkUseSQLServer", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Use SQL")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsStartupExitPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsStartupExitPageTests.cs new file mode 100644 index 00000000..c53d3d5b --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsStartupExitPageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsStartupExitPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void StartupExitPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[0].Text, Does.Match("Startup/Exit")); + } + + [Test] + public void IconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[0].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingStartupExitPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Startup/Exit"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkSaveConsOnExit", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Save connections")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsTabsPanelPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsTabsPanelPageTests.cs new file mode 100644 index 00000000..5c085aad --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsTabsPanelPageTests.cs @@ -0,0 +1,32 @@ +using NUnit.Extensions.Forms; +using NUnit.Framework; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsTabsPanelPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void TabsPanelPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[2].Text, Does.Match("Tabs & Panels")); + } + + [Test] + public void TabsPanelIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[2].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingTabsPanelPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Tabs & Panels"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkAlwaysShowPanelTabs", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Always show panel tabs")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsThemePageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsThemePageTests.cs new file mode 100644 index 00000000..f426bf99 --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsThemePageTests.cs @@ -0,0 +1,34 @@ +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsThemePageTests : OptionsFormSetupAndTeardown + { + [Test] + public void ThemePageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[6].Text, Does.Match("Theme")); + } + + [Test] + public void ThemeIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[6].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingThemePageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Theme"); + ButtonTester buttonTester = new ButtonTester("btnThemeNew", _optionsForm); + Assert.That(buttonTester.Text, Does.Match("New")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/OptionsPages/OptionsUpdatesPageTests.cs b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsUpdatesPageTests.cs new file mode 100644 index 00000000..2c9243ca --- /dev/null +++ b/mRemoteNGTests/UI/Forms/OptionsPages/OptionsUpdatesPageTests.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System; +using NUnit.Framework; +using mRemoteNGTests.UI.Forms; +using NUnit.Extensions.Forms; + +namespace mRemoteNGTests.UI.Forms.OptionsPages +{ + [TestFixture] + public class OptionsUpdatesPageTests : OptionsFormSetupAndTeardown + { + [Test] + public void UpdatesPageLinkExistsInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[5].Text, Does.Match("Updates")); + } + + [Test] + public void UpdatesIconShownInListView() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + Assert.That(listViewTester.Items[5].ImageList, Is.Not.Null); + } + + [Test] + public void SelectingUpdatesPageLoadsSettings() + { + ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm); + listViewTester.Select("Updates"); + CheckBoxTester checkboxTester = new CheckBoxTester("chkCheckForUpdatesOnStartup", _optionsForm); + Assert.That(checkboxTester.Text, Does.Match("Check for updates")); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/Forms/PasswordFormTests.cs b/mRemoteNGTests/UI/Forms/PasswordFormTests.cs new file mode 100644 index 00000000..983a2e42 --- /dev/null +++ b/mRemoteNGTests/UI/Forms/PasswordFormTests.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework; +using NUnit.Extensions.Forms; +using System.Threading.Tasks; +using mRemoteNG.Forms; + +namespace mRemoteNGTests.UI.Forms +{ + [TestFixture] + public class PasswordFormTests + { + PasswordForm _passwordForm; + + [SetUp] + public void Setup() + { + _passwordForm = new PasswordForm(); + _passwordForm.Show(); + } + + [TearDown] + public void Teardown() + { + _passwordForm.Dispose(); + while (_passwordForm.Disposing) ; + _passwordForm = null; + } + + [Test] + public void PasswordFormText() + { + FormTester formTester = new FormTester("PasswordForm"); + Assert.That(formTester.Text, Does.Match("Password")); + } + + [Test] + public void ClickingCancelClosesPasswordForm() + { + bool eventFired = false; + _passwordForm.FormClosed += (o, e) => eventFired = true; + ButtonTester cancelButton = new ButtonTester("btnCancel", _passwordForm); + cancelButton.Click(); + Assert.That(eventFired, Is.True); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/UI/WindowListTests.cs b/mRemoteNGTests/UI/WindowListTests.cs new file mode 100644 index 00000000..4554966d --- /dev/null +++ b/mRemoteNGTests/UI/WindowListTests.cs @@ -0,0 +1,138 @@ +using System; +using NUnit.Framework; +using mRemoteNG.UI.Window; + +namespace mRemoteNGTests.UI +{ + [TestFixture] + public class WindowListTests + { + private WindowList _windowList; + + [SetUp] + public void Setup() + { + _windowList = new WindowList(); + } + + [TearDown] + public void Teardown() + { + _windowList = null; + } + + [Test] + public void EmptyWhenInitialized() + { + Assert.That(_windowList, Is.Empty); + } + + [Test] + public void WindowIsInListAfterBeingAdded() + { + BaseWindow window = new BaseWindow(); + _windowList.Add(window); + Assert.That(_windowList, Has.Member(window)); + } + + [Test] + public void WindowsAreInListAfterCallingAddRange() + { + BaseWindow window1 = new BaseWindow(); + BaseWindow window2 = new BaseWindow(); + BaseWindow window3 = new BaseWindow(); + BaseWindow[] windowArray = new BaseWindow[] {window1, window2, window3}; + _windowList.AddRange(windowArray); + Assert.That(_windowList, Contains.Item(window1)); + Assert.That(_windowList, Contains.Item(window2)); + Assert.That(_windowList, Contains.Item(window3)); + } + + [Test] + public void CountReturnsCorrectNumberOfElements() + { + _windowList.Add(new BaseWindow()); + _windowList.Add(new BaseWindow()); + _windowList.Add(new BaseWindow()); + Assert.That(_windowList.Count, Is.EqualTo(3)); + } + + [Test] + public void IndexingByObjectReturnsTheCorrectObject() + { + BaseWindow window1 = new BaseWindow(); + BaseWindow window2 = new BaseWindow(); + _windowList.Add(window1); + _windowList.Add(window2); + Assert.That(_windowList[window1], Is.EqualTo(window1)); + } + + [Test] + public void IndexingByNumberReturnsTheCorrectObject() + { + BaseWindow window1 = new BaseWindow(); + BaseWindow window2 = new BaseWindow(); + _windowList.Add(window1); + _windowList.Add(window2); + Assert.That(_windowList[1], Is.EqualTo(window2)); + } + + [Test] + public void ThrowsExceptionWhenIndexingByObjectFails() + { + BaseWindow window1 = new BaseWindow(); + Assert.That(() => _windowList[window1], Throws.TypeOf()); + } + + [Test] + public void ItemIsNotInListAfterBeingRemoved() + { + BaseWindow window1 = new BaseWindow(); + BaseWindow window2 = new BaseWindow(); + _windowList.Add(window1); + _windowList.Add(window2); + _windowList.Remove(window1); + Assert.That(() => _windowList[window1], Throws.TypeOf()); + } + + [Test] + public void ThrowsExceptionWhenIndexingPastListBounds() + { + BaseWindow window1 = new BaseWindow(); + _windowList.Add(window1); + Assert.That(() => _windowList[100], Throws.TypeOf()); + } + + [Test] + public void CountIsReducedAfterItemRemoved() + { + BaseWindow window1 = new BaseWindow(); + BaseWindow window2 = new BaseWindow(); + _windowList.Add(window1); + _windowList.Add(window2); + _windowList.Remove(window1); + Assert.That(_windowList.Count, Is.EqualTo(1)); + } + + [Test] + public void ListIsEmptyAfterLastItemRemoved() + { + BaseWindow window1 = new BaseWindow(); + _windowList.Add(window1); + _windowList.Remove(window1); + Assert.That(_windowList, Is.Empty); + } + + [Test] + public void GetWindowFromStringReturnsCorrectObject() + { + BaseWindow window1 = new BaseWindow(); + window1.SetFormText("TheWindowWeWant"); + BaseWindow window2 = new BaseWindow(); + window2.SetFormText("WeDontWantThisWindow"); + _windowList.Add(window1); + _windowList.Add(window2); + Assert.That(_windowList.FromString("TheWindowWeWant"), Is.EqualTo(window1)); + } + } +} \ No newline at end of file diff --git a/mRemoteNGTests/mRemoteNGTests.csproj b/mRemoteNGTests/mRemoteNGTests.csproj new file mode 100644 index 00000000..5b9795ce --- /dev/null +++ b/mRemoteNGTests/mRemoteNGTests.csproj @@ -0,0 +1,148 @@ + + + + Debug + AnyCPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB} + Library + Properties + mRemoteNGTests + mRemoteNGTests + v4.5 + 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 + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\mRemoteV1\References\log4net.dll + + + ..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll + True + + + ..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll + True + + + nUnitForms\bin\NUnitForms.dll + + + + + + + + False + ..\mRemoteV1\References\WeifenLuo.WinFormsUI.Docking.dll + + + + + + + + + + + + + + + + + + + + + + + + Form + + + TestForm.cs + + + + + + + + + + + + + + + + + + + + + {4934a491-40bc-4e5b-9166-ea1169a220f6} + mRemoteV1 + + + {0f615504-5f30-4cf2-8341-1de7fec95a23} + SharedLibraryNG + + + + + TestForm.cs + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/mRemoteNGTests/nUnitForms/bin/Coverage.xsl b/mRemoteNGTests/nUnitForms/bin/Coverage.xsl new file mode 100644 index 00000000..32c54940 --- /dev/null +++ b/mRemoteNGTests/nUnitForms/bin/Coverage.xsl @@ -0,0 +1,75 @@ + +]> + + + + + + Code Coverage Report + + + +
Code Coverage Report
+

+ + + +
+ + +
+
+

+ +
+ + +
.
+ + + + + + + + + + +
Visit CountLineColumnEnd LineEnd ColumnDocument
+

+
+ + + + + + + hldatacell + gooddatacell + datacell + + + + + + + + + + + + +
\ No newline at end of file diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.Example.exe b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Example.exe new file mode 100644 index 00000000..d4356533 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Example.exe differ diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.dll b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.dll new file mode 100644 index 00000000..5d5e6b28 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.dll differ diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.exe b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.exe new file mode 100644 index 00000000..49ff5993 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Recorder.exe differ diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.Test.dll b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Test.dll new file mode 100644 index 00000000..08b8e046 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/NUnitForms.Test.dll differ diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.dll b/mRemoteNGTests/nUnitForms/bin/NUnitForms.dll new file mode 100644 index 00000000..fb7e1356 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/NUnitForms.dll differ diff --git a/mRemoteNGTests/nUnitForms/bin/NUnitForms.xml b/mRemoteNGTests/nUnitForms/bin/NUnitForms.xml new file mode 100644 index 00000000..d419e8fa --- /dev/null +++ b/mRemoteNGTests/nUnitForms/bin/NUnitForms.xml @@ -0,0 +1,2320 @@ + + + + NUnitForms + + + + + Exception is thrown when there is more than one control with the specified name. + + + You should qualify the name according to the name property of the parent control in + a dot-delimited string. + + If you have multiple dynamic controls with the same name, consider giving them unique + names or else access them using the indexer property on each ControlTester. + + + + grandparent.parent.child is a valid name string.. You can use the shortest name string + that uniquely identifies a control. + + + + + Creates an AmbiguousNameException. + + + The message string can be specified. + + The messasge for the exception. + + + + A ControlTester for testing Buttons. + + + This has no convenience methods beyond those provided + by ControlTester, but does provide a typed Properties + property. + + + + A ControlTester for any type of control. It is the base class for all + ControlTesters in the API. It can also serve as a generic tester for all + Controls with no specifically implemented support. + + + If you want to make your own ControlTester for a custom or unsupported + control, you should implement a version of each of the four constructors. + I plan to separate out (and generate) this code once we get partial class + support in c#. + You should also implement a Property named Properties that returns the + underlying control. + You should hide the indexer (new) and implement one that returns the + appropriate type. + The ButtonTester class is a good place to look for an example (or cut and + paste starting point) if you are making your own tester. + + + + The name of the underlying control. + + + + + Creates a ControlTester that will test controls with the specified name + on a form with the specified name. + + + If the name is unique, you can operate on the tester directly, otherwise + you should use the indexer or Enumerator properties to access each separate + control. + The name of the control to test. + The name of the form to test. + + + + Should call this method after editing something in order to trigger any + databinding done with the Databindings collection. (ie text box to a data + set) + + + + + Creates a ControlTester that will test controls with the specified name + on the specified form. + + + If the name is unique, you can operate on the tester directly, otherwise + you should use the indexer or Enumerator properties to access each separate + control. + The name of the control to test. + The form to test. + + + + Creates a ControlTester that will test controls with the specified name. + + + If the name is unique, you can operate on the tester directly, otherwise + you should use the indexer or Enumerator properties to access each separate + control. + The name of the control to test. + + + + Returns uniquely qualified ControlTesters for each of the controls + associated with this tester as an IEnumerator. This allows use of a + foreach loop. + + IEnumerator of ControlTesters (typed correctly) + + + + Convenience method "Clicks" on the control being tested if it is visible + + + ControlNotVisibleException is thrown if the Control is not Visible. + + + + + Simulates firing of an event by the control being tested. + + The name of the event to fire. + The optional arguments required to construct the EventArgs for the specified event. + + + + Simulates firing of an event by the control being tested. + + The name of the event to fire. + The EventArgs object to pass as a parameter on the event. + + + + Convenience method invoker for any nonsupported method on a control to test + + the name of the method to invoke + the arguments to pass into the method + + + + Returns a that + can be used with the control under test. + + It would be better to use the MouseController on the base test class so + that you don't have to worry about disposing it after your test. I think + this may be marked obsolete soon. + + + A . + + + MouseController returns a new instance of a + that can be used with the control under test. + All mouse positions are relative + the control. + + The returned MouseController must be disposed + to restore the mouse settings prior to the testing; which can be accomplished with the using + statement. + + + + + TextBoxTester textBox = new TextBoxTester("myTextBox"); + using (MouseController mouse = textBox.MouseController()) + { + mouse.Position = new PointF(1,1); + mouse.Drag(30,1); + } + + + + + + Allows you to find a ControlTester by index where the name is not unique. + + + When a control is not uniquely identified by its name property, you can + access it according to an index. This should only be used when you have + dynamic controls and it is inconvenient to set the Name property uniquely. + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the ControlTester. + + + + Returns the number of controls associated with this tester. + + + + + Convenience method retrieves the Text property of the tested control. + + + + + Convenience accessor / mutator for any nonsupported property on a control + to test. + + + ControlTester t = new ControlTester("t"); + t["Text"] = "a"; + AssertEqual("a", t["Text"]); + + + + + + The underlying control for this tester. + + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Allows you to find a ButtonTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the ButtonTester. + + + + Provides access to all of the Properties of the button. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing CheckBoxes. + + + Has convenience methods for Check and Uncheck as well as the Checked Property. + + Fully supported by the recorder application + + + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Sets the Checked property to the specified value. + + + Pass a boolean to indicate checked (true) or unchecked (false) + + Should the box be checked or not checked. + + + + Sets the Checked property of the CheckBox to true + + + Equivalent to Check(true) + + + + + Sets the Checked property of the CheckBox to false + + + Equivalent to Check(false) + + + + + Allows you to find a CheckBoxTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the CheckBoxTester. + + + + Provides access to all of the Properties of the CheckBox. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + Retrieves the Checked property of the CheckBox + + + Just returns the checked property of the underlying checkbox. + + + A boolean to indicate whether the CheckBox is checked. + + + + + A ControlTester for testing ComboBoxes. + + + Has convenience methods for Selecting items and Entering text. + + Fully supported by the recorder application + + + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Sets the text property of the ComboBox to the specified value. + + + Also calls EndCurrentEdit() so that databinding will happen. + + The specified value for the text property. + + + + Selects an entry in the ComboBox according to its index. + + + Sets the SelectedIndex property on the underlying control. + + The index of the ComboBox entry to select. + + + + Selects an entry in the ComboBox according to its string value. + + + Sets the Selected Index property on the underlying control after calling + FindStringExact + + The string value of the entry to select. + + + + Allows you to find a ComboBoxTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the ComboBoxTester. + + + + Provides access to all of the Properties of the ComboBox. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + Internal use only. Represents a collection of controls. + + + NUnitForms users should not have a need for this class. When C# supports + generics, this should be replaced. + + + + + Add a Control to the collection. + + + Will not add a duplicate control. In this way, the collection acts like a Set. + + The control to add. + + + + Add one ControlCollection to another. Combines them into one collection. + + The collection to merge with this one. + + + + Returns an IEnumerator of the Controls in this collection. + + An enumerator of controls. + + + + Returns the number of Controls in this ControlCollection. + + + Delegates to the Count property of the underlying collection. + + + How many controls are in the collection. + + + + + Returns a Control from this collection according to its index. + + + delegates to the Item indexer of an underlying collection. + + + The control at the index. + + the index + + + + Internal use only. Finds controls according to their name property. + + + It is also used by the recorder application. + + the recorder application. + + + + Internal use only. Base class for ControlFinder and MenuItemFinder. + + + It is also used by the recorder application to determine names of Controls. + + + + + Finds the parent of a Control or MenuItem. + + + Necessary only because Control and MenuItem don't have a shared base class. + the Control or MenuItem + The parent of the Control or MenuItem + + + + Finds the name of a Control or MenuItem. + + + Necessary only because Control and MenuItem don't have a shared base class. + the Control or MenuItem + The name of the Control or MenuItem + + + + Creates a ControlFinder that will find controls on a specific Form according to their name. + + The name of the Control to find. + The form to search for the control. + + + + Creates a ControlFinder that will find controls according to their name. + + The name of the Control to find. + + + + Finds a control. + + + If there is more than one with the specified name, it will + throw an AmbiguousNameException. If the Control does not exist, it will throw + a NoSuchControlException. + + The control if one is found. + + + + Exception is thrown when you attempt an action on a Control that is not + visible. + + + + + Creates a ControlNotVisibleException. + + + The message string can be specified. + + The messasge for the exception. + + + + Internal use only. Represents a collection of controls. + + + NUnitForms users should not have a need for this class. When C# supports + generics, this should be replaced. + + + + + Add a Form to the collection. + + + Will not add a duplicate form. In this way, the collection acts like a Set. + + The form to add. + + + + Returns a boolean to indicate whether the supplied form exists in this collection. + + The form to check for existence. + true if the form is in the collection, false otherwise. + + + + Add one FormCollection to another. Combines them into one collection. + + The collection to merge with this one. + + + + Returns an IEnumerator of the Forms in this collection. + + + + + + Returns the number of forms in this FormCollection. + + + + + Returns a Form from this collection according to its index. + + + + + A class to help find a form according to its name. NUnitForms users should not need to use + this class. Consider it as internal. + + + It is also used by the recorder application. + + + + Finds all of the forms with a specified name and returns them in a FormCollection. + + The name of the form to search for. + the FormCollection of all found forms. + + + + Finds one form with the specified name. + + The name of the form to search for. + The form it finds. + + Thrown if there are no forms with the specified name. + + + Thrown if there is more than one form with the specified name. + + + + Finds all of the forms. + + FormCollection with all of the forms regardless of name. + + + + A ControlTester for testing forms. + + This class implements a Close() helper method to close a form that you find. + + + This class does not have all of the constructors because they don't make + sense in this context. + + + + Provides access to all of the Properties of the Form. + + + Allows typed access to all of the properties of the underlying control. + + + + + Constant values for use with KeyboardController. + + + + + Provides testing control of the keyboard. + + + KeyboardController lets you send key presses to your application. You can + click, press, or release any key. The UseOn() method allows you to assert + focus on a specific control before sending the keys. It also initializes + the Keyboard controller for use by blocking user input. + + [Test] + public void TextBox() + { + new TextBoxTestForm().Show(); + TextBoxTester box = new TextBoxTester( "myTextBox", CurrentForm ); + Assert.AreEqual( "default", box.Text ); + + Keyboard.UseOn( box ); + + Keyboard.Click( Key.A ); + Keyboard.Click( Key.B ); + Keyboard.Press( Key.SHIFT ); + Keyboard.Click( Key.C ); + Keyboard.Release( Key.SHIFT ); + + Assert.AreEqual( "abC", box.Text ); + } + + + + + Creates a keyboard controller and sets the focus on the control + indicated by the supplied ControlTester. + + The ControlTester to use the keyboard + on. + + + + Initializes the KeyboardController, blocks user input, and sets + the focus on the specified control. + + The ControlTester to use the keyboard on. + + + + Overloaded. Allows you to specify the control by name. + + + You should probably use this one if you are not sure. + The name of the control. + + + + Overloaded. Allows you to specify the control by name and + qualified by a form name. + + The name of the control. + The name of the form. + + + + Overloaded. Allows you to specify the control by name and + qualified by a form instance. This should be obsolete soon. + Do not use it unless necessary. + + The name of the control. + The form instance to test on. + + + + Implements the IDisposable interface. This restores user input. + It should eventually return the keyboard to its pre-test state. + + + If you are using the Keyboard controller through the base NUnitFormTest + class, then you should not need to call this method or use finally or using + blocks. The base class handles this for you. + + + + Press and release a key. + these constants. + + + Use the Key class (in Key.cs) to find these constants. + + The key to click. + + + + Press a key. + + + Use the Key class (in Key.cs) to find these constants. + + The key to press. + + + + Release a key. + + + Use the Key class (in Key.cs) to find these constants. + + The key to release. + + + + A ControlTester for testing Labels. + + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Allows you to find a LabelTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the LabelTester. + + + + Provides access to all of the Properties of the Label. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing LinkLabels. + + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Allows you to find a LinkLabelTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the LinkLabelTester. + + + + Provides access to all of the Properties of the LinkLabel. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing ListBoxes. + + + It includes helper methods for selecting items from the list + and for clearing those selections. + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Clears the selections from the list box. + + + + + Selects an item in the ListBox according to its index. + + the index to select. + + + + Selects an item in the list according to its string value. + + The item to select. + + + + Sets the selected property of an item at an index. + + the index to select (or clear) + true if you want to select, false to clear. + + + + Sets the selected property of an item with a specified string value. + + the item to select (or clear) + true if you want to select, false to clear. + + + + Allows you to find a ListBoxTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the ListBoxTester. + + + + Provides access to all of the Properties of the ListBox. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + Internal use only. Represents a collection of MenuItems. + + + NUnitForms users should not have a need for this class. When C# supports + generics, this should be replaced. + + + + + Add a MenuItem to the collection. + + + Will not add a duplicate MenuItem. In this way, the collection acts like a Set. + + The menu item to add. + + + + Add one MenuItemCollection to another. Combines them into one collection. + + The collection to merge with this one. + + + + Returns an IEnumerator of the MenuItems in this collection. + + + + + + Returns the number of Controls in this MenuItemCollection. + + + + + Returns a MenuItem from this collection according to its index. + + + + + Internal use only. This class finds MenuItems according to a name. + + + It is also used by the recorder application to determine names of Controls. + + + + + Creates a MenuItemFinder that will find MenuItems according to their name + and qualified by a form instance. + + The MenuItem name. + The form instance. + + + + Creates a MenuItemFinder that will find a MenuItem according to its name. + + + + + + Finds the MenuItem. + + the MenuItem found by this MenuItemFinder. + + Thrown if this MenuItem is not found. + + Thrown if multiple MenuItems are found with the same name. + + + + A ControlTester for MenuItems. + + + It does not extend ControlTester because MenuItems are not Controls. (sadly) + + + + Clicks the MenuItem (activates it) + + + + + Pops up a menu. + + + + + Gets the text of this MenuItem. + + + + + Allows you to access any properties of this MenuItem. + + + + + A ControlTester for MessageBoxes. + Allows you to handle and test MessageBoxes by pressing any of the + buttons that ordinarily appear on them. + + + It does not extend ControlTester because MessageBoxes are not controls. + + public void MessageBoxHandler + { + MessageBoxTester messageBox = new MessageBoxTester( "MessageBoxName" ); + Assert.AreEqual( "MessageBoxText", messageBox.Text ); + Assert.AreEqual( "MessageBoxTitle", messageBox.Title ); + messageBox.SendCommand( MessageBoxTester.Command.OK ); + } + + + + + Creates a MessageBoxTester with the specified handle. NUnitForms + users probably won't use this directly. Use the other constructor. + + The handle of the MessageBox to test. + + + + Creates a MessageBoxTester that finds MessageBoxes with the + specified name. + + The name of the MessageBox to test. + + + + Sends a command to the MessageBox. + + The command to send.. (ok, cancel, yes, abort, etc..) + + + + Clicks the Ok button of a MessageBox. + + + + + Clicks the cancel button of a MessageBox. + + + + + Returns the caption on the message box we are testing. + + + + + Returns the text of the message box we are testing. + + + + + Available commands you can send to the MessageBox. + + + There are convenience methods for OK and Cancel, so you should not need + those. + + + + + Used to specify a handler for a Modal form that is displayed during testing. + + + + + Translation between mouse position and screen position. + + + A mouse coordinate relative to + the origin control and specified in PositionUnit. + + + The scale to convert by. + + + A mouse coordinate relative to + the screen and specified in pixels. + + + + + Provides testing control over the mouse. + + + MouseController allows you to control the mouse position + and buttons and simulate dragging and clicking during a test. It can be + used to test the behavior of a control. For testing the behavior of an + application in reponse to a control's events, it is not necessary to use + the MouseControl. I suggest you directly fire the appropriate events instead. + (You probably aren't using this class unless you are writing some custom + control and need to see its response to actual low level mouse movement, etc..) + + The mouse Position can be relative to a or a + on a Form. The Position can be specified in pixels, inches or millimetres + + + The mouse buttons are controlled with the Press and Release methods. Both + methods allow a bitwise combination of the , for example + Press(MouseButtons.Left | MouseButtons.Center). + Button modifiers, the Alt, Shift and Ctrl keys, are also controlled with the two methods. + + + The XButtons ( and ) + can only be simulated when a mouse with 5 buttons is installed. + The Press and Release methods will throw if the XButtons are used + when a mouse does not have 4 or 5 button support. + + + + + [TestFixture] public class ATest : NUnitFormTest + { + // Gets the Form used for testing. + public override Type FormType + { + get {return typeof(MyTestForm);} + } + + [Test] public void Selecting() + { + ControlTester myControl = new ControlTester("myControl", CurrentForm); + using (MouseController mouse = myControl.MouseController()) + { + mouse.Drag (10,10, 20,20); + AssertEquals (1, myControl.Properties.SelectedObjects.Count); + } + } + + + + + + Creates and initialises a new instance of the class. + + + + + Creates and initialises a new instance of the class for the specified . + + + A . + + + The mouse position is relative to the managed by + the . + + While the MouseController is active, user keyboard and mouse input is disabled. For this + reason the MouseController should be disposed of when the testing is concluded. + + + + + using (MouseController mouse = new MouseControler(myTestControl)) + { + mouse.Position = new PointF(1,1); + mouse.Press(MouseButtons.Middle); + } + + + + + + Specify which control or form we should use for the relative position. + + + A . + + + + + Overloaded. Specifies control by name. + + The name of the control + + + + Overloaded. Specifies control by name and form name + + The name of the control. + The name of the form. + + + + Overloaded. Specifies control by name and form instance. + + The name of the control. + The form instance. + + + + Releases the resources used by the . + + + Dispose releases any pressed mouse keys, restores the + mouse and enables user input. + + + + + Simulate hovering over the control under test. + + + Hover positions the mouse over the control under test for the + system defined mouse hover time and then processes the events. + + + + + Simulate hovering over the control under test at the specified x and y-coordinate. + + + The x-coordinate, + relative to the control under test, + to move the mouse to. + + + The y-coordinate, + relative to the control under test, + to move the mouse to. + + + Hover positions the mouse over the control under test + at the specified point (, ) for the system defined mouse hover + time and then processes the events. + + + + + Simulate hovering over the control under test at the specified . + + + A , relative to the control under test, + to move the mouse to. + + + Hover positions the mouse over the control under test + at the specified for the system defined mouse hover + time and then processes the events. + + + + + Simulate clicking on the control under test. + + + Click positions the mouse over the control under test + and then presses and releases the left mouse button. + + + + + Simulate clicking at the specified x and y-coordinate. + + + The x-coordinate, + relative to the control under test, + to move the mouse to. + + + The y-coordinate, + relative to the control under test, + to move the mouse to. + + + Click positions the mouse over the control under test + at the specified point (, ) + and then presses and releases the left mouse button. + + + + + Simulate clicking at the specified . + + + A , relative to the control under test, + to move the mouse to. + + + Click positions the mouse over the control under test + at the specified + and then presses and releases the left mouse button. + + + + + Simulate double clicking on the control under test. + + + Click positions the mouse over the control under test + and then presses and releases the left mouse button twice. + + + + + Simulate double clicking at the specified x and y-coordinate. + + + The x-coordinate, + relative to the control under test, + to move the mouse to. + + + The y-coordinate, + relative to the control under test, + to move the mouse to. + + + Click positions the mouse over the control under test + at the specified point (, ) + and then presses and releases the left mouse button twice. + + + + + Simulate double clicking at the specified . + + + A , relative to the control under test, + to move the mouse to. + + + Click positions the mouse over the control under test + at the specified + and then presses and releases the left mouse button twice. + + + + + Simulate pressing the mouse button(s). + + + A bitwise combination of the enumeration values. + + + Press positions the mouse over the control under test + and then simulates pressing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulate pressing the mouse button(s) at the specified x and y-coordinate. + + + A bitwise combination of the enumeration values. + + + The x-coordinate, + relative to the control under test, + to move the mouse to. + + + The y-coordinate, + relative to the control under test, + to move the mouse to. + + + Press positions the mouse over the control under test + at the specified point (, ) + and then simulates pressing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulate pressing the mouse button(s) at the specified . + + + A bitwise combination of the enumeration values. + + + A , relative to the control under test, + to move the mouse to. + + + Press positions the mouse over the control under test + at the specified + and then simulates pressing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulates pressing the or modifier . + + + Simulate pressing the mouse modifier key(s) (Alt, Shift and Control). + + + A bitwise combination of the enumeration values. Only Alt, Shift + and Control are allowed. + + + Press simulates pressing the specified . + + + When contains a value that is not + Alt, Shift or Control. + + + The following example performs a "shift drag" and verifies that + two objects are selected. + + [TestFixture] public class ATest : NUnitFormTest + { + // Gets the Form used for testing. + public override Type FormType + { + get {return typeof(MyTestForm);} + } + + [Test] public void Selecting() + { + ControlTester myControl = new ControlTester("myControl", CurrentForm); + using (MouseController mouse = myControl.MouseController()) + { + mouse.Drag (10,10, 20,20); + AssertEquals (1, myControl.Properties.SelectedObjects.Count); + + mouse.Press(Keys.Shift); + mouse.Drag(100,100, 200,200); + mouse.Release(Keys.Shift); + AssertEquals (2, myControl.Properties.SelectedObjects.Count); + } + } + + + + + + Simulate releasing the mouse button(s). + + + A bitwise combination of the enumeration values. + + + Release positions the mouse over the control under test + and then simulates releasing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulate release the mouse button(s) at the specified x and y-coordinate. + + + A bitwise combination of the enumeration values. + + + The x-coordinate, + relative to the control under test, + to move the mouse to. + + + The y-coordinate, + relative to the control under test, + to move the mouse to. + + + Release positions the mouse over the control under test + at the specified point (, ) + and then simulates releasing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulate releasing the mouse button(s) at the specified . + + + A bitwise combination of the enumeration values. + + + A , relative to the control under test, + to move the mouse to. + + + Release positions the mouse over the control under test + at the specified + and then simulates releasing the specified . + + + When contains MouseButtons.XButton1 + or MouseButtons.XButton2 and the installed mouse does have 4 + or 5 buttons, respectively. + + + + + Simulates releasing the or modifier . + + + Simulate releasing the mouse modifier key(s) (Alt, Shift and Control). + + + A bitwise combination of the enumeration values. Only Alt, Shift + and Control are allowed. + + + Release simulates releasing the specified . + + + When contains a value that is not + Alt, Shift or Control. + + + The following example performs a "shift drag" and verifies that + two objects are selected. + + [TestFixture] public class ATest : NUnitFormTest + { + // Gets the Form used for testing. + public override Type FormType + { + get {return typeof(MyTestForm);} + } + + [Test] public void Selecting() + { + ControlTester myControl = new ControlTester("myControl", CurrentForm); + using (MouseController mouse = myControl.MouseController()) + { + mouse.Drag (10,10, 20,20); + AssertEquals (1, myControl.Properties.SelectedObjects.Count); + + mouse.Press(Keys.Shift); + mouse.Drag(100,100, 200,200); + mouse.Release(Keys.Shift); + AssertEquals (2, myControl.Properties.SelectedObjects.Count); + } + } + + + + + + Simulate dragging the mouse. + + + A to start the drag operation at. + + + Array of structures that represent the points to move> + the mouse to. + + + When is null. + + + When does not contain any elements. + + + Drag positions the mouse over the control under test + at the specified and then presses the + left mouse button. It then moves the mouse to each point specified in the + array. Finally the left button is released. + + + + using (MouseController mouse = new MouseControler(myTestControl)) + { + mouse.Drag(new PointF(0,0), new Point(100, 100)); + } + + + + + + Simulate dragging the mouse. + + + A x-coordinate to start the drag operation at. + + + A y-coordinate to start the drag operation at. + + + Array of values that represent the x and y coordinates to move> + the mouse to. + + + When is null. + + + When does not contain at lease two values, +
Or, the number of elements is odd. +
+ + Drag positions the mouse over the control under test + at the specified (, ) + and then presses the left mouse button. It then moves the mouse + to each point specified in the array. Finally the left button is released. + + + + using (MouseController mouse = new MouseControler(myTestControl)) + { + mouse.Drag(0,0, 100,100); + } + + +
+ + + Gets or sets the mouse position. + + + A representing the mouse position in the space. + + + Position is the position of the mouse, relative to the control under test + and specified in position units. + + + + + Gets or sets the unit of measure used for mouse coordinates. + + + A member of the enumeration. The default + is GraphicsUnit.Pixel. + + + PositionUnit specifies how the mouse coordinates + are interpreted. + + + When value is GraphicsUnit.World. + + + When value is not a valid enumeration value. + + + + + Exception is thrown when a control can not be found + by its specified name. + + + + + Creates a NoSuchControlException. + + + The message string can be specified. + + The messasge for the exception. + + + + One of three base classes for your NUnitForms tests. This one can be + used by people who want "built-in" Assertion functionality and prefer + the older style "Assertion" syntax. + + + + + One of three base classes for your NUnitForms tests. This one can be + used by people who do not need or want "built-in" Assert functionality. + + This is the recommended base class for all unit tests that use NUnitForms. + + + You should probably extend this class to create all of your test fixtures. The benefit is that + this class implements setup and teardown methods that clean up after your test. Any forms that + are created and displayed during your test are cleaned up by the tear down method. This base + class also provides easy access to keyboard and mouse controllers. It has a method that allows + you to set up a handler for modal dialog boxes. It allows your tests to run on a separate + (usually hidden) desktop so that they are faster and do not interfere with your normal desktop + activity. If you want custom setup and teardown behavior, you should override the virtual + Setup and TearDown methods. Do not use the setup and teardown attributes in your child class. + + + + + This is the base classes setup method. It will be called by NUnit before each test. + You should not have anything to do with it. + + + + + This is the method that is called to handled unexpected modal dialogs. It is called automatically + by the NUnitForms framework when such a dialog appears. You should not need to call it. + + + + + + One of four overloaded methods to set up a modal dialog handler. If you expect a modal + dialog to appear and can handle it during the test, use this method to set up the handler. + + The caption on the dialog you expect. + The method to call when that dialog appears. + + + + One of four overloaded methods to set up a modal dialog handler. If you expect a modal + dialog to appear and can handle it during the test, use this method to set up the handler. + Because "expected" is usually (always) true if you are calling this, I don't expect it will + be used externally. + + The caption on the dialog you expect. + The method to call when that dialog appears. + A boolean to indicate whether you expect this modal dialog to appear. + + + + One of four overloaded methods to set up a modal dialog handler. If you expect a modal + dialog to appear and can handle it during the test, use this method to set up the handler. + Because "expected" is usually (always) true if you are calling this, I don't expect it will + be used externally. + + The caption on the dialog you expect. + The name of the method to call when that dialog appears. + A boolean to indicate whether you expect this modal dialog to appear. + + + + One of four overloaded methods to set up a modal dialog handler. If you are not sure which + to use, use this one. If you expect a modal dialog to appear and can handle it during the + test, use this method to set up the handler. Because "expected" is usually (always) true + if you are calling this, I don't expect it will be used externally. + + The caption on the dialog you expect. + The name of the method to call when that dialog appears. + + + + Obsolete soon. In your test class, you used to have the choice to override this + method, or implement the FormType property. Now neither is necessary. It is still + here for compatibility with tests written to use the CurrentForm property. + + + + + Override this Setup method if you have custom behavior to execute before each test + in your fixture. + + + + + This will be marked obsolete soon. This method is called before each test in order + to set the CurrentForm property (also obsolete) You can override this method as an + alternative to setting the FormType property if you want to test the old way. + + + + + + This method is called by NUnit after each test runs. If you have custom + behavior to run after each test, then override the TearDown method and do + it there. That method is called at the beginning of this one. + You should not need to do anything with it. Do not call it. + If you do call it, call it as the last thing you do in your test. + + + + + This method is called after each test. Put code here to clean up anything + you need to between tests. NUnitForms cleans up most everything you need + related to the framework (closes extra windows, etc..) but you might need + custom behavior beyond this. Put it here. + + + + + This property controls whether the separate hidden desktop is displayed for the duration of + this test. You will need to override and return true from this property if your test makes + use of the keyboard or mouse controllers. (The hidden desktop cannot accept user input.) For + tests that do not use the keyboard and mouse controller (most should not) you don't need to do + anything with this. The default behavior is fine. + + + + + This property controls whether a separate desktop is used at all. I highly recommend that you + leave this as returning true. Tests on the separate desktop are faster and safer. (There is + no danger of keyboard or mouse input going to your own separate running applications.) However + I have heard report of operating systems or environments where the separate desktop does not work. + In that case there are 2 options. You can override this method from your test class to return false. + Or you can set an environment variable called "UseHiddenDesktop" and set that to "false" Either will + cause the tests to run on your original, standard desktop. + + + + + This should be marked obsolete. It is used only in combination with the FormType property. + If you override the FormType property, then CurrentForm will be initialized (on setup) to + an instance of the form whose type you specify. None of the testers require a reference + to the active form anymore, so this should not be necessary. It will be marked obsolete + soon. + + + + + Returns a reference to the current MouseController for doing Mouse tests. I recommend + this only when you are writing your own custom controls and need to respond to actual + mouse input to test them properly. In most other cases there is a better way to test + the form's logic. + + + + + Returns a reference to the current KeyboardController for doing Keyboard tests. I recommend + this only when you are writing your own custom controls and need to respond to actual + keyboard input to test them properly. In most other cases there is a better way to test + for the form's logic. + + + + + Soon to be marked obsolete. This property specifies the type of form to instantiate + before each test. Do not use it anymore. + + + + + One of three base classes for your NUnitForms tests. This one can be + used by people who want "built-in" Assert functionality and prefer + the newer style "Assert" syntax. + + + + + A ControlTester for testing RadioButtons. + + + This class provides a convenience property for determining + whether a RadioButton is checked. + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Allows you to find a RadioButtonTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the RadioButtonTester. + + + + Provides access to all of the Properties of the RadioButton. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing TabControls. + + + There is a convenience method for selecting a specified tab. + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Selects the tab at the specified index. + + The tab to select. + + + + Allows you to find a TabControlTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the TabControlTester. + + + + Provides access to all of the Properties of the TabControl. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing TextBoxes. + + + There is a convenience method for entering text into a text box. + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + This method allows you to enter text into the text box. + + The text to enter into the text box. + + + + Allows you to find a TextBoxTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the TextBoxTester. + + + + Provides access to all of the Properties of the TextBox. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + + + + A ControlTester for testing TreeViews. + + + There is a convenience method for selecting a node in the tree. + + + + Creates a ControlTester from the control name and the form instance. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form instance. + + + + Creates a ControlTester from the control name and the form name. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The Control name. + The Form name.. + + + + Creates a ControlTester from the control name. + + + This is the best constructor. + The Control name. + + + + Creates a ControlTester from a ControlTester and an index where the + original tester's name is not unique. + + + It is best to use the overloaded Constructor that requires just the name + parameter if possible. + + The ControlTester. + The index to test. + + + + Selects a node in the tree. + + an array of the indexes of the node to select + + + + Allows you to find a TreeViewTester by index where the name is not unique. + + + This was added to support the ability to find controls where their name is + not unique. If all of your controls are uniquely named (I recommend this) then + you will not need this. + + The ControlTester at the specified index. + The index of the TreeViewTester. + + + + Provides access to all of the Properties of the TreeView. + + + Allows typed access to all of the properties of the underlying control. + + The underlying control. + +
+
diff --git a/mRemoteNGTests/nUnitForms/bin/TestResult.xml b/mRemoteNGTests/nUnitForms/bin/TestResult.xml new file mode 100644 index 00000000..b07c9c42 --- /dev/null +++ b/mRemoteNGTests/nUnitForms/bin/TestResult.xml @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNGTests/nUnitForms/bin/nmock.dll b/mRemoteNGTests/nUnitForms/bin/nmock.dll new file mode 100644 index 00000000..1d101b94 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/nmock.dll differ diff --git a/mRemoteNGTests/nUnitForms/bin/nunit.core.dll b/mRemoteNGTests/nUnitForms/bin/nunit.core.dll new file mode 100644 index 00000000..24e9c263 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/nunit.core.dll differ diff --git a/mRemoteNGTests/nUnitForms/bin/nunit.framework.dll b/mRemoteNGTests/nUnitForms/bin/nunit.framework.dll new file mode 100644 index 00000000..220a58a9 Binary files /dev/null and b/mRemoteNGTests/nUnitForms/bin/nunit.framework.dll differ diff --git a/mRemoteNGTests/nUnitForms/license.txt b/mRemoteNGTests/nUnitForms/license.txt new file mode 100644 index 00000000..8c1c78ff --- /dev/null +++ b/mRemoteNGTests/nUnitForms/license.txt @@ -0,0 +1,27 @@ +/******************************************************************************************************************** +' +' Copyright (c) 2003-2004, Luke T. Maxon +' All rights reserved. +' +' Redistribution and use in source and binary forms, with or without modification, are permitted provided +' that the following conditions are met: +' +' * Redistributions of source code must retain the above copyright notice, this list of conditions and the +' following disclaimer. +' +' * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and +' the following disclaimer in the documentation and/or other materials provided with the distribution. +' +' * Neither the name of the author nor the names of its contributors may be used to endorse or +' promote products derived from this software without specific prior written permission. +' +' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +' WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +' PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +' ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +' LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +' IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +' +'*******************************************************************************************************************/ diff --git a/mRemoteNGTests/packages.config b/mRemoteNGTests/packages.config new file mode 100644 index 00000000..7692ea5d --- /dev/null +++ b/mRemoteNGTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mRemoteV1.sln b/mRemoteV1.sln index df785bd9..e739ca28 100644 --- a/mRemoteV1.sln +++ b/mRemoteV1.sln @@ -1,14 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = ".\mRemoteV1\mRemoteV1", ".\mRemoteV1\mRemoteV1.csproj", "{4934A491-40BC-4E5B-9166-EA1169A220F6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mRemoteV1", "mRemoteV1\mRemoteV1.csproj", "{4934A491-40BC-4E5B-9166-EA1169A220F6}" ProjectSection(ProjectDependencies) = postProject {0F615504-5F30-4CF2-8341-1DE7FEC95A23} = {0F615504-5F30-4CF2-8341-1DE7FEC95A23} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibraryNG", ".\SharedLibraryNG\SharedLibraryNG.csproj", "{0F615504-5F30-4CF2-8341-1DE7FEC95A23}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibraryNG", "SharedLibraryNG\SharedLibraryNG.csproj", "{0F615504-5F30-4CF2-8341-1DE7FEC95A23}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mRemoteNGTests", "mRemoteNGTests\mRemoteNGTests.csproj", "{1453B37F-8621-499E-B0B2-6091F76DC0BB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,6 +36,14 @@ Global {0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release Portable|Any CPU.Build.0 = Release|Any CPU {0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.ActiveCfg = Release|Any CPU {0F615504-5F30-4CF2-8341-1DE7FEC95A23}.Release|Any CPU.Build.0 = Release|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug Portable|Any CPU.ActiveCfg = Debug|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug Portable|Any CPU.Build.0 = Debug|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release Portable|Any CPU.ActiveCfg = Release|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release Portable|Any CPU.Build.0 = Release|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1453B37F-8621-499E-B0B2-6091F76DC0BB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/mRemoteV1.v12.suo b/mRemoteV1.v12.suo index a55dc577..b8a1058d 100644 Binary files a/mRemoteV1.v12.suo and b/mRemoteV1.v12.suo differ diff --git a/mRemoteV1/App/App.Info.cs b/mRemoteV1/App/App.Info.cs deleted file mode 100644 index 68c76ea3..00000000 --- a/mRemoteV1/App/App.Info.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using System; -using System.Threading; - - -namespace mRemoteNG.App.Info -{ - public class General - { - public static readonly string URLHome = "http://www.mremoteng.org/"; - public static readonly string URLDonate = "http://donate.mremoteng.org/"; - public static readonly string URLForum = "http://forum.mremoteng.org/"; - public static readonly string URLBugs = "http://bugs.mremoteng.org/"; - public static readonly string HomePath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath; - public static string EncryptionKey = "mR3m"; - public static string ReportingFilePath = ""; - public static readonly string PuttyPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\PuTTYNG.exe"; - public static string UserAgent - { - get - { - List details = new List(); - details.Add("compatible"); - if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) - { - details.Add(string.Format("Windows NT {0}.{1}", System.Environment.OSVersion.Version.Major, System.Environment.OSVersion.Version.Minor)); - } - else - { - details.Add(System.Environment.OSVersion.VersionString); - } - if (Tools.EnvironmentInfo.IsWow64) - { - details.Add("WOW64"); - } - details.Add(Thread.CurrentThread.CurrentUICulture.Name); - details.Add(string.Format(".NET CLR {0}", System.Environment.Version)); - string detailsString = string.Join("; ", details.ToArray()); - - return string.Format("Mozilla/4.0 ({0}) {1}/{2}", detailsString, System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); - } - } - } - - public class Settings - { - #if !PORTABLE - public static readonly string SettingsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName; - #else - public static readonly string SettingsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath; - #endif - public static readonly string LayoutFileName = "pnlLayout.xml"; - public static readonly string ExtAppsFilesName = "extApps.xml"; - public const string ThemesFileName = "Themes.xml"; - } - - public class Update - { - public static string FileName - { - get - { - #if DEBUG - return "update-debug.txt"; - #else - if ((string) (My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug") - { - return "update-debug.txt"; - } - else - { - return "update.txt"; - } - #endif - } - } - } - - public class Connections - { - public static readonly string DefaultConnectionsPath = App.Info.Settings.SettingsPath; - public static readonly string DefaultConnectionsFile = "confCons.xml"; - public static readonly string DefaultConnectionsFileNew = "confConsNew.xml"; - public static readonly double ConnectionFileVersion = 2.5; - } - - public class Credentials - { - public static readonly string CredentialsPath = App.Info.Settings.SettingsPath; - public static readonly string CredentialsFile = "confCreds.xml"; - public static readonly string CredentialsFileNew = "confCredsNew.xml"; - public static readonly double CredentialsFileVersion = 1.0; - } -} diff --git a/mRemoteV1/App/App.Runtime.cs b/mRemoteV1/App/App.Runtime.cs deleted file mode 100644 index 30a8e93d..00000000 --- a/mRemoteV1/App/App.Runtime.cs +++ /dev/null @@ -1,2285 +0,0 @@ -using System.Collections.Generic; -using System; -using System.Drawing; -using System.Diagnostics; -using Microsoft.VisualBasic; -using System.Collections; -using System.Windows.Forms; -using System.ComponentModel; -using mRemoteNG.Forms; -using log4net; -using mRemoteNG.Messages; -using mRemoteNG.Connection; -using mRemoteNG.Tools; -using mRemoteNG.Forms.OptionsPages; -using PSTaskDialog; -using WeifenLuo.WinFormsUI.Docking; -using System.IO; -using System.Threading; -using System.Xml; -using System.Management; -using Microsoft.Win32; -using mRemoteNG.Connection.Protocol; - - -namespace mRemoteNG.App -{ - public class Runtime - { - private Runtime() - { - // Fix Warning 292 CA1053 : Microsoft.Design : Because type 'Native' contains only 'static' ('Shared' in Visual Basic) members, add a default private constructor to prevent the compiler from adding a default public constructor. - } - - #region Public Properties - public static frmMain MainForm {get; set;} - - private static Connection.ConnectionList _connectionList; - public static Connection.ConnectionList ConnectionList - { - get - { - return _connectionList; - } - set - { - _connectionList = value; - } - } - - private static Connection.ConnectionList _previousConnectionList; - public static Connection.ConnectionList PreviousConnectionList - { - get - { - return _previousConnectionList; - } - set - { - _previousConnectionList = value; - } - } - - private static Container.List _containerList; - public static Container.List ContainerList - { - get - { - return _containerList; - } - set - { - _containerList = value; - } - } - - private static Container.List _previousContainerList; - public static Container.List PreviousContainerList - { - get - { - return _previousContainerList; - } - set - { - _previousContainerList = value; - } - } - - private static Credential.List _credentialList; - public static Credential.List CredentialList - { - get - { - return _credentialList; - } - set - { - _credentialList = value; - } - } - - private static Credential.List _previousCredentialList; - public static Credential.List PreviousCredentialList - { - get - { - return _previousCredentialList; - } - set - { - _previousCredentialList = value; - } - } - - - private static UI.Window.List _windowList; - public static UI.Window.List WindowList - { - get - { - return _windowList; - } - set - { - _windowList = value; - } - } - - private static Messages.Collector _messageCollector; - public static Collector MessageCollector - { - get - { - return _messageCollector; - } - set - { - _messageCollector = value; - } - } - - private static Tools.Controls.NotificationAreaIcon _notificationAreaIcon; - public static Tools.Controls.NotificationAreaIcon NotificationAreaIcon - { - get - { - return _notificationAreaIcon; - } - set - { - _notificationAreaIcon = value; - } - } - - private static mRemoteNG.Tools.SystemMenu _systemMenu; - public static SystemMenu SystemMenu - { - get - { - return _systemMenu; - } - set - { - _systemMenu = value; - } - } - - private static log4net.ILog _log; - public static ILog Log - { - get - { - return _log; - } - set - { - _log = value; - } - } - - private static bool _isConnectionsFileLoaded; - public static bool IsConnectionsFileLoaded - { - get - { - return _isConnectionsFileLoaded; - } - set - { - _isConnectionsFileLoaded = value; - } - } - - private static System.Timers.Timer _timerSqlWatcher; - public static System.Timers.Timer TimerSqlWatcher - { - get - { - return _timerSqlWatcher; - } - set - { - _timerSqlWatcher = value; - _timerSqlWatcher.Elapsed += tmrSqlWatcher_Elapsed; - } - } - - private static DateTime _lastSqlUpdate; - public static DateTime LastSqlUpdate - { - get - { - return _lastSqlUpdate; - } - set - { - _lastSqlUpdate = value; - } - } - - private static string _lastSelected; - public static string LastSelected - { - get - { - return _lastSelected; - } - set - { - _lastSelected = value; - } - } - - private static Connection.ConnectionRecordImp _defaultConnection; - public static Connection.ConnectionRecordImp DefaultConnection - { - get - { - return _defaultConnection; - } - set - { - _defaultConnection = value; - } - } - - private static ConnectionRecordInheritanceImp _defaultInheritance; - public static ConnectionRecordInheritanceImp DefaultInheritance - { - get - { - return _defaultInheritance; - } - set - { - _defaultInheritance = value; - } - } - - private static ArrayList _externalTools = new ArrayList(); - public static ArrayList ExternalTools - { - get - { - return _externalTools; - } - set - { - _externalTools = value; - } - } - - #endregion - - #region Classes - public class Windows - { - public static UI.Window.Tree treeForm; - public static DockContent treePanel = new DockContent(); - public static UI.Window.Config configForm; - public static DockContent configPanel = new DockContent(); - public static UI.Window.ErrorsAndInfos errorsForm; - public static DockContent errorsPanel = new DockContent(); - public static UI.Window.Sessions sessionsForm; - public static DockContent sessionsPanel = new DockContent(); - public static UI.Window.ScreenshotManager screenshotForm; - public static DockContent screenshotPanel = new DockContent(); - public static ExportForm exportForm; - public static DockContent exportPanel = new DockContent(); - public static UI.Window.About aboutForm; - public static DockContent aboutPanel = new DockContent(); - public static UI.Window.Update updateForm; - public static DockContent updatePanel = new DockContent(); - public static UI.Window.SSHTransfer sshtransferForm; - public static DockContent sshtransferPanel = new DockContent(); - public static UI.Window.ActiveDirectoryImport adimportForm; - public static DockContent adimportPanel = new DockContent(); - public static UI.Window.Help helpForm; - public static DockContent helpPanel = new DockContent(); - public static UI.Window.ExternalTools externalappsForm; - public static DockContent externalappsPanel = new DockContent(); - public static UI.Window.PortScan portscanForm; - public static DockContent portscanPanel = new DockContent(); - public static UI.Window.UltraVNCSC ultravncscForm; - public static DockContent ultravncscPanel = new DockContent(); - public static UI.Window.ComponentsCheck componentscheckForm; - public static DockContent componentscheckPanel = new DockContent(); - public static UI.Window.Announcement AnnouncementForm; - public static DockContent AnnouncementPanel = new DockContent(); - - public static void Show(UI.Window.Type windowType, bool portScanImport = false) - { - try - { - if (windowType.Equals(UI.Window.Type.About)) - { - if (aboutForm == null || aboutForm.IsDisposed) - { - aboutForm = new UI.Window.About(aboutPanel); - aboutPanel = aboutForm; - } - aboutForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.ActiveDirectoryImport)) - { - if (adimportForm == null || adimportForm.IsDisposed) - { - adimportForm = new UI.Window.ActiveDirectoryImport(adimportPanel); - adimportPanel = adimportForm; - } - adimportPanel.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.Options)) - { - using (OptionsForm optionsForm = new OptionsForm()) - { - optionsForm.ShowDialog(frmMain.Default); - } - } - else if (windowType.Equals(UI.Window.Type.SSHTransfer)) - { - sshtransferForm = new UI.Window.SSHTransfer(sshtransferPanel); - sshtransferPanel = sshtransferForm; - sshtransferForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.Update)) - { - if (updateForm == null || updateForm.IsDisposed) - { - updateForm = new UI.Window.Update(updatePanel); - updatePanel = updateForm; - } - updateForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.Help)) - { - if (helpForm == null || helpForm.IsDisposed) - { - helpForm = new UI.Window.Help(helpPanel); - helpPanel = helpForm; - } - helpForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.ExternalApps)) - { - if (externalappsForm == null || externalappsForm.IsDisposed) - { - externalappsForm = new UI.Window.ExternalTools(externalappsPanel); - externalappsPanel = externalappsForm; - } - externalappsForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.PortScan)) - { - portscanForm = new UI.Window.PortScan(portscanPanel, portScanImport); - portscanPanel = portscanForm; - portscanForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.UltraVNCSC)) - { - if (ultravncscForm == null || ultravncscForm.IsDisposed) - { - ultravncscForm = new UI.Window.UltraVNCSC(ultravncscPanel); - ultravncscPanel = ultravncscForm; - } - ultravncscForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.ComponentsCheck)) - { - if (componentscheckForm == null || componentscheckForm.IsDisposed) - { - componentscheckForm = new UI.Window.ComponentsCheck(componentscheckPanel); - componentscheckPanel = componentscheckForm; - } - componentscheckForm.Show(frmMain.Default.pnlDock); - } - else if (windowType.Equals(UI.Window.Type.Announcement)) - { - if (AnnouncementForm == null || AnnouncementForm.IsDisposed) - { - AnnouncementForm = new UI.Window.Announcement(AnnouncementPanel); - AnnouncementPanel = AnnouncementForm; - } - AnnouncementForm.Show(frmMain.Default.pnlDock); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "App.Runtime.Windows.Show() failed." + Environment.NewLine + ex.Message, true); - } - } - - public static void ShowUpdatesTab() - { - using (OptionsForm optionsForm = new OptionsForm()) - { - optionsForm.ShowDialog(frmMain.Default, typeof(UpdatesPage)); - } - - } - } - - public class Screens - { - public static void SendFormToScreen(Screen Screen) - { - bool wasMax = false; - - if (frmMain.Default.WindowState == FormWindowState.Maximized) - { - wasMax = true; - frmMain.Default.WindowState = FormWindowState.Normal; - } - - frmMain.Default.Location = Screen.Bounds.Location; - - if (wasMax) - { - frmMain.Default.WindowState = FormWindowState.Maximized; - } - } - - public static void SendPanelToScreen(DockContent Panel, Screen Screen) - { - Panel.DockState = DockState.Float; - Panel.ParentForm.Left = Screen.Bounds.Location.X; - Panel.ParentForm.Top = Screen.Bounds.Location.Y; - } - } - - public class Startup - { - public static void CheckCompatibility() - { - CheckFipsPolicy(); - CheckLenovoAutoScrollUtility(); - } - - private static void CheckFipsPolicy() - { - RegistryKey regKey = default(RegistryKey); - - bool isFipsPolicyEnabled = false; - - // Windows XP/Windows Server 2003 - regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa"); - if (regKey != null) - { - if (!((int)regKey.GetValue("FIPSAlgorithmPolicy") == 0)) - { - isFipsPolicyEnabled = true; - } - } - - // Windows Vista/Windows Server 2008 and newer - regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy"); - if (regKey != null) - { - if (!((int)regKey.GetValue("Enabled") == 0)) - { - isFipsPolicyEnabled = true; - } - } - - if (isFipsPolicyEnabled) - { - MessageBox.Show(frmMain.Default, string.Format(My.Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - System.Environment.Exit(1); - } - } - - private static void CheckLenovoAutoScrollUtility() - { - if (!My.Settings.Default.CompatibilityWarnLenovoAutoScrollUtility) - { - return ; - } - - Process[] proccesses = new Process[] {}; - try - { - proccesses = Process.GetProcessesByName("virtscrl"); - } - catch - { - } - if (proccesses.Length == 0) - { - return ; - } - - cTaskDialog.MessageBox(System.Windows.Forms.Application.ProductName, My.Language.strCompatibilityProblemDetected, string.Format(My.Language.strCompatibilityLenovoAutoScrollUtilityDetected, System.Windows.Forms.Application.ProductName), "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.OK, eSysIcons.Warning, eSysIcons.Warning); - if (cTaskDialog.VerificationChecked) - { - My.Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false; - } - } - - public static void CreatePanels() - { - Windows.configForm = new UI.Window.Config(Windows.configPanel); - Windows.configPanel = Windows.configForm; - - Windows.treeForm = new UI.Window.Tree(Windows.treePanel); - Windows.treePanel = Windows.treeForm; - Tree.Node.TreeView = Windows.treeForm.tvConnections; - - Windows.errorsForm = new UI.Window.ErrorsAndInfos(Windows.errorsPanel); - Windows.errorsPanel = Windows.errorsForm; - - Windows.sessionsForm = new UI.Window.Sessions(Windows.sessionsPanel); - Windows.sessionsPanel = Windows.sessionsForm; - - Windows.screenshotForm = new UI.Window.ScreenshotManager(Windows.screenshotPanel); - Windows.screenshotPanel = Windows.screenshotForm; - - Windows.updateForm = new UI.Window.Update(Windows.updatePanel); - Windows.updatePanel = Windows.updateForm; - - Windows.AnnouncementForm = new UI.Window.Announcement(Windows.AnnouncementPanel); - Windows.AnnouncementPanel = Windows.AnnouncementForm; - } - - public static void SetDefaultLayout() - { - frmMain.Default.pnlDock.Visible = false; - - frmMain.Default.pnlDock.DockLeftPortion = frmMain.Default.pnlDock.Width * 0.2; - frmMain.Default.pnlDock.DockRightPortion = frmMain.Default.pnlDock.Width * 0.2; - frmMain.Default.pnlDock.DockTopPortion = frmMain.Default.pnlDock.Height * 0.25; - frmMain.Default.pnlDock.DockBottomPortion = frmMain.Default.pnlDock.Height * 0.25; - - Windows.treePanel.Show(frmMain.Default.pnlDock, DockState.DockLeft); - Windows.configPanel.Show(frmMain.Default.pnlDock); - Windows.configPanel.DockTo(Windows.treePanel.Pane, DockStyle.Bottom, -1); - - Windows.screenshotForm.Hide(); - - frmMain.Default.pnlDock.Visible = true; - } - - public static void GetConnectionIcons() - { - string iPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Icons\\"; - - if (Directory.Exists(iPath) == false) - { - return; - } - - foreach (string f in Directory.GetFiles(iPath, "*.ico", SearchOption.AllDirectories)) - { - FileInfo fInfo = new FileInfo(f); - - Array.Resize(ref Connection.Icon.Icons, Connection.Icon.Icons.Length + 1); - Connection.Icon.Icons.SetValue(fInfo.Name.Replace(".ico", ""), Connection.Icon.Icons.Length - 1); - } - } - - public static void CreateLogger() - { - log4net.Config.XmlConfigurator.Configure(); - - string logFilePath = ""; - #if !PORTABLE - logFilePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), System.Windows.Forms.Application.ProductName); - #else - logFilePath = System.Windows.Forms.Application.StartupPath; - #endif - string logFileName = Path.ChangeExtension(System.Windows.Forms.Application.ProductName, ".log"); - string logFile = Path.Combine(logFilePath, logFileName); - - log4net.Repository.ILoggerRepository repository = LogManager.GetRepository(); - log4net.Appender.IAppender[] appenders = repository.GetAppenders(); - log4net.Appender.FileAppender fileAppender = default(log4net.Appender.FileAppender); - foreach (log4net.Appender.IAppender appender in appenders) - { - fileAppender = appender as log4net.Appender.FileAppender; - if (!(fileAppender == null || !(fileAppender.Name == "LogFileAppender"))) - { - fileAppender.File = logFile; - fileAppender.ActivateOptions(); - } - } - - Log = LogManager.GetLogger("Logger"); - - if (My.Settings.Default.WriteLogFile) - { - #if !PORTABLE - Log.InfoFormat("{0} {1} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); - #else - Log.InfoFormat("{0} {1} {2} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion, My.Language.strLabelPortableEdition); - #endif - Log.InfoFormat("Command Line: {0}", Environment.GetCommandLineArgs()); - - string osVersion = string.Empty; - string servicePack = string.Empty; - try - { - foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get()) - { - osVersion = System.Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim(); - int servicePackNumber = System.Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion")); - if (!(servicePackNumber == 0)) - { - servicePack = string.Format("Service Pack {0}", servicePackNumber); - } - } - } - catch (Exception ex) - { - Log.WarnFormat("Error retrieving operating system information from WMI. {0}", ex.Message); - } - - string architecture = string.Empty; - try - { - foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get()) - { - int addressWidth = System.Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth")); - architecture = string.Format("{0}-bit", addressWidth); - } - } - catch (Exception ex) - { - Log.WarnFormat("Error retrieving operating system address width from WMI. {0}", ex.Message); - } - - Log.InfoFormat(string.Join(" ", Array.FindAll(new string[] {osVersion, servicePack, architecture}, s => !string.IsNullOrEmpty(System.Convert.ToString(s))))); - - Log.InfoFormat("Microsoft .NET CLR {0}", System.Environment.Version.ToString()); - Log.InfoFormat("System Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName); - } - } - - private static Update _appUpdate; - public static void CheckForUpdate() - { - if (_appUpdate == null) - { - _appUpdate = new Update(); - } - else if (_appUpdate.IsGetUpdateInfoRunning) - { - return ; - } - - DateTime nextUpdateCheck = System.Convert.ToDateTime(My.Settings.Default.CheckForUpdatesLastCheck.Add(TimeSpan.FromDays(System.Convert.ToDouble(My.Settings.Default.CheckForUpdatesFrequencyDays)))); - if (!My.Settings.Default.UpdatePending && DateTime.UtcNow < nextUpdateCheck) - { - return ; - } - - _appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted; - _appUpdate.GetUpdateInfoAsync(); - } - - private static void GetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e) - { - if (MainForm.InvokeRequired) - { - MainForm.Invoke(new AsyncCompletedEventHandler(GetUpdateInfoCompleted), new object[] {sender, e}); - return ; - } - - try - { - _appUpdate.GetUpdateInfoCompletedEvent -= GetUpdateInfoCompleted; - - if (e.Cancelled) - { - return ; - } - if (e.Error != null) - { - throw (e.Error); - } - - if (_appUpdate.IsUpdateAvailable()) - { - Windows.Show(UI.Window.Type.Update); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage("GetUpdateInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true); - } - } - - public static void CheckForAnnouncement() - { - if (_appUpdate == null) - { - _appUpdate = new Update(); - } - else if (_appUpdate.IsGetAnnouncementInfoRunning) - { - return ; - } - - _appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted; - _appUpdate.GetAnnouncementInfoAsync(); - } - - private static void GetAnnouncementInfoCompleted(object sender, AsyncCompletedEventArgs e) - { - if (MainForm.InvokeRequired) - { - MainForm.Invoke(new AsyncCompletedEventHandler(GetAnnouncementInfoCompleted), new object[] {sender, e}); - return ; - } - - try - { - _appUpdate.GetAnnouncementInfoCompletedEvent -= GetAnnouncementInfoCompleted; - - if (e.Cancelled) - { - return ; - } - if (e.Error != null) - { - throw (e.Error); - } - - if (_appUpdate.IsAnnouncementAvailable()) - { - Windows.Show(UI.Window.Type.Announcement); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage("GetAnnouncementInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true); - } - } - - public static void ParseCommandLineArgs() - { - try - { - Tools.Misc.CMDArguments cmd = new Tools.Misc.CMDArguments(Environment.GetCommandLineArgs()); - - string ConsParam = ""; - if (cmd["cons"] != null) - { - ConsParam = "cons"; - } - if (cmd["c"] != null) - { - ConsParam = "c"; - } - - string ResetPosParam = ""; - if (cmd["resetpos"] != null) - { - ResetPosParam = "resetpos"; - } - if (cmd["rp"] != null) - { - ResetPosParam = "rp"; - } - - string ResetPanelsParam = ""; - if (cmd["resetpanels"] != null) - { - ResetPanelsParam = "resetpanels"; - } - if (cmd["rpnl"] != null) - { - ResetPanelsParam = "rpnl"; - } - - string ResetToolbarsParam = ""; - if (cmd["resettoolbar"] != null) - { - ResetToolbarsParam = "resettoolbar"; - } - if (cmd["rtbr"] != null) - { - ResetToolbarsParam = "rtbr"; - } - - if (cmd["reset"] != null) - { - ResetPosParam = "rp"; - ResetPanelsParam = "rpnl"; - ResetToolbarsParam = "rtbr"; - } - - string NoReconnectParam = ""; - if (cmd["noreconnect"] != null) - { - NoReconnectParam = "noreconnect"; - } - if (cmd["norc"] != null) - { - NoReconnectParam = "norc"; - } - - if (!string.IsNullOrEmpty(ConsParam)) - { - if (File.Exists(cmd[ConsParam]) == false) - { - if (File.Exists((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam])) - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam]; - return; - } - else if (File.Exists(App.Info.Connections.DefaultConnectionsPath + "\\" + cmd[ConsParam])) - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = App.Info.Connections.DefaultConnectionsPath + "\\" + cmd[ConsParam]; - return; - } - } - else - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = cmd[ConsParam]; - return; - } - } - - if (!string.IsNullOrEmpty(ResetPosParam)) - { - My.Settings.Default.MainFormKiosk = false; - My.Settings.Default.MainFormLocation = new Point(999, 999); - My.Settings.Default.MainFormSize = new Size(900, 600); - My.Settings.Default.MainFormState = FormWindowState.Normal; - } - - if (!string.IsNullOrEmpty(ResetPanelsParam)) - { - My.Settings.Default.ResetPanels = true; - } - - if (!string.IsNullOrEmpty(NoReconnectParam)) - { - My.Settings.Default.NoReconnect = true; - } - - if (!string.IsNullOrEmpty(ResetToolbarsParam)) - { - My.Settings.Default.ResetToolbars = true; - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strCommandLineArgsCouldNotBeParsed + Environment.NewLine + ex.Message); - } - } - - public static void CreateSQLUpdateHandlerAndStartTimer() - { - if (My.Settings.Default.UseSQLServer == true) - { - Tools.Misc.SQLUpdateCheckFinished += SQLUpdateCheckFinished; - TimerSqlWatcher = new System.Timers.Timer(3000); - TimerSqlWatcher.Start(); - } - } - - public static void DestroySQLUpdateHandlerAndStopTimer() - { - try - { - //LastSqlUpdate = null; - Tools.Misc.SQLUpdateCheckFinished -= SQLUpdateCheckFinished; - if (TimerSqlWatcher != null) - { - TimerSqlWatcher.Stop(); - TimerSqlWatcher.Close(); - } - } - catch (Exception) - { - } - } - } - - public class Shutdown - { - public static void Quit(string updateFilePath = null) - { - _updateFilePath = updateFilePath; - frmMain.Default.Close(); - } - - public static void Cleanup() - { - try - { - Config.Putty.Sessions.StopWatcher(); - - if (NotificationAreaIcon != null) - { - if (NotificationAreaIcon.Disposed == false) - { - NotificationAreaIcon.Dispose(); - } - } - - if (My.Settings.Default.SaveConsOnExit) - { - SaveConnections(); - } - - Config.Settings.Save.SaveSettings(); - - IeBrowserEmulation.Unregister(); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strSettingsCouldNotBeSavedOrTrayDispose + Environment.NewLine + ex.Message, true); - } - } - - public static void StartUpdate() - { - if (!UpdatePending) - { - return ; - } - try - { - Process.Start(_updateFilePath); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "The update could not be started." + Environment.NewLine + ex.Message, true); - } - } - - private static string _updateFilePath = null; - - public static bool UpdatePending - { - get - { - return !string.IsNullOrEmpty(_updateFilePath); - } - } - } - #endregion - - #region Default Connection - public static mRemoteNG.Connection.ConnectionRecordImp DefaultConnectionFromSettings() - { - DefaultConnection = new mRemoteNG.Connection.ConnectionRecordImp(); - DefaultConnection.IsDefault = true; - return DefaultConnection; - } - - public static void DefaultConnectionToSettings() - { - My.Settings.Default.ConDefaultDescription = DefaultConnection.Description; - My.Settings.Default.ConDefaultIcon = DefaultConnection.Icon; - My.Settings.Default.ConDefaultUsername = DefaultConnection.Username; - My.Settings.Default.ConDefaultPassword = DefaultConnection.Password; - My.Settings.Default.ConDefaultDomain = DefaultConnection.Domain; - My.Settings.Default.ConDefaultProtocol = DefaultConnection.Protocol.ToString(); - My.Settings.Default.ConDefaultPuttySession = DefaultConnection.PuttySession; - My.Settings.Default.ConDefaultICAEncryptionStrength = DefaultConnection.ICAEncryption.ToString(); - My.Settings.Default.ConDefaultRDPAuthenticationLevel = DefaultConnection.RDPAuthenticationLevel.ToString(); - My.Settings.Default.ConDefaultLoadBalanceInfo = DefaultConnection.LoadBalanceInfo; - My.Settings.Default.ConDefaultUseConsoleSession = DefaultConnection.UseConsoleSession; - My.Settings.Default.ConDefaultUseCredSsp = DefaultConnection.UseCredSsp; - My.Settings.Default.ConDefaultRenderingEngine = DefaultConnection.RenderingEngine.ToString(); - My.Settings.Default.ConDefaultResolution = DefaultConnection.Resolution.ToString(); - My.Settings.Default.ConDefaultAutomaticResize = DefaultConnection.AutomaticResize; - My.Settings.Default.ConDefaultColors = DefaultConnection.Colors.ToString(); - My.Settings.Default.ConDefaultCacheBitmaps = DefaultConnection.CacheBitmaps; - My.Settings.Default.ConDefaultDisplayWallpaper = DefaultConnection.DisplayWallpaper; - My.Settings.Default.ConDefaultDisplayThemes = DefaultConnection.DisplayThemes; - My.Settings.Default.ConDefaultEnableFontSmoothing = DefaultConnection.EnableFontSmoothing; - My.Settings.Default.ConDefaultEnableDesktopComposition = DefaultConnection.EnableDesktopComposition; - My.Settings.Default.ConDefaultRedirectKeys = DefaultConnection.RedirectKeys; - My.Settings.Default.ConDefaultRedirectDiskDrives = DefaultConnection.RedirectDiskDrives; - My.Settings.Default.ConDefaultRedirectPrinters = DefaultConnection.RedirectPrinters; - My.Settings.Default.ConDefaultRedirectPorts = DefaultConnection.RedirectPorts; - My.Settings.Default.ConDefaultRedirectSmartCards = DefaultConnection.RedirectSmartCards; - My.Settings.Default.ConDefaultRedirectSound = DefaultConnection.RedirectSound.ToString(); - My.Settings.Default.ConDefaultPreExtApp = DefaultConnection.PreExtApp; - My.Settings.Default.ConDefaultPostExtApp = DefaultConnection.PostExtApp; - My.Settings.Default.ConDefaultMacAddress = DefaultConnection.MacAddress; - My.Settings.Default.ConDefaultUserField = DefaultConnection.UserField; - My.Settings.Default.ConDefaultVNCAuthMode = DefaultConnection.VNCAuthMode.ToString(); - My.Settings.Default.ConDefaultVNCColors = DefaultConnection.VNCColors.ToString(); - My.Settings.Default.ConDefaultVNCCompression = DefaultConnection.VNCCompression.ToString(); - My.Settings.Default.ConDefaultVNCEncoding = DefaultConnection.VNCEncoding.ToString(); - My.Settings.Default.ConDefaultVNCProxyIP = DefaultConnection.VNCProxyIP; - My.Settings.Default.ConDefaultVNCProxyPassword = DefaultConnection.VNCProxyPassword; - My.Settings.Default.ConDefaultVNCProxyPort = DefaultConnection.VNCProxyPort; - My.Settings.Default.ConDefaultVNCProxyType = DefaultConnection.VNCProxyType.ToString(); - My.Settings.Default.ConDefaultVNCProxyUsername = DefaultConnection.VNCProxyUsername; - My.Settings.Default.ConDefaultVNCSmartSizeMode = DefaultConnection.VNCSmartSizeMode.ToString(); - My.Settings.Default.ConDefaultVNCViewOnly = DefaultConnection.VNCViewOnly; - My.Settings.Default.ConDefaultExtApp = DefaultConnection.ExtApp; - My.Settings.Default.ConDefaultRDGatewayUsageMethod = DefaultConnection.RDGatewayUsageMethod.ToString(); - My.Settings.Default.ConDefaultRDGatewayHostname = DefaultConnection.RDGatewayHostname; - My.Settings.Default.ConDefaultRDGatewayUsername = DefaultConnection.RDGatewayUsername; - My.Settings.Default.ConDefaultRDGatewayPassword = DefaultConnection.RDGatewayPassword; - My.Settings.Default.ConDefaultRDGatewayDomain = DefaultConnection.RDGatewayDomain; - My.Settings.Default.ConDefaultRDGatewayUseConnectionCredentials = DefaultConnection.RDGatewayUseConnectionCredentials.ToString(); - } - #endregion - - #region Default Inheritance - public static ConnectionRecordInheritanceController DefaultInheritanceFromSettings() - { - DefaultInheritance = new ConnectionRecordInheritanceImp(null); - DefaultInheritance.IsDefault = true; - return DefaultInheritance; - } - - public static void DefaultInheritanceToSettings() - { - My.Settings.Default.InhDefaultDescription = DefaultInheritance.Description; - My.Settings.Default.InhDefaultIcon = DefaultInheritance.Icon; - My.Settings.Default.InhDefaultPanel = DefaultInheritance.Panel; - My.Settings.Default.InhDefaultUsername = DefaultInheritance.Username; - My.Settings.Default.InhDefaultPassword = DefaultInheritance.Password; - My.Settings.Default.InhDefaultDomain = DefaultInheritance.Domain; - My.Settings.Default.InhDefaultProtocol = DefaultInheritance.Protocol; - My.Settings.Default.InhDefaultPort = DefaultInheritance.Port; - My.Settings.Default.InhDefaultPuttySession = DefaultInheritance.PuttySession; - My.Settings.Default.InhDefaultUseConsoleSession = DefaultInheritance.UseConsoleSession; - My.Settings.Default.InhDefaultUseCredSsp = DefaultInheritance.UseCredSsp; - My.Settings.Default.InhDefaultRenderingEngine = DefaultInheritance.RenderingEngine; - My.Settings.Default.InhDefaultICAEncryptionStrength = DefaultInheritance.ICAEncryption; - My.Settings.Default.InhDefaultRDPAuthenticationLevel = DefaultInheritance.RDPAuthenticationLevel; - My.Settings.Default.InhDefaultLoadBalanceInfo = DefaultInheritance.LoadBalanceInfo; - My.Settings.Default.InhDefaultResolution = DefaultInheritance.Resolution; - My.Settings.Default.InhDefaultAutomaticResize = DefaultInheritance.AutomaticResize; - My.Settings.Default.InhDefaultColors = DefaultInheritance.Colors; - My.Settings.Default.InhDefaultCacheBitmaps = DefaultInheritance.CacheBitmaps; - My.Settings.Default.InhDefaultDisplayWallpaper = DefaultInheritance.DisplayWallpaper; - My.Settings.Default.InhDefaultDisplayThemes = DefaultInheritance.DisplayThemes; - My.Settings.Default.InhDefaultEnableFontSmoothing = DefaultInheritance.EnableFontSmoothing; - My.Settings.Default.InhDefaultEnableDesktopComposition = DefaultInheritance.EnableDesktopComposition; - My.Settings.Default.InhDefaultRedirectKeys = DefaultInheritance.RedirectKeys; - My.Settings.Default.InhDefaultRedirectDiskDrives = DefaultInheritance.RedirectDiskDrives; - My.Settings.Default.InhDefaultRedirectPrinters = DefaultInheritance.RedirectPrinters; - My.Settings.Default.InhDefaultRedirectPorts = DefaultInheritance.RedirectPorts; - My.Settings.Default.InhDefaultRedirectSmartCards = DefaultInheritance.RedirectSmartCards; - My.Settings.Default.InhDefaultRedirectSound = DefaultInheritance.RedirectSound; - My.Settings.Default.InhDefaultPreExtApp = DefaultInheritance.PreExtApp; - My.Settings.Default.InhDefaultPostExtApp = DefaultInheritance.PostExtApp; - My.Settings.Default.InhDefaultMacAddress = DefaultInheritance.MacAddress; - My.Settings.Default.InhDefaultUserField = DefaultInheritance.UserField; - // VNC inheritance - My.Settings.Default.InhDefaultVNCAuthMode = DefaultInheritance.VNCAuthMode; - My.Settings.Default.InhDefaultVNCColors = DefaultInheritance.VNCColors; - My.Settings.Default.InhDefaultVNCCompression = DefaultInheritance.VNCCompression; - My.Settings.Default.InhDefaultVNCEncoding = DefaultInheritance.VNCEncoding; - My.Settings.Default.InhDefaultVNCProxyIP = DefaultInheritance.VNCProxyIP; - My.Settings.Default.InhDefaultVNCProxyPassword = DefaultInheritance.VNCProxyPassword; - My.Settings.Default.InhDefaultVNCProxyPort = DefaultInheritance.VNCProxyPort; - My.Settings.Default.InhDefaultVNCProxyType = DefaultInheritance.VNCProxyType; - My.Settings.Default.InhDefaultVNCProxyUsername = DefaultInheritance.VNCProxyUsername; - My.Settings.Default.InhDefaultVNCSmartSizeMode = DefaultInheritance.VNCSmartSizeMode; - My.Settings.Default.InhDefaultVNCViewOnly = DefaultInheritance.VNCViewOnly; - // Ext. App inheritance - My.Settings.Default.InhDefaultExtApp = DefaultInheritance.ExtApp; - // RDP gateway inheritance - My.Settings.Default.InhDefaultRDGatewayUsageMethod = DefaultInheritance.RDGatewayUsageMethod; - My.Settings.Default.InhDefaultRDGatewayHostname = DefaultInheritance.RDGatewayHostname; - My.Settings.Default.InhDefaultRDGatewayUsername = DefaultInheritance.RDGatewayUsername; - My.Settings.Default.InhDefaultRDGatewayPassword = DefaultInheritance.RDGatewayPassword; - My.Settings.Default.InhDefaultRDGatewayDomain = DefaultInheritance.RDGatewayDomain; - My.Settings.Default.InhDefaultRDGatewayUseConnectionCredentials = DefaultInheritance.RDGatewayUseConnectionCredentials; - } - #endregion - - #region Panels - public static System.Windows.Forms.Form AddPanel(string title = "", bool noTabber = false) - { - try - { - if (title == "") - { - title = My.Language.strNewPanel; - } - - DockContent pnlcForm = new DockContent(); - UI.Window.Connection cForm = new UI.Window.Connection(pnlcForm); - pnlcForm = cForm; - - //create context menu - ContextMenuStrip cMen = new ContextMenuStrip(); - - //create rename item - ToolStripMenuItem cMenRen = new ToolStripMenuItem(); - cMenRen.Text = My.Language.strRename; - cMenRen.Image = My.Resources.Rename; - cMenRen.Tag = pnlcForm; - cMenRen.Click += cMenConnectionPanelRename_Click; - - ToolStripMenuItem cMenScreens = new ToolStripMenuItem(); - cMenScreens.Text = My.Language.strSendTo; - cMenScreens.Image = My.Resources.Monitor; - cMenScreens.Tag = pnlcForm; - cMenScreens.DropDownItems.Add("Dummy"); - cMenScreens.DropDownOpening += cMenConnectionPanelScreens_DropDownOpening; - - cMen.Items.AddRange(new ToolStripMenuItem[] {cMenRen, cMenScreens}); - - pnlcForm.TabPageContextMenuStrip = cMen; - - (cForm as UI.Window.Connection).SetFormText(title.Replace("&", "&&")); - - pnlcForm.Show(frmMain.Default.pnlDock, DockState.Document); - - if (noTabber) - { - (cForm as UI.Window.Connection).TabController.Dispose(); - } - else - { - WindowList.Add(cForm); - } - - return cForm; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t add panel" + Environment.NewLine + ex.Message); - return null; - } - } - - private static void cMenConnectionPanelRename_Click(System.Object sender, System.EventArgs e) - { - try - { - UI.Window.Connection conW = default(UI.Window.Connection); - conW = (UI.Window.Connection)((System.Windows.Forms.Control)sender).Tag; - - string nTitle = Interaction.InputBox(Prompt: My.Language.strNewTitle + ":", DefaultResponse: System.Convert.ToString(((System.Windows.Forms.Control)((System.Windows.Forms.Control)sender).Tag).Text.Replace("&&", "&"))); - - if (!string.IsNullOrEmpty(nTitle)) - { - conW.SetFormText(nTitle.Replace("&", "&&")); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t rename panel" + Environment.NewLine + ex.Message); - } - } - - private static void cMenConnectionPanelScreens_DropDownOpening(System.Object sender, System.EventArgs e) - { - try - { - ToolStripMenuItem cMenScreens = (ToolStripMenuItem)sender; - cMenScreens.DropDownItems.Clear(); - - for (int i = 0; i <= Screen.AllScreens.Length - 1; i++) - { - ToolStripMenuItem cMenScreen = new ToolStripMenuItem(My.Language.strScreen + " " + System.Convert.ToString(i + 1)); - cMenScreen.Tag = new ArrayList(); - cMenScreen.Image = My.Resources.Monitor_GoTo; - (cMenScreen.Tag as ArrayList).Add(Screen.AllScreens[i]); - (cMenScreen.Tag as ArrayList).Add(cMenScreens.Tag); - cMenScreen.Click += cMenConnectionPanelScreen_Click; - cMenScreens.DropDownItems.Add(cMenScreen); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t enumerate screens" + Environment.NewLine + ex.Message); - } - } - - private static void cMenConnectionPanelScreen_Click(object sender, System.EventArgs e) - { - System.Windows.Forms.Screen screen = null; - WeifenLuo.WinFormsUI.Docking.DockContent panel = null; - try - { - IEnumerable tagEnumeration = (IEnumerable)((ToolStripMenuItem)sender).Tag; - if (tagEnumeration != null) - { - foreach (Object obj in tagEnumeration) - { - if (obj is System.Windows.Forms.Screen) - { - screen = (System.Windows.Forms.Screen)obj; - } - else if (obj is WeifenLuo.WinFormsUI.Docking.DockContent) - { - panel = (WeifenLuo.WinFormsUI.Docking.DockContent)obj; - } - } - Screens.SendPanelToScreen(panel, screen); - } - } - catch (Exception) - { - } - } - #endregion - - #region Credential Loading/Saving - public static void LoadCredentials() - { - - } - #endregion - - #region Connections Loading/Saving - public static void NewConnections(string filename) - { - try - { - ConnectionList = new Connection.ConnectionList(); - ContainerList = new Container.List(); - - mRemoteNG.Config.Connections.Load connectionsLoad = new Config.Connections.Load(); - - if (filename == GetDefaultStartupConnectionFileName()) - { - My.Settings.Default.LoadConsFromCustomLocation = false; - } - else - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = filename; - } - - Directory.CreateDirectory(Path.GetDirectoryName(filename)); - - // Use File.Open with FileMode.CreateNew so that we don't overwrite an existing file - using (FileStream fileStream = File.Open(filename, FileMode.CreateNew, FileAccess.Write, FileShare.None)) - { - using (XmlTextWriter xmlTextWriter = new XmlTextWriter(fileStream, System.Text.Encoding.UTF8)) - { - xmlTextWriter.Formatting = Formatting.Indented; - xmlTextWriter.Indentation = 4; - - xmlTextWriter.WriteStartDocument(); - - xmlTextWriter.WriteStartElement("Connections"); // Do not localize - xmlTextWriter.WriteAttributeString("Name", My.Language.strConnections); - xmlTextWriter.WriteAttributeString("Export", "", "False"); - xmlTextWriter.WriteAttributeString("Protected", "", "GiUis20DIbnYzWPcdaQKfjE2H5jh//L5v4RGrJMGNXuIq2CttB/d/BxaBP2LwRhY"); - xmlTextWriter.WriteAttributeString("ConfVersion", "", "2.5"); - - xmlTextWriter.WriteEndElement(); - xmlTextWriter.WriteEndDocument(); - - xmlTextWriter.Close(); - } - - } - - - connectionsLoad.ConnectionList = ConnectionList; - connectionsLoad.ContainerList = ContainerList; - - Tree.Node.ResetTree(); - - connectionsLoad.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; - - // Load config - connectionsLoad.ConnectionFileName = filename; - connectionsLoad.LoadConnections(false); - - Windows.treeForm.tvConnections.SelectedNode = connectionsLoad.RootTreeNode; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage(My.Language.strCouldNotCreateNewConnectionsFile, ex, MessageClass.ErrorMsg); - } - } - - private static void LoadConnectionsBG(bool WithDialog = false, bool Update = false) - { - _withDialog = false; - _loadUpdate = true; - - Thread t = new Thread(new System.Threading.ThreadStart(LoadConnectionsBGd)); - t.SetApartmentState(System.Threading.ApartmentState.STA); - t.Start(); - } - - private static bool _withDialog = false; - private static bool _loadUpdate = false; - private static void LoadConnectionsBGd() - { - LoadConnections(_withDialog, _loadUpdate); - } - - public static void LoadConnections(bool withDialog = false, bool update = false) - { - mRemoteNG.Config.Connections.Load connectionsLoad = new mRemoteNG.Config.Connections.Load(); - - try - { - bool tmrWasEnabled = false; - if (TimerSqlWatcher != null) - { - tmrWasEnabled = TimerSqlWatcher.Enabled; - - if (TimerSqlWatcher.Enabled == true) - { - TimerSqlWatcher.Stop(); - } - } - - if (ConnectionList != null && ContainerList != null) - { - PreviousConnectionList = ConnectionList.Copy(); - PreviousContainerList = ContainerList.Copy(); - } - - ConnectionList = new Connection.ConnectionList(); - ContainerList = new Container.List(); - - if (!My.Settings.Default.UseSQLServer) - { - if (withDialog) - { - OpenFileDialog loadDialog = Tools.Controls.ConnectionsLoadDialog(); - - if (loadDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) - { - connectionsLoad.ConnectionFileName = loadDialog.FileName; - } - else - { - return; - } - } - else - { - connectionsLoad.ConnectionFileName = GetStartupConnectionFileName(); - } - - CreateBackupFile(System.Convert.ToString(connectionsLoad.ConnectionFileName)); - } - - connectionsLoad.ConnectionList = ConnectionList; - connectionsLoad.ContainerList = ContainerList; - - if (PreviousConnectionList != null && PreviousContainerList != null) - { - connectionsLoad.PreviousConnectionList = PreviousConnectionList; - connectionsLoad.PreviousContainerList = PreviousContainerList; - } - - if (update == true) - { - connectionsLoad.PreviousSelected = LastSelected; - } - - Tree.Node.ResetTree(); - - connectionsLoad.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; - - connectionsLoad.UseSQL = My.Settings.Default.UseSQLServer; - connectionsLoad.SQLHost = My.Settings.Default.SQLHost; - connectionsLoad.SQLDatabaseName = My.Settings.Default.SQLDatabaseName; - connectionsLoad.SQLUsername = My.Settings.Default.SQLUser; - connectionsLoad.SQLPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), Info.General.EncryptionKey); - connectionsLoad.SQLUpdate = update; - - connectionsLoad.LoadConnections(false); - - if (My.Settings.Default.UseSQLServer == true) - { - LastSqlUpdate = DateTime.Now; - } - else - { - if (connectionsLoad.ConnectionFileName == GetDefaultStartupConnectionFileName()) - { - My.Settings.Default.LoadConsFromCustomLocation = false; - } - else - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = connectionsLoad.ConnectionFileName; - } - } - - if (tmrWasEnabled && TimerSqlWatcher != null) - { - TimerSqlWatcher.Start(); - } - } - catch (Exception ex) - { - if (My.Settings.Default.UseSQLServer) - { - Runtime.MessageCollector.AddExceptionMessage(My.Language.strLoadFromSqlFailed, ex); - string commandButtons = string.Join("|", new[] {My.Language.strCommandTryAgain, My.Language.strCommandOpenConnectionFile, string.Format(My.Language.strCommandExitProgram, System.Windows.Forms.Application.ProductName)}); - cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, My.Language.strLoadFromSqlFailed, My.Language.strLoadFromSqlFailedContent, Misc.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, eSysIcons.Error, eSysIcons.Error); - switch (cTaskDialog.CommandButtonResult) - { - case 0: - LoadConnections(withDialog, update); - return ; - case 1: - My.Settings.Default.UseSQLServer = false; - LoadConnections(true, update); - return ; - default: - Application.Exit(); - return ; - } - } - else - { - if (ex is FileNotFoundException&& !withDialog) - { - Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoad.ConnectionFileName), ex, MessageClass.InformationMsg); - NewConnections(System.Convert.ToString(connectionsLoad.ConnectionFileName)); - return ; - } - - Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotBeLoaded, connectionsLoad.ConnectionFileName), ex); - if (!(connectionsLoad.ConnectionFileName == GetStartupConnectionFileName())) - { - LoadConnections(withDialog, update); - return ; - } - else - { - Interaction.MsgBox(string.Format(My.Language.strErrorStartupConnectionFileLoad, Environment.NewLine, System.Windows.Forms.Application.ProductName, GetStartupConnectionFileName(), Misc.GetExceptionMessageRecursive(ex)), (int) MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, null); - Application.Exit(); - return ; - } - } - } - } - - protected static void CreateBackupFile(string fileName) - { - // This intentionally doesn't prune any existing backup files. We just assume the user doesn't want any new ones created. - if (My.Settings.Default.BackupFileKeepCount == 0) - { - return ; - } - - try - { - string backupFileName = string.Format(My.Settings.Default.BackupFileNameFormat, fileName, DateTime.UtcNow); - File.Copy(fileName, backupFileName); - PruneBackupFiles(fileName); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage(My.Language.strConnectionsFileBackupFailed, ex, MessageClass.WarningMsg); - throw; - } - } - - protected static void PruneBackupFiles(string baseName) - { - string fileName = Path.GetFileName(baseName); - string directoryName = Path.GetDirectoryName(baseName); - - if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(directoryName)) - { - return ; - } - - string searchPattern = string.Format(My.Settings.Default.BackupFileNameFormat, fileName, "*"); - string[] files = Directory.GetFiles(directoryName, searchPattern); - - if (files.Length <= My.Settings.Default.BackupFileKeepCount) - { - return ; - } - - Array.Sort(files); - Array.Resize(ref files, files.Length - My.Settings.Default.BackupFileKeepCount); - - foreach (string file in files) - { - System.IO.File.Delete(file); - } - } - - public static string GetDefaultStartupConnectionFileName() - { - string newPath = App.Info.Connections.DefaultConnectionsPath + "\\" + Info.Connections.DefaultConnectionsFile; - #if !PORTABLE - string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + Info.Connections.DefaultConnectionsFile; - if (File.Exists(oldPath)) - { - return oldPath; - } - #endif - return newPath; - } - - public static string GetStartupConnectionFileName() - { - if (My.Settings.Default.LoadConsFromCustomLocation == false) - { - return GetDefaultStartupConnectionFileName(); - } - else - { - return My.Settings.Default.CustomConsPath; - } - } - - public static void SaveConnectionsBG() - { - _saveUpdate = true; - - Thread t = new Thread(new System.Threading.ThreadStart(SaveConnectionsBGd)); - t.SetApartmentState(System.Threading.ApartmentState.STA); - t.Start(); - } - - private static bool _saveUpdate = false; - private static object _saveLock = new object(); - private static void SaveConnectionsBGd() - { - Monitor.Enter(_saveLock); - SaveConnections(_saveUpdate); - Monitor.Exit(_saveLock); - } - - public static void SaveConnections(bool Update = false) - { - if (!IsConnectionsFileLoaded) - { - return; - } - - bool previousTimerState = false; - - try - { - if (Update == true && My.Settings.Default.UseSQLServer == false) - { - return; - } - - if (TimerSqlWatcher != null) - { - previousTimerState = TimerSqlWatcher.Enabled; - TimerSqlWatcher.Enabled = false; - } - - Config.Connections.Save conS = new Config.Connections.Save(); - - if (!My.Settings.Default.UseSQLServer) - { - conS.ConnectionFileName = GetStartupConnectionFileName(); - } - - conS.ConnectionList = ConnectionList; - conS.ContainerList = ContainerList; - conS.Export = false; - conS.SaveSecurity = new Security.Save(false); - conS.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; - - if (My.Settings.Default.UseSQLServer == true) - { - conS.SaveFormat = Config.Connections.Save.Format.SQL; - conS.SQLHost = System.Convert.ToString(My.Settings.Default.SQLHost); - conS.SQLDatabaseName = System.Convert.ToString(My.Settings.Default.SQLDatabaseName); - conS.SQLUsername = System.Convert.ToString(My.Settings.Default.SQLUser); - conS.SQLPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), App.Info.General.EncryptionKey); - } - - conS.SaveConnections(); - - if (My.Settings.Default.UseSQLServer == true) - { - LastSqlUpdate = DateTime.Now; - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionsFileCouldNotBeSaved + Environment.NewLine + ex.Message); - } - finally - { - if (TimerSqlWatcher != null) - { - TimerSqlWatcher.Enabled = previousTimerState; - } - } - } - - public static void SaveConnectionsAs() - { - bool previousTimerState = false; - mRemoteNG.Config.Connections.Save connectionsSave = new mRemoteNG.Config.Connections.Save(); - - try - { - if (TimerSqlWatcher != null) - { - previousTimerState = TimerSqlWatcher.Enabled; - TimerSqlWatcher.Enabled = false; - } - - using (SaveFileDialog saveFileDialog = new SaveFileDialog()) - { - saveFileDialog.CheckPathExists = true; - saveFileDialog.InitialDirectory = Info.Connections.DefaultConnectionsPath; - saveFileDialog.FileName = Info.Connections.DefaultConnectionsFile; - saveFileDialog.OverwritePrompt = true; - - ConnectionList fileTypes = new List(); - fileTypes.AddRange(new[] {My.Language.strFiltermRemoteXML, "*.xml"}); - fileTypes.AddRange(new[] {My.Language.strFilterAll, "*.*"}); - - saveFileDialog.Filter = string.Join("|", fileTypes.ToArray()); - - if (!(saveFileDialog.ShowDialog(frmMain.Default) == DialogResult.OK)) - { - return ; - } - - connectionsSave.SaveFormat = mRemoteNG.Config.Connections.Save.Format.mRXML; - connectionsSave.ConnectionFileName = saveFileDialog.FileName; - connectionsSave.Export = false; - connectionsSave.SaveSecurity = new Security.Save(); - connectionsSave.ConnectionList = ConnectionList; - connectionsSave.ContainerList = ContainerList; - connectionsSave.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; - - connectionsSave.SaveConnections(); - - if (saveFileDialog.FileName == GetDefaultStartupConnectionFileName()) - { - My.Settings.Default.LoadConsFromCustomLocation = false; - } - else - { - My.Settings.Default.LoadConsFromCustomLocation = true; - My.Settings.Default.CustomConsPath = saveFileDialog.FileName; - } - } - - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotSaveAs, connectionsSave.ConnectionFileName), ex); - } - finally - { - if (TimerSqlWatcher != null) - { - TimerSqlWatcher.Enabled = previousTimerState; - } - } - } - #endregion - - #region Opening Connection - public static Connection.ConnectionRecordImp CreateQuickConnect(string connectionString, Protocols protocol) - { - try - { - Uri uri = new Uri("dummyscheme" + System.Uri.SchemeDelimiter + connectionString); - if (string.IsNullOrEmpty(uri.Host)) - { - return null; - } - - Connection.ConnectionRecordImp newConnectionInfo = new Connection.ConnectionRecordImp(); - - if (My.Settings.Default.IdentifyQuickConnectTabs) - { - newConnectionInfo.Name = string.Format(My.Language.strQuick, uri.Host); - } - else - { - newConnectionInfo.Name = uri.Host; - } - - newConnectionInfo.Protocol = protocol; - newConnectionInfo.Hostname = uri.Host; - if (uri.Port == -1) - { - newConnectionInfo.SetDefaultPort(); - } - else - { - newConnectionInfo.Port = uri.Port; - } - newConnectionInfo.IsQuickConnect = true; - - return newConnectionInfo; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage(My.Language.strQuickConnectFailed, ex, MessageClass.ErrorMsg); - return null; - } - } - - public static void OpenConnection() - { - try - { - OpenConnection(Connection.ConnectionRecordImp.Force.None); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static void OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force Force) - { - try - { - if (Windows.treeForm.tvConnections.SelectedNode.Tag == null) - { - return; - } - - if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttySession) - { - OpenConnection((mRemoteNG.Connection.ConnectionRecordImp)Windows.treeForm.tvConnections.SelectedNode.Tag, Force); - } - else if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Container) - { - foreach (TreeNode tNode in Tree.Node.SelectedNode.Nodes) - { - if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttySession) - { - if (tNode.Tag != null) - { - OpenConnection((mRemoteNG.Connection.ConnectionRecordImp)tNode.Tag, Force); - } - } - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static void OpenConnection(mRemoteNG.Connection.ConnectionRecordImp ConnectionInfo) - { - try - { - OpenConnection(ConnectionInfo, Connection.ConnectionRecordImp.Force.None); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static void OpenConnection(mRemoteNG.Connection.ConnectionRecordImp ConnectionInfo, System.Windows.Forms.Form ConnectionForm) - { - try - { - OpenConnectionFinal(ConnectionInfo, Connection.ConnectionRecordImp.Force.None, ConnectionForm); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static void OpenConnection(mRemoteNG.Connection.ConnectionRecordImp ConnectionInfo, System.Windows.Forms.Form ConnectionForm, Connection.ConnectionRecordImp.Force Force) - { - try - { - OpenConnectionFinal(ConnectionInfo, Force, ConnectionForm); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static void OpenConnection(mRemoteNG.Connection.ConnectionRecordImp ConnectionInfo, mRemoteNG.Connection.ConnectionRecordImp.Force Force) - { - try - { - OpenConnectionFinal(ConnectionInfo, Force, null); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - private static void OpenConnectionFinal(mRemoteNG.Connection.ConnectionRecordImp newConnectionInfo, mRemoteNG.Connection.ConnectionRecordImp.Force Force, System.Windows.Forms.Form ConForm) - { - try - { - if (newConnectionInfo.Hostname == "" && newConnectionInfo.Protocol != Connection.Protocol.Protocols.IntApp) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strConnectionOpenFailedNoHostname); - return; - } - - if (newConnectionInfo.PreExtApp != "") - { - Tools.ExternalTool extA = App.Runtime.GetExtAppByName(newConnectionInfo.PreExtApp); - if (extA != null) - { - extA.Start(newConnectionInfo); - } - } - - if ((Force & Connection.ConnectionRecordImp.Force.DoNotJump) != Connection.ConnectionRecordImp.Force.DoNotJump) - { - if (SwitchToOpenConnection(newConnectionInfo)) - { - return; - } - } - - Base newProtocol = default(Base); - // Create connection based on protocol type - switch (newConnectionInfo.Protocol) - { - case Protocols.RDP: - newProtocol = new RDPConnectionProtocolImp(); - ((RDPConnectionProtocolImp) newProtocol).tmrReconnect.Elapsed += ((RDPConnectionProtocolImp) newProtocol).tmrReconnect_Elapsed; - ((RDPConnectionProtocolImp) newProtocol).tmrReconnect.Elapsed += ((RDPConnectionProtocolImp) newProtocol).tmrReconnect_Elapsed; - break; - case Protocols.VNC: - newProtocol = new VNC(); - break; - case Protocols.SSH1: - newProtocol = new SSH1(); - break; - case Protocols.SSH2: - newProtocol = new SSH2(); - break; - case Protocols.Telnet: - newProtocol = new Telnet(); - break; - case Protocols.Rlogin: - newProtocol = new Rlogin(); - break; - case Protocols.RAW: - newProtocol = new RAW(); - break; - case Protocols.HTTP: - newProtocol = new HTTP(newConnectionInfo.RenderingEngine); - break; - case Protocols.HTTPS: - newProtocol = new HTTPS(newConnectionInfo.RenderingEngine); - break; - case Protocols.ICA: - newProtocol = new ICA(); - ((ICA) newProtocol).tmrReconnect.Elapsed += ((ICA) newProtocol).tmrReconnect_Elapsed; - ((ICA) newProtocol).tmrReconnect.Elapsed += ((ICA) newProtocol).tmrReconnect_Elapsed; - break; - case Protocols.IntApp: - newProtocol = new IntegratedProgram(); - - if (newConnectionInfo.ExtApp == "") - { - throw (new Exception(My.Language.strNoExtAppDefined)); - } - break; - default: - return; - } - - Control cContainer = default(Control); - System.Windows.Forms.Form cForm = default(System.Windows.Forms.Form); - - string cPnl = ""; - if (newConnectionInfo.Panel == "" || (Force & Connection.ConnectionRecordImp.Force.OverridePanel) == Connection.ConnectionRecordImp.Force.OverridePanel | My.Settings.Default.AlwaysShowPanelSelectionDlg) - { - frmChoosePanel frmPnl = new frmChoosePanel(); - if (frmPnl.ShowDialog() == DialogResult.OK) - { - cPnl = frmPnl.Panel; - } - else - { - return; - } - } - else - { - cPnl = newConnectionInfo.Panel; - } - - if (ConForm == null) - { - cForm = WindowList.FromString(cPnl); - } - else - { - cForm = ConForm; - } - - if (cForm == null) - { - cForm = AddPanel(cPnl); - cForm.Focus(); - } - else - { - (cForm as UI.Window.Connection).Show(frmMain.Default.pnlDock); - (cForm as UI.Window.Connection).Focus(); - } - - cContainer = ((UI.Window.Connection)cForm).AddConnectionTab(newConnectionInfo); - - if (newConnectionInfo.Protocol == Connection.Protocol.Protocols.IntApp) - { - if (App.Runtime.GetExtAppByName(newConnectionInfo.ExtApp).Icon != null) - { - (cContainer as Crownwood.Magic.Controls.TabPage).Icon = App.Runtime.GetExtAppByName(newConnectionInfo.ExtApp).Icon; - } - } - - newProtocol.Closed += ((UI.Window.Connection)cForm).Prot_Event_Closed; - - newProtocol.Disconnected += Prot_Event_Disconnected; - newProtocol.Connected += Prot_Event_Connected; - newProtocol.Closed += Prot_Event_Closed; - newProtocol.ErrorOccured += Prot_Event_ErrorOccured; - - newProtocol.InterfaceControl = new Connection.InterfaceControl(cContainer, newProtocol, newConnectionInfo); - - newProtocol.Force = Force; - - if (newProtocol.SetProps() == false) - { - newProtocol.Close(); - return; - } - - if (newProtocol.Connect() == false) - { - newProtocol.Close(); - return; - } - - newConnectionInfo.OpenConnections.Add(newProtocol); - - if (newConnectionInfo.IsQuickConnect == false) - { - if (newConnectionInfo.Protocol != Connection.Protocol.Protocols.IntApp) - { - Tree.Node.SetNodeImage(newConnectionInfo.TreeNode, Images.Enums.TreeImage.ConnectionOpen); - } - else - { - Tools.ExternalTool extApp = GetExtAppByName(newConnectionInfo.ExtApp); - if (extApp != null) - { - if (extApp.TryIntegrate) - { - if (newConnectionInfo.TreeNode != null) - { - Tree.Node.SetNodeImage(newConnectionInfo.TreeNode, Images.Enums.TreeImage.ConnectionOpen); - } - } - } - } - } - - frmMain.Default.SelectedConnection = newConnectionInfo; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); - } - } - - public static bool SwitchToOpenConnection(Connection.ConnectionRecordImp nCi) - { - mRemoteNG.Connection.InterfaceControl IC = FindConnectionContainer(nCi); - - if (IC != null) - { - (IC.FindForm() as UI.Window.Connection).Focus(); - (IC.FindForm() as UI.Window.Connection).Show(frmMain.Default.pnlDock); - Crownwood.Magic.Controls.TabPage t = (Crownwood.Magic.Controls.TabPage) IC.Parent; - t.Selected = true; - return true; - } - - return false; - } - #endregion - - #region Event Handlers - public static void Prot_Event_Disconnected(object sender, string DisconnectedMessage) - { - try - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(My.Language.strProtocolEventDisconnected, DisconnectedMessage), true); - - Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender; - if (Prot.InterfaceControl.Info.Protocol == Connection.Protocol.Protocols.RDP) - { - string[] Reason = DisconnectedMessage.Split("\r\n".ToCharArray()); - string ReasonCode = Reason[0]; - string ReasonDescription = Reason[1]; - if (System.Convert.ToInt32(ReasonCode) > 3) - { - if (!string.IsNullOrEmpty(ReasonDescription)) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strRdpDisconnected + Environment.NewLine + ReasonDescription + Environment.NewLine + string.Format(My.Language.strErrorCode, ReasonCode)); - } - else - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strRdpDisconnected + Environment.NewLine + string.Format(My.Language.strErrorCode, ReasonCode)); - } - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(My.Language.strProtocolEventDisconnectFailed, ex.Message), true); - } - } - - public static void Prot_Event_Closed(object sender) - { - try - { - Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender; - - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnenctionCloseEvent, true); - - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ReportMsg, string.Format(My.Language.strConnenctionClosedByUser, Prot.InterfaceControl.Info.Hostname, Prot.InterfaceControl.Info.Protocol.ToString(), (new Microsoft.VisualBasic.ApplicationServices.User()).Name)); - - Prot.InterfaceControl.Info.OpenConnections.Remove(Prot); - - if (Prot.InterfaceControl.Info.OpenConnections.Count < 1 && Prot.InterfaceControl.Info.IsQuickConnect == false) - { - Tree.Node.SetNodeImage(Prot.InterfaceControl.Info.TreeNode, Images.Enums.TreeImage.ConnectionClosed); - } - - if (Prot.InterfaceControl.Info.PostExtApp != "") - { - Tools.ExternalTool extA = App.Runtime.GetExtAppByName(Prot.InterfaceControl.Info.PostExtApp); - if (extA != null) - { - extA.Start(Prot.InterfaceControl.Info); - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnenctionCloseEventFailed + Environment.NewLine + ex.Message, true); - } - } - - public static void Prot_Event_Connected(object sender) - { - mRemoteNG.Connection.Protocol.Base prot = (Connection.Protocol.Base)sender; - - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnectionEventConnected, true); - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ReportMsg, string.Format(My.Language.strConnectionEventConnectedDetail, prot.InterfaceControl.Info.Hostname, prot.InterfaceControl.Info.Protocol.ToString(), (new Microsoft.VisualBasic.ApplicationServices.User()).Name, prot.InterfaceControl.Info.Description, prot.InterfaceControl.Info.UserField)); - } - - public static void Prot_Event_ErrorOccured(object sender, string ErrorMessage) - { - try - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strConnectionEventErrorOccured, true); - - Connection.Protocol.Base Prot = (Connection.Protocol.Base)sender; - - if (Prot.InterfaceControl.Info.Protocol == Connection.Protocol.Protocols.RDP) - { - if (System.Convert.ToInt32(ErrorMessage) > -1) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, string.Format(My.Language.strConnectionRdpErrorDetail, ErrorMessage, Connection.Protocol.RDPConnectionProtocolImp.FatalErrors.GetError(ErrorMessage))); - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionEventConnectionFailed + Environment.NewLine + ex.Message, true); - } - } - #endregion - - #region External Apps - public static Tools.ExternalTool GetExtAppByName(string Name) - { - foreach (Tools.ExternalTool extA in ExternalTools) - { - if (extA.DisplayName == Name) - { - return extA; - } - } - - return null; - } - #endregion - - #region Misc - public static void GoToURL(string URL) - { - mRemoteNG.Connection.ConnectionRecordImp cI = new mRemoteNG.Connection.ConnectionRecordImp(); - - cI.Name = ""; - cI.Hostname = URL; - if (URL.StartsWith("https:")) - { - cI.Protocol = Connection.Protocol.Protocols.HTTPS; - } - else - { - cI.Protocol = Connection.Protocol.Protocols.HTTP; - } - cI.SetDefaultPort(); - cI.IsQuickConnect = true; - - App.Runtime.OpenConnection(cI, mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); - } - - public static void GoToWebsite() - { - GoToURL(App.Info.General.URLHome); - } - - public static void GoToDonate() - { - GoToURL(App.Info.General.URLDonate); - } - - public static void GoToForum() - { - GoToURL(App.Info.General.URLForum); - } - - public static void GoToBugs() - { - GoToURL(App.Info.General.URLBugs); - } - - public static void Report(string Text) - { - try - { - StreamWriter sWr = new StreamWriter((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Report.log", true); - sWr.WriteLine(Text); - sWr.Close(); - } - catch (Exception) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strLogWriteToFileFailed); - } - } - - public static bool SaveReport() - { - StreamReader streamReader = null; - StreamWriter streamWriter = null; - try - { - streamReader = new StreamReader((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Report.log"); - string text = streamReader.ReadToEnd(); - streamReader.Close(); - - streamWriter = new StreamWriter(App.Info.General.ReportingFilePath, true); - streamWriter.Write(text); - - return true; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strLogWriteToFileFinalLocationFailed + Environment.NewLine + ex.Message, true); - return false; - } - finally - { - if (streamReader != null) - { - streamReader.Close(); - streamReader.Dispose(); - } - if (streamWriter != null) - { - streamWriter.Close(); - streamWriter.Dispose(); - } - } - } - - public static Connection.InterfaceControl FindConnectionContainer(Connection.ConnectionRecordImp ConI) - { - if (ConI.OpenConnections.Count > 0) - { - for (int i = 0; i <= WindowList.Count - 1; i++) - { - if (WindowList[i] is UI.Window.Connection) - { - UI.Window.Connection conW = (UI.Window.Connection)WindowList[i]; - - if (conW.TabController != null) - { - foreach (Crownwood.Magic.Controls.TabPage t in conW.TabController.TabPages) - { - if (t.Controls[0] != null) - { - if (t.Controls[0] is Connection.InterfaceControl) - { - Connection.InterfaceControl IC = (Connection.InterfaceControl)t.Controls[0]; - if (IC.Info == ConI) - { - return IC; - } - } - } - } - } - } - } - } - - return null; - } - - // Override the font of all controls in a container with the default font based on the OS version - public static void FontOverride(Control ctlParent) - { - Control ctlChild = default(Control); - foreach (Control tempLoopVar_ctlChild in ctlParent.Controls) - { - ctlChild = tempLoopVar_ctlChild; - ctlChild.Font = new System.Drawing.Font(SystemFonts.MessageBoxFont.Name, ctlChild.Font.Size, ctlChild.Font.Style, ctlChild.Font.Unit, ctlChild.Font.GdiCharSet); - if (ctlChild.Controls.Count > 0) - { - FontOverride(ctlChild); - } - } - } - #endregion - - #region SQL Watcher - private static void tmrSqlWatcher_Elapsed(object sender, System.Timers.ElapsedEventArgs e) - { - Tools.Misc.IsSQLUpdateAvailableAsync(); - } - - private static void SQLUpdateCheckFinished(bool UpdateAvailable) - { - if (UpdateAvailable == true) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strSqlUpdateCheckUpdateAvailable, true); - LoadConnectionsBG(); - } - } - #endregion - } -} diff --git a/mRemoteV1/App/Export.cs b/mRemoteV1/App/Export.cs index 8c911f7c..6967229b 100644 --- a/mRemoteV1/App/Export.cs +++ b/mRemoteV1/App/Export.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Forms; using mRemoteNG.Forms; +using mRemoteNG.Config.Connections; namespace mRemoteNG.App @@ -16,13 +17,13 @@ namespace mRemoteNG.App using (ExportForm exportForm = new ExportForm()) { - if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Container) { exportForm.SelectedFolder = selectedTreeNode; } - else if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.Node.Type.Connection) + else if (Tree.Node.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Connection) { - if (Tree.Node.GetNodeType(selectedTreeNode.Parent) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(selectedTreeNode.Parent) == Tree.TreeNodeType.Container) { exportForm.SelectedFolder = selectedTreeNode.Parent; } @@ -62,29 +63,25 @@ namespace mRemoteNG.App } } - private static void SaveExportFile(string fileName, mRemoteNG.Config.Connections.Save.Format saveFormat, TreeNode rootNode, Security.Save saveSecurity) + private static void SaveExportFile(string fileName, ConnectionsSaver.Format saveFormat, TreeNode rootNode, Security.Save saveSecurity) { bool previousTimerEnabled = false; try { - if (Runtime.TimerSqlWatcher != null) + if (Runtime.SQLConnProvider != null) { - previousTimerEnabled = Runtime.TimerSqlWatcher.Enabled; - Runtime.TimerSqlWatcher.Enabled = false; + Runtime.SQLConnProvider.Disable(); } - Config.Connections.Save connectionsSave = new Config.Connections.Save(); + ConnectionsSaver connectionsSave = new ConnectionsSaver(); connectionsSave.Export = true; connectionsSave.ConnectionFileName = fileName; connectionsSave.SaveFormat = saveFormat; - connectionsSave.ConnectionList = Runtime.ConnectionList; connectionsSave.ContainerList = Runtime.ContainerList; connectionsSave.RootTreeNode = rootNode; - connectionsSave.SaveSecurity = saveSecurity; - connectionsSave.SaveConnections(); } catch (Exception ex) @@ -93,11 +90,11 @@ namespace mRemoteNG.App } finally { - if (Runtime.TimerSqlWatcher != null) + if (Runtime.SQLConnProvider != null) { - Runtime.TimerSqlWatcher.Enabled = previousTimerEnabled; + Runtime.SQLConnProvider.Enable(); } } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/App/Import.cs b/mRemoteV1/App/Import.cs index c857f9dd..50a6860f 100644 --- a/mRemoteV1/App/Import.cs +++ b/mRemoteV1/App/Import.cs @@ -6,6 +6,7 @@ using System.Windows.Forms; using System.IO; using mRemoteNG.My; using PSTaskDialog; +using mRemoteNG.Tree; namespace mRemoteNG.App @@ -68,12 +69,12 @@ namespace mRemoteNG.App } catch (Exception ex) { - cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.Misc.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, eSysIcons.Error); + cTaskDialog.ShowTaskDialogBox(System.Windows.Forms.Application.ProductName, Language.strImportFileFailedMainInstruction, string.Format(Language.strImportFileFailedContent, fileName), Tools.MiscTools.GetExceptionMessageRecursive(ex), "", "", "", "", eTaskDialogButtons.OK, eSysIcons.Error, eSysIcons.Error); } } parentTreeNode.Expand(); - Container.Info parentContainer = (Container.Info)parentTreeNode.Tag; + Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag; if (parentContainer != null) { parentContainer.IsExpanded = true; @@ -93,8 +94,8 @@ namespace mRemoteNG.App { try { - TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0]; - TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode; + TreeNode rootTreeNode = ConnectionTree.TreeView.Nodes[0]; + TreeNode selectedTreeNode = ConnectionTree.TreeView.SelectedNode; TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode); if (parentTreeNode == null) @@ -105,7 +106,7 @@ namespace mRemoteNG.App Config.Import.ActiveDirectory.Import(ldapPath, parentTreeNode); parentTreeNode.Expand(); - Container.Info parentContainer = (Container.Info)parentTreeNode.Tag; + Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag; if (parentContainer != null) { parentContainer.IsExpanded = true; @@ -119,12 +120,12 @@ namespace mRemoteNG.App } } - public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.Protocols protocol) + public static void ImportFromPortScan(IEnumerable hosts, Connection.Protocol.ProtocolType protocol) { try { - TreeNode rootTreeNode = Tree.Node.TreeView.Nodes[0]; - TreeNode selectedTreeNode = Tree.Node.TreeView.SelectedNode; + TreeNode rootTreeNode = ConnectionTree.TreeView.Nodes[0]; + TreeNode selectedTreeNode = ConnectionTree.TreeView.SelectedNode; TreeNode parentTreeNode = GetParentTreeNode(rootTreeNode, selectedTreeNode); if (parentTreeNode == null) @@ -135,7 +136,7 @@ namespace mRemoteNG.App Config.Import.PortScan.Import(hosts, protocol, parentTreeNode); parentTreeNode.Expand(); - Container.Info parentContainer = (Container.Info)parentTreeNode.Tag; + Container.ContainerInfo parentContainer = (Container.ContainerInfo)parentTreeNode.Tag; if (parentContainer != null) { parentContainer.IsExpanded = true; @@ -189,11 +190,11 @@ namespace mRemoteNG.App private static TreeNode GetContainerTreeNode(TreeNode treeNode) { - if ((Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Container)) + if ((Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Root) || (Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Container)) { return treeNode; } - else if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Connection) + else if (Tree.Node.GetNodeType(treeNode) == Tree.TreeNodeType.Connection) { return treeNode.Parent; } diff --git a/mRemoteV1/App/Info/ConnectionsFileInfo.cs b/mRemoteV1/App/Info/ConnectionsFileInfo.cs new file mode 100644 index 00000000..40813a0e --- /dev/null +++ b/mRemoteV1/App/Info/ConnectionsFileInfo.cs @@ -0,0 +1,10 @@ +namespace mRemoteNG.App.Info +{ + public class ConnectionsFileInfo + { + public static readonly string DefaultConnectionsPath = SettingsFileInfo.SettingsPath; + public static readonly string DefaultConnectionsFile = "confCons.xml"; + public static readonly string DefaultConnectionsFileNew = "confConsNew.xml"; + public static readonly double ConnectionFileVersion = 2.5; + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Info/CredentialsFileInfo.cs b/mRemoteV1/App/Info/CredentialsFileInfo.cs new file mode 100644 index 00000000..fce3d07d --- /dev/null +++ b/mRemoteV1/App/Info/CredentialsFileInfo.cs @@ -0,0 +1,10 @@ +namespace mRemoteNG.App.Info +{ + public class CredentialsFileInfo + { + public static readonly string CredentialsPath = SettingsFileInfo.SettingsPath; + public static readonly string CredentialsFile = "confCreds.xml"; + public static readonly string CredentialsFileNew = "confCredsNew.xml"; + public static readonly double CredentialsFileVersion = 1.0; + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Info/GeneralAppInfo.cs b/mRemoteV1/App/Info/GeneralAppInfo.cs new file mode 100644 index 00000000..d99d8cb3 --- /dev/null +++ b/mRemoteV1/App/Info/GeneralAppInfo.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using System; +using System.Threading; + + +namespace mRemoteNG.App.Info +{ + public class GeneralAppInfo + { + public static readonly string URLHome = "http://www.mremoteng.org/"; + public static readonly string URLDonate = "http://donate.mremoteng.org/"; + public static readonly string URLForum = "http://forum.mremoteng.org/"; + public static readonly string URLBugs = "http://bugs.mremoteng.org/"; + public static readonly string HomePath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath; + public static string EncryptionKey = "mR3m"; + public static string ReportingFilePath = ""; + public static readonly string PuttyPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\PuTTYNG.exe"; + public static string UserAgent + { + get + { + List details = new List(); + details.Add("compatible"); + if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) + { + details.Add(string.Format("Windows NT {0}.{1}", System.Environment.OSVersion.Version.Major, System.Environment.OSVersion.Version.Minor)); + } + else + { + details.Add(System.Environment.OSVersion.VersionString); + } + if (Tools.EnvironmentInfo.IsWow64) + { + details.Add("WOW64"); + } + details.Add(Thread.CurrentThread.CurrentUICulture.Name); + details.Add(string.Format(".NET CLR {0}", System.Environment.Version)); + string detailsString = string.Join("; ", details.ToArray()); + + return string.Format("Mozilla/4.0 ({0}) {1}/{2}", detailsString, System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Info/SettingsFileInfo.cs b/mRemoteV1/App/Info/SettingsFileInfo.cs new file mode 100644 index 00000000..09e70af8 --- /dev/null +++ b/mRemoteV1/App/Info/SettingsFileInfo.cs @@ -0,0 +1,15 @@ + +namespace mRemoteNG.App.Info +{ + public class SettingsFileInfo + { + #if !PORTABLE + public static readonly string SettingsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName; + #else + public static readonly string SettingsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath; + #endif + public static readonly string LayoutFileName = "pnlLayout.xml"; + public static readonly string ExtAppsFilesName = "extApps.xml"; + public const string ThemesFileName = "Themes.xml"; + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Info/UpdateChannelInfo.cs b/mRemoteV1/App/Info/UpdateChannelInfo.cs new file mode 100644 index 00000000..feff4724 --- /dev/null +++ b/mRemoteV1/App/Info/UpdateChannelInfo.cs @@ -0,0 +1,20 @@ +namespace mRemoteNG.App.Info +{ + public class UpdateChannelInfo + { + public static string FileName + { + get + { + #if DEBUG + return "update-debug.txt"; + #else + if ((string)(My.Settings.Default.UpdateChannel.ToLowerInvariant()) == "debug") + return "update-debug.txt"; + else + return "update.txt"; + #endif + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Logger.cs b/mRemoteV1/App/Logger.cs new file mode 100644 index 00000000..cc16d794 --- /dev/null +++ b/mRemoteV1/App/Logger.cs @@ -0,0 +1,60 @@ +using log4net; +using log4net.Appender; +using log4net.Config; +using log4net.Repository; +using System.IO; + +namespace mRemoteNG.App +{ + public class Logger + { + private static Logger _logger = null; + private ILog _log; + + public static ILog GetSingletonInstance() + { + if (_logger == null) + _logger = new Logger(); + return _logger._log; + } + + private Logger() + { + this.Initialize(); + } + + private void Initialize() + { + XmlConfigurator.Configure(); + string logFile = BuildLogFilePath(); + + ILoggerRepository repository = LogManager.GetRepository(); + IAppender[] appenders = repository.GetAppenders(); + + FileAppender fileAppender = default(FileAppender); + foreach (IAppender appender in appenders) + { + fileAppender = appender as FileAppender; + if (!(fileAppender == null || fileAppender.Name != "LogFileAppender")) + { + fileAppender.File = logFile; + fileAppender.ActivateOptions(); + } + } + _log = LogManager.GetLogger("Logger"); + } + + private static string BuildLogFilePath() + { + string logFilePath = ""; + #if !PORTABLE + logFilePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), System.Windows.Forms.Application.ProductName); + #else + logFilePath = System.Windows.Forms.Application.StartupPath; + #endif + string logFileName = Path.ChangeExtension(System.Windows.Forms.Application.ProductName, ".log"); + string logFile = Path.Combine(logFilePath, logFileName); + return logFile; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/App.Native.cs b/mRemoteV1/App/Native.cs similarity index 99% rename from mRemoteV1/App/App.Native.cs rename to mRemoteV1/App/Native.cs index 77a8b791..c2544ba4 100644 --- a/mRemoteV1/App/App.Native.cs +++ b/mRemoteV1/App/Native.cs @@ -59,7 +59,7 @@ namespace mRemoteNG.App [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr WindowFromPoint(Point point); #endregion - + #region Structures [StructLayout(LayoutKind.Sequential)] public struct WINDOWPOS @@ -73,7 +73,7 @@ namespace mRemoteNG.App public int flags; } #endregion - + #region Helpers public static int MAKELONG(int wLow, int wHigh) { @@ -105,25 +105,25 @@ namespace mRemoteNG.App return HIWORD(value.ToInt32()); } #endregion - + #region Constants // GetWindowLong public const int GWL_STYLE = (-16); - + // AppendMenu / ModifyMenu / DeleteMenu / RemoveMenu public const int MF_BYCOMMAND = 0x0; public const int MF_BYPOSITION = 0x400; public const int MF_STRING = 0x0; public const int MF_POPUP = 0x10; public const int MF_SEPARATOR = 0x800; - + // WM_LBUTTONDOWN / WM_LBUTTONUP public const int MK_LBUTTON = 0x1; - + // ShowWindow public const int SW_SHOWMAXIMIZED = 3; public const int SW_RESTORE = 9; - + // SetWindowPos / WM_WINDOWPOSCHANGING / WM_WINDOWPOSCHANGED public const int SWP_NOSIZE = 0x1; public const int SWP_NOMOVE = 0x2; @@ -142,12 +142,12 @@ namespace mRemoteNG.App public const int SWP_DEFERERASE = 0x2000; public const int SWP_ASYNCWINDOWPOS = 0x4000; public const int SWP_STATECHANGED = 0x8000; - + // WM_ACTIVATE public const int WA_INACTIVE = 0x0; public const int WA_ACTIVE = 0x1; public const int WA_CLICKACTIVE = 0x2; - + // Window Messages public const int WM_CREATE = 0x1; public const int WM_DESTROY = 0x2; @@ -176,13 +176,13 @@ namespace mRemoteNG.App public const int WM_EXITSIZEMOVE = 0x232; public const int WM_DRAWCLIPBOARD = 0x308; public const int WM_CHANGECBCHAIN = 0x30D; - + // Window Styles public const int WS_MAXIMIZE = 0x1000000; public const int WS_VISIBLE = 0x10000000; public const int WS_CHILD = 0x40000000; public const int WS_EX_MDICHILD = 0x40; - + // Virtual Key Codes public const int VK_CONTROL = 0x11; public const int VK_C = 0x67; diff --git a/mRemoteV1/App/ProgramRoot.cs b/mRemoteV1/App/ProgramRoot.cs index 9b2c6d00..273b55c2 100644 --- a/mRemoteV1/App/ProgramRoot.cs +++ b/mRemoteV1/App/ProgramRoot.cs @@ -13,11 +13,8 @@ namespace mRemoteNG [STAThread] public static void Main() { - // Create main form mRemoteNG.frmMain mainForm = new frmMain(); - // Set default form mRemoteNG.frmMain.Default = mainForm; - // Run the default form Application.Run(mainForm); } } diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs new file mode 100644 index 00000000..f494f622 --- /dev/null +++ b/mRemoteV1/App/Runtime.cs @@ -0,0 +1,1429 @@ +using log4net; +using Microsoft.VisualBasic; +using mRemoteNG.App.Info; +using mRemoteNG.Config.Connections; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Container; +using mRemoteNG.Credential; +using mRemoteNG.Images; +using mRemoteNG.Messages; +using mRemoteNG.Tools; +using mRemoteNG.Tree; +using mRemoteNG.UI.Window; +using PSTaskDialog; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Threading; +using System.Windows.Forms; +using System.Xml; +using WeifenLuo.WinFormsUI.Docking; + + +namespace mRemoteNG.App +{ + public class Runtime + { + private Runtime() + { + // Fix Warning 292 CA1053 : Microsoft.Design : Because type 'Native' contains only 'static' ('Shared' in Visual Basic) members, add a default private constructor to prevent the compiler from adding a default public constructor. + } + + #region Private Variables + private static ConnectionList _connectionList; + private static ConnectionList _previousConnectionList; + private static ContainerList _containerList; + private static ContainerList _previousContainerList; + private static CredentialList _credentialList; + private static CredentialList _previousCredentialList; + private static WindowList _windowList; + private static MessageCollector _messageCollector; + private static Tools.Controls.NotificationAreaIcon _notificationAreaIcon; + private static mRemoteNG.Tools.SystemMenu _systemMenu; + private static log4net.ILog _log; + private static bool _isConnectionsFileLoaded; + private static System.Timers.Timer _timerSqlWatcher; + private static SqlConnectionsProvider _sqlConnectionsProvider; + private static DateTime _lastSqlUpdate; + private static string _lastSelected; + private static ConnectionInfo _defaultConnection; + private static ConnectionInfoInheritance _defaultInheritance; + private static ArrayList _externalTools = new ArrayList(); + #endregion + + #region Public Properties + public static frmMain MainForm { get; set; } + + public static ConnectionList ConnectionList + { + get { return _connectionList; } + set { _connectionList = value; } + } + + public static ConnectionList PreviousConnectionList + { + get { return _previousConnectionList; } + set { _previousConnectionList = value; } + } + + public static ContainerList ContainerList + { + get { return _containerList; } + set { _containerList = value; } + } + + public static ContainerList PreviousContainerList + { + get { return _previousContainerList; } + set { _previousContainerList = value; } + } + + public static CredentialList CredentialList + { + get { return _credentialList; } + set { _credentialList = value; } + } + + public static CredentialList PreviousCredentialList + { + get { return _previousCredentialList; } + set { _previousCredentialList = value; } + } + + public static WindowList WindowList + { + get { return _windowList; } + set { _windowList = value; } + } + + public static MessageCollector MessageCollector + { + get { return _messageCollector; } + set { _messageCollector = value; } + } + + public static Tools.Controls.NotificationAreaIcon NotificationAreaIcon + { + get { return _notificationAreaIcon; } + set { _notificationAreaIcon = value; } + } + + public static SystemMenu SystemMenu + { + get { return _systemMenu; } + set { _systemMenu = value; } + } + + public static ILog Log + { + get { return _log; } + set { _log = value; } + } + + public static bool IsConnectionsFileLoaded + { + get { return _isConnectionsFileLoaded; } + set { _isConnectionsFileLoaded = value; } + } + + + public static SqlConnectionsProvider SQLConnProvider + { + get { return _sqlConnectionsProvider; } + set { _sqlConnectionsProvider = value; } + } + /* + public static System.Timers.Timer TimerSqlWatcher + { + get { return _timerSqlWatcher; } + set + { + _timerSqlWatcher = value; + _timerSqlWatcher.Elapsed += tmrSqlWatcher_Elapsed; + } + } + */ + + public static DateTime LastSqlUpdate + { + get { return _lastSqlUpdate; } + set { _lastSqlUpdate = value; } + } + + public static string LastSelected + { + get { return _lastSelected; } + set { _lastSelected = value; } + } + + public static ConnectionInfo DefaultConnection + { + get { return _defaultConnection; } + set { _defaultConnection = value; } + } + + public static ConnectionInfoInheritance DefaultInheritance + { + get { return _defaultInheritance; } + set { _defaultInheritance = value; } + } + + public static ArrayList ExternalTools + { + get { return _externalTools; } + set { _externalTools = value; } + } + #endregion + + #region Default Connection + public static ConnectionInfo DefaultConnectionFromSettings() + { + DefaultConnection = new ConnectionInfo(); + DefaultConnection.IsDefault = true; + return DefaultConnection; + } + + public static void DefaultConnectionToSettings() + { + My.Settings.Default.ConDefaultDescription = DefaultConnection.Description; + My.Settings.Default.ConDefaultIcon = DefaultConnection.Icon; + My.Settings.Default.ConDefaultUsername = DefaultConnection.Username; + My.Settings.Default.ConDefaultPassword = DefaultConnection.Password; + My.Settings.Default.ConDefaultDomain = DefaultConnection.Domain; + My.Settings.Default.ConDefaultProtocol = DefaultConnection.Protocol.ToString(); + My.Settings.Default.ConDefaultPuttySession = DefaultConnection.PuttySession; + My.Settings.Default.ConDefaultICAEncryptionStrength = DefaultConnection.ICAEncryption.ToString(); + My.Settings.Default.ConDefaultRDPAuthenticationLevel = DefaultConnection.RDPAuthenticationLevel.ToString(); + My.Settings.Default.ConDefaultLoadBalanceInfo = DefaultConnection.LoadBalanceInfo; + My.Settings.Default.ConDefaultUseConsoleSession = DefaultConnection.UseConsoleSession; + My.Settings.Default.ConDefaultUseCredSsp = DefaultConnection.UseCredSsp; + My.Settings.Default.ConDefaultRenderingEngine = DefaultConnection.RenderingEngine.ToString(); + My.Settings.Default.ConDefaultResolution = DefaultConnection.Resolution.ToString(); + My.Settings.Default.ConDefaultAutomaticResize = DefaultConnection.AutomaticResize; + My.Settings.Default.ConDefaultColors = DefaultConnection.Colors.ToString(); + My.Settings.Default.ConDefaultCacheBitmaps = DefaultConnection.CacheBitmaps; + My.Settings.Default.ConDefaultDisplayWallpaper = DefaultConnection.DisplayWallpaper; + My.Settings.Default.ConDefaultDisplayThemes = DefaultConnection.DisplayThemes; + My.Settings.Default.ConDefaultEnableFontSmoothing = DefaultConnection.EnableFontSmoothing; + My.Settings.Default.ConDefaultEnableDesktopComposition = DefaultConnection.EnableDesktopComposition; + My.Settings.Default.ConDefaultRedirectKeys = DefaultConnection.RedirectKeys; + My.Settings.Default.ConDefaultRedirectDiskDrives = DefaultConnection.RedirectDiskDrives; + My.Settings.Default.ConDefaultRedirectPrinters = DefaultConnection.RedirectPrinters; + My.Settings.Default.ConDefaultRedirectPorts = DefaultConnection.RedirectPorts; + My.Settings.Default.ConDefaultRedirectSmartCards = DefaultConnection.RedirectSmartCards; + My.Settings.Default.ConDefaultRedirectSound = DefaultConnection.RedirectSound.ToString(); + My.Settings.Default.ConDefaultPreExtApp = DefaultConnection.PreExtApp; + My.Settings.Default.ConDefaultPostExtApp = DefaultConnection.PostExtApp; + My.Settings.Default.ConDefaultMacAddress = DefaultConnection.MacAddress; + My.Settings.Default.ConDefaultUserField = DefaultConnection.UserField; + My.Settings.Default.ConDefaultVNCAuthMode = DefaultConnection.VNCAuthMode.ToString(); + My.Settings.Default.ConDefaultVNCColors = DefaultConnection.VNCColors.ToString(); + My.Settings.Default.ConDefaultVNCCompression = DefaultConnection.VNCCompression.ToString(); + My.Settings.Default.ConDefaultVNCEncoding = DefaultConnection.VNCEncoding.ToString(); + My.Settings.Default.ConDefaultVNCProxyIP = DefaultConnection.VNCProxyIP; + My.Settings.Default.ConDefaultVNCProxyPassword = DefaultConnection.VNCProxyPassword; + My.Settings.Default.ConDefaultVNCProxyPort = DefaultConnection.VNCProxyPort; + My.Settings.Default.ConDefaultVNCProxyType = DefaultConnection.VNCProxyType.ToString(); + My.Settings.Default.ConDefaultVNCProxyUsername = DefaultConnection.VNCProxyUsername; + My.Settings.Default.ConDefaultVNCSmartSizeMode = DefaultConnection.VNCSmartSizeMode.ToString(); + My.Settings.Default.ConDefaultVNCViewOnly = DefaultConnection.VNCViewOnly; + My.Settings.Default.ConDefaultExtApp = DefaultConnection.ExtApp; + My.Settings.Default.ConDefaultRDGatewayUsageMethod = DefaultConnection.RDGatewayUsageMethod.ToString(); + My.Settings.Default.ConDefaultRDGatewayHostname = DefaultConnection.RDGatewayHostname; + My.Settings.Default.ConDefaultRDGatewayUsername = DefaultConnection.RDGatewayUsername; + My.Settings.Default.ConDefaultRDGatewayPassword = DefaultConnection.RDGatewayPassword; + My.Settings.Default.ConDefaultRDGatewayDomain = DefaultConnection.RDGatewayDomain; + My.Settings.Default.ConDefaultRDGatewayUseConnectionCredentials = DefaultConnection.RDGatewayUseConnectionCredentials.ToString(); + } + #endregion + + #region Default Inheritance + public static ConnectionInfoInheritance DefaultInheritanceFromSettings() + { + DefaultInheritance = new ConnectionInfoInheritance(null); + DefaultInheritance.IsDefault = true; + return DefaultInheritance; + } + + public static void DefaultInheritanceToSettings() + { + My.Settings.Default.InhDefaultDescription = DefaultInheritance.Description; + My.Settings.Default.InhDefaultIcon = DefaultInheritance.Icon; + My.Settings.Default.InhDefaultPanel = DefaultInheritance.Panel; + My.Settings.Default.InhDefaultUsername = DefaultInheritance.Username; + My.Settings.Default.InhDefaultPassword = DefaultInheritance.Password; + My.Settings.Default.InhDefaultDomain = DefaultInheritance.Domain; + My.Settings.Default.InhDefaultProtocol = DefaultInheritance.Protocol; + My.Settings.Default.InhDefaultPort = DefaultInheritance.Port; + My.Settings.Default.InhDefaultPuttySession = DefaultInheritance.PuttySession; + My.Settings.Default.InhDefaultUseConsoleSession = DefaultInheritance.UseConsoleSession; + My.Settings.Default.InhDefaultUseCredSsp = DefaultInheritance.UseCredSsp; + My.Settings.Default.InhDefaultRenderingEngine = DefaultInheritance.RenderingEngine; + My.Settings.Default.InhDefaultICAEncryptionStrength = DefaultInheritance.ICAEncryption; + My.Settings.Default.InhDefaultRDPAuthenticationLevel = DefaultInheritance.RDPAuthenticationLevel; + My.Settings.Default.InhDefaultLoadBalanceInfo = DefaultInheritance.LoadBalanceInfo; + My.Settings.Default.InhDefaultResolution = DefaultInheritance.Resolution; + My.Settings.Default.InhDefaultAutomaticResize = DefaultInheritance.AutomaticResize; + My.Settings.Default.InhDefaultColors = DefaultInheritance.Colors; + My.Settings.Default.InhDefaultCacheBitmaps = DefaultInheritance.CacheBitmaps; + My.Settings.Default.InhDefaultDisplayWallpaper = DefaultInheritance.DisplayWallpaper; + My.Settings.Default.InhDefaultDisplayThemes = DefaultInheritance.DisplayThemes; + My.Settings.Default.InhDefaultEnableFontSmoothing = DefaultInheritance.EnableFontSmoothing; + My.Settings.Default.InhDefaultEnableDesktopComposition = DefaultInheritance.EnableDesktopComposition; + My.Settings.Default.InhDefaultRedirectKeys = DefaultInheritance.RedirectKeys; + My.Settings.Default.InhDefaultRedirectDiskDrives = DefaultInheritance.RedirectDiskDrives; + My.Settings.Default.InhDefaultRedirectPrinters = DefaultInheritance.RedirectPrinters; + My.Settings.Default.InhDefaultRedirectPorts = DefaultInheritance.RedirectPorts; + My.Settings.Default.InhDefaultRedirectSmartCards = DefaultInheritance.RedirectSmartCards; + My.Settings.Default.InhDefaultRedirectSound = DefaultInheritance.RedirectSound; + My.Settings.Default.InhDefaultPreExtApp = DefaultInheritance.PreExtApp; + My.Settings.Default.InhDefaultPostExtApp = DefaultInheritance.PostExtApp; + My.Settings.Default.InhDefaultMacAddress = DefaultInheritance.MacAddress; + My.Settings.Default.InhDefaultUserField = DefaultInheritance.UserField; + // VNC inheritance + My.Settings.Default.InhDefaultVNCAuthMode = DefaultInheritance.VNCAuthMode; + My.Settings.Default.InhDefaultVNCColors = DefaultInheritance.VNCColors; + My.Settings.Default.InhDefaultVNCCompression = DefaultInheritance.VNCCompression; + My.Settings.Default.InhDefaultVNCEncoding = DefaultInheritance.VNCEncoding; + My.Settings.Default.InhDefaultVNCProxyIP = DefaultInheritance.VNCProxyIP; + My.Settings.Default.InhDefaultVNCProxyPassword = DefaultInheritance.VNCProxyPassword; + My.Settings.Default.InhDefaultVNCProxyPort = DefaultInheritance.VNCProxyPort; + My.Settings.Default.InhDefaultVNCProxyType = DefaultInheritance.VNCProxyType; + My.Settings.Default.InhDefaultVNCProxyUsername = DefaultInheritance.VNCProxyUsername; + My.Settings.Default.InhDefaultVNCSmartSizeMode = DefaultInheritance.VNCSmartSizeMode; + My.Settings.Default.InhDefaultVNCViewOnly = DefaultInheritance.VNCViewOnly; + // Ext. App inheritance + My.Settings.Default.InhDefaultExtApp = DefaultInheritance.ExtApp; + // RDP gateway inheritance + My.Settings.Default.InhDefaultRDGatewayUsageMethod = DefaultInheritance.RDGatewayUsageMethod; + My.Settings.Default.InhDefaultRDGatewayHostname = DefaultInheritance.RDGatewayHostname; + My.Settings.Default.InhDefaultRDGatewayUsername = DefaultInheritance.RDGatewayUsername; + My.Settings.Default.InhDefaultRDGatewayPassword = DefaultInheritance.RDGatewayPassword; + My.Settings.Default.InhDefaultRDGatewayDomain = DefaultInheritance.RDGatewayDomain; + My.Settings.Default.InhDefaultRDGatewayUseConnectionCredentials = DefaultInheritance.RDGatewayUseConnectionCredentials; + } + #endregion + + #region Panels + public static Form AddPanel(string title = "", bool noTabber = false) + { + try + { + ConnectionWindow connectionForm = new ConnectionWindow(new DockContent()); + BuildConnectionWindowContextMenu(connectionForm); + SetConnectionWindowTitle(title, connectionForm); + ShowConnectionWindow(connectionForm); + PrepareTabControllerSupport(noTabber, connectionForm); + return connectionForm; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t add panel" + Environment.NewLine + ex.Message); + return null; + } + } + + private static void ShowConnectionWindow(ConnectionWindow connectionForm) + { + connectionForm.Show(frmMain.Default.pnlDock, DockState.Document); + } + + private static void PrepareTabControllerSupport(bool noTabber, ConnectionWindow connectionForm) + { + if (noTabber) + connectionForm.TabController.Dispose(); + else + WindowList.Add(connectionForm); + } + + private static void SetConnectionWindowTitle(string title, ConnectionWindow connectionForm) + { + if (title == "") + title = My.Language.strNewPanel; + connectionForm.SetFormText(title.Replace("&", "&&")); + } + + private static void BuildConnectionWindowContextMenu(DockContent pnlcForm) + { + ContextMenuStrip cMen = new ContextMenuStrip(); + ToolStripMenuItem cMenRen = CreateRenameMenuItem(pnlcForm); + ToolStripMenuItem cMenScreens = CreateScreensMenuItem(pnlcForm); + cMen.Items.AddRange(new ToolStripMenuItem[] { cMenRen, cMenScreens }); + pnlcForm.TabPageContextMenuStrip = cMen; + } + + private static ToolStripMenuItem CreateScreensMenuItem(DockContent pnlcForm) + { + ToolStripMenuItem cMenScreens = new ToolStripMenuItem(); + cMenScreens.Text = My.Language.strSendTo; + cMenScreens.Image = My.Resources.Monitor; + cMenScreens.Tag = pnlcForm; + cMenScreens.DropDownItems.Add("Dummy"); + cMenScreens.DropDownOpening += cMenConnectionPanelScreens_DropDownOpening; + return cMenScreens; + } + + private static ToolStripMenuItem CreateRenameMenuItem(DockContent pnlcForm) + { + ToolStripMenuItem cMenRen = new ToolStripMenuItem(); + cMenRen.Text = My.Language.strRename; + cMenRen.Image = My.Resources.Rename; + cMenRen.Tag = pnlcForm; + cMenRen.Click += cMenConnectionPanelRename_Click; + return cMenRen; + } + + private static void cMenConnectionPanelRename_Click(Object sender, EventArgs e) + { + try + { + ConnectionWindow conW = default(ConnectionWindow); + conW = (ConnectionWindow)((Control)sender).Tag; + + string nTitle = Interaction.InputBox(Prompt: My.Language.strNewTitle + ":", DefaultResponse: Convert.ToString(((Control)((Control)sender).Tag).Text.Replace("&&", "&"))); + + if (!string.IsNullOrEmpty(nTitle)) + { + conW.SetFormText(nTitle.Replace("&", "&&")); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t rename panel" + Environment.NewLine + ex.Message); + } + } + + private static void cMenConnectionPanelScreens_DropDownOpening(Object sender, EventArgs e) + { + try + { + ToolStripMenuItem cMenScreens = (ToolStripMenuItem)sender; + cMenScreens.DropDownItems.Clear(); + + for (int i = 0; i <= Screen.AllScreens.Length - 1; i++) + { + ToolStripMenuItem cMenScreen = new ToolStripMenuItem(My.Language.strScreen + " " + Convert.ToString(i + 1)); + cMenScreen.Tag = new ArrayList(); + cMenScreen.Image = My.Resources.Monitor_GoTo; + (cMenScreen.Tag as ArrayList).Add(Screen.AllScreens[i]); + (cMenScreen.Tag as ArrayList).Add(cMenScreens.Tag); + cMenScreen.Click += cMenConnectionPanelScreen_Click; + cMenScreens.DropDownItems.Add(cMenScreen); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t enumerate screens" + Environment.NewLine + ex.Message); + } + } + + private static void cMenConnectionPanelScreen_Click(object sender, EventArgs e) + { + Screen screen = null; + DockContent panel = null; + try + { + IEnumerable tagEnumeration = (IEnumerable)((ToolStripMenuItem)sender).Tag; + if (tagEnumeration != null) + { + foreach (Object obj in tagEnumeration) + { + if (obj is Screen) + { + screen = (Screen)obj; + } + else if (obj is DockContent) + { + panel = (DockContent)obj; + } + } + Screens.SendPanelToScreen(panel, screen); + } + } + catch (Exception) + { + } + } + #endregion + + #region Credential Loading/Saving + public static void LoadCredentials() + { + + } + #endregion + + #region Connections Loading/Saving + public static void NewConnections(string filename) + { + try + { + ConnectionList = new ConnectionList(); + ContainerList = new ContainerList(); + ConnectionsLoader connectionsLoader = new ConnectionsLoader(); + + if (filename == GetDefaultStartupConnectionFileName()) + { + My.Settings.Default.LoadConsFromCustomLocation = false; + } + else + { + My.Settings.Default.LoadConsFromCustomLocation = true; + My.Settings.Default.CustomConsPath = filename; + } + + Directory.CreateDirectory(Path.GetDirectoryName(filename)); + + // Use File.Open with FileMode.CreateNew so that we don't overwrite an existing file + using (FileStream fileStream = File.Open(filename, FileMode.CreateNew, FileAccess.Write, FileShare.None)) + { + using (XmlTextWriter xmlTextWriter = new XmlTextWriter(fileStream, System.Text.Encoding.UTF8)) + { + xmlTextWriter.Formatting = Formatting.Indented; + xmlTextWriter.Indentation = 4; + xmlTextWriter.WriteStartDocument(); + xmlTextWriter.WriteStartElement("Connections"); // Do not localize + xmlTextWriter.WriteAttributeString("Name", My.Language.strConnections); + xmlTextWriter.WriteAttributeString("Export", "", "False"); + xmlTextWriter.WriteAttributeString("Protected", "", "GiUis20DIbnYzWPcdaQKfjE2H5jh//L5v4RGrJMGNXuIq2CttB/d/BxaBP2LwRhY"); + xmlTextWriter.WriteAttributeString("ConfVersion", "", "2.5"); + xmlTextWriter.WriteEndElement(); + xmlTextWriter.WriteEndDocument(); + xmlTextWriter.Close(); + } + + } + + connectionsLoader.ConnectionList = ConnectionList; + connectionsLoader.ContainerList = ContainerList; + ConnectionTree.ResetTree(); + connectionsLoader.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; + + // Load config + connectionsLoader.ConnectionFileName = filename; + connectionsLoader.LoadConnections(false); + Windows.treeForm.tvConnections.SelectedNode = connectionsLoader.RootTreeNode; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage(My.Language.strCouldNotCreateNewConnectionsFile, ex, MessageClass.ErrorMsg); + } + } + + public static void LoadConnectionsBG(bool WithDialog = false, bool Update = false) + { + _withDialog = false; + _loadUpdate = true; + + Thread t = new Thread(new System.Threading.ThreadStart(LoadConnectionsBGd)); + t.SetApartmentState(System.Threading.ApartmentState.STA); + t.Start(); + } + + private static bool _withDialog = false; + private static bool _loadUpdate = false; + private static void LoadConnectionsBGd() + { + LoadConnections(_withDialog, _loadUpdate); + } + + public static void LoadConnections(bool withDialog = false, bool update = false) + { + ConnectionsLoader connectionsLoader = new ConnectionsLoader(); + try + { + // disable sql update checking while we are loading updates + if (SQLConnProvider != null) + SQLConnProvider.Disable(); + + if (ConnectionList != null && ContainerList != null) + { + PreviousConnectionList = ConnectionList.Copy(); + PreviousContainerList = ContainerList.Copy(); + } + + ConnectionList = new ConnectionList(); + ContainerList = new ContainerList(); + + if (!My.Settings.Default.UseSQLServer) + { + if (withDialog) + { + OpenFileDialog loadDialog = Tools.Controls.ConnectionsLoadDialog(); + if (loadDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + connectionsLoader.ConnectionFileName = loadDialog.FileName; + } + else + { + return; + } + } + else + { + connectionsLoader.ConnectionFileName = GetStartupConnectionFileName(); + } + + CreateBackupFile(Convert.ToString(connectionsLoader.ConnectionFileName)); + } + + connectionsLoader.ConnectionList = ConnectionList; + connectionsLoader.ContainerList = ContainerList; + + if (PreviousConnectionList != null && PreviousContainerList != null) + { + connectionsLoader.PreviousConnectionList = PreviousConnectionList; + connectionsLoader.PreviousContainerList = PreviousContainerList; + } + + if (update == true) + { + connectionsLoader.PreviousSelected = LastSelected; + } + + ConnectionTree.ResetTree(); + + connectionsLoader.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; + connectionsLoader.UseSQL = My.Settings.Default.UseSQLServer; + connectionsLoader.SQLHost = My.Settings.Default.SQLHost; + connectionsLoader.SQLDatabaseName = My.Settings.Default.SQLDatabaseName; + connectionsLoader.SQLUsername = My.Settings.Default.SQLUser; + connectionsLoader.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(My.Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey); + connectionsLoader.SQLUpdate = update; + connectionsLoader.LoadConnections(false); + + if (My.Settings.Default.UseSQLServer == true) + { + LastSqlUpdate = DateTime.Now; + } + else + { + if (connectionsLoader.ConnectionFileName == GetDefaultStartupConnectionFileName()) + { + My.Settings.Default.LoadConsFromCustomLocation = false; + } + else + { + My.Settings.Default.LoadConsFromCustomLocation = true; + My.Settings.Default.CustomConsPath = connectionsLoader.ConnectionFileName; + } + } + + // re-enable sql update checking after updates are loaded + if (My.Settings.Default.UseSQLServer && SQLConnProvider != null) + { + SQLConnProvider.Enable(); + } + } + catch (Exception ex) + { + if (My.Settings.Default.UseSQLServer) + { + Runtime.MessageCollector.AddExceptionMessage(My.Language.strLoadFromSqlFailed, ex); + string commandButtons = string.Join("|", new[] {My.Language.strCommandTryAgain, My.Language.strCommandOpenConnectionFile, string.Format(My.Language.strCommandExitProgram, System.Windows.Forms.Application.ProductName)}); + cTaskDialog.ShowCommandBox(System.Windows.Forms.Application.ProductName, My.Language.strLoadFromSqlFailed, My.Language.strLoadFromSqlFailedContent, MiscTools.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, eSysIcons.Error, eSysIcons.Error); + switch (cTaskDialog.CommandButtonResult) + { + case 0: + LoadConnections(withDialog, update); + return ; + case 1: + My.Settings.Default.UseSQLServer = false; + LoadConnections(true, update); + return ; + default: + Application.Exit(); + return ; + } + } + else + { + if (ex is FileNotFoundException&& !withDialog) + { + Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoader.ConnectionFileName), ex, MessageClass.InformationMsg); + NewConnections(Convert.ToString(connectionsLoader.ConnectionFileName)); + return ; + } + + Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotBeLoaded, connectionsLoader.ConnectionFileName), ex); + if (!(connectionsLoader.ConnectionFileName == GetStartupConnectionFileName())) + { + LoadConnections(withDialog, update); + return ; + } + else + { + Interaction.MsgBox(string.Format(My.Language.strErrorStartupConnectionFileLoad, Environment.NewLine, System.Windows.Forms.Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)), (int) MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, null); + Application.Exit(); + return ; + } + } + } + } + + protected static void CreateBackupFile(string fileName) + { + // This intentionally doesn't prune any existing backup files. We just assume the user doesn't want any new ones created. + if (My.Settings.Default.BackupFileKeepCount == 0) + { + return ; + } + + try + { + string backupFileName = string.Format(My.Settings.Default.BackupFileNameFormat, fileName, DateTime.UtcNow); + File.Copy(fileName, backupFileName); + PruneBackupFiles(fileName); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage(My.Language.strConnectionsFileBackupFailed, ex, MessageClass.WarningMsg); + throw; + } + } + + protected static void PruneBackupFiles(string baseName) + { + string fileName = Path.GetFileName(baseName); + string directoryName = Path.GetDirectoryName(baseName); + + if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(directoryName)) + { + return ; + } + + string searchPattern = string.Format(My.Settings.Default.BackupFileNameFormat, fileName, "*"); + string[] files = Directory.GetFiles(directoryName, searchPattern); + + if (files.Length <= My.Settings.Default.BackupFileKeepCount) + { + return ; + } + + Array.Sort(files); + Array.Resize(ref files, files.Length - My.Settings.Default.BackupFileKeepCount); + + foreach (string file in files) + { + System.IO.File.Delete(file); + } + } + + public static string GetDefaultStartupConnectionFileName() + { + string newPath = App.Info.ConnectionsFileInfo.DefaultConnectionsPath + "\\" + Info.ConnectionsFileInfo.DefaultConnectionsFile; + #if !PORTABLE + string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + Info.Connections.DefaultConnectionsFile; + if (File.Exists(oldPath)) + { + return oldPath; + } + #endif + return newPath; + } + + public static string GetStartupConnectionFileName() + { + if (My.Settings.Default.LoadConsFromCustomLocation == false) + { + return GetDefaultStartupConnectionFileName(); + } + else + { + return My.Settings.Default.CustomConsPath; + } + } + + public static void SaveConnectionsBG() + { + _saveUpdate = true; + Thread t = new Thread(new ThreadStart(SaveConnectionsBGd)); + t.SetApartmentState(System.Threading.ApartmentState.STA); + t.Start(); + } + + private static bool _saveUpdate = false; + private static object _saveLock = new object(); + private static void SaveConnectionsBGd() + { + Monitor.Enter(_saveLock); + SaveConnections(_saveUpdate); + Monitor.Exit(_saveLock); + } + + public static void SaveConnections(bool Update = false) + { + if (!IsConnectionsFileLoaded) + { + return; + } + + bool previousTimerState = false; + + try + { + if (Update == true && My.Settings.Default.UseSQLServer == false) + { + return; + } + + if (SQLConnProvider != null) + { + SQLConnProvider.Disable(); + } + + ConnectionsSaver conS = new ConnectionsSaver(); + + if (!My.Settings.Default.UseSQLServer) + { + conS.ConnectionFileName = GetStartupConnectionFileName(); + } + + conS.ConnectionList = ConnectionList; + conS.ContainerList = ContainerList; + conS.Export = false; + conS.SaveSecurity = new Security.Save(false); + conS.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; + + if (My.Settings.Default.UseSQLServer == true) + { + conS.SaveFormat = ConnectionsSaver.Format.SQL; + conS.SQLHost = Convert.ToString(My.Settings.Default.SQLHost); + conS.SQLDatabaseName = Convert.ToString(My.Settings.Default.SQLDatabaseName); + conS.SQLUsername = Convert.ToString(My.Settings.Default.SQLUser); + conS.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(My.Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey); + } + + conS.SaveConnections(); + + if (My.Settings.Default.UseSQLServer == true) + { + LastSqlUpdate = DateTime.Now; + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strConnectionsFileCouldNotBeSaved + Environment.NewLine + ex.Message); + } + finally + { + if (SQLConnProvider != null) + { + SQLConnProvider.Enable(); + } + } + } + + public static void SaveConnectionsAs() + { + bool previousTimerState = false; + ConnectionsSaver connectionsSave = new ConnectionsSaver(); + + try + { + if (SQLConnProvider != null) + { + SQLConnProvider.Disable(); + } + + using (SaveFileDialog saveFileDialog = new SaveFileDialog()) + { + saveFileDialog.CheckPathExists = true; + saveFileDialog.InitialDirectory = Info.ConnectionsFileInfo.DefaultConnectionsPath; + saveFileDialog.FileName = Info.ConnectionsFileInfo.DefaultConnectionsFile; + saveFileDialog.OverwritePrompt = true; + + List fileTypes = new List(); + fileTypes.AddRange(new[] {My.Language.strFiltermRemoteXML, "*.xml"}); + fileTypes.AddRange(new[] {My.Language.strFilterAll, "*.*"}); + + saveFileDialog.Filter = string.Join("|", fileTypes.ToArray()); + + if (!(saveFileDialog.ShowDialog(frmMain.Default) == DialogResult.OK)) + { + return ; + } + + connectionsSave.SaveFormat = ConnectionsSaver.Format.mRXML; + connectionsSave.ConnectionFileName = saveFileDialog.FileName; + connectionsSave.Export = false; + connectionsSave.SaveSecurity = new Security.Save(); + connectionsSave.ConnectionList = ConnectionList; + connectionsSave.ContainerList = ContainerList; + connectionsSave.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; + + connectionsSave.SaveConnections(); + + if (saveFileDialog.FileName == GetDefaultStartupConnectionFileName()) + { + My.Settings.Default.LoadConsFromCustomLocation = false; + } + else + { + My.Settings.Default.LoadConsFromCustomLocation = true; + My.Settings.Default.CustomConsPath = saveFileDialog.FileName; + } + } + + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage(string.Format(My.Language.strConnectionsFileCouldNotSaveAs, connectionsSave.ConnectionFileName), ex); + } + finally + { + if (SQLConnProvider != null) + { + SQLConnProvider.Enable(); + } + } + } + #endregion + + #region Opening Connection + public static ConnectionInfo CreateQuickConnect(string connectionString, ProtocolType protocol) + { + try + { + Uri uri = new Uri("dummyscheme" + System.Uri.SchemeDelimiter + connectionString); + if (string.IsNullOrEmpty(uri.Host)) + { + return null; + } + + ConnectionInfo newConnectionInfo = new ConnectionInfo(); + + if (My.Settings.Default.IdentifyQuickConnectTabs) + { + newConnectionInfo.Name = string.Format(My.Language.strQuick, uri.Host); + } + else + { + newConnectionInfo.Name = uri.Host; + } + + newConnectionInfo.Protocol = protocol; + newConnectionInfo.Hostname = uri.Host; + if (uri.Port == -1) + { + newConnectionInfo.SetDefaultPort(); + } + else + { + newConnectionInfo.Port = uri.Port; + } + newConnectionInfo.IsQuickConnect = true; + + return newConnectionInfo; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage(My.Language.strQuickConnectFailed, ex, MessageClass.ErrorMsg); + return null; + } + } + + public static void OpenConnection() + { + try + { + OpenConnection(ConnectionInfo.Force.None); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + public static void OpenConnection(ConnectionInfo.Force Force) + { + try + { + if (Windows.treeForm.tvConnections.SelectedNode.Tag == null) + { + return; + } + + if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == Tree.TreeNodeType.Connection | Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == Tree.TreeNodeType.PuttySession) + { + OpenConnection((ConnectionInfo)Windows.treeForm.tvConnections.SelectedNode.Tag, Force); + } + else if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == Tree.TreeNodeType.Container) + { + foreach (TreeNode tNode in ConnectionTree.SelectedNode.Nodes) + { + if (Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.Connection | Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == Tree.TreeNodeType.PuttySession) + { + if (tNode.Tag != null) + { + OpenConnection((ConnectionInfo)tNode.Tag, Force); + } + } + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + public static void OpenConnection(ConnectionInfo ConnectionInfo) + { + try + { + OpenConnection(ConnectionInfo, ConnectionInfo.Force.None); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + public static void OpenConnection(ConnectionInfo ConnectionInfo, System.Windows.Forms.Form ConnectionForm) + { + try + { + OpenConnectionFinal(ConnectionInfo, ConnectionInfo.Force.None, ConnectionForm); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + public static void OpenConnection(ConnectionInfo ConnectionInfo, System.Windows.Forms.Form ConnectionForm, ConnectionInfo.Force Force) + { + try + { + OpenConnectionFinal(ConnectionInfo, Force, ConnectionForm); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + public static void OpenConnection(ConnectionInfo ConnectionInfo, mRemoteNG.Connection.ConnectionInfo.Force Force) + { + try + { + OpenConnectionFinal(ConnectionInfo, Force, null); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + private static void OpenConnectionFinal(ConnectionInfo ConnectionInfo, ConnectionInfo.Force Force, System.Windows.Forms.Form ConForm) + { + try + { + if (ConnectionInfo.Hostname == "" && ConnectionInfo.Protocol != Connection.Protocol.ProtocolType.IntApp) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strConnectionOpenFailedNoHostname); + return; + } + + StartPreConnectionExternalApp(ConnectionInfo); + + if ((Force & ConnectionInfo.Force.DoNotJump) != ConnectionInfo.Force.DoNotJump) + { + if (SwitchToOpenConnection(ConnectionInfo)) + { + return; + } + } + + ProtocolFactory protocolFactory = new ProtocolFactory(); + ProtocolBase newProtocol = protocolFactory.CreateProtocol(ConnectionInfo); + + string connectionPanel = SetConnectionPanel(ConnectionInfo, Force); + Form connectionForm = SetConnectionForm(ConForm, connectionPanel); + Control connectionContainer = SetConnectionContainer(ConnectionInfo, connectionForm); + SetConnectionFormEventHandlers(newProtocol, connectionForm); + SetConnectionEventHandlers(newProtocol); + BuildConnectionInterfaceController(ConnectionInfo, newProtocol, connectionContainer); + + newProtocol.Force = Force; + + if (newProtocol.Initialize() == false) + { + newProtocol.Close(); + return; + } + + if (newProtocol.Connect() == false) + { + newProtocol.Close(); + return; + } + + ConnectionInfo.OpenConnections.Add(newProtocol); + SetTreeNodeImages(ConnectionInfo); + frmMain.Default.SelectedConnection = ConnectionInfo; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionOpenFailed + Environment.NewLine + ex.Message); + } + } + + private static void BuildConnectionInterfaceController(ConnectionInfo ConnectionInfo, ProtocolBase newProtocol, Control connectionContainer) + { + newProtocol.InterfaceControl = new Connection.InterfaceControl(connectionContainer, newProtocol, ConnectionInfo); + } + + private static void SetConnectionFormEventHandlers(ProtocolBase newProtocol, Form connectionForm) + { + newProtocol.Closed += ((UI.Window.ConnectionWindow)connectionForm).Prot_Event_Closed; + } + + private static Control SetConnectionContainer(ConnectionInfo ConnectionInfo, System.Windows.Forms.Form connectionForm) + { + Control connectionContainer = default(Control); + connectionContainer = ((ConnectionWindow)connectionForm).AddConnectionTab(ConnectionInfo); + + if (ConnectionInfo.Protocol == ProtocolType.IntApp) + { + if (Runtime.GetExtAppByName(ConnectionInfo.ExtApp).Icon != null) + (connectionContainer as Crownwood.Magic.Controls.TabPage).Icon = Runtime.GetExtAppByName(ConnectionInfo.ExtApp).Icon; + } + return connectionContainer; + } + + private static void SetTreeNodeImages(ConnectionInfo ConnectionInfo) + { + if (ConnectionInfo.IsQuickConnect == false) + { + if (ConnectionInfo.Protocol != Connection.Protocol.ProtocolType.IntApp) + { + Tree.Node.SetNodeImage(ConnectionInfo.TreeNode, TreeImageType.ConnectionOpen); + } + else + { + ExternalTool extApp = GetExtAppByName(ConnectionInfo.ExtApp); + if (extApp != null) + { + if (extApp.TryIntegrate && ConnectionInfo.TreeNode != null) + { + Tree.Node.SetNodeImage(ConnectionInfo.TreeNode, TreeImageType.ConnectionOpen); + } + } + } + } + } + + private static void SetConnectionEventHandlers(ProtocolBase newProtocol) + { + newProtocol.Disconnected += Prot_Event_Disconnected; + newProtocol.Connected += Prot_Event_Connected; + newProtocol.Closed += Prot_Event_Closed; + newProtocol.ErrorOccured += Prot_Event_ErrorOccured; + } + + private static Form SetConnectionForm(Form ConForm, string connectionPanel) + { + Form connectionForm = default(Form); + if (ConForm == null) + connectionForm = WindowList.FromString(connectionPanel); + else + connectionForm = ConForm; + + if (connectionForm == null) + connectionForm = AddPanel(connectionPanel); + else + ((ConnectionWindow) connectionForm).Show(frmMain.Default.pnlDock); + + connectionForm.Focus(); + return connectionForm; + } + + private static string SetConnectionPanel(ConnectionInfo ConnectionInfo, ConnectionInfo.Force Force) + { + string connectionPanel = ""; + if (ConnectionInfo.Panel == "" || (Force & ConnectionInfo.Force.OverridePanel) == ConnectionInfo.Force.OverridePanel | My.Settings.Default.AlwaysShowPanelSelectionDlg) + { + frmChoosePanel frmPnl = new frmChoosePanel(); + if (frmPnl.ShowDialog() == DialogResult.OK) + { + connectionPanel = frmPnl.Panel; + } + } + else + { + connectionPanel = ConnectionInfo.Panel; + } + return connectionPanel; + } + + private static void StartPreConnectionExternalApp(ConnectionInfo ConnectionInfo) + { + if (ConnectionInfo.PreExtApp != "") + { + Tools.ExternalTool extA = Runtime.GetExtAppByName(ConnectionInfo.PreExtApp); + if (extA != null) + { + extA.Start(ConnectionInfo); + } + } + } + + public static bool SwitchToOpenConnection(ConnectionInfo nCi) + { + InterfaceControl IC = FindConnectionContainer(nCi); + if (IC != null) + { + ((ConnectionWindow) IC.FindForm()).Focus(); + ((ConnectionWindow) IC.FindForm()).Show(frmMain.Default.pnlDock); + Crownwood.Magic.Controls.TabPage tabPage = (Crownwood.Magic.Controls.TabPage) IC.Parent; + tabPage.Selected = true; + return true; + } + return false; + } + #endregion + + #region Event Handlers + public static void Prot_Event_Disconnected(object sender, string DisconnectedMessage) + { + try + { + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(My.Language.strProtocolEventDisconnected, DisconnectedMessage), true); + + ProtocolBase Prot = (ProtocolBase)sender; + if (Prot.InterfaceControl.Info.Protocol == ProtocolType.RDP) + { + string[] Reason = DisconnectedMessage.Split("\r\n".ToCharArray()); + string ReasonCode = Reason[0]; + string ReasonDescription = Reason[1]; + if (Convert.ToInt32(ReasonCode) > 3) + { + if (!string.IsNullOrEmpty(ReasonDescription)) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strRdpDisconnected + Environment.NewLine + ReasonDescription + Environment.NewLine + string.Format(My.Language.strErrorCode, ReasonCode)); + } + else + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strRdpDisconnected + Environment.NewLine + string.Format(My.Language.strErrorCode, ReasonCode)); + } + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(My.Language.strProtocolEventDisconnectFailed, ex.Message), true); + } + } + + public static void Prot_Event_Closed(object sender) + { + try + { + ProtocolBase Prot = (ProtocolBase)sender; + + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strConnenctionCloseEvent, true); + + Runtime.MessageCollector.AddMessage(MessageClass.ReportMsg, string.Format(My.Language.strConnenctionClosedByUser, Prot.InterfaceControl.Info.Hostname, Prot.InterfaceControl.Info.Protocol.ToString(), (new Microsoft.VisualBasic.ApplicationServices.User()).Name)); + + Prot.InterfaceControl.Info.OpenConnections.Remove(Prot); + + if (Prot.InterfaceControl.Info.OpenConnections.Count < 1 && Prot.InterfaceControl.Info.IsQuickConnect == false) + { + Tree.Node.SetNodeImage(Prot.InterfaceControl.Info.TreeNode, TreeImageType.ConnectionClosed); + } + + if (Prot.InterfaceControl.Info.PostExtApp != "") + { + Tools.ExternalTool extA = Runtime.GetExtAppByName(Prot.InterfaceControl.Info.PostExtApp); + if (extA != null) + { + extA.Start(Prot.InterfaceControl.Info); + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnenctionCloseEventFailed + Environment.NewLine + ex.Message, true); + } + } + + public static void Prot_Event_Connected(object sender) + { + ProtocolBase prot = (ProtocolBase)sender; + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strConnectionEventConnected, true); + Runtime.MessageCollector.AddMessage(MessageClass.ReportMsg, string.Format(My.Language.strConnectionEventConnectedDetail, prot.InterfaceControl.Info.Hostname, prot.InterfaceControl.Info.Protocol.ToString(), (new Microsoft.VisualBasic.ApplicationServices.User()).Name, prot.InterfaceControl.Info.Description, prot.InterfaceControl.Info.UserField)); + } + + public static void Prot_Event_ErrorOccured(object sender, string ErrorMessage) + { + try + { + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strConnectionEventErrorOccured, true); + ProtocolBase Prot = (ProtocolBase)sender; + + if (Prot.InterfaceControl.Info.Protocol == ProtocolType.RDP) + { + if (Convert.ToInt32(ErrorMessage) > -1) + { + Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, string.Format(My.Language.strConnectionRdpErrorDetail, ErrorMessage, ProtocolRDP.FatalErrors.GetError(ErrorMessage))); + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strConnectionEventConnectionFailed + Environment.NewLine + ex.Message, true); + } + } + #endregion + + #region External Apps + public static Tools.ExternalTool GetExtAppByName(string Name) + { + foreach (Tools.ExternalTool extA in ExternalTools) + { + if (extA.DisplayName == Name) + return extA; + } + return null; + } + #endregion + + #region Misc + public static void GoToURL(string URL) + { + ConnectionInfo connectionInfo = new ConnectionInfo(); + + connectionInfo.Name = ""; + connectionInfo.Hostname = URL; + if (URL.StartsWith("https:")) + { + connectionInfo.Protocol = ProtocolType.HTTPS; + } + else + { + connectionInfo.Protocol = ProtocolType.HTTP; + } + connectionInfo.SetDefaultPort(); + connectionInfo.IsQuickConnect = true; + Runtime.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump); + } + + public static void GoToWebsite() + { + GoToURL(App.Info.GeneralAppInfo.URLHome); + } + + public static void GoToDonate() + { + GoToURL(App.Info.GeneralAppInfo.URLDonate); + } + + public static void GoToForum() + { + GoToURL(App.Info.GeneralAppInfo.URLForum); + } + + public static void GoToBugs() + { + GoToURL(App.Info.GeneralAppInfo.URLBugs); + } + + public static void Report(string Text) + { + try + { + StreamWriter sWr = new StreamWriter((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Report.log", true); + sWr.WriteLine(Text); + sWr.Close(); + } + catch (Exception) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strLogWriteToFileFailed); + } + } + + public static bool SaveReport() + { + StreamReader streamReader = null; + StreamWriter streamWriter = null; + try + { + streamReader = new StreamReader((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Report.log"); + string text = streamReader.ReadToEnd(); + streamReader.Close(); + streamWriter = new StreamWriter(App.Info.GeneralAppInfo.ReportingFilePath, true); + streamWriter.Write(text); + return true; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strLogWriteToFileFinalLocationFailed + Environment.NewLine + ex.Message, true); + return false; + } + finally + { + if (streamReader != null) + { + streamReader.Close(); + streamReader.Dispose(); + } + if (streamWriter != null) + { + streamWriter.Close(); + streamWriter.Dispose(); + } + } + } + + public static InterfaceControl FindConnectionContainer(ConnectionInfo connectionInfo) + { + if (connectionInfo.OpenConnections.Count > 0) + { + for (int i = 0; i <= WindowList.Count - 1; i++) + { + if (WindowList[i] is ConnectionWindow) + { + ConnectionWindow connectionWindow = (ConnectionWindow)WindowList[i]; + if (connectionWindow.TabController != null) + { + foreach (Crownwood.Magic.Controls.TabPage t in connectionWindow.TabController.TabPages) + { + if (t.Controls[0] != null && t.Controls[0] is InterfaceControl) + { + InterfaceControl IC = (InterfaceControl)t.Controls[0]; + if (IC.Info == connectionInfo) + { + return IC; + } + } + } + } + } + } + } + return null; + } + + // Override the font of all controls in a container with the default font based on the OS version + public static void FontOverride(Control ctlParent) + { + Control ctlChild = default(Control); + foreach (Control tempLoopVar_ctlChild in ctlParent.Controls) + { + ctlChild = tempLoopVar_ctlChild; + ctlChild.Font = new System.Drawing.Font(SystemFonts.MessageBoxFont.Name, ctlChild.Font.Size, ctlChild.Font.Style, ctlChild.Font.Unit, ctlChild.Font.GdiCharSet); + if (ctlChild.Controls.Count > 0) + { + FontOverride(ctlChild); + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Screens.cs b/mRemoteV1/App/Screens.cs new file mode 100644 index 00000000..6c24a6e0 --- /dev/null +++ b/mRemoteV1/App/Screens.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; + +namespace mRemoteNG.App +{ + public class Screens + { + public static void SendFormToScreen(Screen Screen) + { + bool wasMax = false; + + if (frmMain.Default.WindowState == FormWindowState.Maximized) + { + wasMax = true; + frmMain.Default.WindowState = FormWindowState.Normal; + } + + frmMain.Default.Location = Screen.Bounds.Location; + + if (wasMax) + { + frmMain.Default.WindowState = FormWindowState.Maximized; + } + } + + public static void SendPanelToScreen(DockContent Panel, Screen Screen) + { + Panel.DockState = DockState.Float; + Panel.ParentForm.Left = Screen.Bounds.Location.X; + Panel.ParentForm.Top = Screen.Bounds.Location.Y; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Shutdown.cs b/mRemoteV1/App/Shutdown.cs new file mode 100644 index 00000000..44668566 --- /dev/null +++ b/mRemoteV1/App/Shutdown.cs @@ -0,0 +1,87 @@ +using mRemoteNG.Messages; +using mRemoteNG.Tools; +using System; +using System.Diagnostics; + +namespace mRemoteNG.App +{ + public class Shutdown + { + private static string _updateFilePath = null; + + public static bool UpdatePending + { + get + { + return !string.IsNullOrEmpty(_updateFilePath); + } + } + + public static void Quit(string updateFilePath = null) + { + _updateFilePath = updateFilePath; + frmMain.Default.Close(); + } + + public static void Cleanup() + { + try + { + StopPuttySessionWatcher(); + DisposeNotificationAreaIcon(); + SaveConnections(); + SaveSettings(); + UnregisterBrowsers(); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strSettingsCouldNotBeSavedOrTrayDispose + Environment.NewLine + ex.Message, true); + } + } + + private static void StopPuttySessionWatcher() + { + Config.Putty.Sessions.StopWatcher(); + } + + private static void DisposeNotificationAreaIcon() + { + if (Runtime.NotificationAreaIcon != null && Runtime.NotificationAreaIcon.Disposed == false) + Runtime.NotificationAreaIcon.Dispose(); + } + + private static void SaveConnections() + { + if (My.Settings.Default.SaveConsOnExit) + Runtime.SaveConnections(); + } + + private static void SaveSettings() + { + Config.Settings.SettingsSaver.SaveSettings(); + } + + private static void UnregisterBrowsers() + { + IeBrowserEmulation.Unregister(); + } + + public static void StartUpdate() + { + try + { + RunUpdateFile(); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "The update could not be started." + Environment.NewLine + ex.Message, true); + } + } + + private static void RunUpdateFile() + { + if (UpdatePending) + Process.Start(_updateFilePath); + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Startup.cs b/mRemoteV1/App/Startup.cs new file mode 100644 index 00000000..b012f7fb --- /dev/null +++ b/mRemoteV1/App/Startup.cs @@ -0,0 +1,467 @@ +using Microsoft.Win32; +using mRemoteNG.App.Update; +using mRemoteNG.Connection; +using mRemoteNG.Messages; +using mRemoteNG.My; +using mRemoteNG.Tools; +using mRemoteNG.Tree; +using mRemoteNG.UI.Window; +using PSTaskDialog; +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Management; +using System.Threading; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; +using mRemoteNG.Config.Connections; + +namespace mRemoteNG.App +{ + public class Startup + { + private static AppUpdater _appUpdate; + + + public static void CheckCompatibility() + { + CheckFipsPolicy(); + CheckLenovoAutoScrollUtility(); + } + private static void CheckFipsPolicy() + { + RegistryKey regKey = default(RegistryKey); + + bool isFipsPolicyEnabled = false; + + // Windows XP/Windows Server 2003 + regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa"); + if (regKey != null) + { + if (!((int)regKey.GetValue("FIPSAlgorithmPolicy") == 0)) + { + isFipsPolicyEnabled = true; + } + } + + // Windows Vista/Windows Server 2008 and newer + regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy"); + if (regKey != null) + { + if (!((int)regKey.GetValue("Enabled") == 0)) + { + isFipsPolicyEnabled = true; + } + } + + if (isFipsPolicyEnabled) + { + MessageBox.Show(frmMain.Default, string.Format(My.Language.strErrorFipsPolicyIncompatible, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName), (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); + System.Environment.Exit(1); + } + } + private static void CheckLenovoAutoScrollUtility() + { + if (!Settings.Default.CompatibilityWarnLenovoAutoScrollUtility) + { + return; + } + + Process[] proccesses = new Process[] { }; + try + { + proccesses = Process.GetProcessesByName("virtscrl"); + } + catch + { + } + if (proccesses.Length == 0) + { + return; + } + + cTaskDialog.MessageBox(System.Windows.Forms.Application.ProductName, My.Language.strCompatibilityProblemDetected, string.Format(My.Language.strCompatibilityLenovoAutoScrollUtilityDetected, System.Windows.Forms.Application.ProductName), "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.OK, eSysIcons.Warning, eSysIcons.Warning); + if (cTaskDialog.VerificationChecked) + { + Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false; + } + } + + + public static void CreatePanels() + { + Windows.configForm = new ConfigWindow(Windows.configPanel); + Windows.configPanel = Windows.configForm; + + Windows.treeForm = new ConnectionTreeWindow(Windows.treePanel); + Windows.treePanel = Windows.treeForm; + ConnectionTree.TreeView = Windows.treeForm.tvConnections; + + Windows.errorsForm = new ErrorAndInfoWindow(Windows.errorsPanel); + Windows.errorsPanel = Windows.errorsForm; + + Windows.sessionsForm = new SessionsWindow(Windows.sessionsPanel); + Windows.sessionsPanel = Windows.sessionsForm; + + Windows.screenshotForm = new ScreenshotManagerWindow(Windows.screenshotPanel); + Windows.screenshotPanel = Windows.screenshotForm; + + Windows.updateForm = new UpdateWindow(Windows.updatePanel); + Windows.updatePanel = Windows.updateForm; + + Windows.AnnouncementForm = new AnnouncementWindow(Windows.AnnouncementPanel); + Windows.AnnouncementPanel = Windows.AnnouncementForm; + } + public static void SetDefaultLayout() + { + frmMain.Default.pnlDock.Visible = false; + + frmMain.Default.pnlDock.DockLeftPortion = frmMain.Default.pnlDock.Width * 0.2; + frmMain.Default.pnlDock.DockRightPortion = frmMain.Default.pnlDock.Width * 0.2; + frmMain.Default.pnlDock.DockTopPortion = frmMain.Default.pnlDock.Height * 0.25; + frmMain.Default.pnlDock.DockBottomPortion = frmMain.Default.pnlDock.Height * 0.25; + + Windows.treePanel.Show(frmMain.Default.pnlDock, DockState.DockLeft); + Windows.configPanel.Show(frmMain.Default.pnlDock); + Windows.configPanel.DockTo(Windows.treePanel.Pane, DockStyle.Bottom, -1); + + Windows.screenshotForm.Hide(); + + frmMain.Default.pnlDock.Visible = true; + } + public static void GetConnectionIcons() + { + string iPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Icons\\"; + if (Directory.Exists(iPath) == false) + { + return; + } + + foreach (string f in Directory.GetFiles(iPath, "*.ico", SearchOption.AllDirectories)) + { + FileInfo fInfo = new FileInfo(f); + Array.Resize(ref ConnectionIcon.Icons, ConnectionIcon.Icons.Length + 1); + ConnectionIcon.Icons.SetValue(fInfo.Name.Replace(".ico", ""), ConnectionIcon.Icons.Length - 1); + } + } + + + public static void CreateLogger() + { + Runtime.Log = Logger.GetSingletonInstance(); + } + public static void LogStartupData() + { + if (Settings.Default.WriteLogFile) + { + LogApplicationData(); + LogCmdLineArgs(); + LogSystemData(); + LogCLRData(); + LogCultureData(); + } + } + private static void LogSystemData() + { + string osData = GetOperatingSystemData(); + string architecture = GetArchitectureData(); + Runtime.Log.InfoFormat(string.Join(" ", Array.FindAll(new string[] { osData, architecture }, s => !string.IsNullOrEmpty(Convert.ToString(s))))); + } + private static string GetOperatingSystemData() + { + string osVersion = string.Empty; + string servicePack = string.Empty; + string osData = string.Empty; + + try + { + foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary=True").Get()) + { + osVersion = GetOSVersion(osVersion, managementObject); + servicePack = GetOSServicePack(servicePack, managementObject); + } + } + catch (Exception ex) + { + Runtime.Log.WarnFormat("Error retrieving operating system information from WMI. {0}", ex.Message); + } + osData = string.Join(" ", new string[] { osVersion, servicePack }); + return osData; + } + private static string GetOSVersion(string osVersion, ManagementObject managementObject) + { + osVersion = Convert.ToString(managementObject.GetPropertyValue("Caption")).Trim(); + return osVersion; + } + private static string GetOSServicePack(string servicePack, ManagementObject managementObject) + { + int servicePackNumber = Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion")); + if (!(servicePackNumber == 0)) + { + servicePack = string.Format("Service Pack {0}", servicePackNumber); + } + return servicePack; + } + private static string GetArchitectureData() + { + string architecture = string.Empty; + try + { + foreach (ManagementObject managementObject in new ManagementObjectSearcher("SELECT * FROM Win32_Processor WHERE DeviceID=\'CPU0\'").Get()) + { + int addressWidth = Convert.ToInt32(managementObject.GetPropertyValue("AddressWidth")); + architecture = string.Format("{0}-bit", addressWidth); + } + } + catch (Exception ex) + { + Runtime.Log.WarnFormat("Error retrieving operating system address width from WMI. {0}", ex.Message); + } + return architecture; + } + private static void LogApplicationData() + { + #if !PORTABLE + Log.InfoFormat("{0} {1} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion); + #else + Runtime.Log.InfoFormat("{0} {1} {2} starting.", System.Windows.Forms.Application.ProductName, System.Windows.Forms.Application.ProductVersion, My.Language.strLabelPortableEdition); + #endif + } + private static void LogCmdLineArgs() + { + Runtime.Log.InfoFormat("Command Line: {0}", Environment.GetCommandLineArgs()); + } + private static void LogCLRData() + { + Runtime.Log.InfoFormat("Microsoft .NET CLR {0}", System.Environment.Version.ToString()); + } + private static void LogCultureData() + { + Runtime.Log.InfoFormat("System Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName); + } + + + public static void CreateConnectionsProvider() + { + if (My.Settings.Default.UseSQLServer == true) + { + SqlConnectionsProvider _sqlConnectionsProvider = new SqlConnectionsProvider(); + } + } + + public static void CheckForUpdate() + { + if (_appUpdate == null) + { + _appUpdate = new AppUpdater(); + } + else if (_appUpdate.IsGetUpdateInfoRunning) + { + return; + } + + DateTime nextUpdateCheck = Convert.ToDateTime(Settings.Default.CheckForUpdatesLastCheck.Add(TimeSpan.FromDays(Convert.ToDouble(Settings.Default.CheckForUpdatesFrequencyDays)))); + if (!Settings.Default.UpdatePending && DateTime.UtcNow < nextUpdateCheck) + { + return; + } + + _appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted; + _appUpdate.GetUpdateInfoAsync(); + } + private static void GetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e) + { + if (Runtime.MainForm.InvokeRequired) + { + Runtime.MainForm.Invoke(new AsyncCompletedEventHandler(GetUpdateInfoCompleted), new object[] { sender, e }); + return; + } + + try + { + _appUpdate.GetUpdateInfoCompletedEvent -= GetUpdateInfoCompleted; + + if (e.Cancelled) + { + return; + } + if (e.Error != null) + { + throw (e.Error); + } + + if (_appUpdate.IsUpdateAvailable()) + { + Windows.Show(WindowType.Update); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage("GetUpdateInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true); + } + } + + + public static void CheckForAnnouncement() + { + if (_appUpdate == null) + _appUpdate = new AppUpdater(); + else if (_appUpdate.IsGetAnnouncementInfoRunning) + return; + + _appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted; + _appUpdate.GetAnnouncementInfoAsync(); + } + private static void GetAnnouncementInfoCompleted(object sender, AsyncCompletedEventArgs e) + { + if (Runtime.MainForm.InvokeRequired) + { + Runtime.MainForm.Invoke(new AsyncCompletedEventHandler(GetAnnouncementInfoCompleted), new object[] { sender, e }); + return; + } + + try + { + _appUpdate.GetAnnouncementInfoCompletedEvent -= GetAnnouncementInfoCompleted; + + if (e.Cancelled) + { + return; + } + if (e.Error != null) + { + throw (e.Error); + } + + if (_appUpdate.IsAnnouncementAvailable()) + { + Windows.Show(WindowType.Announcement); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage("GetAnnouncementInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true); + } + } + + + public static void ParseCommandLineArgs() + { + try + { + CmdArgumentsInterpreter cmd = new CmdArgumentsInterpreter(Environment.GetCommandLineArgs()); + + string ConsParam = ""; + if (cmd["cons"] != null) + { + ConsParam = "cons"; + } + if (cmd["c"] != null) + { + ConsParam = "c"; + } + + string ResetPosParam = ""; + if (cmd["resetpos"] != null) + { + ResetPosParam = "resetpos"; + } + if (cmd["rp"] != null) + { + ResetPosParam = "rp"; + } + + string ResetPanelsParam = ""; + if (cmd["resetpanels"] != null) + { + ResetPanelsParam = "resetpanels"; + } + if (cmd["rpnl"] != null) + { + ResetPanelsParam = "rpnl"; + } + + string ResetToolbarsParam = ""; + if (cmd["resettoolbar"] != null) + { + ResetToolbarsParam = "resettoolbar"; + } + if (cmd["rtbr"] != null) + { + ResetToolbarsParam = "rtbr"; + } + + if (cmd["reset"] != null) + { + ResetPosParam = "rp"; + ResetPanelsParam = "rpnl"; + ResetToolbarsParam = "rtbr"; + } + + string NoReconnectParam = ""; + if (cmd["noreconnect"] != null) + { + NoReconnectParam = "noreconnect"; + } + if (cmd["norc"] != null) + { + NoReconnectParam = "norc"; + } + + if (!string.IsNullOrEmpty(ConsParam)) + { + if (File.Exists(cmd[ConsParam]) == false) + { + if (File.Exists((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam])) + { + Settings.Default.LoadConsFromCustomLocation = true; + Settings.Default.CustomConsPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\" + cmd[ConsParam]; + return; + } + else if (File.Exists(App.Info.ConnectionsFileInfo.DefaultConnectionsPath + "\\" + cmd[ConsParam])) + { + Settings.Default.LoadConsFromCustomLocation = true; + Settings.Default.CustomConsPath = App.Info.ConnectionsFileInfo.DefaultConnectionsPath + "\\" + cmd[ConsParam]; + return; + } + } + else + { + Settings.Default.LoadConsFromCustomLocation = true; + Settings.Default.CustomConsPath = cmd[ConsParam]; + return; + } + } + + if (!string.IsNullOrEmpty(ResetPosParam)) + { + Settings.Default.MainFormKiosk = false; + Settings.Default.MainFormLocation = new Point(999, 999); + Settings.Default.MainFormSize = new Size(900, 600); + Settings.Default.MainFormState = FormWindowState.Normal; + } + + if (!string.IsNullOrEmpty(ResetPanelsParam)) + { + Settings.Default.ResetPanels = true; + } + + if (!string.IsNullOrEmpty(NoReconnectParam)) + { + Settings.Default.NoReconnect = true; + } + + if (!string.IsNullOrEmpty(ResetToolbarsParam)) + { + Settings.Default.ResetToolbars = true; + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, My.Language.strCommandLineArgsCouldNotBeParsed + Environment.NewLine + ex.Message); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/App.SupportedCultures.cs b/mRemoteV1/App/SupportedCultures.cs similarity index 59% rename from mRemoteV1/App/App.SupportedCultures.cs rename to mRemoteV1/App/SupportedCultures.cs index 19488dc7..e45d96f3 100644 --- a/mRemoteV1/App/App.SupportedCultures.cs +++ b/mRemoteV1/App/SupportedCultures.cs @@ -5,27 +5,12 @@ using System.Diagnostics; namespace mRemoteNG.App { - public class SupportedCultures : System.Collections.Generic.Dictionary + public class SupportedCultures : Dictionary { - - private SupportedCultures() - { - System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo); - foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(',')) - { - try - { - CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim()); - Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName)); - } - catch (Exception ex) - { - Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString())); - } - } - } - - private static SupportedCultures _Instance = null; + private static SupportedCultures _Instance = null; + + + public static void InstantiateSingleton() { if (_Instance == null) @@ -33,6 +18,23 @@ namespace mRemoteNG.App _Instance = new SupportedCultures(); } } + + private SupportedCultures() + { + System.Globalization.CultureInfo CultureInfo = default(System.Globalization.CultureInfo); + foreach (string CultureName in My.Settings.Default.SupportedUICultures.Split(',')) + { + try + { + CultureInfo = new System.Globalization.CultureInfo(CultureName.Trim()); + Add(CultureInfo.Name, CultureInfo.TextInfo.ToTitleCase(CultureInfo.NativeName)); + } + catch (Exception ex) + { + Debug.Print(string.Format("An exception occurred while adding the culture \'{0}\' to the list of supported cultures. {1}", CultureName, ex.ToString())); + } + } + } public static bool IsNameSupported(string CultureName) { @@ -81,4 +83,4 @@ namespace mRemoteNG.App } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/App/Update/AnnouncementInfo.cs b/mRemoteV1/App/Update/AnnouncementInfo.cs new file mode 100644 index 00000000..4f07eb09 --- /dev/null +++ b/mRemoteV1/App/Update/AnnouncementInfo.cs @@ -0,0 +1,32 @@ +using System; + +namespace mRemoteNG.App.Update +{ + public class AnnouncementInfo + { + #region Public Properties + public bool IsValid { get; set; } + public string Name { get; set; } + public Uri Address { get; set; } + #endregion + + #region Public Methods + public static AnnouncementInfo FromString(string input) + { + AnnouncementInfo newInfo = new AnnouncementInfo(); + if (string.IsNullOrEmpty(input)) + { + newInfo.IsValid = false; + } + else + { + UpdateFile updateFile = new UpdateFile(input); + newInfo.Name = updateFile.GetString("Name"); + newInfo.Address = updateFile.GetUri("URL"); + newInfo.IsValid = true; + } + return newInfo; + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/App/App.Update.cs b/mRemoteV1/App/Update/AppUpdater.cs similarity index 58% rename from mRemoteV1/App/App.Update.cs rename to mRemoteV1/App/Update/AppUpdater.cs index 1a5cc33b..5463e36e 100644 --- a/mRemoteV1/App/App.Update.cs +++ b/mRemoteV1/App/Update/AppUpdater.cs @@ -8,79 +8,19 @@ using mRemoteNG.Tools; using System.Reflection; -namespace mRemoteNG.App +namespace mRemoteNG.App.Update { - public class Update + public class AppUpdater { - #region Events - private AsyncCompletedEventHandler GetUpdateInfoCompletedEventEvent; - public event AsyncCompletedEventHandler GetUpdateInfoCompletedEvent - { - add - { - GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetUpdateInfoCompletedEventEvent, value); - } - remove - { - GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetUpdateInfoCompletedEventEvent, value); - } - } - - private AsyncCompletedEventHandler GetChangeLogCompletedEventEvent; - public event AsyncCompletedEventHandler GetChangeLogCompletedEvent - { - add - { - GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetChangeLogCompletedEventEvent, value); - } - remove - { - GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetChangeLogCompletedEventEvent, value); - } - } - - private AsyncCompletedEventHandler GetAnnouncementInfoCompletedEventEvent; - public event AsyncCompletedEventHandler GetAnnouncementInfoCompletedEvent - { - add - { - GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value); - } - remove - { - GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value); - } - } - - private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent; - public event DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEvent - { - add - { - DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler) System.Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value); - } - remove - { - DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler) System.Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value); - } - } - - private AsyncCompletedEventHandler DownloadUpdateCompletedEventEvent; - public event AsyncCompletedEventHandler DownloadUpdateCompletedEvent - { - add - { - DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Combine(DownloadUpdateCompletedEventEvent, value); - } - remove - { - DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler) System.Delegate.Remove(DownloadUpdateCompletedEventEvent, value); - } - } - #endregion - + private UpdateInfo _currentUpdateInfo; + private string _changeLog; + private AnnouncementInfo _currentAnnouncementInfo; + private WebProxy _webProxy; + private Thread _getUpdateInfoThread; + private Thread _getChangeLogThread; + private Thread _getAnnouncementInfoThread; + #region Public Properties - private UpdateInfo _currentUpdateInfo; public UpdateInfo CurrentUpdateInfo { get @@ -88,8 +28,7 @@ namespace mRemoteNG.App return _currentUpdateInfo; } } - - private string _changeLog; + public string ChangeLog { get @@ -97,8 +36,7 @@ namespace mRemoteNG.App return _changeLog; } } - - private AnnouncementInfo _currentAnnouncementInfo; + public AnnouncementInfo CurrentAnnouncementInfo { get @@ -106,7 +44,7 @@ namespace mRemoteNG.App return _currentAnnouncementInfo; } } - + public bool IsGetUpdateInfoRunning { get @@ -121,7 +59,7 @@ namespace mRemoteNG.App return false; } } - + public bool IsGetChangeLogRunning { get @@ -136,7 +74,7 @@ namespace mRemoteNG.App return false; } } - + public bool IsGetAnnouncementInfoRunning { get @@ -151,7 +89,7 @@ namespace mRemoteNG.App return false; } } - + public bool IsDownloadUpdateRunning { get @@ -160,16 +98,16 @@ namespace mRemoteNG.App } } #endregion - + #region Public Methods - public Update() + public AppUpdater() { SetProxySettings(); } public void SetProxySettings() { - SetProxySettings(System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy), System.Convert.ToString(My.Settings.Default.UpdateProxyAddress), System.Convert.ToInt32(My.Settings.Default.UpdateProxyPort), System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication), System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), Info.General.EncryptionKey)); + SetProxySettings(System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy), System.Convert.ToString(My.Settings.Default.UpdateProxyAddress), System.Convert.ToInt32(My.Settings.Default.UpdateProxyPort), System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication), System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), Info.GeneralAppInfo.EncryptionKey)); } public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password) @@ -280,7 +218,7 @@ namespace mRemoteNG.App DownloadUpdateWebClient.DownloadFileAsync(CurrentUpdateInfo.DownloadAddress, _currentUpdateInfo.UpdateFilePath); } #endregion - + #region Private Properties private WebClient _downloadUpdateWebClient; private WebClient DownloadUpdateWebClient @@ -301,19 +239,12 @@ namespace mRemoteNG.App } } #endregion - - #region Private Fields - private WebProxy _webProxy; - private Thread _getUpdateInfoThread; - private Thread _getChangeLogThread; - private Thread _getAnnouncementInfoThread; - #endregion - + #region Private Methods private WebClient CreateWebClient() { WebClient webClient = new WebClient(); - webClient.Headers.Add("user-agent", Info.General.UserAgent); + webClient.Headers.Add("user-agent", Info.GeneralAppInfo.UserAgent); webClient.Proxy = _webProxy; return webClient; } @@ -354,7 +285,7 @@ namespace mRemoteNG.App private void GetUpdateInfo() { - Uri updateFileUri = new Uri(new Uri(System.Convert.ToString(My.Settings.Default.UpdateAddress)), new Uri(Info.Update.FileName, UriKind.Relative)); + Uri updateFileUri = new Uri(new Uri(System.Convert.ToString(My.Settings.Default.UpdateAddress)), new Uri(Info.UpdateChannelInfo.FileName, UriKind.Relative)); DownloadStringCompletedEventArgs e = DownloadString(updateFileUri); if (!e.Cancelled && e.Error == null) @@ -452,172 +383,72 @@ namespace mRemoteNG.App _downloadUpdateWebClient = null; } #endregion - - #region Public Classes - public class UpdateInfo - { - #region Public Properties - public bool IsValid {get; set;} - public Version Version {get; set;} - public Uri DownloadAddress {get; set;} - public string UpdateFilePath {get; set;} - public Uri ChangeLogAddress {get; set;} - public Uri ImageAddress {get; set;} - public Uri ImageLinkAddress {get; set;} - public string CertificateThumbprint {get; set;} - #endregion - - #region Public Methods - public static UpdateInfo FromString(string input) - { - UpdateInfo newInfo = new UpdateInfo(); - if (string.IsNullOrEmpty(input)) - { - newInfo.IsValid = false; - } - else - { - UpdateFile updateFile = new UpdateFile(input); - newInfo.Version = updateFile.GetVersion("Version"); - newInfo.DownloadAddress = updateFile.GetUri("dURL"); - newInfo.ChangeLogAddress = updateFile.GetUri("clURL"); - newInfo.ImageAddress = updateFile.GetUri("imgURL"); - newInfo.ImageLinkAddress = updateFile.GetUri("imgURLLink"); - newInfo.CertificateThumbprint = updateFile.GetThumbprint("CertificateThumbprint"); - newInfo.IsValid = true; - } - return newInfo; - } - #endregion - } - - public class AnnouncementInfo - { - #region Public Properties - public bool IsValid {get; set;} - public string Name {get; set;} - public Uri Address {get; set;} - #endregion - - #region Public Methods - public static AnnouncementInfo FromString(string input) - { - AnnouncementInfo newInfo = new AnnouncementInfo(); - if (string.IsNullOrEmpty(input)) - { - newInfo.IsValid = false; - } - else - { - UpdateFile updateFile = new UpdateFile(input); - newInfo.Name = updateFile.GetString("Name"); - newInfo.Address = updateFile.GetUri("URL"); - newInfo.IsValid = true; - } - return newInfo; - } - #endregion - } - #endregion - - #region Private Classes - private class UpdateFile - { - #region Public Properties - private Dictionary _items = new Dictionary(StringComparer.InvariantCultureIgnoreCase); - // ReSharper disable MemberCanBePrivate.Local - public Dictionary Items - { - // ReSharper restore MemberCanBePrivate.Local - get - { - return _items; - } - } - #endregion - - #region Public Methods - public UpdateFile(string content) - { - FromString(content); - } - - // ReSharper disable MemberCanBePrivate.Local - public void FromString(string content) - { - // ReSharper restore MemberCanBePrivate.Local - if (string.IsNullOrEmpty(content)) - { - } - else - { - char[] lineSeparators = new char[] {'\n', '\r'}; - char[] keyValueSeparators = new char[] {':', '='}; - char[] commentCharacters = new char[] {'#', ';', '\''}; - - string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - foreach (string line in lines) - { - string trimmedLine = line.Trim(); - if (trimmedLine.Length == 0) - { - continue; - } - if (!(trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1)) - { - continue; - } + + #region Events + private AsyncCompletedEventHandler GetUpdateInfoCompletedEventEvent; + public event AsyncCompletedEventHandler GetUpdateInfoCompletedEvent + { + add + { + GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetUpdateInfoCompletedEventEvent, value); + } + remove + { + GetUpdateInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetUpdateInfoCompletedEventEvent, value); + } + } - string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2); - if (!(parts.Length == 2)) - { - continue; - } - string key = System.Convert.ToString(parts[0].Trim()); - string value = System.Convert.ToString(parts[1].Trim()); - - _items.Add(key, value); - } - } - } - - // ReSharper disable MemberCanBePrivate.Local - public string GetString(string key) - { - // ReSharper restore MemberCanBePrivate.Local - if (!Items.ContainsKey(key)) - { - return string.Empty; - } - return this._items[key]; - } - - public Version GetVersion(string key) - { - string value = GetString(key); - if (string.IsNullOrEmpty(value)) - { - return null; - } - return new Version(value); - } - - public Uri GetUri(string key) - { - string value = GetString(key); - if (string.IsNullOrEmpty(value)) - { - return null; - } - return new Uri(value); - } - - public string GetThumbprint(string key) - { - return GetString(key).Replace(" ", "").ToUpperInvariant(); - } - #endregion - } + private AsyncCompletedEventHandler GetChangeLogCompletedEventEvent; + public event AsyncCompletedEventHandler GetChangeLogCompletedEvent + { + add + { + GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetChangeLogCompletedEventEvent, value); + } + remove + { + GetChangeLogCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetChangeLogCompletedEventEvent, value); + } + } + + private AsyncCompletedEventHandler GetAnnouncementInfoCompletedEventEvent; + public event AsyncCompletedEventHandler GetAnnouncementInfoCompletedEvent + { + add + { + GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value); + } + remove + { + GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value); + } + } + + private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent; + public event DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEvent + { + add + { + DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Combine(DownloadUpdateProgressChangedEventEvent, value); + } + remove + { + DownloadUpdateProgressChangedEventEvent = (DownloadProgressChangedEventHandler)System.Delegate.Remove(DownloadUpdateProgressChangedEventEvent, value); + } + } + + private AsyncCompletedEventHandler DownloadUpdateCompletedEventEvent; + public event AsyncCompletedEventHandler DownloadUpdateCompletedEvent + { + add + { + DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Combine(DownloadUpdateCompletedEventEvent, value); + } + remove + { + DownloadUpdateCompletedEventEvent = (AsyncCompletedEventHandler)System.Delegate.Remove(DownloadUpdateCompletedEventEvent, value); + } + } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/App/Update/UpdateFile.cs b/mRemoteV1/App/Update/UpdateFile.cs new file mode 100644 index 00000000..45fa7478 --- /dev/null +++ b/mRemoteV1/App/Update/UpdateFile.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; + +namespace mRemoteNG.App.Update +{ + public class UpdateFile + { + #region Public Properties + private Dictionary _items = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + // ReSharper disable MemberCanBePrivate.Local + public Dictionary Items + { + // ReSharper restore MemberCanBePrivate.Local + get + { + return _items; + } + } + #endregion + + #region Public Methods + public UpdateFile(string content) + { + FromString(content); + } + + // ReSharper disable MemberCanBePrivate.Local + public void FromString(string content) + { + // ReSharper restore MemberCanBePrivate.Local + if (string.IsNullOrEmpty(content)) + { + } + else + { + char[] lineSeparators = new char[] { '\n', '\r' }; + char[] keyValueSeparators = new char[] { ':', '=' }; + char[] commentCharacters = new char[] { '#', ';', '\'' }; + + string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + foreach (string line in lines) + { + string trimmedLine = line.Trim(); + if (trimmedLine.Length == 0) + { + continue; + } + if (!(trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) == -1)) + { + continue; + } + + string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2); + if (!(parts.Length == 2)) + { + continue; + } + string key = System.Convert.ToString(parts[0].Trim()); + string value = System.Convert.ToString(parts[1].Trim()); + + _items.Add(key, value); + } + } + } + + // ReSharper disable MemberCanBePrivate.Local + public string GetString(string key) + { + // ReSharper restore MemberCanBePrivate.Local + if (!Items.ContainsKey(key)) + { + return string.Empty; + } + return this._items[key]; + } + + public Version GetVersion(string key) + { + string value = GetString(key); + if (string.IsNullOrEmpty(value)) + { + return null; + } + return new Version(value); + } + + public Uri GetUri(string key) + { + string value = GetString(key); + if (string.IsNullOrEmpty(value)) + { + return null; + } + return new Uri(value); + } + + public string GetThumbprint(string key) + { + return GetString(key).Replace(" ", "").ToUpperInvariant(); + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Update/UpdateInfo.cs b/mRemoteV1/App/Update/UpdateInfo.cs new file mode 100644 index 00000000..44e7351c --- /dev/null +++ b/mRemoteV1/App/Update/UpdateInfo.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.App.Update +{ + public class UpdateInfo + { + public bool IsValid { get; set; } + public Version Version { get; set; } + public Uri DownloadAddress { get; set; } + public string UpdateFilePath { get; set; } + public Uri ChangeLogAddress { get; set; } + public Uri ImageAddress { get; set; } + public Uri ImageLinkAddress { get; set; } + public string CertificateThumbprint { get; set; } + + public static UpdateInfo FromString(string input) + { + UpdateInfo newInfo = new UpdateInfo(); + if (string.IsNullOrEmpty(input)) + { + newInfo.IsValid = false; + } + else + { + UpdateFile updateFile = new UpdateFile(input); + newInfo.Version = updateFile.GetVersion("Version"); + newInfo.DownloadAddress = updateFile.GetUri("dURL"); + newInfo.ChangeLogAddress = updateFile.GetUri("clURL"); + newInfo.ImageAddress = updateFile.GetUri("imgURL"); + newInfo.ImageLinkAddress = updateFile.GetUri("imgURLLink"); + newInfo.CertificateThumbprint = updateFile.GetThumbprint("CertificateThumbprint"); + newInfo.IsValid = true; + } + return newInfo; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/App/Windows.cs b/mRemoteV1/App/Windows.cs new file mode 100644 index 00000000..80075e8e --- /dev/null +++ b/mRemoteV1/App/Windows.cs @@ -0,0 +1,155 @@ +using mRemoteNG.Forms; +using mRemoteNG.Forms.OptionsPages; +using mRemoteNG.Messages; +using System; +using WeifenLuo.WinFormsUI.Docking; + +namespace mRemoteNG.App +{ + public class Windows + { + public static UI.Window.ConnectionTreeWindow treeForm; + public static DockContent treePanel = new DockContent(); + public static UI.Window.ConfigWindow configForm; + public static DockContent configPanel = new DockContent(); + public static UI.Window.ErrorAndInfoWindow errorsForm; + public static DockContent errorsPanel = new DockContent(); + public static UI.Window.SessionsWindow sessionsForm; + public static DockContent sessionsPanel = new DockContent(); + public static UI.Window.ScreenshotManagerWindow screenshotForm; + public static DockContent screenshotPanel = new DockContent(); + public static ExportForm exportForm; + public static DockContent exportPanel = new DockContent(); + public static UI.Window.AboutWindow aboutForm; + public static DockContent aboutPanel = new DockContent(); + public static UI.Window.UpdateWindow updateForm; + public static DockContent updatePanel = new DockContent(); + public static UI.Window.SSHTransferWindow sshtransferForm; + public static DockContent sshtransferPanel = new DockContent(); + public static UI.Window.ActiveDirectoryImportWindow adimportForm; + public static DockContent adimportPanel = new DockContent(); + public static UI.Window.HelpWindow helpForm; + public static DockContent helpPanel = new DockContent(); + public static UI.Window.ExternalToolsWindow externalappsForm; + public static DockContent externalappsPanel = new DockContent(); + public static UI.Window.PortScanWindow portscanForm; + public static DockContent portscanPanel = new DockContent(); + public static UI.Window.UltraVNCWindow ultravncscForm; + public static DockContent ultravncscPanel = new DockContent(); + public static UI.Window.ComponentsCheckWindow componentscheckForm; + public static DockContent componentscheckPanel = new DockContent(); + public static UI.Window.AnnouncementWindow AnnouncementForm; + public static DockContent AnnouncementPanel = new DockContent(); + + public static void Show(UI.Window.WindowType windowType, bool portScanImport = false) + { + try + { + if (windowType.Equals(UI.Window.WindowType.About)) + { + if (aboutForm == null || aboutForm.IsDisposed) + { + aboutForm = new UI.Window.AboutWindow(aboutPanel); + aboutPanel = aboutForm; + } + aboutForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.ActiveDirectoryImport)) + { + if (adimportForm == null || adimportForm.IsDisposed) + { + adimportForm = new UI.Window.ActiveDirectoryImportWindow(adimportPanel); + adimportPanel = adimportForm; + } + adimportPanel.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.Options)) + { + using (OptionsForm optionsForm = new OptionsForm()) + { + optionsForm.ShowDialog(frmMain.Default); + } + } + else if (windowType.Equals(UI.Window.WindowType.SSHTransfer)) + { + sshtransferForm = new UI.Window.SSHTransferWindow(sshtransferPanel); + sshtransferPanel = sshtransferForm; + sshtransferForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.Update)) + { + if (updateForm == null || updateForm.IsDisposed) + { + updateForm = new UI.Window.UpdateWindow(updatePanel); + updatePanel = updateForm; + } + updateForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.Help)) + { + if (helpForm == null || helpForm.IsDisposed) + { + helpForm = new UI.Window.HelpWindow(helpPanel); + helpPanel = helpForm; + } + helpForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.ExternalApps)) + { + if (externalappsForm == null || externalappsForm.IsDisposed) + { + externalappsForm = new UI.Window.ExternalToolsWindow(externalappsPanel); + externalappsPanel = externalappsForm; + } + externalappsForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.PortScan)) + { + portscanForm = new UI.Window.PortScanWindow(portscanPanel, portScanImport); + portscanPanel = portscanForm; + portscanForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.UltraVNCSC)) + { + if (ultravncscForm == null || ultravncscForm.IsDisposed) + { + ultravncscForm = new UI.Window.UltraVNCWindow(ultravncscPanel); + ultravncscPanel = ultravncscForm; + } + ultravncscForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.ComponentsCheck)) + { + if (componentscheckForm == null || componentscheckForm.IsDisposed) + { + componentscheckForm = new UI.Window.ComponentsCheckWindow(componentscheckPanel); + componentscheckPanel = componentscheckForm; + } + componentscheckForm.Show(frmMain.Default.pnlDock); + } + else if (windowType.Equals(UI.Window.WindowType.Announcement)) + { + if (AnnouncementForm == null || AnnouncementForm.IsDisposed) + { + AnnouncementForm = new UI.Window.AnnouncementWindow(AnnouncementPanel); + AnnouncementPanel = AnnouncementForm; + } + AnnouncementForm.Show(frmMain.Default.pnlDock); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "App.Runtime.Windows.Show() failed." + Environment.NewLine + ex.Message, true); + } + } + + public static void ShowUpdatesTab() + { + using (OptionsForm optionsForm = new OptionsForm()) + { + optionsForm.ShowDialog(frmMain.Default, typeof(UpdatesPage)); + } + + } + } +} \ No newline at end of file diff --git a/mRemoteV1/ClassDiagram1.cd b/mRemoteV1/ClassDiagram1.cd new file mode 100644 index 00000000..a42f004b --- /dev/null +++ b/mRemoteV1/ClassDiagram1.cd @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + Connection\Connection.Info.cs + + + + + + + + + Connection\Connection.Info.Inheritance.cs + + + + + nsdT4YQ80AjyrN6+C3B3TRVBrwEyVASPjA5epmmggHg= + Connection\Connection.Info.cs + + + + + + + + + + AAIAAAAAAAAAAAAACAAAAAQAAkAAAAAAAAAAAABEAAA= + Connection\Connection.List.cs + + + + + + + + + + + + + + Connection\Connection.Protocol.PuttyBase.cs + + + + + Connection\Connection.Protocol.PuttyBase.cs + + + + + BjAAQAAAQBAAgAAAgAAAAIAAAAAADoAAAAQAAAGAQgA= + Connection\Connection.Protocol.PuttyBase.cs + + + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAA= + Connection\Connection.Protocol.Protocols.cs + + + + + + + + + + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + Connection\Connection.Protocol.Base.cs + + + + + ACSAAQAMAABAQQADAgBUoMSAlIAQAAgAAAAAkwGoABA= + Connection\Connection.Protocol.Base.cs + + + + + + + + + + + AAAAAAAAACAAAAAAAACAAABKAAAAAAAAAAAAAEAAABA= + Connection\Connection.InterfaceControl.cs + + + + + + + + + + AAIAAAAAAAABACAAEAAAAAAAAAAAAAAAAAAAAAAAAAE= + Connection\Connection.Icon.cs + + + + + + AxQAAAAAIAgAAQABAAAAAYAQAQAAAAAAAAAAAEAAwAA= + Connection\Protocol\VNC\Connection.Protocol.VNC.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\Telnet\Connection.Protocol.Telnet.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\SSH\Connection.Protocol.SSH1.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\SSH\Connection.Protocol.SSH2.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\Serial\Connection.Protocol.Serial.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\Rlogin\Connection.Protocol.Rlogin.cs + + + + + + ACQRAAAFIAQgIQACAIBACIAAQaAABIIbAIgUYgEAgAE= + Connection\Protocol\RDP\Connection.Protocol.RDP.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\RAW\Connection.Protocol.RAW.cs + + + + + + AAAAEAABAAAAAQADAABAIIAIAQABBAAAAIiAAAAEAgA= + Connection\Protocol\ICA\Connection.Protocol.ICA.cs + + + + + + AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\Http\Connection.Protocol.HTTP.cs + + + + + + AQAAAQAAABAAAQAIAAAAAKCAAAAAAAEAAAAAABAAAUA= + Connection\Protocol\Http\Connection.Protocol.HTTPBase.cs + + + + + + AAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\Http\Connection.Protocol.HTTPS.cs + + + + + + AEAwAgAAAQAQAEAAAAAAAAAAJAEABAAAAAAAAAAAAAA= + Connection\Connection.Protocol.Protocols.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAAAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAAAIAAAAAAAkAAAAAAAQAgAAQAAIAABAAAAAIBAIAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAQAEBAAIAAAAAAAIAAAEAAAQgAAAAAAAAAAAAAAAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAAAACAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + BAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAACAACAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAI= + Connection\Protocol\VNC\VNCEnum.cs + + + + + + AAAIAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA= + Connection\Protocol\VNC\VNCEnum.cs + + + + \ No newline at end of file diff --git a/mRemoteV1/ClassDiagram2.cd b/mRemoteV1/ClassDiagram2.cd new file mode 100644 index 00000000..3c6eea6a --- /dev/null +++ b/mRemoteV1/ClassDiagram2.cd @@ -0,0 +1,54 @@ + + + + + + AAQAAAAAIAAAAAAAAAAAIIVAAAAAAAAAAAAAAAAAABA= + Connection\New\ConnectionRecordImp.cs + + + + + + + AAQAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA= + Connection\New\Connectable.cs + + + + + + AAAAAAAAIAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAA= + Connection\New\ConnectionRecord.cs + + + + + + AAAAAAAAIAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA= + Connection\New\Protocol.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\New\ProtocolRDP.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Connection\New\ProtocolSSH.cs + + + + + + AAIAAAAAAAAAAAAACAAAAAQAAkAAAAAAAAAAAABEAAA= + Connection\New\RecordList.cs + + + + \ No newline at end of file diff --git a/mRemoteV1/Config/Config.Connections.Load.cs b/mRemoteV1/Config/Config.Connections.Load.cs deleted file mode 100644 index 64865c49..00000000 --- a/mRemoteV1/Config/Config.Connections.Load.cs +++ /dev/null @@ -1,1294 +0,0 @@ -using System; -using System.Data; -using System.Windows.Forms; -using System.Xml; -using System.Globalization; -using mRemoteNG.App; -using System.Data.SqlClient; -using System.IO; -using mRemoteNG.My; -using mRemoteNG.Connection; -using PSTaskDialog; - - -namespace mRemoteNG.Config.Connections -{ - public class Load - { - #region Private Properties - private XmlDocument xDom; - private double confVersion; - private string pW = "mR3m"; - private SqlConnection sqlCon; - private SqlCommand sqlQuery; - private SqlDataReader sqlRd; - private TreeNode _selectedTreeNode; - #endregion - - #region Public Properties - private bool _UseSQL; - public bool UseSQL - { - get { return _UseSQL; } - set { _UseSQL = value; } - } - - private string _SQLHost; - public string SQLHost - { - get { return _SQLHost; } - set { _SQLHost = value; } - } - - private string _SQLDatabaseName; - public string SQLDatabaseName - { - get { return _SQLDatabaseName; } - set { _SQLDatabaseName = value; } - } - - private string _SQLUsername; - public string SQLUsername - { - get { return _SQLUsername; } - set { _SQLUsername = value; } - } - - private string _SQLPassword; - public string SQLPassword - { - get { return _SQLPassword; } - set { _SQLPassword = value; } - } - - private bool _SQLUpdate; - public bool SQLUpdate - { - get { return _SQLUpdate; } - set { _SQLUpdate = value; } - } - - private string _PreviousSelected; - public string PreviousSelected - { - get { return _PreviousSelected; } - set { _PreviousSelected = value; } - } - - private string _ConnectionFileName; - public string ConnectionFileName - { - get { return this._ConnectionFileName; } - set { this._ConnectionFileName = value; } - } - - public TreeNode RootTreeNode {get; set;} - - public Connection.ConnectionList ConnectionList {get; set;} - - private Container.List _ContainerList; - public Container.List ContainerList - { - get { return this._ContainerList; } - set { this._ContainerList = value; } - } - - private Connection.ConnectionList _PreviousConnectionList; - public Connection.ConnectionList PreviousConnectionList - { - get { return _PreviousConnectionList; } - set { _PreviousConnectionList = value; } - } - - private Container.List _PreviousContainerList; - public Container.List PreviousContainerList - { - get { return _PreviousContainerList; } - set { _PreviousContainerList = value; } - } - #endregion - - #region Public Methods - public void LoadConnections(bool import) - { - if (UseSQL) - { - LoadFromSQL(); - } - else - { - string connections = DecryptCompleteFile(); - LoadFromXML(connections, import); - } - - frmMain.Default.UsingSqlServer = UseSQL; - frmMain.Default.ConnectionsFileName = ConnectionFileName; - - if (!import) - { - Putty.Sessions.AddSessionsToTree(); - } - } - #endregion - - #region SQL - private delegate void LoadFromSqlDelegate(); - private void LoadFromSQL() - { - if (Runtime.Windows.treeForm == null || Runtime.Windows.treeForm.tvConnections == null) - { - return ; - } - if (Runtime.Windows.treeForm.tvConnections.InvokeRequired) - { - Runtime.Windows.treeForm.tvConnections.Invoke(new LoadFromSqlDelegate(LoadFromSQL)); - return ; - } - - try - { - Runtime.IsConnectionsFileLoaded = false; - - if (!string.IsNullOrEmpty(_SQLUsername)) - { - sqlCon = new SqlConnection("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName + ";User Id=" + _SQLUsername + ";Password=" + _SQLPassword); - } - else - { - sqlCon = new SqlConnection("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName + ";Integrated Security=True"); - } - - sqlCon.Open(); - - sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon); - sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); - - sqlRd.Read(); - - if (sqlRd.HasRows == false) - { - Runtime.SaveConnections(); - - sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon); - sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); - - sqlRd.Read(); - } - - confVersion = Convert.ToDouble(sqlRd["confVersion"], CultureInfo.InvariantCulture); - const double maxSupportedSchemaVersion = 2.5; - if (confVersion > maxSupportedSchemaVersion) - { - cTaskDialog.ShowTaskDialogBox( - frmMain.Default, - System.Windows.Forms.Application.ProductName, - "Incompatible database schema", - string.Format("The database schema on the server is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), - string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", System.Environment.NewLine, confVersion.ToString(), maxSupportedSchemaVersion.ToString()), - "", - "", - "", - "", - eTaskDialogButtons.OK, - eSysIcons.Error, - eSysIcons.Error - ); - throw (new Exception(string.Format("Incompatible database schema (schema version {0}).", confVersion))); - } - - RootTreeNode.Name = System.Convert.ToString(sqlRd["Name"]); - - Root.Info rootInfo = new Root.Info(Root.Info.RootType.Connection); - rootInfo.Name = RootTreeNode.Name; - rootInfo.TreeNode = RootTreeNode; - - RootTreeNode.Tag = rootInfo; - RootTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; - RootTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; - - if (Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["Protected"]), pW) != "ThisIsNotProtected") - { - if (Authenticate(System.Convert.ToString(sqlRd["Protected"]), false, rootInfo) == false) - { - My.Settings.Default.LoadConsFromCustomLocation = false; - My.Settings.Default.CustomConsPath = ""; - RootTreeNode.Remove(); - return; - } - } - - sqlRd.Close(); - - Runtime.Windows.treeForm.tvConnections.BeginUpdate(); - - // SECTION 3. Populate the TreeView with the DOM nodes. - AddNodesFromSQL(RootTreeNode); - - RootTreeNode.Expand(); - - //expand containers - foreach (Container.Info contI in this._ContainerList) - { - if (contI.IsExpanded == true) - { - contI.TreeNode.Expand(); - } - } - - Runtime.Windows.treeForm.tvConnections.EndUpdate(); - - //open connections from last mremote session - if (My.Settings.Default.OpenConsFromLastSession == true && My.Settings.Default.NoReconnect == false) - { - foreach (ConnectionRecordImp connectionRecord in ConnectionList) - { - if (connectionRecord.MetaData.PleaseConnect == true) - { - Runtime.OpenConnection(connectionRecord); - } - } - } - - Runtime.IsConnectionsFileLoaded = true; - Runtime.Windows.treeForm.InitialRefresh(); - SetSelectedNode(_selectedTreeNode); - } - catch (Exception) - { - throw; - } - finally - { - if (sqlCon != null) - { - sqlCon.Close(); - } - } - } - - private delegate void SetSelectedNodeDelegate(TreeNode treeNode); - private static void SetSelectedNode(TreeNode treeNode) - { - if (Tree.Node.TreeView != null && Tree.Node.TreeView.InvokeRequired) - { - Runtime.Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), new object[] { treeNode }); - return ; - } - Runtime.Windows.treeForm.tvConnections.SelectedNode = treeNode; - } - - private void AddNodesFromSQL(TreeNode baseNode) - { - try - { - sqlCon.Open(); - sqlQuery = new SqlCommand("SELECT * FROM tblCons ORDER BY PositionID ASC", sqlCon); - sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); - - if (sqlRd.HasRows == false) - { - return; - } - - TreeNode tNode = default(TreeNode); - - while (sqlRd.Read()) - { - tNode = new TreeNode(System.Convert.ToString(sqlRd["Name"])); - //baseNode.Nodes.Add(tNode) - - if (Tree.Node.GetNodeTypeFromString(System.Convert.ToString(sqlRd["Type"])) == Tree.Node.Type.Connection) - { - ConnectionRecord connectionRecord = GetConnectionInfoFromSQL(); - connectionRecord.TreeNode = tNode; - //conI.Parent = _previousContainer 'NEW - - this.ConnectionList.Add(connectionRecord); - - tNode.Tag = connectionRecord; - - if (SQLUpdate == true) - { - ConnectionRecord prevCon = PreviousConnectionList.FindByConstantID(connectionRecord.ConstantID); - - if (prevCon != null) - { - foreach (Connection.Protocol.Base prot in ((ConnectionRecordImp)prevCon).OpenConnections) - { - prot.InterfaceControl.Info = connectionRecord; - connectionRecord.OpenConnections.Add(prot); - } - - if (connectionRecord.OpenConnections.Count > 0) - { - tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionOpen; - tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionOpen; - } - else - { - tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - } - } - else - { - tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - } - - if (connectionRecord.ConstantID == _PreviousSelected) - { - _selectedTreeNode = tNode; - } - } - else - { - tNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - } - } - else if (Tree.Node.GetNodeTypeFromString(System.Convert.ToString(sqlRd["Type"])) == Tree.Node.Type.Container) - { - Container.Info containerRecord = new Container.Info(); - //If tNode.Parent IsNot Nothing Then - // If Tree.Node.GetNodeType(tNode.Parent) = Tree.Node.Type.Container Then - // contI.Parent = tNode.Parent.Tag - // End If - //End If - //_previousContainer = contI 'NEW - containerRecord.TreeNode = tNode; - - containerRecord.Name = System.Convert.ToString(sqlRd["Name"]); - - ConnectionRecord connectionRecord = default(ConnectionRecordImp); - - connectionRecord = GetConnectionInfoFromSQL(); - - connectionRecord.Parent = containerRecord; - connectionRecord.MetaData.IsContainer = true; - containerRecord.ConnectionRecord = connectionRecord; - - if (SQLUpdate == true) - { - Container.Info prevCont = PreviousContainerList.FindByConstantID(connectionRecord.ConstantID); - if (prevCont != null) - { - containerRecord.IsExpanded = prevCont.IsExpanded; - } - - if (connectionRecord.ConstantID == _PreviousSelected) - { - _selectedTreeNode = tNode; - } - } - else - { - if (System.Convert.ToBoolean(sqlRd["Expanded"]) == true) - containerRecord.IsExpanded = true; - else - containerRecord.IsExpanded = false; - } - - this._ContainerList.Add(containerRecord); - this.ConnectionList.Add(connectionRecord); - - tNode.Tag = containerRecord; - tNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - tNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; - } - - string parentId = System.Convert.ToString(sqlRd["ParentID"].ToString().Trim()); - if (string.IsNullOrEmpty(parentId) || parentId == "0") - { - baseNode.Nodes.Add(tNode); - } - else - { - TreeNode pNode = Tree.Node.GetNodeFromConstantID(System.Convert.ToString(sqlRd["ParentID"])); - - if (pNode != null) - { - pNode.Nodes.Add(tNode); - - if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Connection) - { - (tNode.Tag as Connection.ConnectionRecordImp).Parent = (mRemoteNG.Container.Info)pNode.Tag; - } - else if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Container) - { - (tNode.Tag as Container.Info).Parent = pNode.Tag; - } - } - else - { - baseNode.Nodes.Add(tNode); - } - } - - //AddNodesFromSQL(tNode) - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strAddNodesFromSqlFailed + System.Environment.NewLine + ex.Message, true); - } - } - - private ConnectionRecord GetConnectionInfoFromSQL() - { - try - { - ConnectionRecord connectionRecord = new Connection.ConnectionRecordImp(); - - connectionRecord.MetaData.PositionID = System.Convert.ToInt32(sqlRd["PositionID"]); - connectionRecord.ConstantID = System.Convert.ToString(sqlRd["ConstantID"]); - connectionRecord.Name = System.Convert.ToString(sqlRd["Name"]); - connectionRecord.Description = System.Convert.ToString(sqlRd["Description"]); - connectionRecord.Hostname = System.Convert.ToString(sqlRd["Hostname"]); - connectionRecord.Credential.Username = System.Convert.ToString(sqlRd["Username"]); - connectionRecord.Credential.Password = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["Password"]), pW); - connectionRecord.Credential.Domain = System.Convert.ToString(sqlRd["DomainName"]); - connectionRecord.DisplayWallpaper = System.Convert.ToBoolean(sqlRd["DisplayWallpaper"]); - connectionRecord.DisplayThemes = System.Convert.ToBoolean(sqlRd["DisplayThemes"]); - connectionRecord.CacheBitmaps = System.Convert.ToBoolean(sqlRd["CacheBitmaps"]); - connectionRecord.UseConsoleSession = System.Convert.ToBoolean(sqlRd["ConnectToConsole"]); - - connectionRecord.RedirectDiskDrives = System.Convert.ToBoolean(sqlRd["RedirectDiskDrives"]); - connectionRecord.RedirectPrinters = System.Convert.ToBoolean(sqlRd["RedirectPrinters"]); - connectionRecord.RedirectPorts = System.Convert.ToBoolean(sqlRd["RedirectPorts"]); - connectionRecord.RedirectSmartCards = System.Convert.ToBoolean(sqlRd["RedirectSmartCards"]); - connectionRecord.RedirectKeys = System.Convert.ToBoolean(sqlRd["RedirectKeys"]); - connectionRecord.RedirectSound = (Connection.Protocol.RDPConnectionProtocolImp.RDPSounds)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPSounds), System.Convert.ToString(sqlRd["RedirectSound"])); - - connectionRecord.Protocol = (Connection.Protocol.Protocols)Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), System.Convert.ToString(sqlRd["Protocol"])); - connectionRecord.Port = System.Convert.ToInt32(sqlRd["Port"]); - connectionRecord.PuttySession = System.Convert.ToString(sqlRd["PuttySession"]); - - connectionRecord.Colors = (Connection.Protocol.RDPConnectionProtocolImp.RDPColors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPColors), System.Convert.ToString(sqlRd["Colors"])); - connectionRecord.Resolution = (Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions), System.Convert.ToString(sqlRd["Resolution"])); - - connectionRecord.Inherit = new ConnectionRecordInheritanceImp(connectionRecord); - connectionRecord.Inherit.CacheBitmaps = System.Convert.ToBoolean(sqlRd["InheritCacheBitmaps"]); - connectionRecord.Inherit.Colors = System.Convert.ToBoolean(sqlRd["InheritColors"]); - connectionRecord.Inherit.Description = System.Convert.ToBoolean(sqlRd["InheritDescription"]); - connectionRecord.Inherit.DisplayThemes = System.Convert.ToBoolean(sqlRd["InheritDisplayThemes"]); - connectionRecord.Inherit.DisplayWallpaper = System.Convert.ToBoolean(sqlRd["InheritDisplayWallpaper"]); - connectionRecord.Inherit.Domain = System.Convert.ToBoolean(sqlRd["InheritDomain"]); - connectionRecord.Inherit.Icon = System.Convert.ToBoolean(sqlRd["InheritIcon"]); - connectionRecord.Inherit.Panel = System.Convert.ToBoolean(sqlRd["InheritPanel"]); - connectionRecord.Inherit.Password = System.Convert.ToBoolean(sqlRd["InheritPassword"]); - connectionRecord.Inherit.Port = System.Convert.ToBoolean(sqlRd["InheritPort"]); - connectionRecord.Inherit.Protocol = System.Convert.ToBoolean(sqlRd["InheritProtocol"]); - connectionRecord.Inherit.PuttySession = System.Convert.ToBoolean(sqlRd["InheritPuttySession"]); - connectionRecord.Inherit.RedirectDiskDrives = System.Convert.ToBoolean(sqlRd["InheritRedirectDiskDrives"]); - connectionRecord.Inherit.RedirectKeys = System.Convert.ToBoolean(sqlRd["InheritRedirectKeys"]); - connectionRecord.Inherit.RedirectPorts = System.Convert.ToBoolean(sqlRd["InheritRedirectPorts"]); - connectionRecord.Inherit.RedirectPrinters = System.Convert.ToBoolean(sqlRd["InheritRedirectPrinters"]); - connectionRecord.Inherit.RedirectSmartCards = System.Convert.ToBoolean(sqlRd["InheritRedirectSmartCards"]); - connectionRecord.Inherit.RedirectSound = System.Convert.ToBoolean(sqlRd["InheritRedirectSound"]); - connectionRecord.Inherit.Resolution = System.Convert.ToBoolean(sqlRd["InheritResolution"]); - connectionRecord.Inherit.UseConsoleSession = System.Convert.ToBoolean(sqlRd["InheritUseConsoleSession"]); - connectionRecord.Inherit.Username = System.Convert.ToBoolean(sqlRd["InheritUsername"]); - - connectionRecord.Icon = System.Convert.ToString(sqlRd["Icon"]); - connectionRecord.Panel = System.Convert.ToString(sqlRd["Panel"]); - - if (this.confVersion > 1.5) //1.6 - { - connectionRecord.ICAEncryption = (Connection.Protocol.ICA.EncryptionStrength)Tools.Misc.StringToEnum(typeof(Connection.Protocol.ICA.EncryptionStrength), System.Convert.ToString(sqlRd["ICAEncryptionStrength"])); - connectionRecord.Inherit.ICAEncryption = System.Convert.ToBoolean(sqlRd["InheritICAEncryptionStrength"]); - - connectionRecord.PreExtApp = System.Convert.ToString(sqlRd["PreExtApp"]); - connectionRecord.PostExtApp = System.Convert.ToString(sqlRd["PostExtApp"]); - connectionRecord.Inherit.PreExtApp = System.Convert.ToBoolean(sqlRd["InheritPreExtApp"]); - connectionRecord.Inherit.PostExtApp = System.Convert.ToBoolean(sqlRd["InheritPostExtApp"]); - } - - if (this.confVersion > 1.6) //1.7 - { - connectionRecord.VNCCompression = (Connection.Protocol.VNC.Compression)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Compression), System.Convert.ToString(sqlRd["VNCCompression"])); - connectionRecord.VNCEncoding = (Connection.Protocol.VNC.Encoding)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Encoding), System.Convert.ToString(sqlRd["VNCEncoding"])); - connectionRecord.VNCAuthMode = (Connection.Protocol.VNC.AuthMode)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.AuthMode), System.Convert.ToString(sqlRd["VNCAuthMode"])); - connectionRecord.VNCProxyType = (Connection.Protocol.VNC.ProxyType)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.ProxyType), System.Convert.ToString(sqlRd["VNCProxyType"])); - connectionRecord.VNCProxyIP = System.Convert.ToString(sqlRd["VNCProxyIP"]); - connectionRecord.VNCProxyPort = System.Convert.ToInt32(sqlRd["VNCProxyPort"]); - connectionRecord.VNCProxyUsername = System.Convert.ToString(sqlRd["VNCProxyUsername"]); - connectionRecord.VNCProxyPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["VNCProxyPassword"]), pW); - connectionRecord.VNCColors = (Connection.Protocol.VNC.Colors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.Colors), System.Convert.ToString(sqlRd["VNCColors"])); - connectionRecord.VNCSmartSizeMode = (Connection.Protocol.VNC.SmartSizeMode)Tools.Misc.StringToEnum(typeof(Connection.Protocol.VNC.SmartSizeMode), System.Convert.ToString(sqlRd["VNCSmartSizeMode"])); - connectionRecord.VNCViewOnly = System.Convert.ToBoolean(sqlRd["VNCViewOnly"]); - - connectionRecord.Inherit.VNCCompression = System.Convert.ToBoolean(sqlRd["InheritVNCCompression"]); - connectionRecord.Inherit.VNCEncoding = System.Convert.ToBoolean(sqlRd["InheritVNCEncoding"]); - connectionRecord.Inherit.VNCAuthMode = System.Convert.ToBoolean(sqlRd["InheritVNCAuthMode"]); - connectionRecord.Inherit.VNCProxyType = System.Convert.ToBoolean(sqlRd["InheritVNCProxyType"]); - connectionRecord.Inherit.VNCProxyIP = System.Convert.ToBoolean(sqlRd["InheritVNCProxyIP"]); - connectionRecord.Inherit.VNCProxyPort = System.Convert.ToBoolean(sqlRd["InheritVNCProxyPort"]); - connectionRecord.Inherit.VNCProxyUsername = System.Convert.ToBoolean(sqlRd["InheritVNCProxyUsername"]); - connectionRecord.Inherit.VNCProxyPassword = System.Convert.ToBoolean(sqlRd["InheritVNCProxyPassword"]); - connectionRecord.Inherit.VNCColors = System.Convert.ToBoolean(sqlRd["InheritVNCColors"]); - connectionRecord.Inherit.VNCSmartSizeMode = System.Convert.ToBoolean(sqlRd["InheritVNCSmartSizeMode"]); - connectionRecord.Inherit.VNCViewOnly = System.Convert.ToBoolean(sqlRd["InheritVNCViewOnly"]); - } - - if (this.confVersion > 1.7) //1.8 - { - connectionRecord.RDPAuthenticationLevel = (Connection.Protocol.RDPConnectionProtocolImp.AuthenticationLevel)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.AuthenticationLevel), System.Convert.ToString(sqlRd["RDPAuthenticationLevel"])); - - connectionRecord.Inherit.RDPAuthenticationLevel = System.Convert.ToBoolean(sqlRd["InheritRDPAuthenticationLevel"]); - } - - if (this.confVersion > 1.8) //1.9 - { - connectionRecord.RenderingEngine = (Connection.Protocol.HTTPBase.RenderingEngine)Tools.Misc.StringToEnum(typeof(Connection.Protocol.HTTPBase.RenderingEngine), System.Convert.ToString(sqlRd["RenderingEngine"])); - connectionRecord.ExternalTool.MacAddress = System.Convert.ToString(sqlRd["MacAddress"]); - - connectionRecord.Inherit.RenderingEngine = System.Convert.ToBoolean(sqlRd["InheritRenderingEngine"]); - connectionRecord.Inherit.MacAddress = System.Convert.ToBoolean(sqlRd["InheritMacAddress"]); - } - - if (this.confVersion > 1.9) //2.0 - { - connectionRecord.ExternalTool.UserField = System.Convert.ToString(sqlRd["UserField"]); - - connectionRecord.Inherit.UserField = System.Convert.ToBoolean(sqlRd["InheritUserField"]); - } - - if (this.confVersion > 2.0) //2.1 - { - connectionRecord.ExtApp = System.Convert.ToString(sqlRd["ExtApp"]); - - connectionRecord.Inherit.ExtApp = System.Convert.ToBoolean(sqlRd["InheritExtApp"]); - } - - if (this.confVersion >= 2.2) - { - connectionRecord.RDGatewayUsageMethod = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod), System.Convert.ToString(sqlRd["RDGatewayUsageMethod"])); - connectionRecord.RDGatewayHostname = System.Convert.ToString(sqlRd["RDGatewayHostname"]); - connectionRecord.RDGatewayUseConnectionCredentials = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials), System.Convert.ToString(sqlRd["RDGatewayUseConnectionCredentials"])); - connectionRecord.RDGatewayUsername = System.Convert.ToString(sqlRd["RDGatewayUsername"]); - connectionRecord.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["RDGatewayPassword"]), pW); - connectionRecord.RDGatewayDomain = System.Convert.ToString(sqlRd["RDGatewayDomain"]); - connectionRecord.Inherit.RDGatewayUsageMethod = System.Convert.ToBoolean(sqlRd["InheritRDGatewayUsageMethod"]); - connectionRecord.Inherit.RDGatewayHostname = System.Convert.ToBoolean(sqlRd["InheritRDGatewayHostname"]); - connectionRecord.Inherit.RDGatewayUsername = System.Convert.ToBoolean(sqlRd["InheritRDGatewayUsername"]); - connectionRecord.Inherit.RDGatewayPassword = System.Convert.ToBoolean(sqlRd["InheritRDGatewayPassword"]); - connectionRecord.Inherit.RDGatewayDomain = System.Convert.ToBoolean(sqlRd["InheritRDGatewayDomain"]); - } - - if (this.confVersion >= 2.3) - { - connectionRecord.EnableFontSmoothing = System.Convert.ToBoolean(sqlRd["EnableFontSmoothing"]); - connectionRecord.EnableDesktopComposition = System.Convert.ToBoolean(sqlRd["EnableDesktopComposition"]); - connectionRecord.Inherit.EnableFontSmoothing = System.Convert.ToBoolean(sqlRd["InheritEnableFontSmoothing"]); - connectionRecord.Inherit.EnableDesktopComposition = System.Convert.ToBoolean(sqlRd["InheritEnableDesktopComposition"]); - } - - if (confVersion >= 2.4) - { - connectionRecord.UseCredSsp = System.Convert.ToBoolean(sqlRd["UseCredSsp"]); - connectionRecord.Inherit.UseCredSsp = System.Convert.ToBoolean(sqlRd["InheritUseCredSsp"]); - } - - if (confVersion >= 2.5) - { - connectionRecord.LoadBalanceInfo = System.Convert.ToString(sqlRd["LoadBalanceInfo"]); - connectionRecord.AutomaticResize = System.Convert.ToBoolean(sqlRd["AutomaticResize"]); - connectionRecord.Inherit.LoadBalanceInfo = System.Convert.ToBoolean(sqlRd["InheritLoadBalanceInfo"]); - connectionRecord.Inherit.AutomaticResize = System.Convert.ToBoolean(sqlRd["InheritAutomaticResize"]); - } - - if (SQLUpdate == true) - { - connectionRecord.PleaseConnect = System.Convert.ToBoolean(sqlRd["Connected"]); - } - - return connectionRecord; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strGetConnectionInfoFromSqlFailed + Environment.NewLine + ex.Message, true); - } - - return null; - } - #endregion - - #region XML - private string DecryptCompleteFile() - { - StreamReader sRd = new StreamReader(this._ConnectionFileName); - - string strCons = ""; - strCons = sRd.ReadToEnd(); - sRd.Close(); - - if (!string.IsNullOrEmpty(strCons)) - { - string strDecr = ""; - bool notDecr = true; - - if (strCons.Contains("")) - { - strDecr = strCons; - return strDecr; - } - - try - { - strDecr = Security.Crypt.Decrypt(strCons, pW); - - if (strDecr != strCons) - { - notDecr = false; - } - else - { - notDecr = true; - } - } - catch (Exception) - { - notDecr = true; - } - - if (notDecr) - { - if (Authenticate(strCons, true) == true) - { - strDecr = Security.Crypt.Decrypt(strCons, pW); - notDecr = false; - } - else - { - notDecr = true; - } - - if (notDecr == false) - { - return strDecr; - } - } - else - { - return strDecr; - } - } - - return ""; - } - - private void LoadFromXML(string cons, bool import) - { - try - { - if (!import) - { - Runtime.IsConnectionsFileLoaded = false; - } - - // SECTION 1. Create a DOM Document and load the XML data into it. - this.xDom = new XmlDocument(); - if (cons != "") - { - xDom.LoadXml(cons); - } - else - { - xDom.Load(this._ConnectionFileName); - } - - if (xDom.DocumentElement.HasAttribute("ConfVersion")) - { - this.confVersion = Convert.ToDouble(xDom.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."), CultureInfo.InvariantCulture); - } - else - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strOldConffile); - } - - const double maxSupportedConfVersion = 2.5; - if (confVersion > maxSupportedConfVersion) - { - cTaskDialog.ShowTaskDialogBox( - frmMain.Default, - System.Windows.Forms.Application.ProductName, - "Incompatible connection file format", - string.Format("The format of this connection file is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), - string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Environment.NewLine, ConnectionFileName, confVersion.ToString(), maxSupportedConfVersion.ToString()), - "", - "", - "", - "", - eTaskDialogButtons.OK, - eSysIcons.Error, - eSysIcons.Error - ); - throw (new Exception(string.Format("Incompatible connection file format (file format version {0}).", confVersion))); - } - - // SECTION 2. Initialize the treeview control. - Root.Info rootInfo = default(Root.Info); - if (import) - { - rootInfo = null; - } - else - { - string rootNodeName = ""; - if (xDom.DocumentElement.HasAttribute("Name")) - { - rootNodeName = System.Convert.ToString(xDom.DocumentElement.Attributes["Name"].Value.Trim()); - } - if (!string.IsNullOrEmpty(rootNodeName)) - { - RootTreeNode.Name = rootNodeName; - } - else - { - RootTreeNode.Name = xDom.DocumentElement.Name; - } - RootTreeNode.Text = RootTreeNode.Name; - - rootInfo = new Root.Info(Root.Info.RootType.Connection); - rootInfo.Name = RootTreeNode.Name; - rootInfo.TreeNode = RootTreeNode; - - RootTreeNode.Tag = rootInfo; - } - - if (this.confVersion > 1.3) //1.4 - { - if (Security.Crypt.Decrypt(System.Convert.ToString(xDom.DocumentElement.Attributes["Protected"].Value), pW) != "ThisIsNotProtected") - { - if (Authenticate(System.Convert.ToString(xDom.DocumentElement.Attributes["Protected"].Value), false, rootInfo) == false) - { - My.Settings.Default.LoadConsFromCustomLocation = false; - My.Settings.Default.CustomConsPath = ""; - RootTreeNode.Remove(); - return; - } - } - } - - bool isExportFile = false; - if (confVersion >= 1.0) - { - if (System.Convert.ToBoolean(xDom.DocumentElement.Attributes["Export"].Value) == true) - { - isExportFile = true; - } - } - - if (import && !isExportFile) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strCannotImportNormalSessionFile); - return ; - } - - if (!isExportFile) - { - RootTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; - RootTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; - } - - Runtime.Windows.treeForm.tvConnections.BeginUpdate(); - - // SECTION 3. Populate the TreeView with the DOM nodes. - AddNodeFromXml(xDom.DocumentElement, RootTreeNode); - - RootTreeNode.Expand(); - - //expand containers - foreach (Container.Info contI in this._ContainerList) - { - if (contI.IsExpanded == true) - { - contI.TreeNode.Expand(); - } - } - - Runtime.Windows.treeForm.tvConnections.EndUpdate(); - - //open connections from last mremote session - if (My.Settings.Default.OpenConsFromLastSession == true && My.Settings.Default.NoReconnect == false) - { - foreach (Connection.ConnectionRecordImp conI in ConnectionList) - { - if (conI.PleaseConnect == true) - { - Runtime.OpenConnection(conI); - } - } - } - - RootTreeNode.EnsureVisible(); - - if (!import) - { - Runtime.IsConnectionsFileLoaded = true; - } - Runtime.Windows.treeForm.InitialRefresh(); - SetSelectedNode(RootTreeNode); - } - catch (Exception ex) - { - App.Runtime.IsConnectionsFileLoaded = false; - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strLoadFromXmlFailed + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, true); - throw; - } - } - - private Container.Info _previousContainer; - private void AddNodeFromXml(XmlNode parentXmlNode, TreeNode parentTreeNode) - { - try - { - // Loop through the XML nodes until the leaf is reached. - // Add the nodes to the TreeView during the looping process. - if (parentXmlNode.HasChildNodes) - { - foreach (XmlNode xmlNode in parentXmlNode.ChildNodes) - { - TreeNode treeNode = new TreeNode(xmlNode.Attributes["Name"].Value); - parentTreeNode.Nodes.Add(treeNode); - - if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) == Tree.Node.Type.Connection) //connection info - { - Connection.ConnectionRecordImp connectionInfo = GetConnectionInfoFromXml(xmlNode); - connectionInfo.TreeNode = treeNode; - connectionInfo.Parent = _previousContainer; //NEW - - ConnectionList.Add(connectionInfo); - - treeNode.Tag = connectionInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - } - else if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) == Tree.Node.Type.Container) //container info - { - Container.Info containerInfo = new Container.Info(); - if (treeNode.Parent != null) - { - if (Tree.Node.GetNodeType(treeNode.Parent) == Tree.Node.Type.Container) - { - containerInfo.Parent = treeNode.Parent.Tag; - } - } - _previousContainer = containerInfo; //NEW - containerInfo.TreeNode = treeNode; - - containerInfo.Name = xmlNode.Attributes["Name"].Value; - - if (confVersion >= 0.8) - { - if (xmlNode.Attributes["Expanded"].Value == "True") - { - containerInfo.IsExpanded = true; - } - else - { - containerInfo.IsExpanded = false; - } - } - - Connection.ConnectionRecordImp connectionInfo = default(Connection.ConnectionRecordImp); - if (confVersion >= 0.9) - { - connectionInfo = GetConnectionInfoFromXml(xmlNode); - } - else - { - connectionInfo = new Connection.ConnectionRecordImp(); - } - - connectionInfo.Parent = containerInfo; - connectionInfo.IsContainer = true; - containerInfo.ConnectionRecord = connectionInfo; - - ContainerList.Add(containerInfo); - - treeNode.Tag = containerInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; - } - - AddNodeFromXml(xmlNode, treeNode); - } - } - else - { - string nodeName = ""; - XmlAttribute nameAttribute = parentXmlNode.Attributes["Name"]; - if (!(nameAttribute == null)) - { - nodeName = nameAttribute.Value.Trim(); - } - if (!string.IsNullOrEmpty(nodeName)) - { - parentTreeNode.Text = nodeName; - } - else - { - parentTreeNode.Text = parentXmlNode.Name; - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strAddNodeFromXmlFailed + Environment.NewLine + ex.Message + ex.StackTrace, true); - throw; - } - } - - private Connection.ConnectionRecordImp GetConnectionInfoFromXml(XmlNode xxNode) - { - Connection.ConnectionRecordImp conI = new Connection.ConnectionRecordImp(); - try - { - XmlNode xmlnode = xxNode; - if (this.confVersion > 0.1) //0.2 - { - conI.Name = xmlnode.Attributes["Name"].Value; - conI.Description = xmlnode.Attributes["Descr"].Value; - conI.Hostname = xmlnode.Attributes["Hostname"].Value; - conI.Username = xmlnode.Attributes["Username"].Value; - conI.Password = Security.Crypt.Decrypt(xmlnode.Attributes["Password"].Value, pW); - conI.Domain = xmlnode.Attributes["Domain"].Value; - conI.DisplayWallpaper = bool.Parse(xmlnode.Attributes["DisplayWallpaper"].Value); - conI.DisplayThemes = bool.Parse(xmlnode.Attributes["DisplayThemes"].Value); - conI.CacheBitmaps = bool.Parse(xmlnode.Attributes["CacheBitmaps"].Value); - - if (this.confVersion < 1.1) //1.0 - 0.1 - { - if (System.Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) == true) - { - conI.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.Fullscreen; - } - else - { - conI.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.FitToWindow; - } - } - } - - if (this.confVersion > 0.2) //0.3 - { - if (this.confVersion < 0.7) - { - if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) - { - conI.Protocol = Connection.Protocol.Protocols.VNC; - conI.Port = System.Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); - } - else - { - conI.Protocol = Connection.Protocol.Protocols.RDP; - } - } - } - else - { - conI.Port = (int)Connection.Protocol.RDPConnectionProtocolImp.Defaults.Port; - conI.Protocol = Connection.Protocol.Protocols.RDP; - } - - if (this.confVersion > 0.3) //0.4 - { - if (this.confVersion < 0.7) - { - if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) - { - conI.Port = System.Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); - } - else - { - conI.Port = System.Convert.ToInt32(xmlnode.Attributes["RDPPort"].Value); - } - } - - conI.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value); - } - else - { - if (this.confVersion < 0.7) - { - if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) - { - conI.Port = (int)Connection.Protocol.VNC.Defaults.Port; - } - else - { - conI.Port = (int)Connection.Protocol.RDPConnectionProtocolImp.Defaults.Port; - } - } - conI.UseConsoleSession = false; - } - - if (this.confVersion > 0.4) //0.5 and 0.6 - { - conI.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["RedirectDiskDrives"].Value); - conI.RedirectPrinters = bool.Parse(xmlnode.Attributes["RedirectPrinters"].Value); - conI.RedirectPorts = bool.Parse(xmlnode.Attributes["RedirectPorts"].Value); - conI.RedirectSmartCards = bool.Parse(xmlnode.Attributes["RedirectSmartCards"].Value); - } - else - { - conI.RedirectDiskDrives = false; - conI.RedirectPrinters = false; - conI.RedirectPorts = false; - conI.RedirectSmartCards = false; - } - - if (this.confVersion > 0.6) //0.7 - { - conI.Protocol = (Connection.Protocol.Protocols)Tools.Misc.StringToEnum(typeof(Connection.Protocol.Protocols), xmlnode.Attributes["Protocol"].Value); - conI.Port = System.Convert.ToInt32(xmlnode.Attributes["Port"].Value); - } - - if (this.confVersion > 0.9) //1.0 - { - conI.RedirectKeys = bool.Parse(xmlnode.Attributes["RedirectKeys"].Value); - } - - if (this.confVersion > 1.1) //1.2 - { - conI.PuttySession = xmlnode.Attributes["PuttySession"].Value; - } - - if (this.confVersion > 1.2) //1.3 - { - conI.Colors = (Connection.Protocol.RDPConnectionProtocolImp.RDPColors)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPColors), xmlnode.Attributes["Colors"].Value); - conI.Resolution = (Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions), System.Convert.ToString(xmlnode.Attributes["Resolution"].Value)); - conI.RedirectSound = (Connection.Protocol.RDPConnectionProtocolImp.RDPSounds)Tools.Misc.StringToEnum(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPSounds), System.Convert.ToString(xmlnode.Attributes["RedirectSound"].Value)); - } - else - { - switch (System.Convert.ToInt32(xmlnode.Attributes["Colors"].Value)) - { - case 0: - conI.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors256; - break; - case 1: - conI.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors16Bit; - break; - case 2: - conI.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors24Bit; - break; - case 3: - conI.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors32Bit; - break; - case 4: - conI.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors15Bit; - break; - } - - conI.RedirectSound = (Connection.Protocol.RDPConnectionProtocolImp.RDPSounds) System.Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value); - } - - if (this.confVersion > 1.2) //1.3 - { - conI.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(conI); - conI.Inherit.CacheBitmaps = bool.Parse(xmlnode.Attributes["InheritCacheBitmaps"].Value); - conI.Inherit.Colors = bool.Parse(xmlnode.Attributes["InheritColors"].Value); - conI.Inherit.Description = bool.Parse(xmlnode.Attributes["InheritDescription"].Value); - conI.Inherit.DisplayThemes = bool.Parse(xmlnode.Attributes["InheritDisplayThemes"].Value); - conI.Inherit.DisplayWallpaper = bool.Parse(xmlnode.Attributes["InheritDisplayWallpaper"].Value); - conI.Inherit.Domain = bool.Parse(xmlnode.Attributes["InheritDomain"].Value); - conI.Inherit.Icon = bool.Parse(xmlnode.Attributes["InheritIcon"].Value); - conI.Inherit.Panel = bool.Parse(xmlnode.Attributes["InheritPanel"].Value); - conI.Inherit.Password = bool.Parse(xmlnode.Attributes["InheritPassword"].Value); - conI.Inherit.Port = bool.Parse(xmlnode.Attributes["InheritPort"].Value); - conI.Inherit.Protocol = bool.Parse(xmlnode.Attributes["InheritProtocol"].Value); - conI.Inherit.PuttySession = bool.Parse(xmlnode.Attributes["InheritPuttySession"].Value); - conI.Inherit.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["InheritRedirectDiskDrives"].Value); - conI.Inherit.RedirectKeys = bool.Parse(xmlnode.Attributes["InheritRedirectKeys"].Value); - conI.Inherit.RedirectPorts = bool.Parse(xmlnode.Attributes["InheritRedirectPorts"].Value); - conI.Inherit.RedirectPrinters = bool.Parse(xmlnode.Attributes["InheritRedirectPrinters"].Value); - conI.Inherit.RedirectSmartCards = bool.Parse(xmlnode.Attributes["InheritRedirectSmartCards"].Value); - conI.Inherit.RedirectSound = bool.Parse(xmlnode.Attributes["InheritRedirectSound"].Value); - conI.Inherit.Resolution = bool.Parse(xmlnode.Attributes["InheritResolution"].Value); - conI.Inherit.UseConsoleSession = bool.Parse(xmlnode.Attributes["InheritUseConsoleSession"].Value); - conI.Inherit.Username = bool.Parse(xmlnode.Attributes["InheritUsername"].Value); - - conI.Icon = xmlnode.Attributes["Icon"].Value; - conI.Panel = xmlnode.Attributes["Panel"].Value; - } - else - { - conI.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(conI, System.Convert.ToBoolean(xmlnode.Attributes["Inherit"].Value)); - - conI.Icon = System.Convert.ToString(xmlnode.Attributes["Icon"].Value.Replace(".ico", "")); - conI.Panel = My.Language.strGeneral; - } - - if (this.confVersion > 1.4) //1.5 - { - conI.PleaseConnect = bool.Parse(xmlnode.Attributes["Connected"].Value); - } - - if (this.confVersion > 1.5) //1.6 - { - conI.ICAEncryption = (mRemoteNG.Connection.Protocol.ICA.EncryptionStrength)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.ICA.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value); - conI.Inherit.ICAEncryption = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value); - - conI.PreExtApp = xmlnode.Attributes["PreExtApp"].Value; - conI.PostExtApp = xmlnode.Attributes["PostExtApp"].Value; - conI.Inherit.PreExtApp = bool.Parse(xmlnode.Attributes["InheritPreExtApp"].Value); - conI.Inherit.PostExtApp = bool.Parse(xmlnode.Attributes["InheritPostExtApp"].Value); - } - - if (this.confVersion > 1.6) //1.7 - { - conI.VNCCompression = (mRemoteNG.Connection.Protocol.VNC.Compression)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Compression), xmlnode.Attributes["VNCCompression"].Value); - conI.VNCEncoding = (mRemoteNG.Connection.Protocol.VNC.Encoding)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Encoding), System.Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value)); - conI.VNCAuthMode = (mRemoteNG.Connection.Protocol.VNC.AuthMode)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value); - conI.VNCProxyType = (mRemoteNG.Connection.Protocol.VNC.ProxyType)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value); - conI.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value; - conI.VNCProxyPort = System.Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value); - conI.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value; - conI.VNCProxyPassword = Security.Crypt.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value, pW); - conI.VNCColors = (mRemoteNG.Connection.Protocol.VNC.Colors)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.Colors), xmlnode.Attributes["VNCColors"].Value); - conI.VNCSmartSizeMode = (mRemoteNG.Connection.Protocol.VNC.SmartSizeMode)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.VNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value); - conI.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value); - - conI.Inherit.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value); - conI.Inherit.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value); - conI.Inherit.VNCAuthMode = bool.Parse(xmlnode.Attributes["InheritVNCAuthMode"].Value); - conI.Inherit.VNCProxyType = bool.Parse(xmlnode.Attributes["InheritVNCProxyType"].Value); - conI.Inherit.VNCProxyIP = bool.Parse(xmlnode.Attributes["InheritVNCProxyIP"].Value); - conI.Inherit.VNCProxyPort = bool.Parse(xmlnode.Attributes["InheritVNCProxyPort"].Value); - conI.Inherit.VNCProxyUsername = bool.Parse(xmlnode.Attributes["InheritVNCProxyUsername"].Value); - conI.Inherit.VNCProxyPassword = bool.Parse(xmlnode.Attributes["InheritVNCProxyPassword"].Value); - conI.Inherit.VNCColors = bool.Parse(xmlnode.Attributes["InheritVNCColors"].Value); - conI.Inherit.VNCSmartSizeMode = bool.Parse(xmlnode.Attributes["InheritVNCSmartSizeMode"].Value); - conI.Inherit.VNCViewOnly = bool.Parse(xmlnode.Attributes["InheritVNCViewOnly"].Value); - } - - if (this.confVersion > 1.7) //1.8 - { - conI.RDPAuthenticationLevel = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.AuthenticationLevel)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value); - - conI.Inherit.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value); - } - - if (this.confVersion > 1.8) //1.9 - { - conI.RenderingEngine = (mRemoteNG.Connection.Protocol.HTTPBase.RenderingEngine)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value); - conI.MacAddress = xmlnode.Attributes["MacAddress"].Value; - - conI.Inherit.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value); - conI.Inherit.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value); - } - - if (this.confVersion > 1.9) //2.0 - { - conI.UserField = xmlnode.Attributes["UserField"].Value; - conI.Inherit.UserField = bool.Parse(xmlnode.Attributes["InheritUserField"].Value); - } - - if (this.confVersion > 2.0) //2.1 - { - conI.ExtApp = xmlnode.Attributes["ExtApp"].Value; - conI.Inherit.ExtApp = bool.Parse(xmlnode.Attributes["InheritExtApp"].Value); - } - - if (this.confVersion > 2.1) //2.2 - { - // Get settings - conI.RDGatewayUsageMethod = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod), System.Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value)); - conI.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value; - conI.RDGatewayUseConnectionCredentials = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials), System.Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value)); - conI.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value; - conI.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value), pW); - conI.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value; - - // Get inheritance settings - conI.Inherit.RDGatewayUsageMethod = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsageMethod"].Value); - conI.Inherit.RDGatewayHostname = bool.Parse(xmlnode.Attributes["InheritRDGatewayHostname"].Value); - conI.Inherit.RDGatewayUseConnectionCredentials = bool.Parse(xmlnode.Attributes["InheritRDGatewayUseConnectionCredentials"].Value); - conI.Inherit.RDGatewayUsername = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsername"].Value); - conI.Inherit.RDGatewayPassword = bool.Parse(xmlnode.Attributes["InheritRDGatewayPassword"].Value); - conI.Inherit.RDGatewayDomain = bool.Parse(xmlnode.Attributes["InheritRDGatewayDomain"].Value); - } - - if (this.confVersion > 2.2) //2.3 - { - // Get settings - conI.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["EnableFontSmoothing"].Value); - conI.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["EnableDesktopComposition"].Value); - - // Get inheritance settings - conI.Inherit.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["InheritEnableFontSmoothing"].Value); - conI.Inherit.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["InheritEnableDesktopComposition"].Value); - } - - if (confVersion >= 2.4) - { - conI.UseCredSsp = bool.Parse(xmlnode.Attributes["UseCredSsp"].Value); - conI.Inherit.UseCredSsp = bool.Parse(xmlnode.Attributes["InheritUseCredSsp"].Value); - } - - if (confVersion >= 2.5) - { - conI.LoadBalanceInfo = xmlnode.Attributes["LoadBalanceInfo"].Value; - conI.AutomaticResize = bool.Parse(xmlnode.Attributes["AutomaticResize"].Value); - conI.Inherit.LoadBalanceInfo = bool.Parse(xmlnode.Attributes["InheritLoadBalanceInfo"].Value); - conI.Inherit.AutomaticResize = bool.Parse(xmlnode.Attributes["InheritAutomaticResize"].Value); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(My.Language.strGetConnectionInfoFromXmlFailed, conI.Name, this.ConnectionFileName, ex.Message), false); - } - return conI; - } - - private bool Authenticate(string Value, bool CompareToOriginalValue, Root.Info rootInfo = null) - { - string passwordName = ""; - if (UseSQL) - { - passwordName = Language.strSQLServer.TrimEnd(':'); - } - else - { - passwordName = Path.GetFileName(ConnectionFileName); - } - - if (CompareToOriginalValue) - { - while (!(Security.Crypt.Decrypt(Value, pW) != Value)) - { - pW = Tools.Misc.PasswordDialog(passwordName, false); - - if (string.IsNullOrEmpty(pW)) - { - return false; - } - } - } - else - { - while (!(Security.Crypt.Decrypt(Value, pW) == "ThisIsProtected")) - { - pW = Tools.Misc.PasswordDialog(passwordName, false); - - if (string.IsNullOrEmpty(pW)) - { - return false; - } - } - - if (rootInfo != null) - { - rootInfo.Password = true; - rootInfo.PasswordString = pW; - } - } - - return true; - } - #endregion - } -} diff --git a/mRemoteV1/Config/Config.Settings.Load.cs b/mRemoteV1/Config/Config.Settings.Load.cs deleted file mode 100644 index 5d7232bf..00000000 --- a/mRemoteV1/Config/Config.Settings.Load.cs +++ /dev/null @@ -1,355 +0,0 @@ -using System; -using System.Drawing; -using Microsoft.VisualBasic; -using System.Windows.Forms; -using System.IO; -using WeifenLuo.WinFormsUI.Docking; -using mRemoteNG.App; -using System.Xml; - - -namespace mRemoteNG.Config.Settings -{ - public class Load - { - #region Public Properties - private frmMain _MainForm; - public frmMain MainForm - { - get - { - return this._MainForm; - } - set - { - this._MainForm = value; - } - } - #endregion - - #region Public Methods - public Load(frmMain MainForm) - { - this._MainForm = MainForm; - } - - public void LoadSettings() - { - try - { - // Migrate settings from previous version - if (My.Settings.Default.DoUpgrade) - { - try - { - My.Settings.Default.Upgrade(); - } - catch (Exception ex) - { - Runtime.Log.Error("My.Settings.Upgrade() failed" + Environment.NewLine + ex.Message); - } - My.Settings.Default.DoUpgrade = false; - - // Clear pending update flag - // This is used for automatic updates, not for settings migration, but it - // needs to be cleared here because we know that we just updated. - My.Settings.Default.UpdatePending = false; - } - - App.SupportedCultures.InstantiateSingleton(); - if (!(My.Settings.Default.OverrideUICulture == "") && App.SupportedCultures.IsNameSupported(System.Convert.ToString(My.Settings.Default.OverrideUICulture))) - { - System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(System.Convert.ToString(My.Settings.Default.OverrideUICulture)); - Runtime.Log.InfoFormat("Override Culture: {0}/{1}", System.Threading.Thread.CurrentThread.CurrentUICulture.Name, System.Threading.Thread.CurrentThread.CurrentUICulture.NativeName); - } - - Themes.ThemeManager.LoadTheme(System.Convert.ToString(My.Settings.Default.ThemeName)); - - this._MainForm.WindowState = FormWindowState.Normal; - if (My.Settings.Default.MainFormState == FormWindowState.Normal) - { - if (!My.Settings.Default.MainFormLocation.IsEmpty) - { - this._MainForm.Location = My.Settings.Default.MainFormLocation; - } - if (!My.Settings.Default.MainFormSize.IsEmpty) - { - this._MainForm.Size = My.Settings.Default.MainFormSize; - } - } - else - { - if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty) - { - this._MainForm.Location = My.Settings.Default.MainFormRestoreLocation; - } - if (!My.Settings.Default.MainFormRestoreSize.IsEmpty) - { - this._MainForm.Size = My.Settings.Default.MainFormRestoreSize; - } - } - if (My.Settings.Default.MainFormState == FormWindowState.Maximized) - { - this._MainForm.WindowState = FormWindowState.Maximized; - } - - // Make sure the form is visible on the screen - const int minHorizontal = 300; - const int minVertical = 150; - System.Drawing.Rectangle screenBounds = Screen.FromHandle(this._MainForm.Handle).Bounds; - System.Drawing.Rectangle newBounds = this._MainForm.Bounds; - - if (newBounds.Right < screenBounds.Left + minHorizontal) - { - newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width; - } - if (newBounds.Left > screenBounds.Right - minHorizontal) - { - newBounds.X = screenBounds.Right - minHorizontal; - } - if (newBounds.Bottom < screenBounds.Top + minVertical) - { - newBounds.Y = screenBounds.Top + minVertical - newBounds.Height; - } - if (newBounds.Top > screenBounds.Bottom - minVertical) - { - newBounds.Y = screenBounds.Bottom - minVertical; - } - - this._MainForm.Location = newBounds.Location; - - if (My.Settings.Default.MainFormKiosk == true) - { - this._MainForm.Fullscreen.Value = true; - this._MainForm.mMenViewFullscreen.Checked = true; - } - - if (My.Settings.Default.UseCustomPuttyPath) - { - Connection.Protocol.PuttyBase.PuttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath); - } - else - { - Connection.Protocol.PuttyBase.PuttyPath = App.Info.General.PuttyPath; - } - - if (My.Settings.Default.ShowSystemTrayIcon) - { - App.Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon(); - } - - if (My.Settings.Default.AutoSaveEveryMinutes > 0) - { - this._MainForm.tmrAutoSave.Interval = System.Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000); - this._MainForm.tmrAutoSave.Enabled = true; - } - - My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey); - - this.LoadPanelsFromXML(); - this.LoadExternalAppsFromXML(); - - if (My.Settings.Default.AlwaysShowPanelTabs) - { - frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow; - } - - if (My.Settings.Default.ResetToolbars == false) - { - LoadToolbarsFromSettings(); - } - else - { - SetToolbarsDefault(); - } - } - catch (Exception ex) - { - Runtime.Log.Error("Loading settings failed" + Environment.NewLine + ex.Message); - } - } - - public void SetToolbarsDefault() - { - ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0)); - MainForm.tsQuickConnect.Visible = true; - ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0)); - MainForm.tsExternalTools.Visible = false; - } - - public void LoadToolbarsFromSettings() - { - if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X) - { - AddDynamicPanels(); - AddStaticPanels(); - } - else - { - AddStaticPanels(); - AddDynamicPanels(); - } - } - - private void AddStaticPanels() - { - ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation); - MainForm.tsQuickConnect.Visible = System.Convert.ToBoolean(My.Settings.Default.QuickyTBVisible); - } - - private void AddDynamicPanels() - { - ToolStripPanelFromString(System.Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation); - MainForm.tsExternalTools.Visible = System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible); - } - - private ToolStripPanel ToolStripPanelFromString(string Panel) - { - switch (Panel.ToLower()) - { - case "top": - return MainForm.tsContainer.TopToolStripPanel; - case "bottom": - return MainForm.tsContainer.BottomToolStripPanel; - case "left": - return MainForm.tsContainer.LeftToolStripPanel; - case "right": - return MainForm.tsContainer.RightToolStripPanel; - default: - return MainForm.tsContainer.TopToolStripPanel; - } - } - - public void LoadPanelsFromXML() - { - try - { - Runtime.Windows.treePanel = null; - Runtime.Windows.configPanel = null; - Runtime.Windows.errorsPanel = null; - - while (MainForm.pnlDock.Contents.Count > 0) - { - WeifenLuo.WinFormsUI.Docking.DockContent dc = (WeifenLuo.WinFormsUI.Docking.DockContent)MainForm.pnlDock.Contents[0]; - dc.Close(); - } - - Runtime.Startup.CreatePanels(); - - string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.LayoutFileName; - string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName; - if (File.Exists(newPath)) - { - MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString); - #if !PORTABLE - } - else if (File.Exists(oldPath)) - { - MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString); - #endif - } - else - { - Runtime.Startup.SetDefaultLayout(); - } - } - catch (Exception ex) - { - Runtime.Log.Error("LoadPanelsFromXML failed" + Environment.NewLine + ex.Message); - } - } - - public void LoadExternalAppsFromXML() - { - string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.Settings.ExtAppsFilesName; - string newPath = App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName; - XmlDocument xDom = new XmlDocument(); - if (File.Exists(newPath)) - { - xDom.Load(newPath); - #if !PORTABLE - } - else if (File.Exists(oldPath)) - { - xDom.Load(oldPath); - #endif - } - else - { - return; - } - - foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes) - { - Tools.ExternalTool extA = new Tools.ExternalTool(); - extA.DisplayName = xEl.Attributes["DisplayName"].Value; - extA.FileName = xEl.Attributes["FileName"].Value; - extA.Arguments = xEl.Attributes["Arguments"].Value; - - if (xEl.HasAttribute("WaitForExit")) - { - extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value); - } - - if (xEl.HasAttribute("TryToIntegrate")) - { - extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value); - } - - Runtime.ExternalTools.Add(extA); - } - - MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText)); - - xDom = null; - - frmMain.Default.AddExternalToolsToToolBar(); - } - #endregion - - #region Private Methods - private IDockContent GetContentFromPersistString(string persistString) - { - // pnlLayout.xml persistence XML fix for refactoring to mRemoteNG - if (persistString.StartsWith("mRemote.")) - { - persistString = persistString.Replace("mRemote.", "mRemoteNG."); - } - - try - { - if (persistString == typeof(UI.Window.Config).ToString()) - { - return Runtime.Windows.configPanel; - } - - if (persistString == typeof(UI.Window.Tree).ToString()) - { - return Runtime.Windows.treePanel; - } - - if (persistString == typeof(UI.Window.ErrorsAndInfos).ToString()) - { - return Runtime.Windows.errorsPanel; - } - - if (persistString == typeof(UI.Window.Sessions).ToString()) - { - return Runtime.Windows.sessionsPanel; - } - - if (persistString == typeof(UI.Window.ScreenshotManager).ToString()) - { - return Runtime.Windows.screenshotPanel; - } - } - catch (Exception ex) - { - Runtime.Log.Error("GetContentFromPersistString failed" + Environment.NewLine + ex.Message); - } - - return null; - } - #endregion - } -} diff --git a/mRemoteV1/Config/ConfirmClose.cs b/mRemoteV1/Config/ConfirmCloseEnum.cs similarity index 77% rename from mRemoteV1/Config/ConfirmClose.cs rename to mRemoteV1/Config/ConfirmCloseEnum.cs index ae240dee..d2a8b007 100644 --- a/mRemoteV1/Config/ConfirmClose.cs +++ b/mRemoteV1/Config/ConfirmCloseEnum.cs @@ -1,7 +1,6 @@ - namespace mRemoteNG.Config { - public enum ConfirmClose + public enum ConfirmCloseEnum { Unspecified = 0, Never = 1, @@ -9,4 +8,4 @@ namespace mRemoteNG.Config Multiple = 3, All = 4 } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/ConnectionsLoader.cs b/mRemoteV1/Config/Connections/ConnectionsLoader.cs new file mode 100644 index 00000000..3c0b541e --- /dev/null +++ b/mRemoteV1/Config/Connections/ConnectionsLoader.cs @@ -0,0 +1,1277 @@ +using mRemoteNG.App; +using mRemoteNG.Connection.Protocol.Http; +using mRemoteNG.Connection.Protocol.ICA; +using mRemoteNG.Connection.Protocol.VNC; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.My; +using PSTaskDialog; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Globalization; +using System.IO; +using System.Windows.Forms; +using System.Xml; +using mRemoteNG.Tree; +using mRemoteNG.Connection; +using mRemoteNG.Container; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Images; + + +namespace mRemoteNG.Config.Connections +{ + public class ConnectionsLoader + { + #region Private Properties + private XmlDocument xDom; + private double confVersion; + private string pW = "mR3m"; + private SqlConnection sqlCon; + private SqlCommand sqlQuery; + private SqlDataReader sqlRd; + private TreeNode _selectedTreeNode; + private bool _UseSQL; + private string _SQLHost; + private string _SQLDatabaseName; + private string _SQLUsername; + private string _SQLPassword; + private bool _SQLUpdate; + private string _PreviousSelected; + private string _ConnectionFileName; + private ContainerList _ContainerList; + private ConnectionList _PreviousConnectionList; + private ContainerList _PreviousContainerList; + #endregion + + #region Public Properties + public bool UseSQL + { + get { return _UseSQL; } + set { _UseSQL = value; } + } + + public string SQLHost + { + get { return _SQLHost; } + set { _SQLHost = value; } + } + + public string SQLDatabaseName + { + get { return _SQLDatabaseName; } + set { _SQLDatabaseName = value; } + } + + public string SQLUsername + { + get { return _SQLUsername; } + set { _SQLUsername = value; } + } + + public string SQLPassword + { + get { return _SQLPassword; } + set { _SQLPassword = value; } + } + + public bool SQLUpdate + { + get { return _SQLUpdate; } + set { _SQLUpdate = value; } + } + + public string PreviousSelected + { + get { return _PreviousSelected; } + set { _PreviousSelected = value; } + } + + public string ConnectionFileName + { + get { return this._ConnectionFileName; } + set { this._ConnectionFileName = value; } + } + + public TreeNode RootTreeNode {get; set;} + + public ConnectionList ConnectionList {get; set;} + + public ContainerList ContainerList + { + get { return this._ContainerList; } + set { this._ContainerList = value; } + } + + public ConnectionList PreviousConnectionList + { + get { return _PreviousConnectionList; } + set { _PreviousConnectionList = value; } + } + + public ContainerList PreviousContainerList + { + get { return _PreviousContainerList; } + set { _PreviousContainerList = value; } + } + #endregion + + #region Public Methods + public void LoadConnections(bool import) + { + if (UseSQL) + { + LoadFromSQL(); + } + else + { + string connections = DecryptCompleteFile(); + LoadFromXML(connections, import); + } + + frmMain.Default.AreWeUsingSqlServerForSavingConnections = UseSQL; + frmMain.Default.ConnectionsFileName = ConnectionFileName; + + if (!import) + { + Putty.Sessions.AddSessionsToTree(); + } + } + #endregion + + #region SQL + private delegate void LoadFromSqlDelegate(); + private void LoadFromSQL() + { + if (Windows.treeForm == null || Windows.treeForm.tvConnections == null) + { + return ; + } + if (Windows.treeForm.tvConnections.InvokeRequired) + { + Windows.treeForm.tvConnections.Invoke(new LoadFromSqlDelegate(LoadFromSQL)); + return ; + } + + try + { + Runtime.IsConnectionsFileLoaded = false; + + if (!string.IsNullOrEmpty(_SQLUsername)) + { + sqlCon = new SqlConnection("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName + ";User Id=" + _SQLUsername + ";Password=" + _SQLPassword); + } + else + { + sqlCon = new SqlConnection("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName + ";Integrated Security=True"); + } + + sqlCon.Open(); + + sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon); + sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); + + sqlRd.Read(); + + if (sqlRd.HasRows == false) + { + Runtime.SaveConnections(); + + sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon); + sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); + + sqlRd.Read(); + } + + confVersion = Convert.ToDouble(sqlRd["confVersion"], CultureInfo.InvariantCulture); + const double maxSupportedSchemaVersion = 2.5; + if (confVersion > maxSupportedSchemaVersion) + { + cTaskDialog.ShowTaskDialogBox( + frmMain.Default, + System.Windows.Forms.Application.ProductName, + "Incompatible database schema", + string.Format("The database schema on the server is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), + string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", Environment.NewLine, confVersion.ToString(), maxSupportedSchemaVersion.ToString()), + "", + "", + "", + "", + eTaskDialogButtons.OK, + eSysIcons.Error, + eSysIcons.Error + ); + throw (new Exception(string.Format("Incompatible database schema (schema version {0}).", confVersion))); + } + + RootTreeNode.Name = System.Convert.ToString(sqlRd["Name"]); + + Root.Info rootInfo = new Root.Info(Root.Info.RootType.Connection); + rootInfo.Name = RootTreeNode.Name; + rootInfo.TreeNode = RootTreeNode; + + RootTreeNode.Tag = rootInfo; + RootTreeNode.ImageIndex = (int)TreeImageType.Root; + RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root; + + if (Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["Protected"]), pW) != "ThisIsNotProtected") + { + if (Authenticate(System.Convert.ToString(sqlRd["Protected"]), false, rootInfo) == false) + { + My.Settings.Default.LoadConsFromCustomLocation = false; + My.Settings.Default.CustomConsPath = ""; + RootTreeNode.Remove(); + return; + } + } + + sqlRd.Close(); + + Windows.treeForm.tvConnections.BeginUpdate(); + + // SECTION 3. Populate the TreeView with the DOM nodes. + AddNodesFromSQL(RootTreeNode); + + RootTreeNode.Expand(); + + //expand containers + foreach (Container.ContainerInfo contI in this._ContainerList) + { + if (contI.IsExpanded == true) + { + contI.TreeNode.Expand(); + } + } + + Windows.treeForm.tvConnections.EndUpdate(); + + //open connections from last mremote session + if (My.Settings.Default.OpenConsFromLastSession == true && My.Settings.Default.NoReconnect == false) + { + foreach (Connection.ConnectionInfo conI in ConnectionList) + { + if (conI.PleaseConnect == true) + { + Runtime.OpenConnection(conI); + } + } + } + + Runtime.IsConnectionsFileLoaded = true; + Windows.treeForm.InitialRefresh(); + SetSelectedNode(_selectedTreeNode); + } + catch (Exception) + { + throw; + } + finally + { + if (sqlCon != null) + { + sqlCon.Close(); + } + } + } + + private delegate void SetSelectedNodeDelegate(TreeNode treeNode); + private static void SetSelectedNode(TreeNode treeNode) + { + if (ConnectionTree.TreeView != null && ConnectionTree.TreeView.InvokeRequired) + { + Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), new object[] { treeNode }); + return ; + } + Windows.treeForm.tvConnections.SelectedNode = treeNode; + } + + private void AddNodesFromSQL(TreeNode baseNode) + { + try + { + sqlCon.Open(); + sqlQuery = new SqlCommand("SELECT * FROM tblCons ORDER BY PositionID ASC", sqlCon); + sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); + + if (sqlRd.HasRows == false) + { + return; + } + + TreeNode tNode = default(TreeNode); + + while (sqlRd.Read()) + { + tNode = new TreeNode(System.Convert.ToString(sqlRd["Name"])); + //baseNode.Nodes.Add(tNode) + + if (Tree.Node.GetNodeTypeFromString(System.Convert.ToString(sqlRd["Type"])) == Tree.TreeNodeType.Connection) + { + Connection.ConnectionInfo conI = GetConnectionInfoFromSQL(); + conI.TreeNode = tNode; + //conI.Parent = _previousContainer 'NEW + + this.ConnectionList.Add(conI); + + tNode.Tag = conI; + + if (SQLUpdate == true) + { + Connection.ConnectionInfo prevCon = PreviousConnectionList.FindByConstantID(conI.ConstantID); + + if (prevCon != null) + { + foreach (Connection.Protocol.ProtocolBase prot in prevCon.OpenConnections) + { + prot.InterfaceControl.Info = conI; + conI.OpenConnections.Add(prot); + } + + if (conI.OpenConnections.Count > 0) + { + tNode.ImageIndex = (int)TreeImageType.ConnectionOpen; + tNode.SelectedImageIndex = (int)TreeImageType.ConnectionOpen; + } + else + { + tNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + tNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; + } + } + else + { + tNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + tNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; + } + + if (conI.ConstantID == _PreviousSelected) + { + _selectedTreeNode = tNode; + } + } + else + { + tNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + tNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; + } + } + else if (Tree.Node.GetNodeTypeFromString(System.Convert.ToString(sqlRd["Type"])) == Tree.TreeNodeType.Container) + { + Container.ContainerInfo contI = new Container.ContainerInfo(); + //If tNode.Parent IsNot Nothing Then + // If Tree.Node.GetNodeType(tNode.Parent) = Tree.Node.Type.Container Then + // contI.Parent = tNode.Parent.Tag + // End If + //End If + //_previousContainer = contI 'NEW + contI.TreeNode = tNode; + + contI.Name = System.Convert.ToString(sqlRd["Name"]); + + Connection.ConnectionInfo conI = default(Connection.ConnectionInfo); + + conI = GetConnectionInfoFromSQL(); + + conI.Parent = contI; + conI.IsContainer = true; + contI.ConnectionInfo = conI; + + if (SQLUpdate == true) + { + Container.ContainerInfo prevCont = PreviousContainerList.FindByConstantID(conI.ConstantID); + if (prevCont != null) + { + contI.IsExpanded = prevCont.IsExpanded; + } + + if (conI.ConstantID == _PreviousSelected) + { + _selectedTreeNode = tNode; + } + } + else + { + if (System.Convert.ToBoolean(sqlRd["Expanded"]) == true) + { + contI.IsExpanded = true; + } + else + { + contI.IsExpanded = false; + } + } + + this._ContainerList.Add(contI); + this.ConnectionList.Add(conI); + + tNode.Tag = contI; + tNode.ImageIndex = (int)TreeImageType.Container; + tNode.SelectedImageIndex = (int)TreeImageType.Container; + } + + string parentId = System.Convert.ToString(sqlRd["ParentID"].ToString().Trim()); + if (string.IsNullOrEmpty(parentId) || parentId == "0") + { + baseNode.Nodes.Add(tNode); + } + else + { + TreeNode pNode = Tree.Node.GetNodeFromConstantID(System.Convert.ToString(sqlRd["ParentID"])); + + if (pNode != null) + { + pNode.Nodes.Add(tNode); + + if (Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.Connection) + { + (tNode.Tag as Connection.ConnectionInfo).Parent = (mRemoteNG.Container.ContainerInfo)pNode.Tag; + } + else if (Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.Container) + { + (tNode.Tag as Container.ContainerInfo).Parent = pNode.Tag; + } + } + else + { + baseNode.Nodes.Add(tNode); + } + } + + //AddNodesFromSQL(tNode) + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strAddNodesFromSqlFailed + Environment.NewLine + ex.Message, true); + } + } + + private ConnectionInfo GetConnectionInfoFromSQL() + { + try + { + ConnectionInfo connectionInfo = new ConnectionInfo(); + + connectionInfo.PositionID = Convert.ToInt32(sqlRd["PositionID"]); + connectionInfo.ConstantID = Convert.ToString(sqlRd["ConstantID"]); + connectionInfo.Name = Convert.ToString(sqlRd["Name"]); + connectionInfo.Description = Convert.ToString(sqlRd["Description"]); + connectionInfo.Hostname = Convert.ToString(sqlRd["Hostname"]); + connectionInfo.Username = Convert.ToString(sqlRd["Username"]); + connectionInfo.Password = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["Password"]), pW); + connectionInfo.Domain = Convert.ToString(sqlRd["DomainName"]); + connectionInfo.DisplayWallpaper = Convert.ToBoolean(sqlRd["DisplayWallpaper"]); + connectionInfo.DisplayThemes = Convert.ToBoolean(sqlRd["DisplayThemes"]); + connectionInfo.CacheBitmaps = Convert.ToBoolean(sqlRd["CacheBitmaps"]); + connectionInfo.UseConsoleSession = Convert.ToBoolean(sqlRd["ConnectToConsole"]); + connectionInfo.RedirectDiskDrives = Convert.ToBoolean(sqlRd["RedirectDiskDrives"]); + connectionInfo.RedirectPrinters = Convert.ToBoolean(sqlRd["RedirectPrinters"]); + connectionInfo.RedirectPorts = Convert.ToBoolean(sqlRd["RedirectPorts"]); + connectionInfo.RedirectSmartCards = Convert.ToBoolean(sqlRd["RedirectSmartCards"]); + connectionInfo.RedirectKeys = Convert.ToBoolean(sqlRd["RedirectKeys"]); + connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(sqlRd["RedirectSound"])); + connectionInfo.Protocol = (Connection.Protocol.ProtocolType)Tools.MiscTools.StringToEnum(typeof(ProtocolType), Convert.ToString(sqlRd["Protocol"])); + connectionInfo.Port = Convert.ToInt32(sqlRd["Port"]); + connectionInfo.PuttySession = Convert.ToString(sqlRd["PuttySession"]); + connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), Convert.ToString(sqlRd["Colors"])); + connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(sqlRd["Resolution"])); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); + connectionInfo.Inherit.CacheBitmaps = Convert.ToBoolean(sqlRd["InheritCacheBitmaps"]); + connectionInfo.Inherit.Colors = Convert.ToBoolean(sqlRd["InheritColors"]); + connectionInfo.Inherit.Description = Convert.ToBoolean(sqlRd["InheritDescription"]); + connectionInfo.Inherit.DisplayThemes = Convert.ToBoolean(sqlRd["InheritDisplayThemes"]); + connectionInfo.Inherit.DisplayWallpaper = Convert.ToBoolean(sqlRd["InheritDisplayWallpaper"]); + connectionInfo.Inherit.Domain = Convert.ToBoolean(sqlRd["InheritDomain"]); + connectionInfo.Inherit.Icon = Convert.ToBoolean(sqlRd["InheritIcon"]); + connectionInfo.Inherit.Panel = Convert.ToBoolean(sqlRd["InheritPanel"]); + connectionInfo.Inherit.Password = Convert.ToBoolean(sqlRd["InheritPassword"]); + connectionInfo.Inherit.Port = Convert.ToBoolean(sqlRd["InheritPort"]); + connectionInfo.Inherit.Protocol = Convert.ToBoolean(sqlRd["InheritProtocol"]); + connectionInfo.Inherit.PuttySession = Convert.ToBoolean(sqlRd["InheritPuttySession"]); + connectionInfo.Inherit.RedirectDiskDrives = Convert.ToBoolean(sqlRd["InheritRedirectDiskDrives"]); + connectionInfo.Inherit.RedirectKeys = Convert.ToBoolean(sqlRd["InheritRedirectKeys"]); + connectionInfo.Inherit.RedirectPorts = Convert.ToBoolean(sqlRd["InheritRedirectPorts"]); + connectionInfo.Inherit.RedirectPrinters = Convert.ToBoolean(sqlRd["InheritRedirectPrinters"]); + connectionInfo.Inherit.RedirectSmartCards = Convert.ToBoolean(sqlRd["InheritRedirectSmartCards"]); + connectionInfo.Inherit.RedirectSound = Convert.ToBoolean(sqlRd["InheritRedirectSound"]); + connectionInfo.Inherit.Resolution = Convert.ToBoolean(sqlRd["InheritResolution"]); + connectionInfo.Inherit.UseConsoleSession = Convert.ToBoolean(sqlRd["InheritUseConsoleSession"]); + connectionInfo.Inherit.Username = Convert.ToBoolean(sqlRd["InheritUsername"]); + connectionInfo.Icon = Convert.ToString(sqlRd["Icon"]); + connectionInfo.Panel = Convert.ToString(sqlRd["Panel"]); + + if (this.confVersion > 1.5) //1.6 + { + connectionInfo.ICAEncryption = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), Convert.ToString(sqlRd["ICAEncryptionStrength"])); + connectionInfo.Inherit.ICAEncryption = Convert.ToBoolean(sqlRd["InheritICAEncryptionStrength"]); + connectionInfo.PreExtApp = Convert.ToString(sqlRd["PreExtApp"]); + connectionInfo.PostExtApp = Convert.ToString(sqlRd["PostExtApp"]); + connectionInfo.Inherit.PreExtApp = Convert.ToBoolean(sqlRd["InheritPreExtApp"]); + connectionInfo.Inherit.PostExtApp = Convert.ToBoolean(sqlRd["InheritPostExtApp"]); + } + + if (this.confVersion > 1.6) //1.7 + { + connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), Convert.ToString(sqlRd["VNCCompression"])); + connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(sqlRd["VNCEncoding"])); + connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), Convert.ToString(sqlRd["VNCAuthMode"])); + connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), Convert.ToString(sqlRd["VNCProxyType"])); + connectionInfo.VNCProxyIP = Convert.ToString(sqlRd["VNCProxyIP"]); + connectionInfo.VNCProxyPort = Convert.ToInt32(sqlRd["VNCProxyPort"]); + connectionInfo.VNCProxyUsername = Convert.ToString(sqlRd["VNCProxyUsername"]); + connectionInfo.VNCProxyPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["VNCProxyPassword"]), pW); + connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), Convert.ToString(sqlRd["VNCColors"])); + connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), Convert.ToString(sqlRd["VNCSmartSizeMode"])); + connectionInfo.VNCViewOnly = Convert.ToBoolean(sqlRd["VNCViewOnly"]); + connectionInfo.Inherit.VNCCompression = Convert.ToBoolean(sqlRd["InheritVNCCompression"]); + connectionInfo.Inherit.VNCEncoding = Convert.ToBoolean(sqlRd["InheritVNCEncoding"]); + connectionInfo.Inherit.VNCAuthMode = Convert.ToBoolean(sqlRd["InheritVNCAuthMode"]); + connectionInfo.Inherit.VNCProxyType = Convert.ToBoolean(sqlRd["InheritVNCProxyType"]); + connectionInfo.Inherit.VNCProxyIP = Convert.ToBoolean(sqlRd["InheritVNCProxyIP"]); + connectionInfo.Inherit.VNCProxyPort = Convert.ToBoolean(sqlRd["InheritVNCProxyPort"]); + connectionInfo.Inherit.VNCProxyUsername = Convert.ToBoolean(sqlRd["InheritVNCProxyUsername"]); + connectionInfo.Inherit.VNCProxyPassword = Convert.ToBoolean(sqlRd["InheritVNCProxyPassword"]); + connectionInfo.Inherit.VNCColors = Convert.ToBoolean(sqlRd["InheritVNCColors"]); + connectionInfo.Inherit.VNCSmartSizeMode = Convert.ToBoolean(sqlRd["InheritVNCSmartSizeMode"]); + connectionInfo.Inherit.VNCViewOnly = Convert.ToBoolean(sqlRd["InheritVNCViewOnly"]); + } + + if (this.confVersion > 1.7) //1.8 + { + connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), Convert.ToString(sqlRd["RDPAuthenticationLevel"])); + connectionInfo.Inherit.RDPAuthenticationLevel = Convert.ToBoolean(sqlRd["InheritRDPAuthenticationLevel"]); + } + + if (this.confVersion > 1.8) //1.9 + { + connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), Convert.ToString(sqlRd["RenderingEngine"])); + connectionInfo.MacAddress = Convert.ToString(sqlRd["MacAddress"]); + connectionInfo.Inherit.RenderingEngine = Convert.ToBoolean(sqlRd["InheritRenderingEngine"]); + connectionInfo.Inherit.MacAddress = Convert.ToBoolean(sqlRd["InheritMacAddress"]); + } + + if (this.confVersion > 1.9) //2.0 + { + connectionInfo.UserField = Convert.ToString(sqlRd["UserField"]); + connectionInfo.Inherit.UserField = Convert.ToBoolean(sqlRd["InheritUserField"]); + } + + if (this.confVersion > 2.0) //2.1 + { + connectionInfo.ExtApp = Convert.ToString(sqlRd["ExtApp"]); + connectionInfo.Inherit.ExtApp = Convert.ToBoolean(sqlRd["InheritExtApp"]); + } + + if (this.confVersion >= 2.2) + { + connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(sqlRd["RDGatewayUsageMethod"])); + connectionInfo.RDGatewayHostname = Convert.ToString(sqlRd["RDGatewayHostname"]); + connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(sqlRd["RDGatewayUseConnectionCredentials"])); + connectionInfo.RDGatewayUsername = Convert.ToString(sqlRd["RDGatewayUsername"]); + connectionInfo.RDGatewayPassword = Security.Crypt.Decrypt(System.Convert.ToString(sqlRd["RDGatewayPassword"]), pW); + connectionInfo.RDGatewayDomain = Convert.ToString(sqlRd["RDGatewayDomain"]); + connectionInfo.Inherit.RDGatewayUsageMethod = Convert.ToBoolean(sqlRd["InheritRDGatewayUsageMethod"]); + connectionInfo.Inherit.RDGatewayHostname = Convert.ToBoolean(sqlRd["InheritRDGatewayHostname"]); + connectionInfo.Inherit.RDGatewayUsername = Convert.ToBoolean(sqlRd["InheritRDGatewayUsername"]); + connectionInfo.Inherit.RDGatewayPassword = Convert.ToBoolean(sqlRd["InheritRDGatewayPassword"]); + connectionInfo.Inherit.RDGatewayDomain = Convert.ToBoolean(sqlRd["InheritRDGatewayDomain"]); + } + + if (this.confVersion >= 2.3) + { + connectionInfo.EnableFontSmoothing = Convert.ToBoolean(sqlRd["EnableFontSmoothing"]); + connectionInfo.EnableDesktopComposition = Convert.ToBoolean(sqlRd["EnableDesktopComposition"]); + connectionInfo.Inherit.EnableFontSmoothing = Convert.ToBoolean(sqlRd["InheritEnableFontSmoothing"]); + connectionInfo.Inherit.EnableDesktopComposition = Convert.ToBoolean(sqlRd["InheritEnableDesktopComposition"]); + } + + if (confVersion >= 2.4) + { + connectionInfo.UseCredSsp = Convert.ToBoolean(sqlRd["UseCredSsp"]); + connectionInfo.Inherit.UseCredSsp = Convert.ToBoolean(sqlRd["InheritUseCredSsp"]); + } + + if (confVersion >= 2.5) + { + connectionInfo.LoadBalanceInfo = Convert.ToString(sqlRd["LoadBalanceInfo"]); + connectionInfo.AutomaticResize = Convert.ToBoolean(sqlRd["AutomaticResize"]); + connectionInfo.Inherit.LoadBalanceInfo = Convert.ToBoolean(sqlRd["InheritLoadBalanceInfo"]); + connectionInfo.Inherit.AutomaticResize = Convert.ToBoolean(sqlRd["InheritAutomaticResize"]); + } + + if (SQLUpdate == true) + { + connectionInfo.PleaseConnect = Convert.ToBoolean(sqlRd["Connected"]); + } + + return connectionInfo; + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strGetConnectionInfoFromSqlFailed + Environment.NewLine + ex.Message, true); + } + + return null; + } + #endregion + + #region XML + private string DecryptCompleteFile() + { + StreamReader sRd = new StreamReader(this._ConnectionFileName); + + string strCons = ""; + strCons = sRd.ReadToEnd(); + sRd.Close(); + + if (!string.IsNullOrEmpty(strCons)) + { + string strDecr = ""; + bool notDecr = true; + + if (strCons.Contains("")) + { + strDecr = strCons; + return strDecr; + } + + try + { + strDecr = Security.Crypt.Decrypt(strCons, pW); + + if (strDecr != strCons) + notDecr = false; + else + notDecr = true; + } + catch (Exception) + { + notDecr = true; + } + + if (notDecr) + { + if (Authenticate(strCons, true) == true) + { + strDecr = Security.Crypt.Decrypt(strCons, pW); + notDecr = false; + } + else + { + notDecr = true; + } + + if (notDecr == false) + { + return strDecr; + } + } + else + { + return strDecr; + } + } + + return ""; + } + + private void LoadFromXML(string cons, bool import) + { + try + { + if (!import) + { + Runtime.IsConnectionsFileLoaded = false; + } + + // SECTION 1. Create a DOM Document and load the XML data into it. + this.xDom = new XmlDocument(); + if (cons != "") + { + xDom.LoadXml(cons); + } + else + { + xDom.Load(this._ConnectionFileName); + } + + if (xDom.DocumentElement.HasAttribute("ConfVersion")) + { + this.confVersion = Convert.ToDouble(xDom.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."), CultureInfo.InvariantCulture); + } + else + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strOldConffile); + } + + const double maxSupportedConfVersion = 2.5; + if (confVersion > maxSupportedConfVersion) + { + cTaskDialog.ShowTaskDialogBox( + frmMain.Default, + System.Windows.Forms.Application.ProductName, + "Incompatible connection file format", + string.Format("The format of this connection file is not supported. Please upgrade to a newer version of {0}.", System.Windows.Forms.Application.ProductName), + string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Environment.NewLine, ConnectionFileName, confVersion.ToString(), maxSupportedConfVersion.ToString()), + "", + "", + "", + "", + eTaskDialogButtons.OK, + eSysIcons.Error, + eSysIcons.Error + ); + throw (new Exception(string.Format("Incompatible connection file format (file format version {0}).", confVersion))); + } + + // SECTION 2. Initialize the treeview control. + Root.Info rootInfo = default(Root.Info); + if (import) + { + rootInfo = null; + } + else + { + string rootNodeName = ""; + if (xDom.DocumentElement.HasAttribute("Name")) + { + rootNodeName = System.Convert.ToString(xDom.DocumentElement.Attributes["Name"].Value.Trim()); + } + if (!string.IsNullOrEmpty(rootNodeName)) + { + RootTreeNode.Name = rootNodeName; + } + else + { + RootTreeNode.Name = xDom.DocumentElement.Name; + } + RootTreeNode.Text = RootTreeNode.Name; + + rootInfo = new Root.Info(Root.Info.RootType.Connection); + rootInfo.Name = RootTreeNode.Name; + rootInfo.TreeNode = RootTreeNode; + + RootTreeNode.Tag = rootInfo; + } + + if (this.confVersion > 1.3) //1.4 + { + if (Security.Crypt.Decrypt(System.Convert.ToString(xDom.DocumentElement.Attributes["Protected"].Value), pW) != "ThisIsNotProtected") + { + if (Authenticate(System.Convert.ToString(xDom.DocumentElement.Attributes["Protected"].Value), false, rootInfo) == false) + { + My.Settings.Default.LoadConsFromCustomLocation = false; + My.Settings.Default.CustomConsPath = ""; + RootTreeNode.Remove(); + return; + } + } + } + + bool isExportFile = false; + if (confVersion >= 1.0) + { + if (System.Convert.ToBoolean(xDom.DocumentElement.Attributes["Export"].Value) == true) + { + isExportFile = true; + } + } + + if (import && !isExportFile) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, My.Language.strCannotImportNormalSessionFile); + return ; + } + + if (!isExportFile) + { + RootTreeNode.ImageIndex = (int)TreeImageType.Root; + RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root; + } + + Windows.treeForm.tvConnections.BeginUpdate(); + + // SECTION 3. Populate the TreeView with the DOM nodes. + AddNodeFromXml(xDom.DocumentElement, RootTreeNode); + + RootTreeNode.Expand(); + + //expand containers + foreach (Container.ContainerInfo contI in this._ContainerList) + { + if (contI.IsExpanded == true) + { + contI.TreeNode.Expand(); + } + } + + Windows.treeForm.tvConnections.EndUpdate(); + + //open connections from last mremote session + if (My.Settings.Default.OpenConsFromLastSession == true && My.Settings.Default.NoReconnect == false) + { + foreach (Connection.ConnectionInfo conI in ConnectionList) + { + if (conI.PleaseConnect == true) + { + Runtime.OpenConnection(conI); + } + } + } + + RootTreeNode.EnsureVisible(); + + if (!import) + { + Runtime.IsConnectionsFileLoaded = true; + } + Windows.treeForm.InitialRefresh(); + SetSelectedNode(RootTreeNode); + } + catch (Exception ex) + { + App.Runtime.IsConnectionsFileLoaded = false; + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strLoadFromXmlFailed + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, true); + throw; + } + } + + private ContainerInfo _previousContainer; + private void AddNodeFromXml(XmlNode parentXmlNode, TreeNode parentTreeNode) + { + try + { + // Loop through the XML nodes until the leaf is reached. + // Add the nodes to the TreeView during the looping process. + if (parentXmlNode.HasChildNodes) + { + foreach (XmlNode xmlNode in parentXmlNode.ChildNodes) + { + TreeNode treeNode = new TreeNode(xmlNode.Attributes["Name"].Value); + parentTreeNode.Nodes.Add(treeNode); + + if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) == TreeNodeType.Connection) //connection info + { + ConnectionInfo connectionInfo = GetConnectionInfoFromXml(xmlNode); + connectionInfo.TreeNode = treeNode; + connectionInfo.Parent = _previousContainer; //NEW + + ConnectionList.Add(connectionInfo); + + treeNode.Tag = connectionInfo; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; + } + else if (Tree.Node.GetNodeTypeFromString(xmlNode.Attributes["Type"].Value) == TreeNodeType.Container) //container info + { + ContainerInfo containerInfo = new Container.ContainerInfo(); + if (treeNode.Parent != null) + { + if (Tree.Node.GetNodeType(treeNode.Parent) == TreeNodeType.Container) + { + containerInfo.Parent = treeNode.Parent.Tag; + } + } + _previousContainer = containerInfo; //NEW + containerInfo.TreeNode = treeNode; + + containerInfo.Name = xmlNode.Attributes["Name"].Value; + + if (confVersion >= 0.8) + { + if (xmlNode.Attributes["Expanded"].Value == "True") + { + containerInfo.IsExpanded = true; + } + else + { + containerInfo.IsExpanded = false; + } + } + + ConnectionInfo connectionInfo = default(ConnectionInfo); + if (confVersion >= 0.9) + { + connectionInfo = GetConnectionInfoFromXml(xmlNode); + } + else + { + connectionInfo = new ConnectionInfo(); + } + + connectionInfo.Parent = containerInfo; + connectionInfo.IsContainer = true; + containerInfo.ConnectionInfo = connectionInfo; + + ContainerList.Add(containerInfo); + + treeNode.Tag = containerInfo; + treeNode.ImageIndex = (int)TreeImageType.Container; + treeNode.SelectedImageIndex = (int)TreeImageType.Container; + } + + AddNodeFromXml(xmlNode, treeNode); + } + } + else + { + string nodeName = ""; + XmlAttribute nameAttribute = parentXmlNode.Attributes["Name"]; + if (!(nameAttribute == null)) + { + nodeName = nameAttribute.Value.Trim(); + } + if (!string.IsNullOrEmpty(nodeName)) + { + parentTreeNode.Text = nodeName; + } + else + { + parentTreeNode.Text = parentXmlNode.Name; + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strAddNodeFromXmlFailed + Environment.NewLine + ex.Message + ex.StackTrace, true); + throw; + } + } + + private ConnectionInfo GetConnectionInfoFromXml(XmlNode xxNode) + { + ConnectionInfo connectionInfo = new ConnectionInfo(); + try + { + XmlNode xmlnode = xxNode; + if (this.confVersion > 0.1) //0.2 + { + connectionInfo.Name = xmlnode.Attributes["Name"].Value; + connectionInfo.Description = xmlnode.Attributes["Descr"].Value; + connectionInfo.Hostname = xmlnode.Attributes["Hostname"].Value; + connectionInfo.Username = xmlnode.Attributes["Username"].Value; + connectionInfo.Password = Security.Crypt.Decrypt(xmlnode.Attributes["Password"].Value, pW); + connectionInfo.Domain = xmlnode.Attributes["Domain"].Value; + connectionInfo.DisplayWallpaper = bool.Parse(xmlnode.Attributes["DisplayWallpaper"].Value); + connectionInfo.DisplayThemes = bool.Parse(xmlnode.Attributes["DisplayThemes"].Value); + connectionInfo.CacheBitmaps = bool.Parse(xmlnode.Attributes["CacheBitmaps"].Value); + + if (this.confVersion < 1.1) //1.0 - 0.1 + { + if (Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) == true) + { + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.Fullscreen; + } + else + { + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow; + } + } + } + + if (this.confVersion > 0.2) //0.3 + { + if (this.confVersion < 0.7) + { + if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) + { + connectionInfo.Protocol = ProtocolType.VNC; + connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); + } + else + { + connectionInfo.Protocol = ProtocolType.RDP; + } + } + } + else + { + connectionInfo.Port = (int)ProtocolRDP.Defaults.Port; + connectionInfo.Protocol = ProtocolType.RDP; + } + + if (this.confVersion > 0.3) //0.4 + { + if (this.confVersion < 0.7) + { + if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) + connectionInfo.Port = System.Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value); + else + connectionInfo.Port = System.Convert.ToInt32(xmlnode.Attributes["RDPPort"].Value); + } + + connectionInfo.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value); + } + else + { + if (this.confVersion < 0.7) + { + if (System.Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value) == true) + connectionInfo.Port = (int)ProtocolVNC.Defaults.Port; + else + connectionInfo.Port = (int)ProtocolRDP.Defaults.Port; + } + connectionInfo.UseConsoleSession = false; + } + + if (this.confVersion > 0.4) //0.5 and 0.6 + { + connectionInfo.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["RedirectDiskDrives"].Value); + connectionInfo.RedirectPrinters = bool.Parse(xmlnode.Attributes["RedirectPrinters"].Value); + connectionInfo.RedirectPorts = bool.Parse(xmlnode.Attributes["RedirectPorts"].Value); + connectionInfo.RedirectSmartCards = bool.Parse(xmlnode.Attributes["RedirectSmartCards"].Value); + } + else + { + connectionInfo.RedirectDiskDrives = false; + connectionInfo.RedirectPrinters = false; + connectionInfo.RedirectPorts = false; + connectionInfo.RedirectSmartCards = false; + } + + if (this.confVersion > 0.6) //0.7 + { + connectionInfo.Protocol = (Connection.Protocol.ProtocolType)Tools.MiscTools.StringToEnum(typeof(Connection.Protocol.ProtocolType), xmlnode.Attributes["Protocol"].Value); + connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["Port"].Value); + } + + if (this.confVersion > 0.9) //1.0 + { + connectionInfo.RedirectKeys = bool.Parse(xmlnode.Attributes["RedirectKeys"].Value); + } + + if (this.confVersion > 1.1) //1.2 + { + connectionInfo.PuttySession = xmlnode.Attributes["PuttySession"].Value; + } + + if (this.confVersion > 1.2) //1.3 + { + connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), xmlnode.Attributes["Colors"].Value); + connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value)); + connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value)); + } + else + { + switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value)) + { + case 0: + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors256; + break; + case 1: + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors16Bit; + break; + case 2: + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors24Bit; + break; + case 3: + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit; + break; + case 4: + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit; + break; + } + + connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds) Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value); + } + + if (this.confVersion > 1.2) //1.3 + { + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); + connectionInfo.Inherit.CacheBitmaps = bool.Parse(xmlnode.Attributes["InheritCacheBitmaps"].Value); + connectionInfo.Inherit.Colors = bool.Parse(xmlnode.Attributes["InheritColors"].Value); + connectionInfo.Inherit.Description = bool.Parse(xmlnode.Attributes["InheritDescription"].Value); + connectionInfo.Inherit.DisplayThemes = bool.Parse(xmlnode.Attributes["InheritDisplayThemes"].Value); + connectionInfo.Inherit.DisplayWallpaper = bool.Parse(xmlnode.Attributes["InheritDisplayWallpaper"].Value); + connectionInfo.Inherit.Domain = bool.Parse(xmlnode.Attributes["InheritDomain"].Value); + connectionInfo.Inherit.Icon = bool.Parse(xmlnode.Attributes["InheritIcon"].Value); + connectionInfo.Inherit.Panel = bool.Parse(xmlnode.Attributes["InheritPanel"].Value); + connectionInfo.Inherit.Password = bool.Parse(xmlnode.Attributes["InheritPassword"].Value); + connectionInfo.Inherit.Port = bool.Parse(xmlnode.Attributes["InheritPort"].Value); + connectionInfo.Inherit.Protocol = bool.Parse(xmlnode.Attributes["InheritProtocol"].Value); + connectionInfo.Inherit.PuttySession = bool.Parse(xmlnode.Attributes["InheritPuttySession"].Value); + connectionInfo.Inherit.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["InheritRedirectDiskDrives"].Value); + connectionInfo.Inherit.RedirectKeys = bool.Parse(xmlnode.Attributes["InheritRedirectKeys"].Value); + connectionInfo.Inherit.RedirectPorts = bool.Parse(xmlnode.Attributes["InheritRedirectPorts"].Value); + connectionInfo.Inherit.RedirectPrinters = bool.Parse(xmlnode.Attributes["InheritRedirectPrinters"].Value); + connectionInfo.Inherit.RedirectSmartCards = bool.Parse(xmlnode.Attributes["InheritRedirectSmartCards"].Value); + connectionInfo.Inherit.RedirectSound = bool.Parse(xmlnode.Attributes["InheritRedirectSound"].Value); + connectionInfo.Inherit.Resolution = bool.Parse(xmlnode.Attributes["InheritResolution"].Value); + connectionInfo.Inherit.UseConsoleSession = bool.Parse(xmlnode.Attributes["InheritUseConsoleSession"].Value); + connectionInfo.Inherit.Username = bool.Parse(xmlnode.Attributes["InheritUsername"].Value); + connectionInfo.Icon = xmlnode.Attributes["Icon"].Value; + connectionInfo.Panel = xmlnode.Attributes["Panel"].Value; + } + else + { + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo, Convert.ToBoolean(xmlnode.Attributes["Inherit"].Value)); + connectionInfo.Icon = Convert.ToString(xmlnode.Attributes["Icon"].Value.Replace(".ico", "")); + connectionInfo.Panel = My.Language.strGeneral; + } + + if (this.confVersion > 1.4) //1.5 + { + connectionInfo.PleaseConnect = bool.Parse(xmlnode.Attributes["Connected"].Value); + } + + if (this.confVersion > 1.5) //1.6 + { + connectionInfo.ICAEncryption = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value); + connectionInfo.Inherit.ICAEncryption = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value); + connectionInfo.PreExtApp = xmlnode.Attributes["PreExtApp"].Value; + connectionInfo.PostExtApp = xmlnode.Attributes["PostExtApp"].Value; + connectionInfo.Inherit.PreExtApp = bool.Parse(xmlnode.Attributes["InheritPreExtApp"].Value); + connectionInfo.Inherit.PostExtApp = bool.Parse(xmlnode.Attributes["InheritPostExtApp"].Value); + } + + if (this.confVersion > 1.6) //1.7 + { + connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value); + connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value)); + connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value); + connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value); + connectionInfo.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value; + connectionInfo.VNCProxyPort = Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value); + connectionInfo.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value; + connectionInfo.VNCProxyPassword = Security.Crypt.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value, pW); + connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value); + connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value); + connectionInfo.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value); + connectionInfo.Inherit.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value); + connectionInfo.Inherit.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value); + connectionInfo.Inherit.VNCAuthMode = bool.Parse(xmlnode.Attributes["InheritVNCAuthMode"].Value); + connectionInfo.Inherit.VNCProxyType = bool.Parse(xmlnode.Attributes["InheritVNCProxyType"].Value); + connectionInfo.Inherit.VNCProxyIP = bool.Parse(xmlnode.Attributes["InheritVNCProxyIP"].Value); + connectionInfo.Inherit.VNCProxyPort = bool.Parse(xmlnode.Attributes["InheritVNCProxyPort"].Value); + connectionInfo.Inherit.VNCProxyUsername = bool.Parse(xmlnode.Attributes["InheritVNCProxyUsername"].Value); + connectionInfo.Inherit.VNCProxyPassword = bool.Parse(xmlnode.Attributes["InheritVNCProxyPassword"].Value); + connectionInfo.Inherit.VNCColors = bool.Parse(xmlnode.Attributes["InheritVNCColors"].Value); + connectionInfo.Inherit.VNCSmartSizeMode = bool.Parse(xmlnode.Attributes["InheritVNCSmartSizeMode"].Value); + connectionInfo.Inherit.VNCViewOnly = bool.Parse(xmlnode.Attributes["InheritVNCViewOnly"].Value); + } + + if (this.confVersion > 1.7) //1.8 + { + connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value); + connectionInfo.Inherit.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value); + } + + if (this.confVersion > 1.8) //1.9 + { + connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value); + connectionInfo.MacAddress = xmlnode.Attributes["MacAddress"].Value; + connectionInfo.Inherit.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value); + connectionInfo.Inherit.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value); + } + + if (this.confVersion > 1.9) //2.0 + { + connectionInfo.UserField = xmlnode.Attributes["UserField"].Value; + connectionInfo.Inherit.UserField = bool.Parse(xmlnode.Attributes["InheritUserField"].Value); + } + + if (this.confVersion > 2.0) //2.1 + { + connectionInfo.ExtApp = xmlnode.Attributes["ExtApp"].Value; + connectionInfo.Inherit.ExtApp = bool.Parse(xmlnode.Attributes["InheritExtApp"].Value); + } + + if (this.confVersion > 2.1) //2.2 + { + // Get settings + connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value)); + connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value; + connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), System.Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value)); + connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value; + connectionInfo.RDGatewayPassword = Security.Crypt.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value), pW); + connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value; + + // Get inheritance settings + connectionInfo.Inherit.RDGatewayUsageMethod = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsageMethod"].Value); + connectionInfo.Inherit.RDGatewayHostname = bool.Parse(xmlnode.Attributes["InheritRDGatewayHostname"].Value); + connectionInfo.Inherit.RDGatewayUseConnectionCredentials = bool.Parse(xmlnode.Attributes["InheritRDGatewayUseConnectionCredentials"].Value); + connectionInfo.Inherit.RDGatewayUsername = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsername"].Value); + connectionInfo.Inherit.RDGatewayPassword = bool.Parse(xmlnode.Attributes["InheritRDGatewayPassword"].Value); + connectionInfo.Inherit.RDGatewayDomain = bool.Parse(xmlnode.Attributes["InheritRDGatewayDomain"].Value); + } + + if (this.confVersion > 2.2) //2.3 + { + // Get settings + connectionInfo.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["EnableFontSmoothing"].Value); + connectionInfo.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["EnableDesktopComposition"].Value); + + // Get inheritance settings + connectionInfo.Inherit.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["InheritEnableFontSmoothing"].Value); + connectionInfo.Inherit.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["InheritEnableDesktopComposition"].Value); + } + + if (confVersion >= 2.4) + { + connectionInfo.UseCredSsp = bool.Parse(xmlnode.Attributes["UseCredSsp"].Value); + connectionInfo.Inherit.UseCredSsp = bool.Parse(xmlnode.Attributes["InheritUseCredSsp"].Value); + } + + if (confVersion >= 2.5) + { + connectionInfo.LoadBalanceInfo = xmlnode.Attributes["LoadBalanceInfo"].Value; + connectionInfo.AutomaticResize = bool.Parse(xmlnode.Attributes["AutomaticResize"].Value); + connectionInfo.Inherit.LoadBalanceInfo = bool.Parse(xmlnode.Attributes["InheritLoadBalanceInfo"].Value); + connectionInfo.Inherit.AutomaticResize = bool.Parse(xmlnode.Attributes["InheritAutomaticResize"].Value); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(My.Language.strGetConnectionInfoFromXmlFailed, connectionInfo.Name, this.ConnectionFileName, ex.Message), false); + } + return connectionInfo; + } + + private bool Authenticate(string Value, bool CompareToOriginalValue, Root.Info rootInfo = null) + { + string passwordName = ""; + if (UseSQL) + { + passwordName = Language.strSQLServer.TrimEnd(':'); + } + else + { + passwordName = Path.GetFileName(ConnectionFileName); + } + + if (CompareToOriginalValue) + { + while (!(Security.Crypt.Decrypt(Value, pW) != Value)) + { + pW = Tools.MiscTools.PasswordDialog(passwordName, false); + + if (string.IsNullOrEmpty(pW)) + { + return false; + } + } + } + else + { + while (!(Security.Crypt.Decrypt(Value, pW) == "ThisIsProtected")) + { + pW = Tools.MiscTools.PasswordDialog(passwordName, false); + + if (string.IsNullOrEmpty(pW)) + { + return false; + } + } + + if (rootInfo != null) + { + rootInfo.Password = true; + rootInfo.PasswordString = pW; + } + } + + return true; + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Config.Connections.Save.cs b/mRemoteV1/Config/Connections/ConnectionsSaver.cs similarity index 76% rename from mRemoteV1/Config/Config.Connections.Save.cs rename to mRemoteV1/Config/Connections/ConnectionsSaver.cs index 4286d00e..7a52e8ba 100644 --- a/mRemoteV1/Config/Config.Connections.Save.cs +++ b/mRemoteV1/Config/Connections/ConnectionsSaver.cs @@ -1,18 +1,21 @@ +using mRemoteNG.App; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Container; +using mRemoteNG.Tools; +using mRemoteNG.Tree; using System; +using System.Data.SqlClient; using System.Drawing; -using Microsoft.VisualBasic; +using System.Globalization; +using System.IO; using System.Windows.Forms; using System.Xml; -using System.IO; -using System.Globalization; -using mRemoteNG.App; -using System.Data.SqlClient; -using mRemoteNG.Tools; namespace mRemoteNG.Config.Connections { - public class Save + public class ConnectionsSaver { #region Public Enums public enum Format @@ -34,7 +37,7 @@ namespace mRemoteNG.Config.Connections private SqlCommand _sqlQuery; private int _currentNodeIndex = 0; - private string _parentConstantId = System.Convert.ToString(0); + private string _parentConstantId = Convert.ToString(0); #endregion #region Public Properties @@ -42,14 +45,14 @@ namespace mRemoteNG.Config.Connections public string SQLDatabaseName {get; set;} public string SQLUsername {get; set;} public string SQLPassword {get; set;} - + public string ConnectionFileName {get; set;} public TreeNode RootTreeNode {get; set;} public bool Export {get; set;} public Format SaveFormat {get; set;} public Security.Save SaveSecurity {get; set;} - public Connection.ConnectionList ConnectionList {get; set;} - public Container.List ContainerList {get; set;} + public ConnectionList ConnectionList {get; set;} + public ContainerList ContainerList {get; set;} #endregion #region Public Methods @@ -81,7 +84,7 @@ namespace mRemoteNG.Config.Connections } break; } - frmMain.Default.UsingSqlServer = SaveFormat == Format.SQL; + frmMain.Default.AreWeUsingSqlServerForSavingConnections = SaveFormat == Format.SQL; } #endregion @@ -183,7 +186,7 @@ namespace mRemoteNG.Config.Connections { if ((tN.Tag as mRemoteNG.Root.Info).Password == true) { - _password = System.Convert.ToString((tN.Tag as mRemoteNG.Root.Info).PasswordString); + _password = Convert.ToString((tN.Tag as mRemoteNG.Root.Info).PasswordString); strProtected = Security.Crypt.Encrypt("ThisIsProtected", _password); } else @@ -199,7 +202,7 @@ namespace mRemoteNG.Config.Connections _sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection); _sqlQuery.ExecuteNonQuery(); - _sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + Misc.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection); + _sqlQuery = new SqlCommand("INSERT INTO tblRoot (Name, Export, Protected, ConfVersion) VALUES(\'" + MiscTools.PrepareValueForDB(tN.Text) + "\', 0, \'" + strProtected + "\'," + App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture) + ")", _sqlConnection); _sqlQuery.ExecuteNonQuery(); _sqlQuery = new SqlCommand("DELETE FROM tblCons", _sqlConnection); @@ -212,7 +215,7 @@ namespace mRemoteNG.Config.Connections _sqlQuery = new SqlCommand("DELETE FROM tblUpdate", _sqlConnection); _sqlQuery.ExecuteNonQuery(); - _sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + Tools.Misc.DBDate(DateTime.Now) + "\')", _sqlConnection); + _sqlQuery = new SqlCommand("INSERT INTO tblUpdate (LastUpdate) VALUES(\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')", _sqlConnection); _sqlQuery.ExecuteNonQuery(); _sqlConnection.Close(); @@ -224,38 +227,38 @@ namespace mRemoteNG.Config.Connections { _currentNodeIndex++; - Connection.ConnectionRecordImp curConI = default(Connection.ConnectionRecordImp); + ConnectionInfo curConI = default(ConnectionInfo); _sqlQuery = new SqlCommand("INSERT INTO tblCons (Name, Type, Expanded, Description, Icon, Panel, Username, " + "DomainName, Password, Hostname, Protocol, PuttySession, " + "Port, ConnectToConsole, RenderingEngine, ICAEncryptionStrength, RDPAuthenticationLevel, LoadBalanceInfo, Colors, Resolution, AutomaticResize, DisplayWallpaper, " + "DisplayThemes, EnableFontSmoothing, EnableDesktopComposition, CacheBitmaps, RedirectDiskDrives, RedirectPorts, " + "RedirectPrinters, RedirectSmartCards, RedirectSound, RedirectKeys, " + "Connected, PreExtApp, PostExtApp, MacAddress, UserField, ExtApp, VNCCompression, VNCEncoding, VNCAuthMode, " + "VNCProxyType, VNCProxyIP, VNCProxyPort, VNCProxyUsername, VNCProxyPassword, " + "VNCColors, VNCSmartSizeMode, VNCViewOnly, " + "RDGatewayUsageMethod, RDGatewayHostname, RDGatewayUseConnectionCredentials, RDGatewayUsername, RDGatewayPassword, RDGatewayDomain, " + "UseCredSsp, " + "InheritCacheBitmaps, InheritColors, " + "InheritDescription, InheritDisplayThemes, InheritDisplayWallpaper, InheritEnableFontSmoothing, InheritEnableDesktopComposition, InheritDomain, " + "InheritIcon, InheritPanel, InheritPassword, InheritPort, " + "InheritProtocol, InheritPuttySession, InheritRedirectDiskDrives, " + "InheritRedirectKeys, InheritRedirectPorts, InheritRedirectPrinters, " + "InheritRedirectSmartCards, InheritRedirectSound, InheritResolution, InheritAutomaticResize, " + "InheritUseConsoleSession, InheritRenderingEngine, InheritUsername, InheritICAEncryptionStrength, InheritRDPAuthenticationLevel, InheritLoadBalanceInfo, " + "InheritPreExtApp, InheritPostExtApp, InheritMacAddress, InheritUserField, InheritExtApp, InheritVNCCompression, InheritVNCEncoding, " + "InheritVNCAuthMode, InheritVNCProxyType, InheritVNCProxyIP, InheritVNCProxyPort, " + "InheritVNCProxyUsername, InheritVNCProxyPassword, InheritVNCColors, " + "InheritVNCSmartSizeMode, InheritVNCViewOnly, " + "InheritRDGatewayUsageMethod, InheritRDGatewayHostname, InheritRDGatewayUseConnectionCredentials, InheritRDGatewayUsername, InheritRDGatewayPassword, InheritRDGatewayDomain, " + "InheritUseCredSsp, " + "PositionID, ParentID, ConstantID, LastChange)" + "VALUES (", _sqlConnection ); - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(node) == TreeNodeType.Connection | Tree.Node.GetNodeType(node) == TreeNodeType.Container) { //_xmlTextWriter.WriteStartElement("Node") - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(node.Text) + "\',"; //Name + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(node.Text) + "\',"; //Name _sqlQuery.CommandText += "\'" + Tree.Node.GetNodeType(node).ToString() + "\',"; //Type } - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container + if (Tree.Node.GetNodeType(node) == TreeNodeType.Container) //container { _sqlQuery.CommandText += "\'" + this.ContainerList[node.Tag].IsExpanded + "\',"; //Expanded - curConI = this.ContainerList[node.Tag].ConnectionRecord; + curConI = this.ContainerList[node.Tag].ConnectionInfo; SaveConnectionFieldsSQL(curConI); - _sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText); + _sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText); _sqlQuery.ExecuteNonQuery(); //_parentConstantId = _currentNodeIndex SaveNodesSQL(node.Nodes); //_xmlTextWriter.WriteEndElement() } - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection) + if (Tree.Node.GetNodeType(node) == TreeNodeType.Connection) { _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; curConI = this.ConnectionList[node.Tag]; SaveConnectionFieldsSQL(curConI); //_xmlTextWriter.WriteEndElement() - _sqlQuery.CommandText = Tools.Misc.PrepareForDB(_sqlQuery.CommandText); + _sqlQuery.CommandText = Tools.MiscTools.PrepareForDB(_sqlQuery.CommandText); _sqlQuery.ExecuteNonQuery(); } @@ -263,16 +266,16 @@ namespace mRemoteNG.Config.Connections } } - private void SaveConnectionFieldsSQL(Connection.ConnectionRecordImp curConI) + private void SaveConnectionFieldsSQL(ConnectionInfo curConI) { - Connection.ConnectionRecordImp with_1 = curConI; - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Description) + "\',"; - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Icon) + "\',"; - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Panel) + "\',"; + ConnectionInfo with_1 = curConI; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Description) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Icon) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Panel) + "\',"; if (this.SaveSecurity.Username == true) { - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Username) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Username) + "\',"; } else { @@ -281,7 +284,7 @@ namespace mRemoteNG.Config.Connections if (this.SaveSecurity.Domain == true) { - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Domain) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Domain) + "\',"; } else { @@ -290,36 +293,36 @@ namespace mRemoteNG.Config.Connections if (this.SaveSecurity.Password == true) { - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Security.Crypt.Encrypt(with_1.Password, _password)) + "\',"; } else { _sqlQuery.CommandText += "\'" + "" + "\',"; } - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.Hostname) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Hostname) + "\',"; _sqlQuery.CommandText += "\'" + with_1.Protocol.ToString() + "\',"; - _sqlQuery.CommandText += "\'" + Misc.PrepareValueForDB(with_1.PuttySession) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Port) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseConsoleSession) + "\',"; + _sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.PuttySession) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Port) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseConsoleSession) + "\',"; _sqlQuery.CommandText += "\'" + with_1.RenderingEngine.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.ICAEncryption.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.RDPAuthenticationLevel.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.LoadBalanceInfo + "\',"; _sqlQuery.CommandText += "\'" + with_1.Colors.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.Resolution.ToString() + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.AutomaticResize) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.DisplayWallpaper) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.DisplayThemes) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.EnableFontSmoothing) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.EnableDesktopComposition) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.CacheBitmaps) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectDiskDrives) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectPorts) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectPrinters) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectSmartCards) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.AutomaticResize) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayWallpaper) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.DisplayThemes) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.EnableFontSmoothing) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.EnableDesktopComposition) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.CacheBitmaps) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectDiskDrives) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPorts) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectPrinters) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectSmartCards) + "\',"; _sqlQuery.CommandText += "\'" + with_1.RedirectSound.ToString() + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.RedirectKeys) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.RedirectKeys) + "\',"; if (curConI.OpenConnections.Count > 0) { @@ -341,12 +344,12 @@ namespace mRemoteNG.Config.Connections _sqlQuery.CommandText += "\'" + with_1.VNCAuthMode.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.VNCProxyType.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.VNCProxyIP + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.VNCProxyPort) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCProxyPort) + "\',"; _sqlQuery.CommandText += "\'" + with_1.VNCProxyUsername + "\',"; _sqlQuery.CommandText += "\'" + Security.Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',"; _sqlQuery.CommandText += "\'" + with_1.VNCColors.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode.ToString() + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.VNCViewOnly) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCViewOnly) + "\',"; _sqlQuery.CommandText += "\'" + with_1.RDGatewayUsageMethod.ToString() + "\',"; _sqlQuery.CommandText += "\'" + with_1.RDGatewayHostname + "\',"; @@ -379,149 +382,149 @@ namespace mRemoteNG.Config.Connections _sqlQuery.CommandText += "\'" + "" + "\',"; } - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.UseCredSsp) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.UseCredSsp) + "\',"; if (this.SaveSecurity.Inheritance == true) { - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.CacheBitmaps) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Colors) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Description) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.DisplayThemes) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.DisplayWallpaper) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.EnableFontSmoothing) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.EnableDesktopComposition) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Domain) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Icon) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Panel) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Password) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Port) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Protocol) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PuttySession) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectDiskDrives) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectKeys) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectPorts) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectPrinters) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectSmartCards) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RedirectSound) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Resolution) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.AutomaticResize) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UseConsoleSession) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RenderingEngine) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.Username) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.ICAEncryption) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDPAuthenticationLevel) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.LoadBalanceInfo) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PreExtApp) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.PostExtApp) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.MacAddress) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UserField) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.ExtApp) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.CacheBitmaps) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Colors) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Description) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.DisplayThemes) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.DisplayWallpaper) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.EnableFontSmoothing) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.EnableDesktopComposition) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Domain) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Icon) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Panel) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Password) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Port) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Protocol) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PuttySession) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectDiskDrives) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectKeys) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectPorts) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectPrinters) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectSmartCards) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RedirectSound) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Resolution) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.AutomaticResize) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UseConsoleSession) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RenderingEngine) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.Username) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.ICAEncryption) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDPAuthenticationLevel) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.LoadBalanceInfo) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PreExtApp) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.PostExtApp) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.MacAddress) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UserField) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.ExtApp) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCCompression) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCEncoding) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCAuthMode) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyType) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyIP) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyPort) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyUsername) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCProxyPassword) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCColors) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCSmartSizeMode) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.VNCViewOnly) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCCompression) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCEncoding) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCAuthMode) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyType) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyIP) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyPort) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyUsername) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCProxyPassword) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCColors) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCSmartSizeMode) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.VNCViewOnly) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUsageMethod) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayHostname) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUseConnectionCredentials) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayUsername) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayPassword) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.RDGatewayDomain) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUsageMethod) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayHostname) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUseConnectionCredentials) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayUsername) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayPassword) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.RDGatewayDomain) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(with_1.Inherit.UseCredSsp) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(with_1.Inherit.UseCredSsp) + "\',"; } else { - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .AutomaticResize - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .LoadBalanceInfo - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .AutomaticResize + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .LoadBalanceInfo + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUsageMethod - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayHostname - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUseConnectionCredentials - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayUsername - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayPassword - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .RDGatewayDomain + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUsageMethod + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayHostname + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUseConnectionCredentials + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayUsername + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayPassword + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .RDGatewayDomain - _sqlQuery.CommandText += "\'" + System.Convert.ToString(false) + "\',"; // .UseCredSsp + _sqlQuery.CommandText += "\'" + Convert.ToString(false) + "\',"; // .UseCredSsp } - with_1.MetaData.PositionID = _currentNodeIndex; + with_1.PositionID = _currentNodeIndex; - if (with_1.MetaData.IsContainer == false) + if (with_1.IsContainer == false) { if (with_1.Parent != null) { - _parentConstantId = System.Convert.ToString((with_1.Parent as Container.Info).ConnectionRecord.MetaData.ConstantID); + _parentConstantId = Convert.ToString((with_1.Parent as ContainerInfo).ConnectionInfo.ConstantID); } else { - _parentConstantId = System.Convert.ToString(0); + _parentConstantId = Convert.ToString(0); } } else { - if ((with_1.Parent as Container.Info).Parent != null) + if ((with_1.Parent as ContainerInfo).Parent != null) { - _parentConstantId = System.Convert.ToString(((with_1.Parent as Container.Info).Parent as Container.Info).ConnectionRecord.MetaData.ConstantID); + _parentConstantId = Convert.ToString(((with_1.Parent as ContainerInfo).Parent as ContainerInfo).ConnectionInfo.ConstantID); } else { - _parentConstantId = System.Convert.ToString(0); + _parentConstantId = Convert.ToString(0); } } - _sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.MetaData.ConstantID + "\',\'" + Tools.Misc.DBDate(DateTime.Now) + "\')"; + _sqlQuery.CommandText += _currentNodeIndex + ",\'" + _parentConstantId + "\',\'" + with_1.ConstantID + "\',\'" + Tools.MiscTools.DBDate(DateTime.Now) + "\')"; } #endregion @@ -553,13 +556,13 @@ namespace mRemoteNG.Config.Connections TreeNode treeNode = default(TreeNode); - if (Tree.Node.GetNodeType(RootTreeNode) == Tree.Node.Type.Root) + if (Tree.Node.GetNodeType(RootTreeNode) == Tree.TreeNodeType.Root) { treeNode = (TreeNode)RootTreeNode.Clone(); } else { - treeNode = new TreeNode("mR|Export (" + Tools.Misc.DBDate(DateTime.Now) + ")"); + treeNode = new TreeNode("mR|Export (" + Tools.MiscTools.DBDate(DateTime.Now) + ")"); treeNode.Nodes.Add(System.Convert.ToString(RootTreeNode.Clone())); } @@ -592,7 +595,7 @@ namespace mRemoteNG.Config.Connections } } - _xmlTextWriter.WriteAttributeString("ConfVersion", "", App.Info.Connections.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture)); + _xmlTextWriter.WriteAttributeString("ConfVersion", "", App.Info.ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture)); TreeNodeCollection treeNodeCollection = default(TreeNodeCollection); treeNodeCollection = treeNode.Nodes; @@ -629,25 +632,25 @@ namespace mRemoteNG.Config.Connections { foreach (TreeNode node in tNC) { - Connection.ConnectionRecordImp curConI = default(Connection.ConnectionRecordImp); + Connection.ConnectionInfo curConI = default(Connection.ConnectionInfo); - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection | Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container) { _xmlTextWriter.WriteStartElement("Node"); _xmlTextWriter.WriteAttributeString("Name", "", node.Text); _xmlTextWriter.WriteAttributeString("Type", "", Tree.Node.GetNodeType(node).ToString()); } - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) //container + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container) //container { _xmlTextWriter.WriteAttributeString("Expanded", "", System.Convert.ToString(this.ContainerList[node.Tag].TreeNode.IsExpanded)); - curConI = this.ContainerList[node.Tag].ConnectionRecord; + curConI = this.ContainerList[node.Tag].ConnectionInfo; SaveConnectionFields(curConI); SaveNode(node.Nodes); _xmlTextWriter.WriteEndElement(); } - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection) + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection) { curConI = this.ConnectionList[node.Tag]; SaveConnectionFields(curConI); @@ -661,7 +664,7 @@ namespace mRemoteNG.Config.Connections } } - private void SaveConnectionFields(Connection.ConnectionRecordImp curConI) + private void SaveConnectionFields(Connection.ConnectionInfo curConI) { try { @@ -976,20 +979,20 @@ namespace mRemoteNG.Config.Connections { foreach (TreeNode node in tNC) { - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection) + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection) { - Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag; + Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag; WritemRCSVLine(curConI); } - else if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) + else if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container) { SaveNodemRCSV(node.Nodes); } } } - private void WritemRCSVLine(Connection.ConnectionRecordImp con) + private void WritemRCSVLine(Connection.ConnectionInfo con) { string nodePath = con.TreeNode.FullPath; @@ -1062,23 +1065,23 @@ namespace mRemoteNG.Config.Connections { foreach (TreeNode node in tNC) { - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection) + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection) { - Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag; + Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag; - if (curConI.Protocol == Connection.Protocol.Protocols.RDP) + if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP) { WritevRDCSVLine(curConI); } } - else if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Container) + else if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Container) { SaveNodevRDCSV(node.Nodes); } } } - private void WritevRDCSVLine(Connection.ConnectionRecordImp con) + private void WritevRDCSVLine(Connection.ConnectionInfo con) { string nodePath = con.TreeNode.FullPath; @@ -1135,11 +1138,11 @@ namespace mRemoteNG.Config.Connections { foreach (TreeNode node in tNC) { - if (Tree.Node.GetNodeType(node) == Tree.Node.Type.Connection) + if (Tree.Node.GetNodeType(node) == Tree.TreeNodeType.Connection) { - Connection.ConnectionRecordImp curConI = (Connection.ConnectionRecordImp)node.Tag; + Connection.ConnectionInfo curConI = (Connection.ConnectionInfo)node.Tag; - if (curConI.Protocol == Connection.Protocol.Protocols.RDP) + if (curConI.Protocol == Connection.Protocol.ProtocolType.RDP) { _xmlTextWriter.WriteStartElement("Connection"); _xmlTextWriter.WriteAttributeString("Id", "", ""); @@ -1156,7 +1159,7 @@ namespace mRemoteNG.Config.Connections } } - private void WriteVREitem(Connection.ConnectionRecordImp con) + private void WriteVREitem(Connection.ConnectionInfo con) { //Name _xmlTextWriter.WriteStartElement("ConnectionName"); @@ -1225,7 +1228,7 @@ namespace mRemoteNG.Config.Connections //Smart Size _xmlTextWriter.WriteStartElement("AutoSize"); - _xmlTextWriter.WriteValue(con.Resolution == Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.SmartSize); + _xmlTextWriter.WriteValue(con.Resolution == ProtocolRDP.RDPResolutions.SmartSize); _xmlTextWriter.WriteEndElement(); //SeparateResolutionX @@ -1238,7 +1241,7 @@ namespace mRemoteNG.Config.Connections _xmlTextWriter.WriteValue("768"); _xmlTextWriter.WriteEndElement(); - Rectangle resolution = Connection.Protocol.RDPConnectionProtocolImp.GetResolutionRectangle(con.Resolution); + Rectangle resolution = ProtocolRDP.GetResolutionRectangle(con.Resolution); if (resolution.Width == 0) { resolution.Width = 1024; @@ -1280,4 +1283,4 @@ namespace mRemoteNG.Config.Connections } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SQLConnectionsProvider.cs b/mRemoteV1/Config/Connections/SQLConnectionsProvider.cs new file mode 100644 index 00000000..9063fef0 --- /dev/null +++ b/mRemoteV1/Config/Connections/SQLConnectionsProvider.cs @@ -0,0 +1,77 @@ +using mRemoteNG.App; +using mRemoteNG.Messages; +using mRemoteNG.Tools; +using System; +using System.Collections.Generic; +using System.Text; +using System.Timers; +using mRemoteNG.My; + +namespace mRemoteNG.Config.Connections +{ + public class SqlConnectionsProvider : IDisposable + { + SqlUpdateTimer _updateTimer; + SqlConnectionsUpdateChecker _sqlUpdateChecker; + + + public SqlConnectionsProvider() + { + _updateTimer = new SqlUpdateTimer(); + _sqlUpdateChecker = new SqlConnectionsUpdateChecker(); + SqlUpdateTimer.SqlUpdateTimerElapsed += SqlUpdateTimer_SqlUpdateTimerElapsed; + SqlConnectionsUpdateChecker.SQLUpdateCheckFinished += SQLUpdateCheckFinished; + } + + ~SqlConnectionsProvider() + { + Dispose(false); + } + + public void Enable() + { + _updateTimer.Enable(); + } + + public void Disable() + { + _updateTimer.Disable(); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool itIsSafeToAlsoFreeManagedObjects) + { + if (itIsSafeToAlsoFreeManagedObjects) + { + DestroySQLUpdateHandlers(); + _updateTimer.Dispose(); + _sqlUpdateChecker.Dispose(); + } + } + + private void DestroySQLUpdateHandlers() + { + SqlUpdateTimer.SqlUpdateTimerElapsed -= SqlUpdateTimer_SqlUpdateTimerElapsed; + SqlConnectionsUpdateChecker.SQLUpdateCheckFinished -= SQLUpdateCheckFinished; + } + + private void SqlUpdateTimer_SqlUpdateTimerElapsed() + { + _sqlUpdateChecker.IsDatabaseUpdateAvailableAsync(); + } + + private void SQLUpdateCheckFinished(bool UpdateIsAvailable) + { + if (UpdateIsAvailable) + { + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, My.Language.strSqlUpdateCheckUpdateAvailable, true); + Runtime.LoadConnectionsBG(); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SqlCommandBuilder.cs b/mRemoteV1/Config/Connections/SqlCommandBuilder.cs new file mode 100644 index 00000000..8f5f9a83 --- /dev/null +++ b/mRemoteV1/Config/Connections/SqlCommandBuilder.cs @@ -0,0 +1,9 @@ +using System.Data.SqlClient; + +namespace mRemoteNG.Config.Connections +{ + public interface SqlCommandBuilder + { + SqlCommand BuildCommand(); + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SqlConnectionsUpdateChecker.cs b/mRemoteV1/Config/Connections/SqlConnectionsUpdateChecker.cs new file mode 100644 index 00000000..b81ef2a3 --- /dev/null +++ b/mRemoteV1/Config/Connections/SqlConnectionsUpdateChecker.cs @@ -0,0 +1,131 @@ +using mRemoteNG.App; +using mRemoteNG.Messages; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Threading; + +namespace mRemoteNG.Config.Connections +{ + public class SqlConnectionsUpdateChecker : IDisposable + { + private SqlConnector sqlConnector; + private SqlCommand sqlQuery; + private SqlDataReader sqlReader; + + + public SqlConnectionsUpdateChecker() + { + sqlConnector = default(SqlConnectorImp); + sqlQuery = default(SqlCommand); + sqlReader = default(SqlDataReader); + } + + ~SqlConnectionsUpdateChecker() + { + Dispose(false); + } + + + public void IsDatabaseUpdateAvailableAsync() + { + Thread t = new Thread(IsDatabaseUpdateAvailableDelegate); + t.SetApartmentState(ApartmentState.STA); + t.Start(); + } + + private void IsDatabaseUpdateAvailableDelegate() + { + IsDatabaseUpdateAvailable(); + } + + public bool IsDatabaseUpdateAvailable() + { + ConnectToSqlDB(); + BuildSqlQueryToGetUpdateStatus(); + ExecuteQuery(); + bool updateIsAvailable = DatabaseIsMoreUpToDateThanUs(); + SendUpdateCheckFinishedEvent(updateIsAvailable); + return updateIsAvailable; + } + private void ConnectToSqlDB() + { + try + { + sqlConnector = new SqlConnectorImp(); + sqlConnector.Connect(); + } + catch(Exception e) + { + Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Unable to connect to Sql DB to check for updates." + Environment.NewLine + e.Message, true); + } + } + private void BuildSqlQueryToGetUpdateStatus() + { + try + { + SqlCommandBuilder sqlCmdBuilder = new SqlUpdateQueryBuilder(); + sqlQuery = sqlCmdBuilder.BuildCommand(); + sqlConnector.AssociateItemToThisConnector(sqlQuery); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Could not build query to check for updates from the Sql server." + Environment.NewLine + ex.Message, true); + } + } + private void ExecuteQuery() + { + try + { + sqlReader = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); + sqlReader.Read(); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, "Error executing Sql query to get updates from the DB." + Environment.NewLine + ex.Message, true); + } + } + private bool DatabaseIsMoreUpToDateThanUs() + { + if (GetLastUpdateTimeFromDBResponse() > Runtime.LastSqlUpdate) + return true; + return false; + } + private DateTime GetLastUpdateTimeFromDBResponse() + { + DateTime LastUpdateInDB = default(DateTime); + if (sqlReader.HasRows) + LastUpdateInDB = Convert.ToDateTime(sqlReader["LastUpdate"]); + return LastUpdateInDB; + } + private void SendUpdateCheckFinishedEvent(bool UpdateAvailable) + { + if (SQLUpdateCheckFinishedEvent != null) + SQLUpdateCheckFinishedEvent(UpdateAvailable); + } + + + public void Dispose() + { + Dispose(true); + } + + private void Dispose(bool itIsSafeToDisposeManagedObjects) + { + if (itIsSafeToDisposeManagedObjects) + { + sqlConnector.Disconnect(); + sqlConnector.Dispose(); + } + } + + + public delegate void SQLUpdateCheckFinishedEventHandler(bool UpdateAvailable); + private static SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinishedEvent; + public static event SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinished + { + add { SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler)System.Delegate.Combine(SQLUpdateCheckFinishedEvent, value); } + remove { SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler)System.Delegate.Remove(SQLUpdateCheckFinishedEvent, value); } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SqlUpdateQueryBuilder.cs b/mRemoteV1/Config/Connections/SqlUpdateQueryBuilder.cs new file mode 100644 index 00000000..0c5b2c28 --- /dev/null +++ b/mRemoteV1/Config/Connections/SqlUpdateQueryBuilder.cs @@ -0,0 +1,24 @@ +using System.Data.SqlClient; + +namespace mRemoteNG.Config.Connections +{ + public class SqlUpdateQueryBuilder : SqlCommandBuilder + { + private string _updateQuery; + + public SqlUpdateQueryBuilder() + { + Initialize(); + } + + private void Initialize() + { + _updateQuery = "SELECT * FROM tblUpdate"; + } + + public SqlCommand BuildCommand() + { + return new SqlCommand(_updateQuery); + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Connections/SqlUpdateTimer.cs b/mRemoteV1/Config/Connections/SqlUpdateTimer.cs new file mode 100644 index 00000000..ee46d682 --- /dev/null +++ b/mRemoteV1/Config/Connections/SqlUpdateTimer.cs @@ -0,0 +1,84 @@ +using mRemoteNG.App; +using mRemoteNG.Messages; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Timers; + +namespace mRemoteNG.Config.Connections +{ + public class SqlUpdateTimer : IDisposable + { + private Timer _sqlUpdateTimer; + + public SqlUpdateTimer() + { + Initialize(); + } + + ~SqlUpdateTimer() + { + Dispose(false); + } + + private void Initialize() + { + _sqlUpdateTimer = new Timer(); + _sqlUpdateTimer.Interval = 3000; + _sqlUpdateTimer.Elapsed += sqlUpdateTimer_Elapsed; + } + + public void Enable() + { + _sqlUpdateTimer.Start(); + } + + public void Disable() + { + _sqlUpdateTimer.Stop(); + } + + public bool IsUpdateCheckingEnabled() + { + return _sqlUpdateTimer.Enabled; + } + + private static void sqlUpdateTimer_Elapsed(object sender, ElapsedEventArgs e) + { + SqlUpdateTimerElapsedEvent(); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + protected void Dispose(bool itIsSafeToAlsoFreeManagedObjects) + { + if (itIsSafeToAlsoFreeManagedObjects) + { + StopTimer(); + } + } + private void StopTimer() + { + try + { + _sqlUpdateTimer.Stop(); + _sqlUpdateTimer.Close(); + } + catch (Exception) + { + } + } + + + public delegate void SqlUpdateTimerElapsedEventHandler(); + private static SqlUpdateTimerElapsedEventHandler SqlUpdateTimerElapsedEvent; + public static event SqlUpdateTimerElapsedEventHandler SqlUpdateTimerElapsed + { + add { SqlUpdateTimerElapsedEvent = (SqlUpdateTimerElapsedEventHandler)Delegate.Combine(SqlUpdateTimerElapsedEvent, value); } + remove { SqlUpdateTimerElapsedEvent = (SqlUpdateTimerElapsedEventHandler)Delegate.Remove(SqlUpdateTimerElapsedEvent, value); } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/ActiveDirectory.cs b/mRemoteV1/Config/Import/ActiveDirectory.cs index bd025217..f21cef9b 100644 --- a/mRemoteV1/Config/Import/ActiveDirectory.cs +++ b/mRemoteV1/Config/Import/ActiveDirectory.cs @@ -12,6 +12,8 @@ using System.DirectoryServices; using mRemoteNG.App; using System.Text.RegularExpressions; using mRemoteNG.My; +using mRemoteNG.Connection; +using mRemoteNG.Container; namespace mRemoteNG.Config.Import @@ -22,12 +24,12 @@ namespace mRemoteNG.Config.Import { try { - TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Container); + TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Container); - Container.Info containerInfo = new Container.Info(); + ContainerInfo containerInfo = new ContainerInfo(); containerInfo.TreeNode = treeNode; - containerInfo.ConnectionRecord = new Connection.ConnectionRecordImp(containerInfo); - + containerInfo.ConnectionInfo = new ConnectionInfo(containerInfo); + string name = ""; Match match = Regex.Match(ldapPath, "ou=([^,]*)", RegexOptions.IgnoreCase); if (match.Success) @@ -42,13 +44,13 @@ namespace mRemoteNG.Config.Import containerInfo.Name = name; // We can only inherit from a container node, not the root node or connection nodes - if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container) { containerInfo.Parent = parentTreeNode.Tag; } else { - containerInfo.ConnectionRecord.Inherit.TurnOffInheritanceCompletely(); + containerInfo.ConnectionInfo.Inherit.TurnOffInheritanceCompletely(); } treeNode.Text = name; @@ -91,18 +93,18 @@ namespace mRemoteNG.Config.Import { ldapResult = tempLoopVar_ldapResult; System.DirectoryServices.DirectoryEntry with_2 = ldapResult.GetDirectoryEntry(); - strDisplayName = System.Convert.ToString(with_2.Properties["cn"].Value); - strDescription = System.Convert.ToString(with_2.Properties["Description"].Value); - strHostName = System.Convert.ToString(with_2.Properties["dNSHostName"].Value); + strDisplayName = Convert.ToString(with_2.Properties["cn"].Value); + strDescription = Convert.ToString(with_2.Properties["Description"].Value); + strHostName = Convert.ToString(with_2.Properties["dNSHostName"].Value); - TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, strDisplayName); + TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Connection, strDisplayName); - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp inheritanceInfo = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo, true); + ConnectionInfo connectionInfo = new ConnectionInfo(); + ConnectionInfoInheritance inheritanceInfo = new ConnectionInfoInheritance(connectionInfo, true); inheritanceInfo.Description = false; - if (parentTreeNode.Tag is Container.Info) + if (parentTreeNode.Tag is ContainerInfo) { - connectionInfo.Parent = (Container.Info)parentTreeNode.Tag; + connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag; } connectionInfo.Inherit = inheritanceInfo; connectionInfo.Name = strDisplayName; @@ -123,4 +125,4 @@ namespace mRemoteNG.Config.Import } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/PortScan.cs b/mRemoteV1/Config/Import/PortScan.cs index 09f30773..72ab2f7c 100644 --- a/mRemoteV1/Config/Import/PortScan.cs +++ b/mRemoteV1/Config/Import/PortScan.cs @@ -9,75 +9,78 @@ using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; using mRemoteNG.App; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Container; namespace mRemoteNG.Config.Import { public class PortScan { - public static void Import(IEnumerable hosts, Connection.Protocol.Protocols protocol, TreeNode parentTreeNode) + public static void Import(IEnumerable hosts, ProtocolType protocol, TreeNode parentTreeNode) { foreach (Tools.PortScan.ScanHost host in hosts) { - Connection.Protocol.Protocols finalProtocol = default(Connection.Protocol.Protocols); + ProtocolType finalProtocol = default(ProtocolType); bool protocolValid = false; - TreeNode treeNode = Tree.Node.AddNode(Tree.Node.Type.Connection, host.HostNameWithoutDomain); + TreeNode treeNode = Tree.Node.AddNode(Tree.TreeNodeType.Connection, host.HostNameWithoutDomain); - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo); + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); connectionInfo.Name = host.HostNameWithoutDomain; connectionInfo.Hostname = host.HostName; switch (protocol) { - case Connection.Protocol.Protocols.SSH2: + case ProtocolType.SSH2: if (host.SSH) { - finalProtocol = Connection.Protocol.Protocols.SSH2; + finalProtocol = ProtocolType.SSH2; protocolValid = true; } break; - case Connection.Protocol.Protocols.Telnet: + case ProtocolType.Telnet: if (host.Telnet) { - finalProtocol = Connection.Protocol.Protocols.Telnet; + finalProtocol = ProtocolType.Telnet; protocolValid = true; } break; - case Connection.Protocol.Protocols.HTTP: + case ProtocolType.HTTP: if (host.HTTP) { - finalProtocol = Connection.Protocol.Protocols.HTTP; + finalProtocol = ProtocolType.HTTP; protocolValid = true; } break; - case Connection.Protocol.Protocols.HTTPS: + case ProtocolType.HTTPS: if (host.HTTPS) { - finalProtocol = Connection.Protocol.Protocols.HTTPS; + finalProtocol = ProtocolType.HTTPS; protocolValid = true; } break; - case Connection.Protocol.Protocols.Rlogin: + case ProtocolType.Rlogin: if (host.Rlogin) { - finalProtocol = Connection.Protocol.Protocols.Rlogin; + finalProtocol = ProtocolType.Rlogin; protocolValid = true; } break; - case Connection.Protocol.Protocols.RDP: + case ProtocolType.RDP: if (host.RDP) { - finalProtocol = Connection.Protocol.Protocols.RDP; + finalProtocol = ProtocolType.RDP; protocolValid = true; } break; - case Connection.Protocol.Protocols.VNC: + case ProtocolType.VNC: if (host.VNC) { - finalProtocol = Connection.Protocol.Protocols.VNC; + finalProtocol = ProtocolType.VNC; protocolValid = true; } break; @@ -91,9 +94,9 @@ namespace mRemoteNG.Config.Import treeNode.Tag = connectionInfo; parentTreeNode.Nodes.Add(treeNode); - if (parentTreeNode.Tag is Container.Info) + if (parentTreeNode.Tag is ContainerInfo) { - connectionInfo.Parent = (Container.Info)parentTreeNode.Tag; + connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag; } Runtime.ConnectionList.Add(connectionInfo); @@ -101,4 +104,4 @@ namespace mRemoteNG.Config.Import } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/PuttyConnectionManager.cs b/mRemoteV1/Config/Import/PuttyConnectionManager.cs index bc52d0f9..56c31afc 100644 --- a/mRemoteV1/Config/Import/PuttyConnectionManager.cs +++ b/mRemoteV1/Config/Import/PuttyConnectionManager.cs @@ -12,6 +12,8 @@ using System.Xml; using System.IO; using mRemoteNG.App; using mRemoteNG.Connection.Protocol; +using mRemoteNG.Images; +using mRemoteNG.Connection; namespace mRemoteNG.Config.Import @@ -67,17 +69,17 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Container.Info containerInfo = new Container.Info(); + Container.ContainerInfo containerInfo = new Container.ContainerInfo(); containerInfo.TreeNode = treeNode; containerInfo.Name = name; - Connection.ConnectionRecordImp connectionInfo = CreateConnectionInfo(name); + Connection.ConnectionInfo connectionInfo = CreateConnectionInfo(name); connectionInfo.Parent = containerInfo; connectionInfo.IsContainer = true; - containerInfo.ConnectionRecord = connectionInfo; + containerInfo.ConnectionInfo = connectionInfo; // We can only inherit from a container node, not the root node or connection nodes - if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container) { containerInfo.Parent = parentTreeNode.Tag; } @@ -88,8 +90,8 @@ namespace mRemoteNG.Config.Import treeNode.Name = name; treeNode.Tag = containerInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)TreeImageType.Container; + treeNode.SelectedImageIndex = (int)TreeImageType.Container; foreach (XmlNode childNode in xmlNode.SelectNodes("./*")) { @@ -127,48 +129,48 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(connectionNode); + Connection.ConnectionInfo connectionInfo = ConnectionInfoFromXml(connectionNode); connectionInfo.TreeNode = treeNode; - connectionInfo.Parent = (Container.Info)parentTreeNode.Tag; + connectionInfo.Parent = (Container.ContainerInfo)parentTreeNode.Tag; treeNode.Name = name; treeNode.Tag = connectionInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; Runtime.ConnectionList.Add(connectionInfo); } - private static Connection.ConnectionRecordImp CreateConnectionInfo(string name) + private static ConnectionInfo CreateConnectionInfo(string name) { - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo); + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); connectionInfo.Name = name; return connectionInfo; } - private static Connection.ConnectionRecordImp ConnectionInfoFromXml(XmlNode xmlNode) + private static ConnectionInfo ConnectionInfoFromXml(XmlNode xmlNode) { XmlNode connectionInfoNode = xmlNode.SelectSingleNode("./connection_info"); string name = connectionInfoNode.SelectSingleNode("./name").InnerText; - Connection.ConnectionRecordImp connectionInfo = CreateConnectionInfo(name); + ConnectionInfo connectionInfo = CreateConnectionInfo(name); string protocol = connectionInfoNode.SelectSingleNode("./protocol").InnerText; switch (protocol.ToLowerInvariant()) { case "telnet": - connectionInfo.Protocol = Protocols.Telnet; + connectionInfo.Protocol = ProtocolType.Telnet; break; case "ssh": - connectionInfo.Protocol = Protocols.SSH2; + connectionInfo.Protocol = ProtocolType.SSH2; break; default: throw (new FileFormatException(string.Format("Unrecognized protocol ({0}).", protocol))); } connectionInfo.Hostname = connectionInfoNode.SelectSingleNode("./host").InnerText; - connectionInfo.Port = System.Convert.ToInt32(connectionInfoNode.SelectSingleNode("./port").InnerText); + connectionInfo.Port = Convert.ToInt32(connectionInfoNode.SelectSingleNode("./port").InnerText); connectionInfo.PuttySession = connectionInfoNode.SelectSingleNode("./session").InnerText; // ./commandline connectionInfo.Description = connectionInfoNode.SelectSingleNode("./description").InnerText; @@ -196,4 +198,4 @@ namespace mRemoteNG.Config.Import return connectionInfo; } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/RemoteDesktopConnection.cs b/mRemoteV1/Config/Import/RemoteDesktopConnection.cs index 50fec8f7..0384eda7 100644 --- a/mRemoteV1/Config/Import/RemoteDesktopConnection.cs +++ b/mRemoteV1/Config/Import/RemoteDesktopConnection.cs @@ -10,6 +10,10 @@ using System.Collections; using System.Windows.Forms; using System.IO; using mRemoteNG.App; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Images; +using mRemoteNG.Container; +using mRemoteNG.Connection; namespace mRemoteNG.Config.Import @@ -24,20 +28,20 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo); + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); connectionInfo.Name = name; connectionInfo.TreeNode = treeNode; - if (treeNode.Parent.Tag is Container.Info) + if (treeNode.Parent.Tag is ContainerInfo) { - connectionInfo.Parent = (Container.Info)treeNode.Parent.Tag; + connectionInfo.Parent = (ContainerInfo)treeNode.Parent.Tag; } treeNode.Name = name; treeNode.Tag = connectionInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; foreach (string line in lines) { @@ -56,12 +60,12 @@ namespace mRemoteNG.Config.Import Runtime.ConnectionList.Add(connectionInfo); } - private static void SetConnectionInfoParameter(Connection.ConnectionRecordImp connectionInfo, string key, string value) + private static void SetConnectionInfoParameter(ConnectionInfo connectionInfo, string key, string value) { switch (key.ToLower()) { case "full address": - Uri uri = new Uri("dummyscheme" + System.Uri.SchemeDelimiter + value); + Uri uri = new Uri("dummyscheme" + Uri.SchemeDelimiter + value); if (!string.IsNullOrEmpty(uri.Host)) { connectionInfo.Hostname = uri.Host; @@ -72,7 +76,7 @@ namespace mRemoteNG.Config.Import } break; case "server port": - connectionInfo.Port = System.Convert.ToInt32(value); + connectionInfo.Port = Convert.ToInt32(value); break; case "username": connectionInfo.Username = value; @@ -84,19 +88,19 @@ namespace mRemoteNG.Config.Import switch (value) { case "8": - connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors256; + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors256; break; case "15": - connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors15Bit; + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit; break; case "16": - connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors16Bit; + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors16Bit; break; case "24": - connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors24Bit; + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors24Bit; break; case "32": - connectionInfo.Colors = Connection.Protocol.RDPConnectionProtocolImp.RDPColors.Colors32Bit; + connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit; break; } break; @@ -113,11 +117,11 @@ namespace mRemoteNG.Config.Import case "screen mode id": if (value == "2") { - connectionInfo.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.Fullscreen; + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.Fullscreen; } else { - connectionInfo.Resolution = Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions.FitToWindow; + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow; } break; case "connect to console": @@ -210,17 +214,17 @@ namespace mRemoteNG.Config.Import switch (value) { case "0": - connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.BringToThisComputer; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.BringToThisComputer; break; case "1": - connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.LeaveAtRemoteComputer; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.LeaveAtRemoteComputer; break; case "2": - connectionInfo.RedirectSound = Connection.Protocol.RDPConnectionProtocolImp.RDPSounds.DoNotPlay; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.DoNotPlay; break; } break; } } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/RemoteDesktopConnectionManager.cs b/mRemoteV1/Config/Import/RemoteDesktopConnectionManager.cs index 9b53772c..1138b79f 100644 --- a/mRemoteV1/Config/Import/RemoteDesktopConnectionManager.cs +++ b/mRemoteV1/Config/Import/RemoteDesktopConnectionManager.cs @@ -13,6 +13,10 @@ using System.IO; using System.Runtime.InteropServices; using mRemoteNG.Connection.Protocol; using mRemoteNG.App; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Images; +using mRemoteNG.Connection; +using mRemoteNG.Container; namespace mRemoteNG.Config.Import @@ -50,17 +54,17 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Container.Info containerInfo = new Container.Info(); + Container.ContainerInfo containerInfo = new Container.ContainerInfo(); containerInfo.TreeNode = treeNode; containerInfo.Name = name; - Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(propertiesNode); + Connection.ConnectionInfo connectionInfo = ConnectionInfoFromXml(propertiesNode); connectionInfo.Parent = containerInfo; connectionInfo.IsContainer = true; - containerInfo.ConnectionRecord = connectionInfo; + containerInfo.ConnectionInfo = connectionInfo; // We can only inherit from a container node, not the root node or connection nodes - if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container) { containerInfo.Parent = parentTreeNode.Tag; } @@ -71,8 +75,8 @@ namespace mRemoteNG.Config.Import treeNode.Name = name; treeNode.Tag = containerInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)TreeImageType.Container; + treeNode.SelectedImageIndex = (int)TreeImageType.Container; foreach (XmlNode childNode in xmlNode.SelectNodes("./group|./server")) { @@ -102,22 +106,22 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Connection.ConnectionRecordImp connectionInfo = ConnectionInfoFromXml(serverNode); + ConnectionInfo connectionInfo = ConnectionInfoFromXml(serverNode); connectionInfo.TreeNode = treeNode; - connectionInfo.Parent = (Container.Info)parentTreeNode.Tag; + connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag; treeNode.Name = name; treeNode.Tag = connectionInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; Runtime.ConnectionList.Add(connectionInfo); } - private static Connection.ConnectionRecordImp ConnectionInfoFromXml(XmlNode xmlNode) + private static ConnectionInfo ConnectionInfoFromXml(XmlNode xmlNode) { - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo); + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); string name = xmlNode.SelectSingleNode("./name").InnerText; @@ -166,7 +170,7 @@ namespace mRemoteNG.Config.Import connectionInfo.UseConsoleSession = bool.Parse(connectionSettingsNode.SelectSingleNode("./connectToConsole").InnerText); // ./startProgram // ./workingDir - connectionInfo.Port = System.Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port").InnerText); + connectionInfo.Port = Convert.ToInt32(connectionSettingsNode.SelectSingleNode("./port").InnerText); } else { @@ -179,11 +183,11 @@ namespace mRemoteNG.Config.Import { if (gatewaySettingsNode.SelectSingleNode("./enabled").InnerText == "True") { - connectionInfo.RDGatewayUsageMethod = RDPConnectionProtocolImp.RDGatewayUsageMethod.Always; + connectionInfo.RDGatewayUsageMethod = ProtocolRDP.RDGatewayUsageMethod.Always; } else { - connectionInfo.RDGatewayUsageMethod = RDPConnectionProtocolImp.RDGatewayUsageMethod.Never; + connectionInfo.RDGatewayUsageMethod = ProtocolRDP.RDGatewayUsageMethod.Never; } connectionInfo.RDGatewayHostname = gatewaySettingsNode.SelectSingleNode("./hostName").InnerText; @@ -216,28 +220,28 @@ namespace mRemoteNG.Config.Import XmlNode remoteDesktopNode = xmlNode.SelectSingleNode("./remoteDesktop"); if (remoteDesktopNode.Attributes["inherit"].Value == "None") { - string resolutionString = System.Convert.ToString(remoteDesktopNode.SelectSingleNode("./size").InnerText.Replace(" ", "")); + string resolutionString = Convert.ToString(remoteDesktopNode.SelectSingleNode("./size").InnerText.Replace(" ", "")); try { - connectionInfo.Resolution = (Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions)Enum.Parse(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPResolutions), "Res" + resolutionString); + connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Enum.Parse(typeof(ProtocolRDP.RDPResolutions), "Res" + resolutionString); } catch (ArgumentException) { - connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.FitToWindow; + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow; } if (remoteDesktopNode.SelectSingleNode("./sameSizeAsClientArea").InnerText == "True") { - connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.FitToWindow; + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.FitToWindow; } if (remoteDesktopNode.SelectSingleNode("./fullScreen").InnerText == "True") { - connectionInfo.Resolution = RDPConnectionProtocolImp.RDPResolutions.Fullscreen; + connectionInfo.Resolution = ProtocolRDP.RDPResolutions.Fullscreen; } - connectionInfo.Colors = (Connection.Protocol.RDPConnectionProtocolImp.RDPColors)Enum.Parse(typeof(Connection.Protocol.RDPConnectionProtocolImp.RDPColors), remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText); + connectionInfo.Colors = (ProtocolRDP.RDPColors)Enum.Parse(typeof(ProtocolRDP.RDPColors), remoteDesktopNode.SelectSingleNode("./colorDepth").InnerText); } else { @@ -251,13 +255,13 @@ namespace mRemoteNG.Config.Import switch (localResourcesNode.SelectSingleNode("./audioRedirection").InnerText) { case "0": // Bring to this computer - connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.BringToThisComputer; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.BringToThisComputer; break; case "1": // Leave at remote computer - connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.LeaveAtRemoteComputer; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.LeaveAtRemoteComputer; break; case "2": // Do not play - connectionInfo.RedirectSound = RDPConnectionProtocolImp.RDPSounds.DoNotPlay; + connectionInfo.RedirectSound = ProtocolRDP.RDPSounds.DoNotPlay; break; } @@ -299,13 +303,13 @@ namespace mRemoteNG.Config.Import switch (securitySettingsNode.SelectSingleNode("./authentication").InnerText) { case "0": // No authentication - connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.NoAuth; + connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.NoAuth; break; case "1": // Do not connect if authentication fails - connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.AuthRequired; + connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.AuthRequired; break; case "2": // Warn if authentication fails - connectionInfo.RDPAuthenticationLevel = RDPConnectionProtocolImp.AuthenticationLevel.WarnOnFailedAuth; + connectionInfo.RDPAuthenticationLevel = ProtocolRDP.AuthenticationLevel.WarnOnFailedAuth; break; } } @@ -390,4 +394,4 @@ namespace mRemoteNG.Config.Import // ReSharper restore InconsistentNaming } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Import/mRemoteNG.cs b/mRemoteV1/Config/Import/mRemoteNG.cs index 36051a54..a3cee46d 100644 --- a/mRemoteV1/Config/Import/mRemoteNG.cs +++ b/mRemoteV1/Config/Import/mRemoteNG.cs @@ -10,6 +10,10 @@ using System.Collections; using System.Windows.Forms; using System.IO; using mRemoteNG.App; +using mRemoteNG.Images; +using mRemoteNG.Config.Connections; +using mRemoteNG.Container; +using mRemoteNG.Connection; namespace mRemoteNG.Config.Import @@ -23,20 +27,20 @@ namespace mRemoteNG.Config.Import TreeNode treeNode = new TreeNode(name); parentTreeNode.Nodes.Add(treeNode); - Container.Info containerInfo = new Container.Info(); + ContainerInfo containerInfo = new ContainerInfo(); containerInfo.TreeNode = treeNode; containerInfo.Name = name; - Connection.ConnectionRecordImp connectionInfo = new Connection.ConnectionRecordImp(); - connectionInfo.Inherit = new Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp(connectionInfo); + ConnectionInfo connectionInfo = new ConnectionInfo(); + connectionInfo.Inherit = new ConnectionInfoInheritance(connectionInfo); connectionInfo.Name = name; connectionInfo.TreeNode = treeNode; connectionInfo.Parent = containerInfo; connectionInfo.IsContainer = true; - containerInfo.ConnectionRecord = connectionInfo; + containerInfo.ConnectionInfo = connectionInfo; // We can only inherit from a container node, not the root node or connection nodes - if (Tree.Node.GetNodeType(parentTreeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(parentTreeNode) == Tree.TreeNodeType.Container) { containerInfo.Parent = parentTreeNode.Tag; } @@ -47,10 +51,10 @@ namespace mRemoteNG.Config.Import treeNode.Name = name; treeNode.Tag = containerInfo; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)TreeImageType.Container; + treeNode.SelectedImageIndex = (int)TreeImageType.Container; - Connections.Load connectionsLoad = new Connections.Load(); + ConnectionsLoader connectionsLoad = new ConnectionsLoader(); connectionsLoad.ConnectionFileName = fileName; connectionsLoad.RootTreeNode = treeNode; connectionsLoad.ConnectionList = Runtime.ConnectionList; @@ -61,4 +65,4 @@ namespace mRemoteNG.Config.Import Runtime.ContainerList.Add(containerInfo); } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/KeyboardShortcuts.cs b/mRemoteV1/Config/KeyboardShortcuts.cs deleted file mode 100644 index 9ae11db6..00000000 --- a/mRemoteV1/Config/KeyboardShortcuts.cs +++ /dev/null @@ -1,457 +0,0 @@ -using System.Collections.Generic; -using System; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.ComponentModel; -using mRemoteNG.App; -using SharedLibraryNG; - - -namespace mRemoteNG.Config -{ - public class KeyboardShortcuts - { - #region Public Properties - private static KeyboardShortcutMap _defaultMap = null; - public static KeyboardShortcutMap DefaultMap - { - get - { - LoadDefaultMap(); - return _defaultMap; - } - } - - private static KeyboardShortcutMap _map; - public static KeyboardShortcutMap Map - { - get - { - Load(); - return _map; - } - set - { - CancelKeyNotifications(); - _map = value; - Save(); - RequestKeyNotifications(_handle); - } - } - #endregion - - #region Public Methods - public static void RequestKeyNotifications(IntPtr handle) - { - // ReSharper disable LocalizableElement - if (handle == IntPtr.Zero) - { - throw (new ArgumentException("The handle cannot be null.", "handle")); - } - if (!(_handle == IntPtr.Zero) && !(_handle == handle)) - { - throw (new ArgumentException("The handle must match the handle that was specified the first time this function was called.", "handle")); - } - // ReSharper restore LocalizableElement - _handle = handle; - foreach (ShortcutMapping shortcutMapping in Map.Mappings) - { - KeyboardHook.RequestKeyNotification(handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false); - } - } - - public static ShortcutCommand CommandFromHookKeyMessage(Message m) - { - KeyboardHook.HookKeyMsgData msgData = (SharedLibraryNG.KeyboardHook.HookKeyMsgData)Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData)); - return Map.GetCommand(msgData.KeyCode, msgData.ModifierKeys); - } - #endregion - - #region Private Fields - // ReSharper disable once UnusedMember.Local - private static KeyboardHook _keyboardHook = new KeyboardHook(); - private static bool _mapLoaded = false; - private static IntPtr _handle = IntPtr.Zero; - #endregion - - #region Private Methods - private static void LoadDefaultMap() - { - if (_defaultMap != null) - { - return ; - } - _defaultMap = new KeyboardShortcutMap(); - _defaultMap.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.Properties["KeysPreviousTab"].DefaultValue)); - _defaultMap.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.Properties["KeysNextTab"].DefaultValue)); - } - - private static void Load() - { - if (_mapLoaded) - { - return ; - } - _map = new KeyboardShortcutMap(); - _map.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.KeysPreviousTab)); - _map.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.KeysNextTab)); - _mapLoaded = true; - } - - private static void Save() - { - if (_map == null) - { - return ; - } - My.Settings.Default.KeysPreviousTab = _map.GetConfigString(ShortcutCommand.PreviousTab); - My.Settings.Default.KeysNextTab = _map.GetConfigString(ShortcutCommand.NextTab); - } - - private static void CancelKeyNotifications() - { - if (_handle == IntPtr.Zero) - { - return ; - } - foreach (ShortcutMapping shortcutMapping in Map.Mappings) - { - KeyboardHook.CancelKeyNotification(_handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false); - } - } - #endregion - } - - public class KeyboardShortcutMap : ICloneable - { - - #region Public Properties - private List _mappings; - public List Mappings - { - get - { - return _mappings; - } - } - #endregion - - #region Constructors - public KeyboardShortcutMap() - { - _mappings = new List(); - } - - public KeyboardShortcutMap(List mappings) - { - _mappings = mappings; - } - #endregion - - #region Public Methods - public void Add(ShortcutCommand command, ShortcutKey shortcutKey) - { - if (Mappings.Contains(new ShortcutMapping(command, shortcutKey))) - { - return ; - } - Mappings.Add(new ShortcutMapping(command, shortcutKey)); - } - - public void AddRange(ShortcutCommand command, IEnumerable shortcutKeys) - { - foreach (ShortcutKey shortcutKey in shortcutKeys) - { - Add(command, shortcutKey); - } - } - - public void Remove(ShortcutCommand command, ShortcutKey shortcutKey) - { - Mappings.Remove(new ShortcutMapping(command, shortcutKey)); - } - - public void AddFromConfigString(ShortcutCommand command, string configString) - { - foreach (ShortcutKey shortcutKey in ParseConfigString(configString)) - { - Add(command, shortcutKey); - } - } - - public string GetConfigString(ShortcutCommand command) - { - List parts = new List(); - foreach (ShortcutKey shortcutKey in GetShortcutKeys(command)) - { - parts.Add(shortcutKey.ToConfigString()); - } - return string.Join(", ", parts.ToArray()); - } - - public ShortcutKey[] GetShortcutKeys(ShortcutCommand command) - { - List shortcutKeys = new List(); - foreach (ShortcutMapping shortcutMapping in Mappings) - { - if (shortcutMapping.Command == command) - { - shortcutKeys.Add(shortcutMapping.Key); - } - } - return shortcutKeys.ToArray(); - } - - public void SetShortcutKeys(ShortcutCommand command, IEnumerable shortcutKeys) - { - ClearShortcutKeys(command); - AddRange(command, shortcutKeys); - } - - public ShortcutCommand GetCommand(int keyCode, KeyboardHook.ModifierKeys modifierKeys) - { - return GetCommand(new ShortcutKey(keyCode, modifierKeys)); - } - - public object Clone() - { - List newMappings = new List(); - newMappings.AddRange(Mappings); - return new KeyboardShortcutMap(newMappings); - } - #endregion - - #region Private Methods - private static ShortcutKey[] ParseConfigString(string shortcutKeysString) - { - List shortcutKeys = new List(); - foreach (string shortcutKeyString in shortcutKeysString.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries)) - { - try - { - shortcutKeys.Add(ShortcutKey.FromConfigString(shortcutKeyString.Trim())); - } - catch (Exception ex) - { - Runtime.MessageCollector.AddExceptionMessage(message: string.Format("KeyboardShortcuts.ParseShortcutKeysString({0}) failed at {1}.", shortcutKeysString, shortcutKeyString), ex: ex, logOnly: true); - continue; - } - } - return shortcutKeys.ToArray(); - } - - private ShortcutCommand GetCommand(ShortcutKey shortcutKey) - { - foreach (ShortcutMapping shortcutMapping in Mappings) - { - if (ShortcutKeysMatch(shortcutMapping.Key, shortcutKey)) - { - return shortcutMapping.Command; - } - } - return ShortcutCommand.None; - } - - private static bool - ShortcutKeysMatch(ShortcutKey wanted, ShortcutKey pressed) - { - if (!(wanted.KeyCode == pressed.KeyCode)) - { - return false; - } - return KeyboardHook.ModifierKeysMatch(wanted.ModifierKeys, pressed.ModifierKeys); - } - - private void ClearShortcutKeys(ShortcutCommand command) - { - List mappingsToRemove = new List(); - foreach (ShortcutMapping mapping in Mappings) - { - if (mapping.Command == command) - { - mappingsToRemove.Add(mapping); - } - } - - foreach (ShortcutMapping mapping in mappingsToRemove) - { - Mappings.Remove(mapping); - } - } - #endregion - } - - [ImmutableObject(true)] - public class ShortcutMapping : IEquatable - { - #region Public Properties - private ShortcutCommand _command; - public ShortcutCommand Command - { - get - { - return _command; - } - } - - private ShortcutKey _key; - public ShortcutKey Key - { - get - { - return _key; - } - } - #endregion - - #region Constructors - public ShortcutMapping(ShortcutCommand command, ShortcutKey key) - { - _command = command; - _key = key; - } - #endregion - - #region Public Methods - public bool Equals(ShortcutMapping other) - { - if (!(Command == other.Command)) - { - return false; - } - if (!(Key == other.Key)) - { - return false; - } - return true; - } - #endregion - } - - [ImmutableObject(true)] - public class ShortcutKey : IEquatable - { - #region Public Properties - private int _keyCode; - public int KeyCode - { - get - { - return _keyCode; - } - } - - private KeyboardHook.ModifierKeys _modifierKeys; - public KeyboardHook.ModifierKeys ModifierKeys - { - get - { - return _modifierKeys; - } - } - #endregion - - #region Constructors - public ShortcutKey(int keyCode, KeyboardHook.ModifierKeys modifierKeys) - { - _keyCode = keyCode; - _modifierKeys = modifierKeys; - } - - public ShortcutKey(Keys keysValue) - { - _keyCode = (int) (keysValue & Keys.KeyCode); - if (!((keysValue & Keys.Shift) == 0)) - { - _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Shift; - } - if (!((keysValue & Keys.Control) == 0)) - { - _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Control; - } - if (!((keysValue & Keys.Alt) == 0)) - { - _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Alt; - } - } - #endregion - - #region Public Methods - public string ToConfigString() - { - return string.Join("/", new string[] {KeyCode.ToString(), (Convert.ToInt32(ModifierKeys)).ToString()}); - } - - public static ShortcutKey FromConfigString(string shortcutKeyString) - { - string[] parts = shortcutKeyString.Split(new char[] {'/'}, 2); - if (!(parts.Length == 2)) - { - throw (new ArgumentException(string.Format("ShortcutKey.FromString({0}) failed. parts.Length != 2", shortcutKeyString), shortcutKeyString)); - } - return new ShortcutKey(Convert.ToInt32(parts[0]), (SharedLibraryNG.KeyboardHook.ModifierKeys)Convert.ToInt32(parts[1])); - } - - public override string ToString() - { - return HotkeyControl.KeysToString((System.Windows.Forms.Keys)this.KeyCode); - } - - public bool Equals(ShortcutKey other) - { - if (!(KeyCode == other.KeyCode)) - { - return false; - } - if (!(ModifierKeys == other.ModifierKeys)) - { - return false; - } - return true; - } - #endregion - - #region Operators - public static bool operator ==(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2) - { - return shortcutKey1.Equals(shortcutKey2); - } - - public static bool operator !=(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2) - { - return !shortcutKey1.Equals(shortcutKey2); - } - - // This is a narrowing conversion because (Keys Or Keys.Modifiers) cannot hold all possible values of KeyboardHook.ModifierKeys - public static explicit operator Keys (ShortcutKey shortcutKey) - { - Keys keysValue = System.Windows.Forms.Keys.A; - if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Shift) == 0)) - { - keysValue = (Keys) (keysValue | Keys.Shift); - } - if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Control) == 0)) - { - keysValue = (Keys) (keysValue | Keys.Control); - } - if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Alt) == 0)) - { - keysValue = (Keys) (keysValue | Keys.Alt); - } - return keysValue; - } - - public static implicit operator ShortcutKey (Keys keys) - { - return new ShortcutKey(keys); - } - #endregion - } - - public enum ShortcutCommand - { - None = 0, - PreviousTab, - NextTab - } -} diff --git a/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcutMap.cs b/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcutMap.cs new file mode 100644 index 00000000..af9383e6 --- /dev/null +++ b/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcutMap.cs @@ -0,0 +1,160 @@ +using mRemoteNG.App; +using SharedLibraryNG; +using System; +using System.Collections.Generic; + +namespace mRemoteNG.Config.KeyboardShortcuts +{ + public class KeyboardShortcutMap : ICloneable + { + private List _mappings; + + + public List Mappings + { + get + { + return _mappings; + } + } + + + public KeyboardShortcutMap() + { + _mappings = new List(); + } + + public KeyboardShortcutMap(List mappings) + { + _mappings = mappings; + } + + + public void Add(ShortcutCommand command, ShortcutKey shortcutKey) + { + if (Mappings.Contains(new ShortcutMapping(command, shortcutKey))) + { + return; + } + Mappings.Add(new ShortcutMapping(command, shortcutKey)); + } + + public void AddRange(ShortcutCommand command, IEnumerable shortcutKeys) + { + foreach (ShortcutKey shortcutKey in shortcutKeys) + { + Add(command, shortcutKey); + } + } + + public void Remove(ShortcutCommand command, ShortcutKey shortcutKey) + { + Mappings.Remove(new ShortcutMapping(command, shortcutKey)); + } + + public void AddFromConfigString(ShortcutCommand command, string configString) + { + foreach (ShortcutKey shortcutKey in ParseConfigString(configString)) + { + Add(command, shortcutKey); + } + } + + public string GetConfigString(ShortcutCommand command) + { + List parts = new List(); + foreach (ShortcutKey shortcutKey in GetShortcutKeys(command)) + { + parts.Add(shortcutKey.ToConfigString()); + } + return string.Join(", ", parts.ToArray()); + } + + public ShortcutKey[] GetShortcutKeys(ShortcutCommand command) + { + List shortcutKeys = new List(); + foreach (ShortcutMapping shortcutMapping in Mappings) + { + if (shortcutMapping.Command == command) + { + shortcutKeys.Add(shortcutMapping.Key); + } + } + return shortcutKeys.ToArray(); + } + + public void SetShortcutKeys(ShortcutCommand command, IEnumerable shortcutKeys) + { + ClearShortcutKeys(command); + AddRange(command, shortcutKeys); + } + + public ShortcutCommand GetCommand(int keyCode, KeyboardHook.ModifierKeys modifierKeys) + { + return GetCommand(new ShortcutKey(keyCode, modifierKeys)); + } + + public object Clone() + { + List newMappings = new List(); + newMappings.AddRange(Mappings); + return new KeyboardShortcutMap(newMappings); + } + + private static ShortcutKey[] ParseConfigString(string shortcutKeysString) + { + List shortcutKeys = new List(); + foreach (string shortcutKeyString in shortcutKeysString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + try + { + shortcutKeys.Add(ShortcutKey.FromConfigString(shortcutKeyString.Trim())); + } + catch (Exception ex) + { + Runtime.MessageCollector.AddExceptionMessage(message: string.Format("KeyboardShortcuts.ParseShortcutKeysString({0}) failed at {1}.", shortcutKeysString, shortcutKeyString), ex: ex, logOnly: true); + continue; + } + } + return shortcutKeys.ToArray(); + } + + private ShortcutCommand GetCommand(ShortcutKey shortcutKey) + { + foreach (ShortcutMapping shortcutMapping in Mappings) + { + if (ShortcutKeysMatch(shortcutMapping.Key, shortcutKey)) + { + return shortcutMapping.Command; + } + } + return ShortcutCommand.None; + } + + private static bool ShortcutKeysMatch(ShortcutKey wanted, ShortcutKey pressed) + { + if (!(wanted.KeyCode == pressed.KeyCode)) + { + return false; + } + return KeyboardHook.ModifierKeysMatch(wanted.ModifierKeys, pressed.ModifierKeys); + } + + private void ClearShortcutKeys(ShortcutCommand command) + { + List mappingsToRemove = new List(); + foreach (ShortcutMapping mapping in Mappings) + { + if (mapping.Command == command) + { + mappingsToRemove.Add(mapping); + } + } + + foreach (ShortcutMapping mapping in mappingsToRemove) + { + Mappings.Remove(mapping); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcuts.cs b/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcuts.cs new file mode 100644 index 00000000..8425728a --- /dev/null +++ b/mRemoteV1/Config/KeyboardShortcuts/KeyboardShortcuts.cs @@ -0,0 +1,118 @@ +using System; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using SharedLibraryNG; + + +namespace mRemoteNG.Config.KeyboardShortcuts +{ + public class KeyboardShortcuts + { + private static KeyboardHook _keyboardHook = new KeyboardHook(); + private static bool _mapLoaded = false; + private static IntPtr _handle = IntPtr.Zero; + + #region Public Properties + private static KeyboardShortcutMap _defaultMap = null; + public static KeyboardShortcutMap DefaultMap + { + get + { + LoadDefaultMap(); + return _defaultMap; + } + } + + private static KeyboardShortcutMap _map; + public static KeyboardShortcutMap Map + { + get + { + Load(); + return _map; + } + set + { + CancelKeyNotifications(); + _map = value; + Save(); + RequestKeyNotifications(_handle); + } + } + #endregion + + #region Public Methods + public static void RequestKeyNotifications(IntPtr handle) + { + // ReSharper disable LocalizableElement + if (handle == IntPtr.Zero) + { + throw (new ArgumentException("The handle cannot be null.", "handle")); + } + if (!(_handle == IntPtr.Zero) && !(_handle == handle)) + { + throw (new ArgumentException("The handle must match the handle that was specified the first time this function was called.", "handle")); + } + // ReSharper restore LocalizableElement + _handle = handle; + foreach (ShortcutMapping shortcutMapping in Map.Mappings) + { + KeyboardHook.RequestKeyNotification(handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false); + } + } + + public static ShortcutCommand CommandFromHookKeyMessage(Message m) + { + KeyboardHook.HookKeyMsgData msgData = (SharedLibraryNG.KeyboardHook.HookKeyMsgData)Marshal.PtrToStructure(m.LParam, typeof(KeyboardHook.HookKeyMsgData)); + return Map.GetCommand(msgData.KeyCode, msgData.ModifierKeys); + } + #endregion + + #region Private Methods + private static void LoadDefaultMap() + { + if (_defaultMap != null) + { + return ; + } + _defaultMap = new KeyboardShortcutMap(); + _defaultMap.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.Properties["KeysPreviousTab"].DefaultValue)); + _defaultMap.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.Properties["KeysNextTab"].DefaultValue)); + } + + private static void Load() + { + if (_mapLoaded) + { + return ; + } + _map = new KeyboardShortcutMap(); + _map.AddFromConfigString(ShortcutCommand.PreviousTab, System.Convert.ToString(My.Settings.Default.KeysPreviousTab)); + _map.AddFromConfigString(ShortcutCommand.NextTab, System.Convert.ToString(My.Settings.Default.KeysNextTab)); + _mapLoaded = true; + } + + private static void Save() + { + if (_map == null) + { + return ; + } + My.Settings.Default.KeysPreviousTab = _map.GetConfigString(ShortcutCommand.PreviousTab); + My.Settings.Default.KeysNextTab = _map.GetConfigString(ShortcutCommand.NextTab); + } + + private static void CancelKeyNotifications() + { + if (_handle == IntPtr.Zero) + { + return ; + } + foreach (ShortcutMapping shortcutMapping in Map.Mappings) + { + KeyboardHook.CancelKeyNotification(_handle, shortcutMapping.Key.KeyCode, shortcutMapping.Key.ModifierKeys, false); + } + } + #endregion + } +} diff --git a/mRemoteV1/Config/KeyboardShortcuts/ShortcutCommandEnum.cs b/mRemoteV1/Config/KeyboardShortcuts/ShortcutCommandEnum.cs new file mode 100644 index 00000000..4925d919 --- /dev/null +++ b/mRemoteV1/Config/KeyboardShortcuts/ShortcutCommandEnum.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.Config.KeyboardShortcuts +{ + public enum ShortcutCommand + { + None = 0, + PreviousTab, + NextTab + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/KeyboardShortcuts/ShortcutKey.cs b/mRemoteV1/Config/KeyboardShortcuts/ShortcutKey.cs new file mode 100644 index 00000000..42df5a21 --- /dev/null +++ b/mRemoteV1/Config/KeyboardShortcuts/ShortcutKey.cs @@ -0,0 +1,132 @@ +using SharedLibraryNG; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; +using System.Windows.Forms; + +namespace mRemoteNG.Config.KeyboardShortcuts +{ + [ImmutableObject(true)] + public class ShortcutKey : IEquatable + { + #region Public Properties + private int _keyCode; + public int KeyCode + { + get + { + return _keyCode; + } + } + + private KeyboardHook.ModifierKeys _modifierKeys; + public KeyboardHook.ModifierKeys ModifierKeys + { + get + { + return _modifierKeys; + } + } + #endregion + + #region Constructors + public ShortcutKey(int keyCode, KeyboardHook.ModifierKeys modifierKeys) + { + _keyCode = keyCode; + _modifierKeys = modifierKeys; + } + + public ShortcutKey(Keys keysValue) + { + _keyCode = (int)(keysValue & Keys.KeyCode); + if (!((keysValue & Keys.Shift) == 0)) + { + _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Shift; + } + if (!((keysValue & Keys.Control) == 0)) + { + _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Control; + } + if (!((keysValue & Keys.Alt) == 0)) + { + _modifierKeys = _modifierKeys | KeyboardHook.ModifierKeys.Alt; + } + } + #endregion + + #region Public Methods + public string ToConfigString() + { + return string.Join("/", new string[] { KeyCode.ToString(), (Convert.ToInt32(ModifierKeys)).ToString() }); + } + + public static ShortcutKey FromConfigString(string shortcutKeyString) + { + string[] parts = shortcutKeyString.Split(new char[] { '/' }, 2); + if (!(parts.Length == 2)) + { + throw (new ArgumentException(string.Format("ShortcutKey.FromString({0}) failed. parts.Length != 2", shortcutKeyString), shortcutKeyString)); + } + return new ShortcutKey(Convert.ToInt32(parts[0]), (SharedLibraryNG.KeyboardHook.ModifierKeys)Convert.ToInt32(parts[1])); + } + + public override string ToString() + { + return HotkeyControl.KeysToString((System.Windows.Forms.Keys)this.KeyCode); + } + + public bool Equals(ShortcutKey other) + { + try + { + if (KeyCode != other.KeyCode) + return false; + if (ModifierKeys != other.ModifierKeys) + return false; + } + catch (NullReferenceException e) + { + return false; + } + return true; + } + #endregion + + #region Operators + public static bool operator ==(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2) + { + return shortcutKey1.Equals(shortcutKey2); + } + + public static bool operator !=(ShortcutKey shortcutKey1, ShortcutKey shortcutKey2) + { + return !shortcutKey1.Equals(shortcutKey2); + } + + // This is a narrowing conversion because (Keys Or Keys.Modifiers) cannot hold all possible values of KeyboardHook.ModifierKeys + public static explicit operator Keys(ShortcutKey shortcutKey) + { + Keys keysValue = System.Windows.Forms.Keys.A; + if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Shift) == 0)) + { + keysValue = (Keys)(keysValue | Keys.Shift); + } + if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Control) == 0)) + { + keysValue = (Keys)(keysValue | Keys.Control); + } + if (!((shortcutKey.ModifierKeys & KeyboardHook.ModifierKeys.Alt) == 0)) + { + keysValue = (Keys)(keysValue | Keys.Alt); + } + return keysValue; + } + + public static implicit operator ShortcutKey(Keys keys) + { + return new ShortcutKey(keys); + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/KeyboardShortcuts/ShortcutMapping.cs b/mRemoteV1/Config/KeyboardShortcuts/ShortcutMapping.cs new file mode 100644 index 00000000..6713368a --- /dev/null +++ b/mRemoteV1/Config/KeyboardShortcuts/ShortcutMapping.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace mRemoteNG.Config.KeyboardShortcuts +{ + [ImmutableObject(true)] + public class ShortcutMapping : IEquatable + { + private ShortcutCommand _command; + private ShortcutKey _key; + + public ShortcutCommand Command + { + get { return _command; } + } + + public ShortcutKey Key + { + get { return _key; } + } + + + public ShortcutMapping(ShortcutCommand command, ShortcutKey key) + { + _command = command; + _key = key; + } + + + public bool Equals(ShortcutMapping other) + { + if (!(Command == other.Command)) + { + return false; + } + if (!(Key == other.Key)) + { + return false; + } + return true; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Putty/Config.Putty.Provider.cs b/mRemoteV1/Config/Putty/Config.Putty.Provider.cs index 404ba4e2..73c0b1a7 100644 --- a/mRemoteV1/Config/Putty/Config.Putty.Provider.cs +++ b/mRemoteV1/Config/Putty/Config.Putty.Provider.cs @@ -9,6 +9,9 @@ using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; using mRemoteNG.My; +using mRemoteNG.Tree; +using mRemoteNG.Images; +using mRemoteNG.Connection; namespace mRemoteNG.Config.Putty @@ -43,12 +46,12 @@ namespace mRemoteNG.Config.Putty } public abstract string[] GetSessionNames(bool raw = false); - public abstract Connection.PuttySession.Info GetSession(string sessionName); + public abstract PuttySessionInfo GetSession(string sessionName); - public virtual Connection.PuttySession.Info[] GetSessions() + public virtual PuttySessionInfo[] GetSessions() { - List sessionList = new List(); - Connection.PuttySession.Info sessionInfo = (Connection.PuttySession.Info)default(Connection.ConnectionRecordImp); + List sessionList = new List(); + PuttySessionInfo sessionInfo = (PuttySessionInfo)default(ConnectionInfo); foreach (string sessionName in GetSessionNames(true)) { sessionInfo = GetSession(sessionName); @@ -99,7 +102,7 @@ namespace mRemoteNG.Config.Putty private delegate TreeNode CreateRootTreeNodeDelegate(); protected virtual TreeNode CreateRootTreeNode() { - TreeView treeView = Tree.Node.TreeView; + TreeView treeView = ConnectionTree.TreeView; if (treeView == null) { return null; @@ -115,8 +118,8 @@ namespace mRemoteNG.Config.Putty newTreeNode.Name = _rootInfo.Name; newTreeNode.Text = _rootInfo.Name; newTreeNode.Tag = _rootInfo; - newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.PuttySessions; - newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.PuttySessions; + newTreeNode.ImageIndex = (int)TreeImageType.PuttySessions; + newTreeNode.SelectedImageIndex = (int)TreeImageType.PuttySessions; return newTreeNode; } @@ -125,22 +128,22 @@ namespace mRemoteNG.Config.Putty { Root.PuttySessions.Info newRootInfo = new Root.PuttySessions.Info(); - if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName))) + if (string.IsNullOrEmpty(Convert.ToString(My.Settings.Default.PuttySavedSessionsName))) { newRootInfo.Name = Language.strPuttySavedSessionsRootName; } else { - newRootInfo.Name = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsName); + newRootInfo.Name = Convert.ToString(My.Settings.Default.PuttySavedSessionsName); } - if (string.IsNullOrEmpty(System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel))) + if (string.IsNullOrEmpty(Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel))) { newRootInfo.Panel = Language.strGeneral; } else { - newRootInfo.Panel = System.Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel); + newRootInfo.Panel = Convert.ToString(My.Settings.Default.PuttySavedSessionsPanel); } return newRootInfo; @@ -153,4 +156,4 @@ namespace mRemoteNG.Config.Putty } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Putty/Config.Putty.RegistryProvider.cs b/mRemoteV1/Config/Putty/Config.Putty.RegistryProvider.cs index 1aae912d..d29e8d39 100644 --- a/mRemoteV1/Config/Putty/Config.Putty.RegistryProvider.cs +++ b/mRemoteV1/Config/Putty/Config.Putty.RegistryProvider.cs @@ -1,18 +1,11 @@ -using System.Collections.Generic; -using System; -using AxWFICALib; -using System.Drawing; -using System.Diagnostics; -using System.Data; -using AxMSTSCLib; -using Microsoft.VisualBasic; -using System.Collections; -using System.Windows.Forms; -using System.Management; -using mRemoteNG.App; -using mRemoteNG.Messages; using Microsoft.Win32; +using mRemoteNG.App; +using mRemoteNG.Connection; using mRemoteNG.Connection.Protocol; +using mRemoteNG.Messages; +using System; +using System.Collections.Generic; +using System.Management; using System.Security.Principal; @@ -20,6 +13,11 @@ namespace mRemoteNG.Config.Putty { public class RegistryProvider : Provider { + #region Private Fields + private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions"; + private static ManagementEventWatcher _eventWatcher; + #endregion + #region Public Methods public override string[] GetSessionNames(bool raw = false) { @@ -60,7 +58,7 @@ namespace mRemoteNG.Config.Putty return sessionNames.ToArray(); } - public override Connection.PuttySession.Info GetSession(string sessionName) + public override PuttySessionInfo GetSession(string sessionName) { RegistryKey sessionsKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey); if (sessionsKey == null) @@ -76,7 +74,7 @@ namespace mRemoteNG.Config.Putty sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B")); - Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info(); + PuttySessionInfo sessionInfo = new PuttySessionInfo(); sessionInfo.PuttySession = sessionName; sessionInfo.Name = sessionName; sessionInfo.Hostname = System.Convert.ToString(sessionKey.GetValue("HostName")); @@ -89,10 +87,10 @@ namespace mRemoteNG.Config.Putty switch (protocol.ToLowerInvariant()) { case "raw": - sessionInfo.Protocol = Protocols.RAW; + sessionInfo.Protocol = ProtocolType.RAW; break; case "rlogin": - sessionInfo.Protocol = Protocols.Rlogin; + sessionInfo.Protocol = ProtocolType.Rlogin; break; case "serial": return null; @@ -103,20 +101,20 @@ namespace mRemoteNG.Config.Putty int sshVersion = System.Convert.ToInt32(sshVersionObject); if (sshVersion >= 2) { - sessionInfo.Protocol = Protocols.SSH2; + sessionInfo.Protocol = ProtocolType.SSH2; } else { - sessionInfo.Protocol = Protocols.SSH1; + sessionInfo.Protocol = ProtocolType.SSH1; } } else { - sessionInfo.Protocol = Protocols.SSH2; + sessionInfo.Protocol = ProtocolType.SSH2; } break; case "telnet": - sessionInfo.Protocol = Protocols.Telnet; + sessionInfo.Protocol = ProtocolType.Telnet; break; default: return null; @@ -136,7 +134,7 @@ namespace mRemoteNG.Config.Putty try { string currentUserSid = WindowsIdentity.GetCurrent().User.Value; - string key = System.Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\")); + string key = Convert.ToString(string.Join("\\", new[] {currentUserSid, PuttySessionsKey}).Replace("\\", "\\\\")); WqlEventQuery query = new WqlEventQuery(string.Format("SELECT * FROM RegistryTreeChangeEvent WHERE Hive = \'HKEY_USERS\' AND RootPath = \'{0}\'", key)); _eventWatcher = new ManagementEventWatcher(query); _eventWatcher.EventArrived += OnManagementEventArrived; @@ -159,12 +157,7 @@ namespace mRemoteNG.Config.Putty _eventWatcher = null; } #endregion - - #region Private Fields - private const string PuttySessionsKey = "Software\\SimonTatham\\PuTTY\\Sessions"; - private static ManagementEventWatcher _eventWatcher; - #endregion - + #region Private Methods private void OnManagementEventArrived(object sender, EventArrivedEventArgs e) { diff --git a/mRemoteV1/Config/Putty/Config.Putty.Sessions.cs b/mRemoteV1/Config/Putty/Config.Putty.Sessions.cs index 75f73b4e..b0995c52 100644 --- a/mRemoteV1/Config/Putty/Config.Putty.Sessions.cs +++ b/mRemoteV1/Config/Putty/Config.Putty.Sessions.cs @@ -1,15 +1,10 @@ -using System.Collections.Generic; -using System; -using AxWFICALib; -using System.Drawing; -using System.Diagnostics; -using System.Data; -using AxMSTSCLib; -using Microsoft.VisualBasic; -using System.Collections; -using System.Windows.Forms; -using System.ComponentModel; +using mRemoteNG.Connection; +using mRemoteNG.Images; using mRemoteNG.Tools; +using mRemoteNG.Tree; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; namespace mRemoteNG.Config.Putty @@ -20,7 +15,7 @@ namespace mRemoteNG.Config.Putty private delegate void AddSessionsToTreeDelegate(); public static void AddSessionsToTree() { - TreeView treeView = Tree.Node.TreeView; + TreeView treeView = ConnectionTree.TreeView; if (treeView == null) { return ; @@ -36,7 +31,7 @@ namespace mRemoteNG.Config.Putty TreeNode rootTreeNode = provider.RootTreeNode; bool inUpdate = false; - List savedSessions = new List(provider.GetSessions()); + List savedSessions = new List(provider.GetSessions()); if (!IsProviderEnabled(provider) || savedSessions == null || savedSessions.Count == 0) { if (rootTreeNode != null && treeView.Nodes.Contains(rootTreeNode)) @@ -59,7 +54,7 @@ namespace mRemoteNG.Config.Putty } List newTreeNodes = new List(); - foreach (Connection.PuttySession.Info sessionInfo in savedSessions) + foreach (PuttySessionInfo sessionInfo in savedSessions) { TreeNode treeNode = default(TreeNode); bool isNewNode = false; @@ -70,14 +65,14 @@ namespace mRemoteNG.Config.Putty } else { - treeNode = Tree.Node.AddNode(Tree.Node.Type.PuttySession, sessionInfo.Name); + treeNode = Tree.Node.AddNode(TreeNodeType.PuttySession, sessionInfo.Name); if (treeNode == null) { continue; } treeNode.Name = treeNode.Text; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; isNewNode = true; } @@ -95,7 +90,7 @@ namespace mRemoteNG.Config.Putty foreach (TreeNode treeNode in rootTreeNode.Nodes) { - if (!savedSessions.Contains((Connection.ConnectionRecordImp)treeNode.Tag)) + if (!savedSessions.Contains((ConnectionInfo)treeNode.Tag)) { if (!inUpdate) { @@ -118,7 +113,7 @@ namespace mRemoteNG.Config.Putty if (inUpdate) { - Tree.Node.Sort(rootTreeNode, SortOrder.Ascending); + ConnectionTree.Sort(rootTreeNode, SortOrder.Ascending); rootTreeNode.Expand(); treeView.EndUpdate(); } diff --git a/mRemoteV1/Config/Putty/Config.Putty.XmingProvider.cs b/mRemoteV1/Config/Putty/Config.Putty.XmingProvider.cs index a0b2ac15..eb5fa39c 100644 --- a/mRemoteV1/Config/Putty/Config.Putty.XmingProvider.cs +++ b/mRemoteV1/Config/Putty/Config.Putty.XmingProvider.cs @@ -1,17 +1,10 @@ -using System.Collections.Generic; -using System; -using AxWFICALib; -using System.Drawing; -using System.Diagnostics; -using System.Data; -using AxMSTSCLib; -using Microsoft.VisualBasic; -using System.Collections; -using System.Windows.Forms; -using System.IO; using mRemoteNG.App; -using mRemoteNG.Messages; +using mRemoteNG.Connection; using mRemoteNG.Connection.Protocol; +using mRemoteNG.Messages; +using System; +using System.Collections.Generic; +using System.IO; using System.Text.RegularExpressions; @@ -19,6 +12,13 @@ namespace mRemoteNG.Config.Putty { public class XmingProvider : Provider { + #region Private Fields + private const string RegistrySessionNameFormat = "{0} [registry]"; + private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]"; + private static readonly RegistryProvider RegistryProvider = new RegistryProvider(); + private static FileSystemWatcher _eventWatcher; + #endregion + #region Public Methods public override string[] GetSessionNames(bool raw = false) { @@ -27,8 +27,8 @@ namespace mRemoteNG.Config.Putty { return new string[] {}; } - - List sessionNames = new List(); + + List sessionNames = new List(); foreach (string sessionName in Directory.GetFiles(sessionsFolderPath)) { string _sessionFileName = Path.GetFileName(sessionName); @@ -56,8 +56,8 @@ namespace mRemoteNG.Config.Putty sessionNames.Insert(0, "Default Settings"); } } - - List registrySessionNames = new List(); + + List registrySessionNames = new List(); foreach (string sessionName in RegistryProvider.GetSessionNames(raw)) { registrySessionNames.Add(string.Format(RegistrySessionNameFormat, sessionName)); @@ -69,7 +69,7 @@ namespace mRemoteNG.Config.Putty return sessionNames.ToArray(); } - public override Connection.PuttySession.Info GetSession(string sessionName) + public override PuttySessionInfo GetSession(string sessionName) { string registrySessionName = GetRegistrySessionName(sessionName); if (!string.IsNullOrEmpty(registrySessionName)) @@ -92,7 +92,7 @@ namespace mRemoteNG.Config.Putty sessionName = System.Web.HttpUtility.UrlDecode(sessionName.Replace("+", "%2B")); SessionFileReader sessionFileReader = new SessionFileReader(sessionFile); - Connection.PuttySession.Info sessionInfo = new Connection.PuttySession.Info(); + PuttySessionInfo sessionInfo = new PuttySessionInfo(); sessionInfo.PuttySession = sessionName; sessionInfo.Name = sessionName; sessionInfo.Hostname = sessionFileReader.GetValue("HostName"); @@ -105,10 +105,10 @@ namespace mRemoteNG.Config.Putty switch (protocol.ToLowerInvariant()) { case "raw": - sessionInfo.Protocol = Protocols.RAW; + sessionInfo.Protocol = ProtocolType.RAW; break; case "rlogin": - sessionInfo.Protocol = Protocols.Rlogin; + sessionInfo.Protocol = ProtocolType.Rlogin; break; case "serial": return null; @@ -119,25 +119,25 @@ namespace mRemoteNG.Config.Putty int sshVersion = System.Convert.ToInt32(sshVersionObject); if (sshVersion >= 2) { - sessionInfo.Protocol = Protocols.SSH2; + sessionInfo.Protocol = ProtocolType.SSH2; } else { - sessionInfo.Protocol = Protocols.SSH1; + sessionInfo.Protocol = ProtocolType.SSH1; } } else { - sessionInfo.Protocol = Protocols.SSH2; + sessionInfo.Protocol = ProtocolType.SSH2; } break; case "telnet": - sessionInfo.Protocol = Protocols.Telnet; + sessionInfo.Protocol = ProtocolType.Telnet; break; default: return null; } - sessionInfo.Port = System.Convert.ToInt32(sessionFileReader.GetValue("PortNumber")); + sessionInfo.Port = Convert.ToInt32(sessionFileReader.GetValue("PortNumber")); return sessionInfo; } @@ -182,26 +182,18 @@ namespace mRemoteNG.Config.Putty _eventWatcher = null; } #endregion - - #region Private Fields - private const string RegistrySessionNameFormat = "{0} [registry]"; - private const string RegistrySessionNamePattern = "(.*)\\ \\[registry\\]"; - - private static readonly RegistryProvider RegistryProvider = new RegistryProvider(); - private static FileSystemWatcher _eventWatcher; - #endregion - + #region Private Methods private static string GetPuttyConfPath() { string puttyPath = ""; if (My.Settings.Default.UseCustomPuttyPath) { - puttyPath = System.Convert.ToString(My.Settings.Default.CustomPuttyPath); + puttyPath = Convert.ToString(My.Settings.Default.CustomPuttyPath); } else { - puttyPath = App.Info.General.PuttyPath; + puttyPath = App.Info.GeneralAppInfo.PuttyPath; } return Path.Combine(Path.GetDirectoryName(puttyPath), "putty.conf"); } @@ -233,7 +225,7 @@ namespace mRemoteNG.Config.Putty return groups[1].Value; } - private static Connection.PuttySession.Info ModifyRegistrySessionInfo(Connection.PuttySession.Info sessionInfo) + private static PuttySessionInfo ModifyRegistrySessionInfo(PuttySessionInfo sessionInfo) { sessionInfo.Name = string.Format(RegistrySessionNameFormat, sessionInfo.Name); sessionInfo.PuttySession = string.Format(RegistrySessionNameFormat, sessionInfo.PuttySession); @@ -386,4 +378,4 @@ namespace mRemoteNG.Config.Putty } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs b/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs new file mode 100644 index 00000000..caf0d287 --- /dev/null +++ b/mRemoteV1/Config/Settings/Providers/ChooseProvider.cs @@ -0,0 +1,9 @@ +namespace mRemoteNG.Config.Settings.Providers +{ + public class ChooseProvider : PortableSettingsProvider + { + #if !PORTABLE + #else + #endif + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Config.Settings.Providers.cs b/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs similarity index 97% rename from mRemoteV1/Config/Config.Settings.Providers.cs rename to mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs index dfb09855..99f1559a 100644 --- a/mRemoteV1/Config/Config.Settings.Providers.cs +++ b/mRemoteV1/Config/Settings/Providers/PortableSettingsProvider.cs @@ -1,27 +1,21 @@ using System; -using System.Windows.Forms; -using System.Configuration; using System.Collections.Specialized; +using System.Configuration; +using System.Windows.Forms; using System.Xml; namespace mRemoteNG.Config.Settings.Providers { - public class ChooseProvider : PortableSettingsProvider - { - #if !PORTABLE - #else - #endif - } - public class PortableSettingsProvider : SettingsProvider { const string SETTINGSROOT = "Settings"; //XML Root Node + public override void Initialize(string name, NameValueCollection col) { base.Initialize(this.ApplicationName, col); } - + public override string ApplicationName { get @@ -41,20 +35,20 @@ namespace mRemoteNG.Config.Settings.Providers //Do nothing } } - + virtual public string GetAppSettingsPath() { //Used to determine where to store the settings System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath); return fi.DirectoryName; } - + virtual public string GetAppSettingsFilename() { //Used to determine the filename to store the settings return "portable.config"; //ApplicationName & ".settings" } - + public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals) { //Iterate through the settings to be stored @@ -73,7 +67,7 @@ namespace mRemoteNG.Config.Settings.Providers //Ignore if cant save, device been ejected } } - + public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props) { //Create new collection of values @@ -90,9 +84,9 @@ namespace mRemoteNG.Config.Settings.Providers } return values; } - + private System.Xml.XmlDocument m_SettingsXML = null; - + private System.Xml.XmlDocument SettingsXML { get @@ -122,7 +116,7 @@ namespace mRemoteNG.Config.Settings.Providers return m_SettingsXML; } } - + private string GetValue(SettingsProperty setting) { string ret = ""; @@ -151,7 +145,7 @@ namespace mRemoteNG.Config.Settings.Providers } return ret; } - + private void SetValue(SettingsPropertyValue propVal) { System.Xml.XmlElement MachineNode = default(System.Xml.XmlElement); @@ -225,7 +219,7 @@ namespace mRemoteNG.Config.Settings.Providers } } } - + private bool IsRoaming(SettingsProperty prop) { //Determine if the setting is marked as Roaming diff --git a/mRemoteV1/Config/Settings/SettingsLoader.cs b/mRemoteV1/Config/Settings/SettingsLoader.cs new file mode 100644 index 00000000..cda8a4fa --- /dev/null +++ b/mRemoteV1/Config/Settings/SettingsLoader.cs @@ -0,0 +1,359 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.IO; +using WeifenLuo.WinFormsUI.Docking; +using mRemoteNG.App; +using System.Xml; +using System.Threading; +using System.Globalization; +using mRemoteNG.Themes; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.App.Info; +using mRemoteNG.UI.Window; + + +namespace mRemoteNG.Config.Settings +{ + public class SettingsLoader + { + private frmMain _MainForm; + + public frmMain MainForm + { + get { return this._MainForm; } + set { this._MainForm = value; } + } + + + public SettingsLoader(frmMain MainForm) + { + this._MainForm = MainForm; + } + + #region Public Methods + public void LoadSettings() + { + try + { + EnsureSettingsAreSavedInNewestVersion(); + + SetSupportedCulture(); + + SetTheme(); + SetApplicationWindowPositionAndSize(); + SetKioskMode(); + + SetPuttyPath(); + SetShowSystemTrayIcon(); + SetAutoSave(); + SetConDefaultPassword(); + LoadPanelsFromXML(); + LoadExternalAppsFromXML(); + SetAlwaysShowPanelTabs(); + + if (My.Settings.Default.ResetToolbars == true) + SetToolbarsDefault(); + else + LoadToolbarsFromSettings(); + } + catch (Exception ex) + { + Runtime.Log.Error("Loading settings failed" + Environment.NewLine + ex.Message); + } + } + + private static void SetConDefaultPassword() + { + My.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(My.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey); + } + + private static void SetAlwaysShowPanelTabs() + { + if (My.Settings.Default.AlwaysShowPanelTabs) + { + frmMain.Default.pnlDock.DocumentStyle = DocumentStyle.DockingWindow; + } + } + + private static void SetTheme() + { + ThemeManager.LoadTheme(My.Settings.Default.ThemeName); + } + + private static void SetSupportedCulture() + { + SupportedCultures.InstantiateSingleton(); + if (!(My.Settings.Default.OverrideUICulture == "") && SupportedCultures.IsNameSupported(My.Settings.Default.OverrideUICulture)) + { + Thread.CurrentThread.CurrentUICulture = new CultureInfo(My.Settings.Default.OverrideUICulture); + Runtime.Log.InfoFormat("Override Culture: {0}/{1}", Thread.CurrentThread.CurrentUICulture.Name, Thread.CurrentThread.CurrentUICulture.NativeName); + } + } + + private void SetApplicationWindowPositionAndSize() + { + _MainForm.WindowState = FormWindowState.Normal; + if (My.Settings.Default.MainFormState == FormWindowState.Normal) + { + if (!My.Settings.Default.MainFormLocation.IsEmpty) + _MainForm.Location = My.Settings.Default.MainFormLocation; + if (!My.Settings.Default.MainFormSize.IsEmpty) + _MainForm.Size = My.Settings.Default.MainFormSize; + } + else + { + if (!My.Settings.Default.MainFormRestoreLocation.IsEmpty) + _MainForm.Location = My.Settings.Default.MainFormRestoreLocation; + if (!My.Settings.Default.MainFormRestoreSize.IsEmpty) + _MainForm.Size = My.Settings.Default.MainFormRestoreSize; + } + + if (My.Settings.Default.MainFormState == FormWindowState.Maximized) + { + _MainForm.WindowState = FormWindowState.Maximized; + } + + // Make sure the form is visible on the screen + const int minHorizontal = 300; + const int minVertical = 150; + Rectangle screenBounds = Screen.FromHandle(_MainForm.Handle).Bounds; + Rectangle newBounds = _MainForm.Bounds; + + if (newBounds.Right < screenBounds.Left + minHorizontal) + newBounds.X = screenBounds.Left + minHorizontal - newBounds.Width; + if (newBounds.Left > screenBounds.Right - minHorizontal) + newBounds.X = screenBounds.Right - minHorizontal; + if (newBounds.Bottom < screenBounds.Top + minVertical) + newBounds.Y = screenBounds.Top + minVertical - newBounds.Height; + if (newBounds.Top > screenBounds.Bottom - minVertical) + newBounds.Y = screenBounds.Bottom - minVertical; + + this._MainForm.Location = newBounds.Location; + } + + private void SetAutoSave() + { + if (My.Settings.Default.AutoSaveEveryMinutes > 0) + { + this._MainForm.tmrAutoSave.Interval = Convert.ToInt32(My.Settings.Default.AutoSaveEveryMinutes * 60000); + this._MainForm.tmrAutoSave.Enabled = true; + } + } + + private void SetKioskMode() + { + if (My.Settings.Default.MainFormKiosk == true) + { + _MainForm.Fullscreen.Value = true; + _MainForm.mMenViewFullscreen.Checked = true; + } + } + + private static void SetShowSystemTrayIcon() + { + if (My.Settings.Default.ShowSystemTrayIcon) + Runtime.NotificationAreaIcon = new Tools.Controls.NotificationAreaIcon(); + } + + private static void SetPuttyPath() + { + if (My.Settings.Default.UseCustomPuttyPath) + PuttyBase.PuttyPath = Convert.ToString(My.Settings.Default.CustomPuttyPath); + else + PuttyBase.PuttyPath = GeneralAppInfo.PuttyPath; + } + + private static void EnsureSettingsAreSavedInNewestVersion() + { + if (My.Settings.Default.DoUpgrade) + UpgradeSettingsVersion(); + } + private static void UpgradeSettingsVersion() + { + try + { + My.Settings.Default.Upgrade(); + } + catch (Exception ex) + { + Runtime.Log.Error("My.Settings.Upgrade() failed" + Environment.NewLine + ex.Message); + } + My.Settings.Default.DoUpgrade = false; + + // Clear pending update flag + // This is used for automatic updates, not for settings migration, but it + // needs to be cleared here because we know that we just updated. + My.Settings.Default.UpdatePending = false; + } + + public void SetToolbarsDefault() + { + ToolStripPanelFromString("top").Join(MainForm.tsQuickConnect, new Point(300, 0)); + MainForm.tsQuickConnect.Visible = true; + ToolStripPanelFromString("bottom").Join(MainForm.tsExternalTools, new Point(3, 0)); + MainForm.tsExternalTools.Visible = false; + } + + public void LoadToolbarsFromSettings() + { + if (My.Settings.Default.QuickyTBLocation.X > My.Settings.Default.ExtAppsTBLocation.X) + { + AddDynamicPanels(); + AddStaticPanels(); + } + else + { + AddStaticPanels(); + AddDynamicPanels(); + } + } + + private void AddStaticPanels() + { + ToolStripPanelFromString(Convert.ToString(My.Settings.Default.QuickyTBParentDock)).Join(MainForm.tsQuickConnect, My.Settings.Default.QuickyTBLocation); + MainForm.tsQuickConnect.Visible = Convert.ToBoolean(My.Settings.Default.QuickyTBVisible); + } + + private void AddDynamicPanels() + { + ToolStripPanelFromString(Convert.ToString(My.Settings.Default.ExtAppsTBParentDock)).Join(MainForm.tsExternalTools, My.Settings.Default.ExtAppsTBLocation); + MainForm.tsExternalTools.Visible = Convert.ToBoolean(My.Settings.Default.ExtAppsTBVisible); + } + + private ToolStripPanel ToolStripPanelFromString(string Panel) + { + switch (Panel.ToLower()) + { + case "top": + return MainForm.tsContainer.TopToolStripPanel; + case "bottom": + return MainForm.tsContainer.BottomToolStripPanel; + case "left": + return MainForm.tsContainer.LeftToolStripPanel; + case "right": + return MainForm.tsContainer.RightToolStripPanel; + default: + return MainForm.tsContainer.TopToolStripPanel; + } + } + + public void LoadPanelsFromXML() + { + try + { + Windows.treePanel = null; + Windows.configPanel = null; + Windows.errorsPanel = null; + + while (MainForm.pnlDock.Contents.Count > 0) + { + WeifenLuo.WinFormsUI.Docking.DockContent dc = (WeifenLuo.WinFormsUI.Docking.DockContent)MainForm.pnlDock.Contents[0]; + dc.Close(); + } + + Startup.CreatePanels(); + + string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.SettingsFileInfo.LayoutFileName; + string newPath = App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.LayoutFileName; + if (File.Exists(newPath)) + { + MainForm.pnlDock.LoadFromXml(newPath, GetContentFromPersistString); + #if !PORTABLE + } + else if (File.Exists(oldPath)) + { + MainForm.pnlDock.LoadFromXml(oldPath, GetContentFromPersistString); + #endif + } + else + { + Startup.SetDefaultLayout(); + } + } + catch (Exception ex) + { + Runtime.Log.Error("LoadPanelsFromXML failed" + Environment.NewLine + ex.Message); + } + } + + public void LoadExternalAppsFromXML() + { + string oldPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "\\" + (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName; + string newPath = App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName; + XmlDocument xDom = new XmlDocument(); + if (File.Exists(newPath)) + { + xDom.Load(newPath); + #if !PORTABLE + } + else if (File.Exists(oldPath)) + { + xDom.Load(oldPath); + #endif + } + else + { + return; + } + + foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes) + { + Tools.ExternalTool extA = new Tools.ExternalTool(); + extA.DisplayName = xEl.Attributes["DisplayName"].Value; + extA.FileName = xEl.Attributes["FileName"].Value; + extA.Arguments = xEl.Attributes["Arguments"].Value; + + if (xEl.HasAttribute("WaitForExit")) + { + extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value); + } + + if (xEl.HasAttribute("TryToIntegrate")) + { + extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value); + } + + Runtime.ExternalTools.Add(extA); + } + + MainForm.SwitchToolBarText(System.Convert.ToBoolean(My.Settings.Default.ExtAppsTBShowText)); + + xDom = null; + + frmMain.Default.AddExternalToolsToToolBar(); + } + #endregion + + private IDockContent GetContentFromPersistString(string persistString) + { + // pnlLayout.xml persistence XML fix for refactoring to mRemoteNG + if (persistString.StartsWith("mRemote.")) + persistString = persistString.Replace("mRemote.", "mRemoteNG."); + + try + { + if (persistString == typeof(ConfigWindow).ToString()) + return Windows.configPanel; + + if (persistString == typeof(ConnectionTreeWindow).ToString()) + return Windows.treePanel; + + if (persistString == typeof(ErrorAndInfoWindow).ToString()) + return Windows.errorsPanel; + + if (persistString == typeof(SessionsWindow).ToString()) + return Windows.sessionsPanel; + + if (persistString == typeof(ScreenshotManagerWindow).ToString()) + return Windows.screenshotPanel; + } + catch (Exception ex) + { + Runtime.Log.Error("GetContentFromPersistString failed" + Environment.NewLine + ex.Message); + } + + return null; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/Config.Settings.Save.cs b/mRemoteV1/Config/Settings/SettingsSaver.cs similarity index 86% rename from mRemoteV1/Config/Config.Settings.Save.cs rename to mRemoteV1/Config/Settings/SettingsSaver.cs index 30bf5f59..9e896579 100644 --- a/mRemoteV1/Config/Config.Settings.Save.cs +++ b/mRemoteV1/Config/Settings/SettingsSaver.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.VisualBasic; using System.Windows.Forms; using mRemoteNG.App; using System.Xml; @@ -8,9 +7,8 @@ using System.IO; namespace mRemoteNG.Config.Settings { - public class Save + public class SettingsSaver { - #region Public Methods public static void SaveSettings() { try @@ -56,7 +54,7 @@ namespace mRemoteNG.Config.Settings } My.Settings.Default.QuickyTBVisible = with_1.tsQuickConnect.Visible; - My.Settings.Default.ConDefaultPassword = Security.Crypt.Encrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.General.EncryptionKey); + My.Settings.Default.ConDefaultPassword = Security.Crypt.Encrypt(System.Convert.ToString(My.Settings.Default.ConDefaultPassword), App.Info.GeneralAppInfo.EncryptionKey); My.Settings.Default.Save(); @@ -73,12 +71,12 @@ namespace mRemoteNG.Config.Settings { try { - if (Directory.Exists(App.Info.Settings.SettingsPath) == false) + if (Directory.Exists(App.Info.SettingsFileInfo.SettingsPath) == false) { - Directory.CreateDirectory(App.Info.Settings.SettingsPath); + Directory.CreateDirectory(App.Info.SettingsFileInfo.SettingsPath); } - frmMain.Default.pnlDock.SaveAsXml(App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.LayoutFileName); + frmMain.Default.pnlDock.SaveAsXml(App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.LayoutFileName); } catch (Exception ex) { @@ -90,12 +88,12 @@ namespace mRemoteNG.Config.Settings { try { - if (Directory.Exists(App.Info.Settings.SettingsPath) == false) + if (Directory.Exists(App.Info.SettingsFileInfo.SettingsPath) == false) { - Directory.CreateDirectory(App.Info.Settings.SettingsPath); + Directory.CreateDirectory(App.Info.SettingsFileInfo.SettingsPath); } - XmlTextWriter xmlTextWriter = new XmlTextWriter(App.Info.Settings.SettingsPath + "\\" + App.Info.Settings.ExtAppsFilesName, System.Text.Encoding.UTF8); + XmlTextWriter xmlTextWriter = new XmlTextWriter(App.Info.SettingsFileInfo.SettingsPath + "\\" + App.Info.SettingsFileInfo.ExtAppsFilesName, System.Text.Encoding.UTF8); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.Indentation = 4; @@ -123,6 +121,5 @@ namespace mRemoteNG.Config.Settings Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveExternalAppsToXML failed" + Environment.NewLine + Environment.NewLine + ex.Message, false); } } - #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Config/SqlConnector.cs b/mRemoteV1/Config/SqlConnector.cs new file mode 100644 index 00000000..4ec8faaf --- /dev/null +++ b/mRemoteV1/Config/SqlConnector.cs @@ -0,0 +1,11 @@ +using System; +using System.Data.SqlClient; +namespace mRemoteNG.Config +{ + public interface SqlConnector : IDisposable + { + void Connect(); + void Disconnect(); + void AssociateItemToThisConnector(SqlCommand sqlCommand); + } +} \ No newline at end of file diff --git a/mRemoteV1/Config/SqlConnectorImp.cs b/mRemoteV1/Config/SqlConnectorImp.cs new file mode 100644 index 00000000..ebf84eaa --- /dev/null +++ b/mRemoteV1/Config/SqlConnectorImp.cs @@ -0,0 +1,89 @@ +using mRemoteNG.App.Info; +using System; +using System.Data.SqlClient; + +namespace mRemoteNG.Config +{ + public class SqlConnectorImp : IDisposable, mRemoteNG.Config.SqlConnector + { + private SqlConnection _sqlConnection = default(SqlConnection); + private string _sqlConnectionString = ""; + private string _sqlHost; + private string _sqlCatalog; + private string _sqlUsername; + private string _sqlPassword; + + public SqlConnectorImp() + { + Initialize(); + } + + ~SqlConnectorImp() + { + Dispose(false); + } + + private void Initialize() + { + BuildSqlConnectionString(); + _sqlConnection = new SqlConnection(_sqlConnectionString); + } + + private void BuildSqlConnectionString() + { + GetSqlConnectionDataFromSettings(); + + if (My.Settings.Default.SQLUser != "") + BuildSqlConnectionStringWithCustomCredentials(); + else + BuildSqlConnectionStringWithDefaultCredentials(); + } + + private void BuildSqlConnectionStringWithCustomCredentials() + { + _sqlConnectionString = string.Format("Data Source={0};Initial Catalog={1};User Id={2};Password={3}", _sqlHost, _sqlCatalog, _sqlUsername, _sqlPassword); + } + + private void BuildSqlConnectionStringWithDefaultCredentials() + { + _sqlConnectionString = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", _sqlHost, _sqlCatalog); + } + + private void GetSqlConnectionDataFromSettings() + { + _sqlHost = My.Settings.Default.SQLHost; + _sqlCatalog = My.Settings.Default.SQLDatabaseName; + _sqlUsername = My.Settings.Default.SQLUser; + _sqlPassword = Security.Crypt.Decrypt(My.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey); + } + + public void Connect() + { + _sqlConnection.Open(); + } + + public void Disconnect() + { + _sqlConnection.Close(); + } + + public void AssociateItemToThisConnector(SqlCommand sqlCommand) + { + sqlCommand.Connection = _sqlConnection; + } + + + public void Dispose() + { + Dispose(true); + } + private void Dispose(bool itIsSafeToFreeManagedObjects) + { + if (itIsSafeToFreeManagedObjects) + { + _sqlConnection.Close(); + _sqlConnection.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Connection.Icon.cs b/mRemoteV1/Connection/ConnectionIcon.cs similarity index 94% rename from mRemoteV1/Connection/Connection.Icon.cs rename to mRemoteV1/Connection/ConnectionIcon.cs index aed9e0ec..010b2a16 100644 --- a/mRemoteV1/Connection/Connection.Icon.cs +++ b/mRemoteV1/Connection/ConnectionIcon.cs @@ -6,35 +6,34 @@ using mRemoteNG.App; namespace mRemoteNG.Connection { - public class Icon : StringConverter + public class ConnectionIcon : StringConverter { public static string[] Icons = new string[] {}; - + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { return new StandardValuesCollection(Icons); } - + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { return true; } - + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } - + public static System.Drawing.Icon FromString(string IconName) { try { string IconPath = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\Icons\\" + IconName +".ico"; - + if (System.IO.File.Exists(IconPath)) { System.Drawing.Icon nI = new System.Drawing.Icon(IconPath); - return nI; } } @@ -42,7 +41,6 @@ namespace mRemoteNG.Connection { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t get Icon from String" + Environment.NewLine + ex.Message); } - return null; } } diff --git a/mRemoteV1/Connection/ConnectionRecordImp.cs b/mRemoteV1/Connection/ConnectionInfo.cs similarity index 67% rename from mRemoteV1/Connection/ConnectionRecordImp.cs rename to mRemoteV1/Connection/ConnectionInfo.cs index 12ba0e99..9aa37166 100644 --- a/mRemoteV1/Connection/ConnectionRecordImp.cs +++ b/mRemoteV1/Connection/ConnectionInfo.cs @@ -1,107 +1,90 @@ -using mRemoteNG.App; -using mRemoteNG.Tools; using System; -using System.ComponentModel; -using System.Reflection; using System.Windows.Forms; -using mRemoteNG.Credential; +using System.ComponentModel; +using mRemoteNG.Tools; +using System.Reflection; +using mRemoteNG.App; +using mRemoteNG.Connection.Protocol.VNC; +using mRemoteNG.Connection.Protocol.SSH; +using mRemoteNG.Connection.Protocol.Http; +using mRemoteNG.Connection.Protocol.RAW; +using mRemoteNG.Connection.Protocol.ICA; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Connection.Protocol.Telnet; +using mRemoteNG.Connection.Protocol.Rlogin; namespace mRemoteNG.Connection { [DefaultProperty("Name")] - public partial class ConnectionRecordImp : ConnectionRecord + public partial class ConnectionInfo { #region Private Properties - ConnectionRecordMetaData _metaData; - CredentialRecord _credential; - ExternalToolRecord _externalTool; - ConnectionProtocol _protocol; - private string _constantId; - - - - - // Meta data - //private Protocol.Protocols _protocol; - private ConnectionRecordInheritanceImp _Inherit; - private Protocol.List _OpenConnections; - - - // Display + // Private properties with public get/set private string _name; private string _description; private string _icon; private string _panel; - - // Connection private string _hostname; - private string _username; // Not used in: VNC, Telnet, Rlogin, RAW - private string _password; // Not used in: Telnet, Rlogin, RAW - private string _domain; // Not used in: VNC, SSH, Telnet, Rlogin, RAW, Http/Https, ExtApp - - // Common to all protocols except ICA + private string _username; + private string _password; + private string _domain; + private Protocol.ProtocolType _protocol; + private string _extApp; private int _port; - - // VNC - private Protocol.VNC.Compression _vncCompression; - private Protocol.VNC.Encoding _vncEncoding; - private Protocol.VNC.AuthMode _vncAuthMode; - private Protocol.VNC.ProxyType _vncProxyType; - private Protocol.VNC.Colors _vncColors; - private Protocol.VNC.SmartSizeMode _vncSmartSizeMode; - private bool _vncViewOnly; + private string _puttySession; + private ProtocolICA.EncryptionStrength _icaEncryption; + private bool _useConsoleSession; + private ProtocolRDP.AuthenticationLevel _rdpAuthenticationLevel; + private string _loadBalanceInfo; + private HTTPBase.RenderingEngine _renderingEngine; + private bool _useCredSsp; + private ProtocolRDP.RDGatewayUsageMethod _rdGatewayUsageMethod; + private string _rdGatewayHostname; + private ProtocolRDP.RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials; + private string _rdGatewayUsername; + private string _rdGatewayPassword; + private string _rdGatewayDomain; + private ProtocolRDP.RDPResolutions _resolution; + private bool _automaticResize; + private ProtocolRDP.RDPColors _colors; + private bool _cacheBitmaps; + private bool _displayWallpaper; + private bool _displayThemes; + private bool _enableFontSmoothing; + private bool _enableDesktopComposition; + private bool _redirectKeys; + private bool _redirectDiskDrives; + private bool _redirectPrinters; + private bool _redirectPorts; + private bool _redirectSmartCards; + private ProtocolRDP.RDPSounds _redirectSound; + private string _preExtApp; + private string _postExtApp; + private string _macAddress; + private string _userField; + private ProtocolVNC.Compression _vncCompression; + private ProtocolVNC.Encoding _vncEncoding; + private ProtocolVNC.AuthMode _vncAuthMode; + private ProtocolVNC.ProxyType _vncProxyType; private string _vncProxyIP; private int _vncProxyPort; private string _vncProxyUsername; private string _vncProxyPassword; - - // SSH, Telnet, Rlogin, RAW - private string _puttySession; - - // Http/Https - private Protocol.HTTPBase.RenderingEngine _renderingEngine; - - // ICA - private Protocol.ICA.EncryptionStrength _icaEncryption; - - // External App - private string _extApp; + private ProtocolVNC.Colors _vncColors; + private ProtocolVNC.SmartSizeMode _vncSmartSizeMode; + private bool _vncViewOnly; + private ConnectionInfoInheritance _Inherit; + private Protocol.ProtocolList _OpenConnections; + private bool _IsContainer; + private bool _IsDefault; + private int _PositionID; + private bool _IsQuickConnect; + private bool _PleaseConnect; + private string _constantId; #endregion #region Public Properties - [Browsable(false)] - public ConnectionRecordMetaData MetaData - { - get - { - return _metaData; - } - } - - [Browsable(false)] - public ConnectionRecordInheritanceController Inherit - { - get { return _Inherit; } - } - - [Browsable(false)] - public CredentialRecord Credential - { - get { return _credential; } - set { _credential = value; } - } - - [Browsable(false)] - public string ConstantID - { - get { return _constantId; } - set { _constantId = value; } - } - - [Browsable(false)] - public ConnectionRecord Parent { get; set; } - #region Display [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"), @@ -122,7 +105,7 @@ namespace mRemoteNG.Connection } [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), - TypeConverter(typeof(Icon)), + TypeConverter(typeof(ConnectionIcon)), LocalizedAttributes.LocalizedDisplayName("strPropertyNameIcon"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionIcon")] public virtual string Icon @@ -150,9 +133,13 @@ namespace mRemoteNG.Connection set { if (string.IsNullOrEmpty(value)) + { _hostname = string.Empty; + } else + { _hostname = value.Trim(); + } } } @@ -188,8 +175,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameProtocol"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionProtocol"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public virtual Protocol.Protocols Protocol + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public virtual Protocol.ProtocolType Protocol { get { return GetInheritedPropertyValue("Protocol", _protocol); } set { _protocol = value; } @@ -227,8 +214,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncryptionStrength"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncryptionStrength"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.ICA.EncryptionStrength ICAEncryption + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolICA.EncryptionStrength ICAEncryption { get { return GetInheritedPropertyValue("ICAEncryption", _icaEncryption); } set { _icaEncryption = value; } @@ -237,7 +224,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseConsoleSession"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseConsoleSession"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool UseConsoleSession { get { return GetInheritedPropertyValue("UseConsoleSession", _useConsoleSession); } @@ -247,8 +234,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationLevel"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationLevel"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.AuthenticationLevel RDPAuthenticationLevel + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.AuthenticationLevel RDPAuthenticationLevel { get { return GetInheritedPropertyValue("RDPAuthenticationLevel", _rdpAuthenticationLevel); } set { _rdpAuthenticationLevel = value; } @@ -266,8 +253,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRenderingEngine"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRenderingEngine"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.HTTPBase.RenderingEngine RenderingEngine + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public HTTPBase.RenderingEngine RenderingEngine { get { return GetInheritedPropertyValue("RenderingEngine", _renderingEngine); } set { _renderingEngine = value; } @@ -276,7 +263,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 3), LocalizedAttributes.LocalizedDisplayName("strPropertyNameUseCredSsp"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUseCredSsp"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool UseCredSsp { get { return GetInheritedPropertyValue("UseCredSsp", _useCredSsp); } @@ -287,8 +274,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUsageMethod"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUsageMethod"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod RDGatewayUsageMethod + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.RDGatewayUsageMethod RDGatewayUsageMethod { get { return GetInheritedPropertyValue("RDGatewayUsageMethod", _rdGatewayUsageMethod); } set { _rdGatewayUsageMethod = value; } @@ -306,8 +293,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 4), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRDGatewayUseConnectionCredentials"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRDGatewayUseConnectionCredentials"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.RDGatewayUseConnectionCredentials RDGatewayUseConnectionCredentials { get { return GetInheritedPropertyValue("RDGatewayUseConnectionCredentials", _rdGatewayUseConnectionCredentials); } set { _rdGatewayUseConnectionCredentials = value; } @@ -345,8 +332,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameResolution"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionResolution"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.RDPResolutions Resolution + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.RDPResolutions Resolution { get { return GetInheritedPropertyValue("Resolution", _resolution); } set { _resolution = value; } @@ -355,7 +342,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameAutomaticResize"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAutomaticResize"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool AutomaticResize { get { return GetInheritedPropertyValue("AutomaticResize", _automaticResize); } @@ -365,8 +352,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.RDPColors Colors + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.RDPColors Colors { get { return GetInheritedPropertyValue("Colors", _colors); } set { _colors = value; } @@ -375,7 +362,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameCacheBitmaps"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCacheBitmaps"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool CacheBitmaps { get { return GetInheritedPropertyValue("CacheBitmaps", _cacheBitmaps); } @@ -385,7 +372,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayWallpaper"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayWallpaper"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool DisplayWallpaper { get { return GetInheritedPropertyValue("DisplayWallpaper", _displayWallpaper); } @@ -395,7 +382,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameDisplayThemes"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDisplayThemes"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool DisplayThemes { get { return GetInheritedPropertyValue("DisplayThemes", _displayThemes); } @@ -405,7 +392,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableFontSmoothing"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableFontSmoothing"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool EnableFontSmoothing { get { return GetInheritedPropertyValue("EnableFontSmoothing", _enableFontSmoothing); } @@ -415,7 +402,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameEnableDesktopComposition"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEnableDesktopComposition"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool EnableDesktopComposition { get { return GetInheritedPropertyValue("EnableDesktopComposition", _enableDesktopComposition); } @@ -426,7 +413,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectKeys"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectKeys"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool RedirectKeys { get { return GetInheritedPropertyValue("RedirectKeys", _redirectKeys); } @@ -436,7 +423,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectDrives"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectDrives"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool RedirectDiskDrives { get { return GetInheritedPropertyValue("RedirectDiskDrives", _redirectDiskDrives); } @@ -446,7 +433,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPrinters"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPrinters"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool RedirectPrinters { get { return GetInheritedPropertyValue("RedirectPrinters", _redirectPrinters); } @@ -456,7 +443,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectPorts"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectPorts"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool RedirectPorts { get { return GetInheritedPropertyValue("RedirectPorts", _redirectPorts); } @@ -466,7 +453,7 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSmartCards"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSmartCards"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool RedirectSmartCards { get { return GetInheritedPropertyValue("RedirectSmartCards", _redirectSmartCards); } @@ -476,20 +463,59 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 6), LocalizedAttributes.LocalizedDisplayName("strPropertyNameRedirectSounds"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionRedirectSounds"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.RDPConnectionProtocolImp.RDPSounds RedirectSound + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolRDP.RDPSounds RedirectSound { get { return GetInheritedPropertyValue("RedirectSound", _redirectSound); } set { _redirectSound = value; } } #endregion + #region Misc + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), + LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"), + LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"), + TypeConverter(typeof(Tools.ExternalToolsTypeConverter))] + public virtual string PreExtApp + { + get { return GetInheritedPropertyValue("PreExtApp", _preExtApp); } + set { _preExtApp = value; } + } + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), + LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"), + LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"), + TypeConverter(typeof(Tools.ExternalToolsTypeConverter))] + public virtual string PostExtApp + { + get { return GetInheritedPropertyValue("PostExtApp", _postExtApp); } + set { _postExtApp = value; } + } + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), + LocalizedAttributes.LocalizedDisplayName("strPropertyNameMACAddress"), + LocalizedAttributes.LocalizedDescription("strPropertyDescriptionMACAddress")] + public virtual string MacAddress + { + get { return GetInheritedPropertyValue("MacAddress", _macAddress); } + set { _macAddress = value; } + } + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), + LocalizedAttributes.LocalizedDisplayName("strPropertyNameUser1"), + LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUser1")] + public virtual string UserField + { + get { return GetInheritedPropertyValue("UserField", _userField); } + set { _userField = value; } + } + #endregion #region VNC [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), Browsable(false), LocalizedAttributes.LocalizedDisplayName("strPropertyNameCompression"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionCompression"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.Compression VNCCompression + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.Compression VNCCompression { get { return GetInheritedPropertyValue("VNCCompression", _vncCompression); } set { _vncCompression = value; } @@ -499,8 +525,8 @@ namespace mRemoteNG.Connection Browsable(false), LocalizedAttributes.LocalizedDisplayName("strPropertyNameEncoding"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionEncoding"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.Encoding VNCEncoding + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.Encoding VNCEncoding { get { return GetInheritedPropertyValue("VNCEncoding", _vncEncoding); } set { _vncEncoding = value; } @@ -510,8 +536,8 @@ namespace mRemoteNG.Connection Browsable(false), LocalizedAttributes.LocalizedDisplayName("strPropertyNameAuthenticationMode"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionAuthenticationMode"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.AuthMode VNCAuthMode + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.AuthMode VNCAuthMode { get { return GetInheritedPropertyValue("VNCAuthMode", _vncAuthMode); } set { _vncAuthMode = value; } @@ -521,8 +547,8 @@ namespace mRemoteNG.Connection Browsable(false), LocalizedAttributes.LocalizedDisplayName("strPropertyNameVNCProxyType"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionVNCProxyType"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.ProxyType VNCProxyType + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.ProxyType VNCProxyType { get { return GetInheritedPropertyValue("VNCProxyType", _vncProxyType); } set { _vncProxyType = value; } @@ -573,8 +599,8 @@ namespace mRemoteNG.Connection Browsable(false), LocalizedAttributes.LocalizedDisplayName("strPropertyNameColors"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionColors"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.Colors VNCColors + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.Colors VNCColors { get { return GetInheritedPropertyValue("VNCColors", _vncColors); } set { _vncColors = value; } @@ -583,8 +609,8 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameSmartSizeMode"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionSmartSizeMode"), - TypeConverter(typeof(Tools.Misc.EnumTypeConverter))] - public Protocol.VNC.SmartSizeMode VNCSmartSizeMode + TypeConverter(typeof(Tools.MiscTools.EnumTypeConverter))] + public ProtocolVNC.SmartSizeMode VNCSmartSizeMode { get { return GetInheritedPropertyValue("VNCSmartSizeMode", _vncSmartSizeMode); } set { _vncSmartSizeMode = value; } @@ -593,71 +619,123 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 5), LocalizedAttributes.LocalizedDisplayName("strPropertyNameViewOnly"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionViewOnly"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool VNCViewOnly { get { return GetInheritedPropertyValue("VNCViewOnly", _vncViewOnly); } set { _vncViewOnly = value; } } #endregion - #region Non-browsable public properties [Browsable(false)] - public Protocol.List OpenConnections + public ConnectionInfoInheritance Inherit + { + get { return _Inherit; } + set { _Inherit = value; } + } + + [Browsable(false)] + public Protocol.ProtocolList OpenConnections { get { return _OpenConnections; } set { _OpenConnections = value; } } - + + [Browsable(false)] + public bool IsContainer + { + get { return _IsContainer; } + set { _IsContainer = value; } + } + + [Browsable(false)] + public bool IsDefault + { + get { return _IsDefault; } + set { _IsDefault = value; } + } + + [Browsable(false)] + public Container.ContainerInfo Parent { get; set; } + + [Browsable(false)] + public int PositionID + { + get { return _PositionID; } + set { _PositionID = value; } + } + + [Browsable(false)] + public string ConstantID + { + get { return _constantId; } + set { _constantId = value; } + } + [Browsable(false)] public TreeNode TreeNode { get; set; } + + [Browsable(false)] + public bool IsQuickConnect + { + get { return _IsQuickConnect; } + set { _IsQuickConnect = value; } + } + + [Browsable(false)] + public bool PleaseConnect + { + get { return _PleaseConnect; } + set { _PleaseConnect = value; } + } #endregion #endregion - + #region Constructors - public ConnectionRecordImp(Protocols protocol) - { - this.ConstantID = Tools.Misc.CreateConstantID(); - _metaData = new ConnectionRecordMetaDataImp(); - _credential = new CredentialRecordImp(); - _externalTool = new ExternalToolRecordImp(); - _protocol = new ConnectionProtocolImp(protocol); - SetDefaults(); - } - - public ConnectionRecordImp(Container.Info parent) : this() - { - this.MetaData.IsContainer = true; - this.Parent = parent; - } - #endregion - - #region Public Methods - public object Clone() - { - ConnectionRecordImp newConnectionInfo = (ConnectionRecordImp) this.MemberwiseClone(); - newConnectionInfo.ConstantID = Tools.Misc.CreateConstantID(); - newConnectionInfo._OpenConnections = new Protocol.List(); - return newConnectionInfo; - } - - public void SetDefaults() + public ConnectionInfo() { + // initialize default values for all standard instance members SetTreeDisplayDefaults(); SetConnectionDefaults(); SetProtocolDefaults(); SetRDGatewayDefaults(); SetAppearanceDefaults(); SetRedirectDefaults(); + SetMiscDefaults(); SetVNCDefaults(); SetNonBrowsablePropertiesDefaults(); + SetDefaults(); } - + + public ConnectionInfo(Container.ContainerInfo parent) : this() + { + IsContainer = true; + this.Parent = parent; + } + #endregion + + #region Public Methods + public ConnectionInfo Copy() + { + ConnectionInfo newConnectionInfo = (ConnectionInfo)MemberwiseClone(); + newConnectionInfo.ConstantID = Tools.MiscTools.CreateConstantID(); + newConnectionInfo._OpenConnections = new Protocol.ProtocolList(); + return newConnectionInfo; + } + + public void SetDefaults() + { + if (this.Port == 0) + { + SetDefaultPort(); + } + } + public int GetDefaultPort() { return GetDefaultPort(Protocol); } - + public void SetDefaultPort() { this.Port = GetDefaultPort(); @@ -687,14 +765,14 @@ namespace mRemoteNG.Connection if (inheritPropertyValue && Parent != null) { - ConnectionRecord parentConnectionInfo = default(ConnectionRecord); - if (this.MetaData.IsContainer) + ConnectionInfo parentConnectionInfo = default(ConnectionInfo); + if (IsContainer) { - parentConnectionInfo = ((Container.Info)Parent.Parent).ConnectionRecord; + parentConnectionInfo = ((Container.ContainerInfo)Parent.Parent).ConnectionInfo; } else { - parentConnectionInfo = Parent; + parentConnectionInfo = Parent.ConnectionInfo; } Type connectionInfoType = parentConnectionInfo.GetType(); @@ -709,33 +787,33 @@ namespace mRemoteNG.Connection } } - private static int GetDefaultPort(Protocols protocol) + private static int GetDefaultPort(Protocol.ProtocolType protocol) { try { switch (protocol) { - case Connection.Protocol.Protocols.RDP: - return (int)Connection.Protocol.RDPConnectionProtocolImp.Defaults.Port; - case Connection.Protocol.Protocols.VNC: - return (int)Connection.Protocol.VNC.Defaults.Port; - case Connection.Protocol.Protocols.SSH1: - return (int)Connection.Protocol.SSH1.Defaults.Port; - case Connection.Protocol.Protocols.SSH2: - return (int)Connection.Protocol.SSH2.Defaults.Port; - case Connection.Protocol.Protocols.Telnet: - return (int)Connection.Protocol.Telnet.Defaults.Port; - case Connection.Protocol.Protocols.Rlogin: - return (int)Connection.Protocol.Rlogin.Defaults.Port; - case Connection.Protocol.Protocols.RAW: - return (int)Connection.Protocol.RAW.Defaults.Port; - case Connection.Protocol.Protocols.HTTP: - return (int)Connection.Protocol.HTTP.Defaults.Port; - case Connection.Protocol.Protocols.HTTPS: - return (int)Connection.Protocol.HTTPS.Defaults.Port; - case Connection.Protocol.Protocols.ICA: - return (int)Connection.Protocol.ICA.Defaults.Port; - case Connection.Protocol.Protocols.IntApp: + case Connection.Protocol.ProtocolType.RDP: + return (int)ProtocolRDP.Defaults.Port; + case Connection.Protocol.ProtocolType.VNC: + return (int)ProtocolVNC.Defaults.Port; + case Connection.Protocol.ProtocolType.SSH1: + return (int)ProtocolSSH1.Defaults.Port; + case Connection.Protocol.ProtocolType.SSH2: + return (int)ProtocolSSH2.Defaults.Port; + case Connection.Protocol.ProtocolType.Telnet: + return (int)ProtocolTelnet.Defaults.Port; + case Connection.Protocol.ProtocolType.Rlogin: + return (int)ProtocolRlogin.Defaults.Port; + case Connection.Protocol.ProtocolType.RAW: + return (int)ProtocolRAW.Defaults.Port; + case Connection.Protocol.ProtocolType.HTTP: + return (int)ProtocolHTTP.Defaults.Port; + case Connection.Protocol.ProtocolType.HTTPS: + return (int)ProtocolHTTPS.Defaults.Port; + case Connection.Protocol.ProtocolType.ICA: + return (int)ProtocolICA.Defaults.Port; + case Connection.Protocol.ProtocolType.IntApp: return (int)Connection.Protocol.IntegratedProgram.Defaults.Port; } return 0; @@ -765,23 +843,23 @@ namespace mRemoteNG.Connection private void SetProtocolDefaults() { - _protocol = (Connection.Protocol.Protocols)System.Enum.Parse(typeof(Connection.Protocol.Protocols), My.Settings.Default.ConDefaultProtocol); + _protocol = (Connection.Protocol.ProtocolType)System.Enum.Parse(typeof(Connection.Protocol.ProtocolType), My.Settings.Default.ConDefaultProtocol); _extApp = My.Settings.Default.ConDefaultExtApp; _port = 0; _puttySession = My.Settings.Default.ConDefaultPuttySession; - _icaEncryption = (Protocol.ICA.EncryptionStrength)System.Enum.Parse(typeof(Protocol.ICA.EncryptionStrength), My.Settings.Default.ConDefaultICAEncryptionStrength); + _icaEncryption = (ProtocolICA.EncryptionStrength)System.Enum.Parse(typeof(ProtocolICA.EncryptionStrength), My.Settings.Default.ConDefaultICAEncryptionStrength); _useConsoleSession = My.Settings.Default.ConDefaultUseConsoleSession; - _rdpAuthenticationLevel = (Protocol.RDPConnectionProtocolImp.AuthenticationLevel)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.AuthenticationLevel), My.Settings.Default.ConDefaultRDPAuthenticationLevel); + _rdpAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)System.Enum.Parse(typeof(ProtocolRDP.AuthenticationLevel), My.Settings.Default.ConDefaultRDPAuthenticationLevel); _loadBalanceInfo = My.Settings.Default.ConDefaultLoadBalanceInfo; - _renderingEngine = (Protocol.HTTPBase.RenderingEngine)System.Enum.Parse(typeof(Protocol.HTTPBase.RenderingEngine), My.Settings.Default.ConDefaultRenderingEngine); + _renderingEngine = (HTTPBase.RenderingEngine)System.Enum.Parse(typeof(HTTPBase.RenderingEngine), My.Settings.Default.ConDefaultRenderingEngine); _useCredSsp = My.Settings.Default.ConDefaultUseCredSsp; } private void SetRDGatewayDefaults() { - _rdGatewayUsageMethod = (Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod), My.Settings.Default.ConDefaultRDGatewayUsageMethod); + _rdGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)System.Enum.Parse(typeof(ProtocolRDP.RDGatewayUsageMethod), My.Settings.Default.ConDefaultRDGatewayUsageMethod); _rdGatewayHostname = My.Settings.Default.ConDefaultRDGatewayHostname; - _rdGatewayUseConnectionCredentials = (Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials), My.Settings.Default.ConDefaultRDGatewayUseConnectionCredentials); ; + _rdGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)System.Enum.Parse(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), My.Settings.Default.ConDefaultRDGatewayUseConnectionCredentials); ; _rdGatewayUsername = My.Settings.Default.ConDefaultRDGatewayUsername; _rdGatewayPassword = My.Settings.Default.ConDefaultRDGatewayPassword; _rdGatewayDomain = My.Settings.Default.ConDefaultRDGatewayDomain; @@ -789,9 +867,9 @@ namespace mRemoteNG.Connection private void SetAppearanceDefaults() { - _resolution = (Protocol.RDPConnectionProtocolImp.RDPResolutions)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.RDPResolutions), My.Settings.Default.ConDefaultResolution); + _resolution = (ProtocolRDP.RDPResolutions)System.Enum.Parse(typeof(ProtocolRDP.RDPResolutions), My.Settings.Default.ConDefaultResolution); _automaticResize = My.Settings.Default.ConDefaultAutomaticResize; - _colors = (Protocol.RDPConnectionProtocolImp.RDPColors)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.RDPColors), My.Settings.Default.ConDefaultColors); + _colors = (ProtocolRDP.RDPColors)System.Enum.Parse(typeof(ProtocolRDP.RDPColors), My.Settings.Default.ConDefaultColors); _cacheBitmaps = My.Settings.Default.ConDefaultCacheBitmaps; _displayWallpaper = My.Settings.Default.ConDefaultDisplayWallpaper; _displayThemes = My.Settings.Default.ConDefaultDisplayThemes; @@ -806,29 +884,42 @@ namespace mRemoteNG.Connection _redirectPrinters = My.Settings.Default.ConDefaultRedirectPrinters; _redirectPorts = My.Settings.Default.ConDefaultRedirectPorts; _redirectSmartCards = My.Settings.Default.ConDefaultRedirectSmartCards; - _redirectSound = (Protocol.RDPConnectionProtocolImp.RDPSounds)System.Enum.Parse(typeof(Protocol.RDPConnectionProtocolImp.RDPSounds), My.Settings.Default.ConDefaultRedirectSound); + _redirectSound = (ProtocolRDP.RDPSounds)System.Enum.Parse(typeof(ProtocolRDP.RDPSounds), My.Settings.Default.ConDefaultRedirectSound); + } + + private void SetMiscDefaults() + { + _constantId = Tools.MiscTools.CreateConstantID(); + _preExtApp = My.Settings.Default.ConDefaultPreExtApp; + _postExtApp = My.Settings.Default.ConDefaultPostExtApp; + _macAddress = My.Settings.Default.ConDefaultMacAddress; + _userField = My.Settings.Default.ConDefaultUserField; } private void SetVNCDefaults() { - _vncCompression = (Protocol.VNC.Compression)System.Enum.Parse(typeof(Protocol.VNC.Compression),My.Settings.Default.ConDefaultVNCCompression); - _vncEncoding = (Protocol.VNC.Encoding)System.Enum.Parse(typeof(Protocol.VNC.Encoding),My.Settings.Default.ConDefaultVNCEncoding); - _vncAuthMode = (Protocol.VNC.AuthMode)System.Enum.Parse(typeof(Protocol.VNC.AuthMode),My.Settings.Default.ConDefaultVNCAuthMode); - _vncProxyType = (Protocol.VNC.ProxyType)System.Enum.Parse(typeof(Protocol.VNC.ProxyType),My.Settings.Default.ConDefaultVNCProxyType); + _vncCompression = (ProtocolVNC.Compression)System.Enum.Parse(typeof(ProtocolVNC.Compression),My.Settings.Default.ConDefaultVNCCompression); + _vncEncoding = (ProtocolVNC.Encoding)System.Enum.Parse(typeof(ProtocolVNC.Encoding),My.Settings.Default.ConDefaultVNCEncoding); + _vncAuthMode = (ProtocolVNC.AuthMode)System.Enum.Parse(typeof(ProtocolVNC.AuthMode),My.Settings.Default.ConDefaultVNCAuthMode); + _vncProxyType = (ProtocolVNC.ProxyType)System.Enum.Parse(typeof(ProtocolVNC.ProxyType),My.Settings.Default.ConDefaultVNCProxyType); _vncProxyIP = My.Settings.Default.ConDefaultVNCProxyIP; _vncProxyPort = My.Settings.Default.ConDefaultVNCProxyPort; _vncProxyUsername = My.Settings.Default.ConDefaultVNCProxyUsername; _vncProxyPassword = My.Settings.Default.ConDefaultVNCProxyPassword; - _vncColors = (Protocol.VNC.Colors)System.Enum.Parse(typeof(Protocol.VNC.Colors),My.Settings.Default.ConDefaultVNCColors); - _vncSmartSizeMode = (Protocol.VNC.SmartSizeMode)System.Enum.Parse(typeof(Protocol.VNC.SmartSizeMode),My.Settings.Default.ConDefaultVNCSmartSizeMode); + _vncColors = (ProtocolVNC.Colors)System.Enum.Parse(typeof(ProtocolVNC.Colors),My.Settings.Default.ConDefaultVNCColors); + _vncSmartSizeMode = (ProtocolVNC.SmartSizeMode)System.Enum.Parse(typeof(ProtocolVNC.SmartSizeMode),My.Settings.Default.ConDefaultVNCSmartSizeMode); _vncViewOnly = My.Settings.Default.ConDefaultVNCViewOnly; } private void SetNonBrowsablePropertiesDefaults() { - _constantId = Tools.Misc.CreateConstantID(); - _Inherit = new ConnectionRecordInheritanceImp(this); - _OpenConnections = new Protocol.List(); + _Inherit = new ConnectionInfoInheritance(this); + _OpenConnections = new Protocol.ProtocolList(); + _IsContainer = false; + _IsDefault = false; + _PositionID = 0; + _IsQuickConnect = false; + _PleaseConnect = false; } #endregion } diff --git a/mRemoteV1/Connection/ConnectionInfoInheritance.cs b/mRemoteV1/Connection/ConnectionInfoInheritance.cs new file mode 100644 index 00000000..51f5e203 --- /dev/null +++ b/mRemoteV1/Connection/ConnectionInfoInheritance.cs @@ -0,0 +1,419 @@ +using mRemoteNG.Tools; +using System.ComponentModel; + + +namespace mRemoteNG.Connection +{ + public class ConnectionInfoInheritance + { + #region Public Properties + #region General + [LocalizedAttributes.LocalizedCategory("strCategoryGeneral", 1), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool EverythingInherited + { + get + { + if (CacheBitmaps && Colors && Description && DisplayThemes && DisplayWallpaper + && EnableFontSmoothing && EnableDesktopComposition && Domain && Icon && Password + && Port && Protocol && PuttySession && RedirectDiskDrives && RedirectKeys + && RedirectPorts && RedirectPrinters && RedirectSmartCards && RedirectSound && Resolution + && AutomaticResize && UseConsoleSession && UseCredSsp && RenderingEngine && UserField + && ExtApp && Username && Panel && ICAEncryption && RDPAuthenticationLevel + && LoadBalanceInfo && PreExtApp && PostExtApp && MacAddress && VNCAuthMode + && VNCColors && VNCCompression && VNCEncoding && VNCProxyIP && VNCProxyPassword + && VNCProxyPort && VNCProxyType && VNCProxyUsername) + { + return true; + } + else + { + return false; + } + } + set + { + SetAllValues(value); + } + } + #endregion + #region Display + [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Description {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameIcon"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionIcon"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Icon {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Panel {get; set;} + #endregion + #region Connection + [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Username {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePassword"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPassword"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Password {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Domain {get; set;} + #endregion + #region Protocol + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Protocol {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalTool"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalTool"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool ExtApp {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePort"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPort"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Port {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePuttySession"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPuttySession"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PuttySession {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncryptionStrength"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncryptionStrength"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool ICAEncryption {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationLevel"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationLevel"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RDPAuthenticationLevel {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameLoadBalanceInfo"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionLoadBalanceInfo"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool LoadBalanceInfo {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRenderingEngine"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRenderingEngine"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RenderingEngine {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseConsoleSession"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseConsoleSession"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UseConsoleSession {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UseCredSsp {get; set;} + #endregion + #region RD Gateway + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayUsageMethod {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayHostname"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayHostname"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayHostname {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUseConnectionCredentials"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUseConnectionCredentials"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayUseConnectionCredentials {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsername"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsername"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayUsername {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayPassword"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayPassword"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayPassword {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayDomain"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] + public bool RDGatewayDomain {get; set;} + #endregion + #region Appearance + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Resolution {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAutomaticResize"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAutomaticResize"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool AutomaticResize {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool Colors {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCacheBitmaps"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCacheBitmaps"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool CacheBitmaps {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayWallpaper"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayWallpaper"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool DisplayWallpaper {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayThemes"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayThemes"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool DisplayThemes {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableFontSmoothing"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableFontSmoothing"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool EnableFontSmoothing {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableEnableDesktopComposition"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;} + #endregion + #region Redirect + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectKeys {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectDrives"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectDrives"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectDiskDrives {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPrinters"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPrinters"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectPrinters {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPorts"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPorts"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectPorts {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSmartCards"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSmartCards"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectSmartCards {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool RedirectSound {get; set;} + #endregion + #region Misc + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PreExtApp {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolAfter"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolAfter"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool PostExtApp {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameMACAddress"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionMACAddress"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool MacAddress {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool UserField {get; set;} + #endregion + #region VNC + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCCompression {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncoding"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncoding"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCEncoding {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationMode"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationMode"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCAuthMode {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyType"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyType"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyType {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyAddress"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyAddress"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyIP {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPort"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPort"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyPort {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyUsername"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyUsername"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyUsername {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPassword"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPassword"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCProxyPassword {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCColors {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSmartSizeMode"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSmartSizeMode"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCSmartSizeMode {get; set;} + + [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), + LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"), + LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"), + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))]public bool VNCViewOnly {get; set;} + #endregion + + [Browsable(false)] + public object Parent {get; set;} + + [Browsable(false)] + public bool IsDefault {get; set;} + #endregion + + #region Constructors + public ConnectionInfoInheritance(object parent, bool inheritEverything = false) + { + this.Parent = parent; + if (inheritEverything) + { + TurnOnInheritanceCompletely(); + } + } + #endregion + + #region Public Methods + public ConnectionInfoInheritance Copy() + { + return (ConnectionInfoInheritance)MemberwiseClone(); + } + + public void TurnOnInheritanceCompletely() + { + SetAllValues(true); + } + + public void TurnOffInheritanceCompletely() + { + SetAllValues(false); + } + #endregion + + #region Private Methods + private void SetAllValues(bool value) + { + // Display + Description = value; + Icon = value; + Panel = value; + + // Connection + Username = value; + Password = value; + Domain = value; + + // Protocol + Protocol = value; + ExtApp = value; + Port = value; + PuttySession = value; + ICAEncryption = value; + RDPAuthenticationLevel = value; + LoadBalanceInfo = value; + RenderingEngine = value; + UseConsoleSession = value; + UseCredSsp = value; + + // RD Gateway + RDGatewayUsageMethod = value; + RDGatewayHostname = value; + RDGatewayUseConnectionCredentials = value; + RDGatewayUsername = value; + RDGatewayPassword = value; + RDGatewayDomain = value; + + // Appearance + Resolution = value; + AutomaticResize = value; + Colors = value; + CacheBitmaps = value; + DisplayWallpaper = value; + DisplayThemes = value; + EnableFontSmoothing = value; + EnableDesktopComposition = value; + + // Redirect + RedirectKeys = value; + RedirectDiskDrives = value; + RedirectPrinters = value; + RedirectPorts = value; + RedirectSmartCards = value; + RedirectSound = value; + + // Misc + PreExtApp = value; + PostExtApp = value; + MacAddress = value; + UserField = value; + + // VNC + VNCCompression = value; + VNCEncoding = value; + VNCAuthMode = value; + VNCProxyType = value; + VNCProxyIP = value; + VNCProxyPort = value; + VNCProxyUsername = value; + VNCProxyPassword = value; + VNCColors = value; + VNCSmartSizeMode = value; + VNCViewOnly = value; + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/ConnectionList.cs b/mRemoteV1/Connection/ConnectionList.cs index f512a9db..27c7056d 100644 --- a/mRemoteV1/Connection/ConnectionList.cs +++ b/mRemoteV1/Connection/ConnectionList.cs @@ -7,50 +7,47 @@ namespace mRemoteNG.Connection public class ConnectionList : CollectionBase { #region Public Properties - public ConnectionRecordImp this[object Index] + public Connection.ConnectionInfo this[object Index] { get { - if (Index is ConnectionRecordImp) + if (Index is Connection.ConnectionInfo) { - return (ConnectionRecordImp)Index; + return (Connection.ConnectionInfo)Index; } else { - return ((ConnectionRecordImp) (List[System.Convert.ToInt32(Index)])); + return ((Connection.ConnectionInfo) (List[System.Convert.ToInt32(Index)])); } } } public new int Count { - get - { - return List.Count; - } + get { return List.Count; } } #endregion #region Public Methods - public ConnectionRecord Add(ConnectionRecord cInfo) + public Connection.ConnectionInfo Add(Connection.ConnectionInfo cInfo) { this.List.Add(cInfo); return cInfo; } - - public void AddRange(ConnectionRecord[] cInfo) + + public void AddRange(Connection.ConnectionInfo[] cInfo) { - foreach (ConnectionRecord cI in cInfo) + foreach (Connection.ConnectionInfo cI in cInfo) { List.Add(cI); } } - - public ConnectionRecord FindByConstantID(string id) + + public Connection.ConnectionInfo FindByConstantID(string id) { - foreach (ConnectionRecord conI in List) + foreach (Connection.ConnectionInfo conI in List) { - if (conI.MetaData.ConstantID == id) + if (conI.ConstantID == id) { return conI; } @@ -59,12 +56,6 @@ namespace mRemoteNG.Connection return null; } - //Public Function Find(ByVal cInfo As Connection.Info) - // For Each cI As Connection.Info In List - - // Next - //End Function - public Connection.ConnectionList Copy() { try diff --git a/mRemoteV1/Connection/ConnectionProtocolImp.cs b/mRemoteV1/Connection/ConnectionProtocolImp.cs deleted file mode 100644 index a00f6c8e..00000000 --- a/mRemoteV1/Connection/ConnectionProtocolImp.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; - -namespace mRemoteNG.Connection -{ - public class ConnectionProtocolImp : ConnectionProtocol - { - private ConnectionProtocol _strategy; - private ConnectingEventHandler ConnectingEvent; - private ConnectedEventHandler ConnectedEvent; - private DisconnectedEventHandler DisconnectedEvent; - private ErrorOccuredEventHandler ErrorOccuredEvent; - private ClosingEventHandler ClosingEvent; - private ClosedEventHandler ClosedEvent; - - Protocols Name { get; } - PropertyInfo[] SupportedSettings { get; } - Version ProtocolVersion { get; } - - public ConnectionProtocolImp(ConnectionProtocol Protocol) - { - this._strategy = Protocol; - } - - public ConnectionProtocolImp(Protocols ProtocolEnum) - { - this._strategy = ProtocolManagerImp.GetConnectionProtocol(ProtocolEnum); - } - - public void Initialize() - { - _strategy.Initialize(); - } - - public void Connect() - { - _strategy.Connect(); - } - - public void Disconnect() - { - _strategy.Disconnect(); - } - - delegate void ConnectingEventHandler(object sender); - delegate void ConnectedEventHandler(object sender); - delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage); - delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage); - delegate void ClosingEventHandler(object sender); - delegate void ClosedEventHandler(object sender); - - event ConnectingEventHandler Connecting; - event ConnectedEventHandler Connected; - event DisconnectedEventHandler Disconnected; - event ErrorOccuredEventHandler ErrorOccured; - event ClosingEventHandler Closing; - event ClosedEventHandler Closed; - - void Event_Connecting(object sender); - void Event_Connected(object sender); - void Event_Disconnected(object sender, string DisconnectedMessage); - void Event_ErrorOccured(object sender, string ErrorMsg); - void Event_Closing(object sender); - void Event_Closed(object sender); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/ConnectionRecordInheritanceImp.cs b/mRemoteV1/Connection/ConnectionRecordInheritanceImp.cs deleted file mode 100644 index f9ee9fc6..00000000 --- a/mRemoteV1/Connection/ConnectionRecordInheritanceImp.cs +++ /dev/null @@ -1,417 +0,0 @@ -using mRemoteNG.Tools; -using System.ComponentModel; - - -namespace mRemoteNG.Connection -{ - public class ConnectionRecordInheritanceImp : ConnectionRecordInheritanceController - { - #region Public Properties - #region General - [LocalizedAttributes.LocalizedCategory("strCategoryGeneral", 1), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAll"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAll"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool EverythingInherited - { - get - { - if (CacheBitmaps && Colors && Description && DisplayThemes && DisplayWallpaper - && EnableFontSmoothing && EnableDesktopComposition && Domain && Icon && Password - && Port && Protocol && PuttySession && RedirectDiskDrives && RedirectKeys - && RedirectPorts && RedirectPrinters && RedirectSmartCards && RedirectSound && Resolution - && AutomaticResize && UseConsoleSession && UseCredSsp && RenderingEngine && UserField - && ExtApp && Username && Panel && ICAEncryption && RDPAuthenticationLevel - && LoadBalanceInfo && PreExtApp && PostExtApp && MacAddress && VNCAuthMode - && VNCColors && VNCCompression && VNCEncoding && VNCProxyIP && VNCProxyPassword - && VNCProxyPort && VNCProxyType && VNCProxyUsername) - { - return true; - } - else - { - return false; - } - } - set - { - SetAllValues(value); - } - } - #endregion - #region Display - [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDescription"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDescription"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Description {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameIcon"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionIcon"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Icon {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 2), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePanel"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPanel"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Panel {get; set;} - #endregion - #region Connection - [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUsername"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUsername"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Username {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePassword"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPassword"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Password {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 3), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDomain"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDomain"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Domain {get; set;} - #endregion - #region Protocol - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameProtocol"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionProtocol"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Protocol {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalTool"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalTool"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool ExtApp {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePort"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPort"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Port {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNamePuttySession"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionPuttySession"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool PuttySession {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncryptionStrength"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncryptionStrength"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool ICAEncryption {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationLevel"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationLevel"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RDPAuthenticationLevel {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameLoadBalanceInfo"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionLoadBalanceInfo"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool LoadBalanceInfo {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRenderingEngine"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRenderingEngine"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RenderingEngine {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseConsoleSession"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseConsoleSession"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool UseConsoleSession {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryProtocol", 4), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUseCredSsp"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUseCredSsp"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool UseCredSsp {get; set;} - #endregion - #region RD Gateway - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsageMethod"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsageMethod"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayUsageMethod {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayHostname"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayHostname"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayHostname {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUseConnectionCredentials"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUseConnectionCredentials"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayUseConnectionCredentials {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayUsername"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayUsername"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayUsername {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayPassword"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayPassword"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayPassword {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryGateway", 5), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRDGatewayDomain"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRDGatewayDomain"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] - public bool RDGatewayDomain {get; set;} - #endregion - #region Appearance - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameResolution"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionResolution"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Resolution {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAutomaticResize"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAutomaticResize"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool AutomaticResize {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool Colors {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCacheBitmaps"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCacheBitmaps"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool CacheBitmaps {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayWallpaper"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayWallpaper"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool DisplayWallpaper {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameDisplayThemes"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionDisplayThemes"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool DisplayThemes {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableFontSmoothing"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableFontSmoothing"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool EnableFontSmoothing {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 6), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEnableDesktopComposition"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEnableEnableDesktopComposition"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool EnableDesktopComposition {get; set;} - #endregion - #region Redirect - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectKeys"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectKeys"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectKeys {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectDrives"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectDrives"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectDiskDrives {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPrinters"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPrinters"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectPrinters {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectPorts"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectPorts"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectPorts {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSmartCards"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSmartCards"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectSmartCards {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryRedirect", 7), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameRedirectSounds"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionRedirectSounds"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool RedirectSound {get; set;} - #endregion - #region Misc - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolBefore"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolBefore"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool PreExtApp {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameExternalToolAfter"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionExternalToolAfter"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool PostExtApp {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameMACAddress"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionMACAddress"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool MacAddress {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 8), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameUser1"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionUser1"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool UserField {get; set;} - #endregion - #region VNC - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameCompression"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionCompression"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCCompression {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameEncoding"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionEncoding"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCEncoding {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryConnection", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameAuthenticationMode"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionAuthenticationMode"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCAuthMode {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyType"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyType"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCProxyType {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyAddress"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyAddress"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCProxyIP {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPort"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPort"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCProxyPort {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyUsername"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyUsername"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCProxyUsername {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameVNCProxyPassword"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionVNCProxyPassword"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCProxyPassword {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameColors"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionColors"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCColors {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameSmartSizeMode"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionSmartSizeMode"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCSmartSizeMode {get; set;} - - [LocalizedAttributes.LocalizedCategory("strCategoryAppearance", 9), - LocalizedAttributes.LocalizedDisplayNameInheritAttribute("strPropertyNameViewOnly"), - LocalizedAttributes.LocalizedDescriptionInheritAttribute("strPropertyDescriptionViewOnly"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))]public bool VNCViewOnly {get; set;} - #endregion - - [Browsable(false)] - public object Parent { get; set; } - - [Browsable(false)] - public bool IsDefault { get; set; } - #endregion - - #region Constructors - public ConnectionRecordInheritanceImp(object parent, bool inheritEverything = false) - { - this.Parent = parent; - if (inheritEverything) - TurnOnInheritanceCompletely(); - } - #endregion - - #region Public Methods - public object Clone() - { - return (ConnectionRecordInheritanceImp)this.MemberwiseClone(); - } - - public void TurnOnInheritanceCompletely() - { - this.SetAllValues(true); - } - - public void TurnOffInheritanceCompletely() - { - this.SetAllValues(false); - } - #endregion - - #region Private Methods - private void SetAllValues(bool value) - { - // Display - Description = value; - Icon = value; - Panel = value; - - // Connection - Username = value; - Password = value; - Domain = value; - - // Protocol - Protocol = value; - ExtApp = value; - Port = value; - PuttySession = value; - ICAEncryption = value; - RDPAuthenticationLevel = value; - LoadBalanceInfo = value; - RenderingEngine = value; - UseConsoleSession = value; - UseCredSsp = value; - - // RD Gateway - RDGatewayUsageMethod = value; - RDGatewayHostname = value; - RDGatewayUseConnectionCredentials = value; - RDGatewayUsername = value; - RDGatewayPassword = value; - RDGatewayDomain = value; - - // Appearance - Resolution = value; - AutomaticResize = value; - Colors = value; - CacheBitmaps = value; - DisplayWallpaper = value; - DisplayThemes = value; - EnableFontSmoothing = value; - EnableDesktopComposition = value; - - // Redirect - RedirectKeys = value; - RedirectDiskDrives = value; - RedirectPrinters = value; - RedirectPorts = value; - RedirectSmartCards = value; - RedirectSound = value; - - // Misc - PreExtApp = value; - PostExtApp = value; - MacAddress = value; - UserField = value; - - // VNC - VNCCompression = value; - VNCEncoding = value; - VNCAuthMode = value; - VNCProxyType = value; - VNCProxyIP = value; - VNCProxyPort = value; - VNCProxyUsername = value; - VNCProxyPassword = value; - VNCColors = value; - VNCSmartSizeMode = value; - VNCViewOnly = value; - } - #endregion - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/ConnectionRecordMetaDataImp.cs b/mRemoteV1/Connection/ConnectionRecordMetaDataImp.cs deleted file mode 100644 index ab62e727..00000000 --- a/mRemoteV1/Connection/ConnectionRecordMetaDataImp.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; - -namespace mRemoteNG.Connection -{ - public class ConnectionRecordMetaDataImp : ConnectionRecordMetaData - { - private bool _IsContainer; // refactor code so this isn't required - private int _PositionID; // refactor code so this isn't required - private bool _IsDefault; // also not sure if this var should be here - private bool _IsQuickConnect; - private bool _PleaseConnect; - - #region Properties - [Browsable(false)] - public bool IsContainer - { - get { return _IsContainer; } - set { _IsContainer = value; } - } - - [Browsable(false)] - public bool IsDefault - { - get { return _IsDefault; } - set { _IsDefault = value; } - } - - [Browsable(false)] - public int PositionID - { - get { return _PositionID; } - set { _PositionID = value; } - } - - [Browsable(false)] - public bool IsQuickConnect - { - get { return _IsQuickConnect; } - set { _IsQuickConnect = value; } - } - - [Browsable(false)] - public bool PleaseConnect - { - get { return _PleaseConnect; } - set { _PleaseConnect = value; } - } - #endregion - - - public ConnectionRecordMetaDataImp() - { - this.SetDefaults(); - } - - public object Clone() - { - return this.MemberwiseClone(); - } - - private void SetDefaults() - { - _IsContainer = false; - _IsDefault = false; - _PositionID = 0; - _IsQuickConnect = false; - _PleaseConnect = false; - } - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Converter.cs b/mRemoteV1/Connection/Converter.cs new file mode 100644 index 00000000..1397d506 --- /dev/null +++ b/mRemoteV1/Connection/Converter.cs @@ -0,0 +1,24 @@ +using System; + +namespace mRemoteNG.Connection.Protocol +{ + public class Converter + { + public static string ProtocolToString(ProtocolType protocol) + { + return protocol.ToString(); + } + + public static ProtocolType StringToProtocol(string protocol) + { + try + { + return (ProtocolType)Enum.Parse(typeof(ProtocolType), protocol, true); + } + catch (Exception) + { + return ProtocolType.RDP; + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/ExternalToolRecordImp.cs b/mRemoteV1/Connection/ExternalToolRecordImp.cs deleted file mode 100644 index 9653a13a..00000000 --- a/mRemoteV1/Connection/ExternalToolRecordImp.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.ComponentModel; -using mRemoteNG.Tools; -using mRemoteNG.App; - -namespace mRemoteNG.Connection -{ - public class ExternalToolRecordImp : ExternalToolRecord - { - private string _preExtApp; - private string _postExtApp; - private string _macAddress; - private string _userField; - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), - LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolBefore"), - LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolBefore"), - TypeConverter(typeof(Tools.ExternalToolsTypeConverter))] - public string PreExtApp - { - get { return _preExtApp; } - set { _preExtApp = value; } - } - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), - LocalizedAttributes.LocalizedDisplayName("strPropertyNameExternalToolAfter"), - LocalizedAttributes.LocalizedDescription("strPropertyDescriptionExternalToolAfter"), - TypeConverter(typeof(Tools.ExternalToolsTypeConverter))] - public string PostExtApp - { - get { return _postExtApp; } - set { _postExtApp = value; } - } - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), - LocalizedAttributes.LocalizedDisplayName("strPropertyNameMACAddress"), - LocalizedAttributes.LocalizedDescription("strPropertyDescriptionMACAddress")] - public string MacAddress - { - get { return _macAddress; } - set { _macAddress = value; } - } - - [LocalizedAttributes.LocalizedCategory("strCategoryMiscellaneous", 7), - LocalizedAttributes.LocalizedDisplayName("strPropertyNameUser1"), - LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUser1")] - public string UserField - { - get { return _userField; } - set { _userField = value; } - } - - public ExternalToolRecordImp() - { - this.SetDefaults(); - } - - private void SetDefaults() - { - _preExtApp = My.Settings.Default.ConDefaultPreExtApp; - _postExtApp = My.Settings.Default.ConDefaultPostExtApp; - _macAddress = My.Settings.Default.ConDefaultMacAddress; - _userField = My.Settings.Default.ConDefaultUserField; - } - } -} diff --git a/mRemoteV1/Connection/Connection.InterfaceControl.Designer.cs b/mRemoteV1/Connection/InterfaceControl.Designer.cs similarity index 92% rename from mRemoteV1/Connection/Connection.InterfaceControl.Designer.cs rename to mRemoteV1/Connection/InterfaceControl.Designer.cs index 653c6d27..fbd6ea13 100644 --- a/mRemoteV1/Connection/Connection.InterfaceControl.Designer.cs +++ b/mRemoteV1/Connection/InterfaceControl.Designer.cs @@ -1,7 +1,5 @@ - namespace mRemoteNG.Connection { - [global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()] public partial class InterfaceControl : System.Windows.Forms.Panel { //UserControl overrides dispose to clean up the component list. diff --git a/mRemoteV1/Connection/Connection.InterfaceControl.cs b/mRemoteV1/Connection/InterfaceControl.cs similarity index 72% rename from mRemoteV1/Connection/Connection.InterfaceControl.cs rename to mRemoteV1/Connection/InterfaceControl.cs index a027a3d9..da50be2f 100644 --- a/mRemoteV1/Connection/Connection.InterfaceControl.cs +++ b/mRemoteV1/Connection/InterfaceControl.cs @@ -1,32 +1,35 @@ +using mRemoteNG.App; +using mRemoteNG.Connection.Protocol; using System; using System.Drawing; -using Microsoft.VisualBasic; using System.Windows.Forms; -using mRemoteNG.App; namespace mRemoteNG.Connection { public partial class InterfaceControl { + #region Private Variables + private ProtocolBase _Protocol; + private ConnectionInfo _Info; + #endregion + #region Public Properties - private Connection.Protocol.Base _Protocol; - public Connection.Protocol.Base Protocol + public ProtocolBase Protocol { get { return this._Protocol; } set { this._Protocol = value; } } - - private ConnectionRecordImp _Info; - public ConnectionRecordImp Info + + public ConnectionInfo Info { get { return this._Info; } set { this._Info = value; } } #endregion - #region Methods - public InterfaceControl(Control Parent, Connection.Protocol.Base Protocol, Connection.ConnectionRecordImp Info) + #region Constructors + public InterfaceControl(Control Parent, ProtocolBase Protocol, ConnectionInfo Info) { try { @@ -45,4 +48,4 @@ namespace mRemoteNG.Connection } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/Connectable.cs b/mRemoteV1/Connection/Interfaces/Connectable.cs deleted file mode 100644 index 8f982417..00000000 --- a/mRemoteV1/Connection/Interfaces/Connectable.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface Connectable - { - void Connect(); - void Disconnect(); - //void Close(); - - delegate void ConnectingEventHandler(object sender); - delegate void ConnectedEventHandler(object sender); - delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage); - delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage); - delegate void ClosingEventHandler(object sender); - delegate void ClosedEventHandler(object sender); - - event ConnectingEventHandler Connecting; - event ConnectedEventHandler Connected; - event DisconnectedEventHandler Disconnected; - event ErrorOccuredEventHandler ErrorOccured; - event ClosingEventHandler Closing; - event ClosedEventHandler Closed; - - void Event_Connecting(object sender); - void Event_Connected(object sender); - void Event_Disconnected(object sender, string DisconnectedMessage); - void Event_ErrorOccured(object sender, string ErrorMsg); - void Event_Closing(object sender); - void Event_Closed(object sender); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ConnectionProtocol.cs b/mRemoteV1/Connection/Interfaces/ConnectionProtocol.cs deleted file mode 100644 index f771f27c..00000000 --- a/mRemoteV1/Connection/Interfaces/ConnectionProtocol.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; - -namespace mRemoteNG.Connection -{ - public interface ConnectionProtocol : Connectable - { - Protocols Name { get; } - PropertyInfo[] SupportedSettings { get; } - Version ProtocolVersion { get; } - - void Initialize(); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ConnectionProtocolOptions.cs b/mRemoteV1/Connection/Interfaces/ConnectionProtocolOptions.cs deleted file mode 100644 index 41c515f8..00000000 --- a/mRemoteV1/Connection/Interfaces/ConnectionProtocolOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Reflection; - -namespace mRemoteNG.Connection -{ - public interface ConnectionProtocolOptions : IEnumerable - { - bool DomainFieldSupported { get; } - bool UsernameFieldSupported { get; } - bool PasswordFieldSupported { get; } - PropertyInfo[] GetSupportedOptions(); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ConnectionRecord.cs b/mRemoteV1/Connection/Interfaces/ConnectionRecord.cs deleted file mode 100644 index a269faec..00000000 --- a/mRemoteV1/Connection/Interfaces/ConnectionRecord.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; -using mRemoteNG.Credential; - -namespace mRemoteNG.Connection -{ - public interface ConnectionRecord : Record, Connectable - { - string Name { get; set; } - string Description { get; set; } - string ConstantID { get; set; } - ConnectionRecord Parent { get; set; } - ConnectionRecordMetaData MetaData { get; } - ConnectionRecordInheritanceController Inherit { get; } - ConnectionProtocol Protocol { get; set; } - CredentialRecord Credential { get; set; } - - //ExternalToolRecord ExternalTool { get; set; } - string PreExtApp { get; set; } - string PostExtApp { get; set; } - string MacAddress { get; set; } - string UserField { get; set; } - - - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ConnectionRecordInheritanceController.cs b/mRemoteV1/Connection/Interfaces/ConnectionRecordInheritanceController.cs deleted file mode 100644 index 175ac60e..00000000 --- a/mRemoteV1/Connection/Interfaces/ConnectionRecordInheritanceController.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface ConnectionRecordInheritanceController : Record - { - object Parent { get; set; } - bool IsDefault { get; set; } - - void TurnOnInheritanceCompletely(); - void TurnOffInheritanceCompletely(); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ConnectionRecordMetaData.cs b/mRemoteV1/Connection/Interfaces/ConnectionRecordMetaData.cs deleted file mode 100644 index d616a576..00000000 --- a/mRemoteV1/Connection/Interfaces/ConnectionRecordMetaData.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface ConnectionRecordMetaData : ICloneable - { - bool IsContainer { get; set; } - int PositionID { get; set; } - bool IsDefault { get; set; } - bool IsQuickConnect { get; set; } - bool PleaseConnect { get; set; } - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/ExternalToolRecord.cs b/mRemoteV1/Connection/Interfaces/ExternalToolRecord.cs deleted file mode 100644 index 209fb813..00000000 --- a/mRemoteV1/Connection/Interfaces/ExternalToolRecord.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface ExternalToolRecord - { - string PreExtApp { get; set; } - string PostExtApp { get; set; } - string MacAddress { get; set; } - string UserField { get; set; } - } -} diff --git a/mRemoteV1/Connection/Interfaces/ProtocolManager.cs b/mRemoteV1/Connection/Interfaces/ProtocolManager.cs deleted file mode 100644 index 17068259..00000000 --- a/mRemoteV1/Connection/Interfaces/ProtocolManager.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - interface ProtocolManager - { - ConnectionProtocol GetConnectionProtocol(Protocols protocol); - string ProtocolToString(Protocols protocol); - Protocols StringToProtocol(string protocol); - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/RDPConnectionProtocol.cs b/mRemoteV1/Connection/Interfaces/RDPConnectionProtocol.cs deleted file mode 100644 index 37bf134e..00000000 --- a/mRemoteV1/Connection/Interfaces/RDPConnectionProtocol.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - interface RDPConnectionProtocol : ConnectionProtocol - { - bool SmartSize { get; set; } - bool Fullscreen { get; set; } - bool RedirectKeys { get; set; } - - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Interfaces/Record.cs b/mRemoteV1/Connection/Interfaces/Record.cs deleted file mode 100644 index 24bdd812..00000000 --- a/mRemoteV1/Connection/Interfaces/Record.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface Record : ICloneable - { - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTP.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs similarity index 56% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTP.cs rename to mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs index 413e81a4..5c87f26e 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTP.cs +++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTP.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Http { - public class HTTP : HTTPBase + public class ProtocolHTTP : HTTPBase { - public HTTP(RenderingEngine RenderingEngine) : base(RenderingEngine) + public ProtocolHTTP(RenderingEngine RenderingEngine) : base(RenderingEngine) { } diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPBase.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs similarity index 96% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPBase.cs rename to mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs index 8635b31e..2ef485b2 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPBase.cs +++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPBase.cs @@ -4,9 +4,9 @@ using System.Windows.Forms; using mRemoteNG.Tools; using mRemoteNG.App; -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Http { - public class HTTPBase : Base + public class HTTPBase : ProtocolBase { #region Private Properties private Control wBrowser; @@ -42,9 +42,9 @@ namespace mRemoteNG.Connection.Protocol { } - public override bool SetProps() + public override bool Initialize() { - base.SetProps(); + base.Initialize(); try { @@ -92,7 +92,7 @@ namespace mRemoteNG.Connection.Protocol string strHost = System.Convert.ToString(this.InterfaceControl.Info.Hostname); string strAuth = ""; - if (!(((int)Force & (int)ConnectionRecordImp.Force.NoCredentials) == (int)ConnectionRecordImp.Force.NoCredentials) && !string.IsNullOrEmpty(InterfaceControl.Info.Username) && !string.IsNullOrEmpty(InterfaceControl.Info.Password)) + if (!(((int)Force & (int)ConnectionInfo.Force.NoCredentials) == (int)ConnectionInfo.Force.NoCredentials) && !string.IsNullOrEmpty(InterfaceControl.Info.Username) && !string.IsNullOrEmpty(InterfaceControl.Info.Password)) { strAuth = "Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(this.InterfaceControl.Info.Username + ":" + this.InterfaceControl.Info.Password)) + Environment.NewLine; } diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPS.cs b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs similarity index 55% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPS.cs rename to mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs index 797cdd17..a8cff0f1 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.HTTPS.cs +++ b/mRemoteV1/Connection/Protocol/Http/Connection.Protocol.HTTPS.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Http { - public class HTTPS : HTTPBase + public class ProtocolHTTPS : HTTPBase { - public HTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine) + public ProtocolHTTPS(RenderingEngine RenderingEngine) : base(RenderingEngine) { } diff --git a/mRemoteV1/Connection/Protocol/HttpConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/HttpConnectionProtocol.cs deleted file mode 100644 index f37fb6d5..00000000 --- a/mRemoteV1/Connection/Protocol/HttpConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class HttpConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/HttpsConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/HttpsConnectionProtocol.cs deleted file mode 100644 index d98e124f..00000000 --- a/mRemoteV1/Connection/Protocol/HttpsConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class HttpsConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.ICA.cs b/mRemoteV1/Connection/Protocol/ICA/Connection.Protocol.ICA.cs similarity index 88% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.ICA.cs rename to mRemoteV1/Connection/Protocol/ICA/Connection.Protocol.ICA.cs index 14adbc51..62d3c74b 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.ICA.cs +++ b/mRemoteV1/Connection/Protocol/ICA/Connection.Protocol.ICA.cs @@ -6,25 +6,26 @@ using System.Windows.Forms; using mRemoteNG.App; using System.Threading; using mRemoteNG.Tools; +using mRemoteNG.Connection.Protocol.RDP; -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.ICA { - public class ICA : Base + public class ProtocolICA : ProtocolBase { #region Default Instance - private static ICA defaultInstance; + private static ProtocolICA defaultInstance; /// /// Added by the VB.Net to C# Converter to support default instance behavour in C# /// - public static ICA Default + public static ProtocolICA Default { get { if (defaultInstance == null) { - defaultInstance = new ICA(); + defaultInstance = new ProtocolICA(); //defaultInstance.FormClosed += new FormClosedEventHandler(defaultInstance_FormClosed); } @@ -41,14 +42,14 @@ namespace mRemoteNG.Connection.Protocol defaultInstance = null; } #endregion - + #region Private Properties private AxICAClient _ICAClient; - private Connection.ConnectionRecordImp _Info; + private Connection.ConnectionInfo _Info; #endregion - + #region Public Methods - public ICA() + public ProtocolICA() { try { @@ -60,9 +61,9 @@ namespace mRemoteNG.Connection.Protocol } } - public override bool SetProps() + public override bool Initialize() { - base.SetProps(); + base.Initialize(); try { @@ -134,13 +135,13 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Private Methods private void SetCredentials() { try { - if (((int)Force & (int)Connection.ConnectionRecordImp.Force.NoCredentials) == (int)Connection.ConnectionRecordImp.Force.NoCredentials) + if (((int)Force & (int)Connection.ConnectionInfo.Force.NoCredentials) == (int)Connection.ConnectionInfo.Force.NoCredentials) { return ; } @@ -171,7 +172,7 @@ namespace mRemoteNG.Connection.Protocol { if (My.Settings.Default.DefaultPassword != "") { - _ICAClient.SetProp("ClearPassword", Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey)); + _ICAClient.SetProp("ClearPassword", Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey)); } } } @@ -206,7 +207,7 @@ namespace mRemoteNG.Connection.Protocol { try { - if ((this.Force & Connection.ConnectionRecordImp.Force.Fullscreen) == Connection.ConnectionRecordImp.Force.Fullscreen) + if ((this.Force & Connection.ConnectionInfo.Force.Fullscreen) == Connection.ConnectionInfo.Force.Fullscreen) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); _ICAClient.FullScreenWindow(); @@ -214,22 +215,22 @@ namespace mRemoteNG.Connection.Protocol return; } - if (this.InterfaceControl.Info.Resolution == RDPConnectionProtocolImp.RDPResolutions.FitToWindow) + if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.FitToWindow) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } - else if (this.InterfaceControl.Info.Resolution == RDPConnectionProtocolImp.RDPResolutions.SmartSize) + else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.SmartSize) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } - else if (this.InterfaceControl.Info.Resolution == RDPConnectionProtocolImp.RDPResolutions.Fullscreen) + else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.Fullscreen) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); _ICAClient.FullScreenWindow(); } else { - Rectangle resolution = RDPConnectionProtocolImp.GetResolutionRectangle(_Info.Resolution); + Rectangle resolution = ProtocolRDP.GetResolutionRectangle(_Info.Resolution); _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0); } } @@ -243,13 +244,13 @@ namespace mRemoteNG.Connection.Protocol { switch (_Info.Colors) { - case RDPConnectionProtocolImp.RDPColors.Colors256: + case ProtocolRDP.RDPColors.Colors256: _ICAClient.SetProp("DesiredColor", "2"); break; - case RDPConnectionProtocolImp.RDPColors.Colors15Bit: + case ProtocolRDP.RDPColors.Colors15Bit: _ICAClient.SetProp("DesiredColor", "4"); break; - case RDPConnectionProtocolImp.RDPColors.Colors16Bit: + case ProtocolRDP.RDPColors.Colors16Bit: _ICAClient.SetProp("DesiredColor", "4"); break; default: @@ -296,7 +297,7 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Private Events & Handlers private void ICAEvent_OnConnecting(object sender, System.EventArgs e) { @@ -333,7 +334,7 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Reconnect Stuff public void tmrReconnect_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { @@ -349,7 +350,7 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Enums public enum Defaults { diff --git a/mRemoteV1/Connection/Protocol/ICAConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/ICAConnectionProtocol.cs deleted file mode 100644 index 2715221b..00000000 --- a/mRemoteV1/Connection/Protocol/ICAConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class ICAConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.IntegratedProgram.cs b/mRemoteV1/Connection/Protocol/IntegratedProgram.cs similarity index 88% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.IntegratedProgram.cs rename to mRemoteV1/Connection/Protocol/IntegratedProgram.cs index d473d6dc..4c294221 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.IntegratedProgram.cs +++ b/mRemoteV1/Connection/Protocol/IntegratedProgram.cs @@ -1,18 +1,24 @@ -using System; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; using mRemoteNG.App; using mRemoteNG.Tools; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Threading; +using System.Windows.Forms; namespace mRemoteNG.Connection.Protocol { - public class IntegratedProgram : Base + public class IntegratedProgram : ProtocolBase { + #region Private Fields + private ExternalTool _externalTool; + private IntPtr _handle; + private Process _process; + #endregion + #region Public Methods - public override bool SetProps() + public override bool Initialize() { if (InterfaceControl.Info != null) { @@ -20,7 +26,7 @@ namespace mRemoteNG.Connection.Protocol _externalTool.ConnectionInfo = InterfaceControl.Info; } - return base.SetProps(); + return base.Initialize(); } public override bool Connect() @@ -33,12 +39,13 @@ namespace mRemoteNG.Connection.Protocol Close(); return false; } - + + ArgumentParser argParser = new ArgumentParser(_externalTool.ConnectionInfo); _process = new Process(); _process.StartInfo.UseShellExecute = true; - _process.StartInfo.FileName = _externalTool.ParseArguments(_externalTool.FileName); - _process.StartInfo.Arguments = _externalTool.ParseArguments(_externalTool.Arguments); + _process.StartInfo.FileName = argParser.ParseArguments(_externalTool.FileName); + _process.StartInfo.Arguments = argParser.ParseArguments(_externalTool.Arguments); _process.EnableRaisingEvents = true; _process.Exited += ProcessExited; @@ -138,20 +145,14 @@ namespace mRemoteNG.Connection.Protocol base.Close(); } #endregion - - #region Private Fields - private ExternalTool _externalTool; - private IntPtr _handle; - private Process _process; - #endregion - + #region Private Methods private void ProcessExited(object sender, EventArgs e) { Event_Closed(this); } #endregion - + #region Enumerations public enum Defaults { @@ -159,4 +160,4 @@ namespace mRemoteNG.Connection.Protocol } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/OtherConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/OtherConnectionProtocol.cs deleted file mode 100644 index 00260e24..00000000 --- a/mRemoteV1/Connection/Protocol/OtherConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class OtherConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Base.cs b/mRemoteV1/Connection/Protocol/ProtocolBase.cs similarity index 95% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Base.cs rename to mRemoteV1/Connection/Protocol/ProtocolBase.cs index 6cf2504c..fb6040c8 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Base.cs +++ b/mRemoteV1/Connection/Protocol/ProtocolBase.cs @@ -2,18 +2,19 @@ using System; using System.Windows.Forms; using System.Threading; using mRemoteNG.App; +using mRemoteNG.Connection; namespace mRemoteNG.Connection.Protocol { - public abstract class Base + public abstract class ProtocolBase { #region Private Variables private string _Name; - private UI.Window.Connection _connectionWindow; + private UI.Window.ConnectionWindow _connectionWindow; private InterfaceControl _interfaceControl; private Control _Control; - private ConnectionRecordImp.Force _Force; + private mRemoteNG.Connection.ConnectionInfo.Force _Force; private ConnectingEventHandler ConnectingEvent; private ConnectedEventHandler ConnectedEvent; private DisconnectedEventHandler DisconnectedEvent; @@ -30,7 +31,7 @@ namespace mRemoteNG.Connection.Protocol set { this._Name = value; } } - public UI.Window.Connection ConnectionWindow + public UI.Window.ConnectionWindow ConnectionWindow { get { return _connectionWindow; } set @@ -48,7 +49,7 @@ namespace mRemoteNG.Connection.Protocol set { _interfaceControl = value; - ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.Connection; + ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.ConnectionWindow; } } @@ -59,7 +60,7 @@ namespace mRemoteNG.Connection.Protocol } #endregion - public mRemoteNG.Connection.ConnectionRecordImp.Force Force + public ConnectionInfo.Force Force { get { return this._Force; } set { this._Force = value; } @@ -68,7 +69,7 @@ namespace mRemoteNG.Connection.Protocol public System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000); public ReconnectGroup ReconnectGroup; #endregion - + #region Methods //public abstract int GetDefaultPort(); @@ -96,7 +97,7 @@ namespace mRemoteNG.Connection.Protocol { } - public virtual bool SetProps() + public virtual bool Initialize() { try { @@ -123,7 +124,7 @@ namespace mRemoteNG.Connection.Protocol public virtual bool Connect() { - if (InterfaceControl.Info.Protocol != Protocols.RDP) + if (InterfaceControl.Info.Protocol != ProtocolType.RDP) { if (ConnectedEvent != null) { @@ -237,7 +238,7 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + #region Events public delegate void ConnectingEventHandler(object sender); public event ConnectingEventHandler Connecting diff --git a/mRemoteV1/Connection/Protocol/ProtocolFactory.cs b/mRemoteV1/Connection/Protocol/ProtocolFactory.cs new file mode 100644 index 00000000..74dfec97 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/ProtocolFactory.cs @@ -0,0 +1,70 @@ +using mRemoteNG.Connection.Protocol.Http; +using mRemoteNG.Connection.Protocol.ICA; +using mRemoteNG.Connection.Protocol.RAW; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Connection.Protocol.Rlogin; +using mRemoteNG.Connection.Protocol.SSH; +using mRemoteNG.Connection.Protocol.Telnet; +using mRemoteNG.Connection.Protocol.VNC; +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.Connection.Protocol +{ + public class ProtocolFactory + { + public ProtocolFactory() + { + + } + + public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo) + { + ProtocolBase newProtocol = default(ProtocolBase); + switch (connectionInfo.Protocol) + { + case ProtocolType.RDP: + newProtocol = new ProtocolRDP(); + ((ProtocolRDP) newProtocol).tmrReconnect.Elapsed += ((ProtocolRDP) newProtocol).tmrReconnect_Elapsed; + break; + case ProtocolType.VNC: + newProtocol = new ProtocolVNC(); + break; + case ProtocolType.SSH1: + newProtocol = new ProtocolSSH1(); + break; + case ProtocolType.SSH2: + newProtocol = new ProtocolSSH2(); + break; + case ProtocolType.Telnet: + newProtocol = new ProtocolTelnet(); + break; + case ProtocolType.Rlogin: + newProtocol = new ProtocolRlogin(); + break; + case ProtocolType.RAW: + newProtocol = new ProtocolRAW(); + break; + case ProtocolType.HTTP: + newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine); + break; + case ProtocolType.HTTPS: + newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine); + break; + case ProtocolType.ICA: + newProtocol = new ProtocolICA(); + ((ProtocolICA) newProtocol).tmrReconnect.Elapsed += ((ProtocolICA) newProtocol).tmrReconnect_Elapsed; + break; + case ProtocolType.IntApp: + newProtocol = new IntegratedProgram(); + if (connectionInfo.ExtApp == "") + { + throw (new Exception(My.Language.strNoExtAppDefined)); + } + break; + } + return newProtocol; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.List.cs b/mRemoteV1/Connection/Protocol/ProtocolList.cs similarity index 51% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.List.cs rename to mRemoteV1/Connection/Protocol/ProtocolList.cs index 60dff717..13a45437 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.List.cs +++ b/mRemoteV1/Connection/Protocol/ProtocolList.cs @@ -4,21 +4,17 @@ using System.Collections; namespace mRemoteNG.Connection.Protocol { - public class List : CollectionBase + public class ProtocolList : CollectionBase { #region Public Properties - public Connection.Protocol.Base this[object Index] + public ProtocolBase this[object Index] { get { - if (Index is Connection.Protocol.Base) - { - return (Connection.Protocol.Base)Index; - } + if (Index is ProtocolBase) + return (ProtocolBase)Index; else - { - return ((Connection.Protocol.Base) (List[System.Convert.ToInt32(Index)])); - } + return ((ProtocolBase) (List[Convert.ToInt32(Index)])); } } @@ -32,21 +28,21 @@ namespace mRemoteNG.Connection.Protocol #endregion #region Public Methods - public Connection.Protocol.Base Add(Connection.Protocol.Base cProt) + public ProtocolBase Add(ProtocolBase cProt) { this.List.Add(cProt); return cProt; } - public void AddRange(Connection.Protocol.Base[] cProt) + public void AddRange(ProtocolBase[] cProt) { - foreach (Connection.Protocol.Base cP in cProt) + foreach (ProtocolBase cP in cProt) { List.Add(cP); } } - public void Remove(Connection.Protocol.Base cProt) + public void Remove(ProtocolBase cProt) { try { @@ -63,4 +59,4 @@ namespace mRemoteNG.Connection.Protocol } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/ProtocolType.cs b/mRemoteV1/Connection/Protocol/ProtocolType.cs new file mode 100644 index 00000000..20c5cc15 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/ProtocolType.cs @@ -0,0 +1,31 @@ +using mRemoteNG.Tools; + +namespace mRemoteNG.Connection.Protocol +{ + public enum ProtocolType + { + [LocalizedAttributes.LocalizedDescription("strRDP")] + RDP = 0, + [LocalizedAttributes.LocalizedDescription("strVnc")] + VNC = 1, + [LocalizedAttributes.LocalizedDescription("strSsh1")] + SSH1 = 2, + [LocalizedAttributes.LocalizedDescription("strSsh2")] + SSH2 = 3, + [LocalizedAttributes.LocalizedDescription("strTelnet")] + Telnet = 4, + [LocalizedAttributes.LocalizedDescription("strRlogin")] + Rlogin = 5, + [LocalizedAttributes.LocalizedDescription("strRAW")] + RAW = 6, + [LocalizedAttributes.LocalizedDescription("strHttp")] + HTTP = 7, + [LocalizedAttributes.LocalizedDescription("strHttps")] + HTTPS = 8, + [LocalizedAttributes.LocalizedDescription("strICA")] + ICA = 9, + [LocalizedAttributes.LocalizedDescription("strExtApp")] + IntApp = 20, + SSH = 10 + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.PuttyBase.cs b/mRemoteV1/Connection/Protocol/PuttyBase.cs similarity index 84% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.PuttyBase.cs rename to mRemoteV1/Connection/Protocol/PuttyBase.cs index e10bbdc9..42b763c4 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.PuttyBase.cs +++ b/mRemoteV1/Connection/Protocol/PuttyBase.cs @@ -1,90 +1,56 @@ -using System; -using System.Drawing; -using System.Diagnostics; using Microsoft.VisualBasic; -using System.Windows.Forms; -using mRemoteNG.Messages; -using System.Threading; using mRemoteNG.App; +using mRemoteNG.Messages; using mRemoteNG.Tools; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Threading; +using System.Windows.Forms; namespace mRemoteNG.Connection.Protocol { - public class PuttyBase : Base + public class PuttyBase : ProtocolBase { - #region Constants private const int IDM_RECONF = 0x50; // PuTTY Settings Menu ID - #endregion - - #region Private Properties bool _isPuttyNg; - #endregion - + private Putty_Protocol _PuttyProtocol; + private Putty_SSHVersion _PuttySSHVersion; + private IntPtr _PuttyHandle; + private Process _PuttyProcess; + private static string _PuttyPath; + + #region Public Properties - private Putty_Protocol _PuttyProtocol; public Putty_Protocol PuttyProtocol { - get - { - return this._PuttyProtocol; - } - set - { - this._PuttyProtocol = value; - } + get { return this._PuttyProtocol; } + set { this._PuttyProtocol = value; } } - - private Putty_SSHVersion _PuttySSHVersion; + public Putty_SSHVersion PuttySSHVersion { - get - { - return this._PuttySSHVersion; - } - set - { - this._PuttySSHVersion = value; - } + get { return this._PuttySSHVersion; } + set { this._PuttySSHVersion = value; } } - - private IntPtr _PuttyHandle; + public IntPtr PuttyHandle { - get - { - return this._PuttyHandle; - } - set - { - this._PuttyHandle = value; - } + get { return this._PuttyHandle; } + set { this._PuttyHandle = value; } } - - private Process _PuttyProcess; + public Process PuttyProcess { - get - { - return this._PuttyProcess; - } - set - { - this._PuttyProcess = value; - } + get { return this._PuttyProcess; } + set { this._PuttyProcess = value; } } - - private static string _PuttyPath; + public static string PuttyPath { - get - { - return _PuttyPath; - } - set - { - _PuttyPath = value; - } + get { return _PuttyPath; } + set { _PuttyPath = value; } } public bool Focused @@ -92,17 +58,17 @@ namespace mRemoteNG.Connection.Protocol get { if (Native.GetForegroundWindow() == PuttyHandle) - { return true; - } - else - { - return false; - } + return false; } } #endregion - + + public PuttyBase() + { + + } + #region Private Events & Handlers private void ProcessExited(object sender, System.EventArgs e) { @@ -111,11 +77,6 @@ namespace mRemoteNG.Connection.Protocol #endregion #region Public Methods - public PuttyBase() - { - - } - public override bool Connect() { try @@ -131,7 +92,7 @@ namespace mRemoteNG.Connection.Protocol arguments.Add("-load", InterfaceControl.Info.PuttySession); - if (!(InterfaceControl.Info is PuttySession.Info)) + if (!(InterfaceControl.Info is PuttySessionInfo)) { arguments.Add("-" + _PuttyProtocol.ToString()); @@ -164,13 +125,13 @@ namespace mRemoteNG.Connection.Protocol { if (My.Settings.Default.EmptyCredentials == "custom") { - password = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey); + password = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey); } } - arguments.Add("-" + System.Convert.ToString(_PuttySSHVersion)); + arguments.Add("-" + (int)_PuttySSHVersion); - if (!(((int)Force & (int)ConnectionRecordImp.Force.NoCredentials) == (int)ConnectionRecordImp.Force.NoCredentials)) + if (!(((int)Force & (int)ConnectionInfo.Force.NoCredentials) == (int)ConnectionInfo.Force.NoCredentials)) { if (!string.IsNullOrEmpty(username)) { @@ -329,4 +290,4 @@ namespace mRemoteNG.Connection.Protocol } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/RAW/Connection.Protocol.RAW.cs b/mRemoteV1/Connection/Protocol/RAW/Connection.Protocol.RAW.cs new file mode 100644 index 00000000..fd8b2149 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/RAW/Connection.Protocol.RAW.cs @@ -0,0 +1,15 @@ +namespace mRemoteNG.Connection.Protocol.RAW +{ + public class ProtocolRAW : Connection.Protocol.PuttyBase + { + public ProtocolRAW() + { + this.PuttyProtocol = Putty_Protocol.raw; + } + + public enum Defaults + { + Port = 23 + } + } +} diff --git a/mRemoteV1/Connection/Protocol/RAWConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/RAWConnectionProtocol.cs deleted file mode 100644 index 6be9ed79..00000000 --- a/mRemoteV1/Connection/Protocol/RAWConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class RAWConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/RDP/RDPConnectionProtocolImp.cs b/mRemoteV1/Connection/Protocol/RDP/Connection.Protocol.RDP.cs similarity index 76% rename from mRemoteV1/Connection/Protocol/RDP/RDPConnectionProtocolImp.cs rename to mRemoteV1/Connection/Protocol/RDP/Connection.Protocol.RDP.cs index 64a13dcb..87b9957d 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RDPConnectionProtocolImp.cs +++ b/mRemoteV1/Connection/Protocol/RDP/Connection.Protocol.RDP.cs @@ -2,6 +2,7 @@ using System; using System.Drawing; using System.Diagnostics; using AxMSTSCLib; +using Microsoft.VisualBasic; using System.Collections; using System.Windows.Forms; using System.Threading; @@ -11,23 +12,20 @@ using mRemoteNG.Messages; using mRemoteNG.App; using MSTSCLib; using mRemoteNG.Tools; -using mRemoteNG.Connection.Protocol.RDP; -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.RDP { - public class RDPConnectionProtocolImp : RDPConnectionProtocol + public class ProtocolRDP : ProtocolBase { #region Private Declarations private MsRdpClient6NotSafeForScripting _rdpClient; private Version _rdpVersion; - private ConnectionRecordImp _connectionInfo; + private ConnectionInfo _connectionInfo; private bool _loginComplete; - private Size _controlBeginningSize = new Size(); private bool _redirectKeys = false; - private Control _Control; #endregion - + #region Properties public bool SmartSize { @@ -82,44 +80,23 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - + + #region Constructors + public ProtocolRDP() + { + Control = new AxMsRdpClient6NotSafeForScripting(); + } + #endregion + #region Public Methods - public RDPConnectionProtocolImp() + public override bool Initialize() { - _rdpClient = new MsRdpClient6NotSafeForScriptingClass(); - _rdpVersion = new Version(_rdpClient.Version); - - } - - public override bool SetProps() - { - try - { - this._interfaceControl.Parent.Tag = this._interfaceControl; - this._interfaceControl.Show(); - - if (this._Control != null) - { - this._Control.Name = this._Name; - this._Control.Parent = this._interfaceControl; - this._Control.Location = this._interfaceControl.Location; - this._Control.Size = this.InterfaceControl.Size; - this._Control.Anchor = this._interfaceControl.Anchor; - } - - return true; - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t SetProps (Connection.Protocol.Base)" + Environment.NewLine + ex.Message, true); - return false; - } - + base.Initialize(); try { Control.CreateControl(); _connectionInfo = InterfaceControl.Info; - + try { while (!Control.Created) @@ -127,7 +104,6 @@ namespace mRemoteNG.Connection.Protocol Thread.Sleep(0); System.Windows.Forms.Application.DoEvents(); } - _rdpClient = (MsRdpClient6NotSafeForScripting)((AxMsRdpClient6NotSafeForScripting)Control).GetOcx(); } catch (System.Runtime.InteropServices.COMException ex) @@ -137,9 +113,9 @@ namespace mRemoteNG.Connection.Protocol return false; } - this._rdpVersion = new Version(_rdpClient.Version); + _rdpVersion = new Version(_rdpClient.Version); - this._rdpClient.Server = this._connectionInfo.Hostname; + _rdpClient.Server = this._connectionInfo.Hostname; this.SetCredentials(); this.SetResolution(); @@ -152,9 +128,10 @@ namespace mRemoteNG.Connection.Protocol _rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10.000 = 10 seconds) _rdpClient.AdvancedSettings5.AuthenticationLevel = 0; _rdpClient.AdvancedSettings2.EncryptionEnabled = 1; + _rdpClient.AdvancedSettings2.overallConnectionTimeout = 20; + _rdpClient.AdvancedSettings2.BitmapPeristence = System.Convert.ToInt32(this._connectionInfo.CacheBitmaps); - if (_rdpVersion >= Versions.RDC61) { _rdpClient.AdvancedSettings7.EnableCredSspSupport = _connectionInfo.UseCredSsp; @@ -162,15 +139,19 @@ namespace mRemoteNG.Connection.Protocol this.SetUseConsoleSession(); this.SetPort(); - this.RedirectKeys = _connectionInfo.RedirectKeys; + RedirectKeys = _connectionInfo.RedirectKeys; this.SetRedirection(); this.SetAuthenticationLevel(); - this.SetLoadBalanceInfo(); + SetLoadBalanceInfo(); this.SetRdGateway(); - this._rdpClient.ColorDepth = System.Convert.ToInt32(Conversion.Int(this._connectionInfo.Colors)); + + _rdpClient.ColorDepth = System.Convert.ToInt32(Conversion.Int(this._connectionInfo.Colors)); + this.SetPerformanceFlags(); - this._rdpClient.ConnectingText = My.Language.strConnecting; - base.Control.Anchor = AnchorStyles.None; + + _rdpClient.ConnectingText = My.Language.strConnecting; + + Control.Anchor = AnchorStyles.None; return true; } @@ -180,7 +161,7 @@ namespace mRemoteNG.Connection.Protocol return false; } } - + public override bool Connect() { _loginComplete = false; @@ -189,11 +170,7 @@ namespace mRemoteNG.Connection.Protocol try { _rdpClient.Connect(); - if (ConnectedEvent != null) - { - ConnectedEvent(this); - return true; - } + base.Connect(); return true; } catch (Exception ex) @@ -203,7 +180,7 @@ namespace mRemoteNG.Connection.Protocol return false; } - + public override void Disconnect() { try @@ -216,7 +193,7 @@ namespace mRemoteNG.Connection.Protocol base.Close(); } } - + public void ToggleFullscreen() { try @@ -228,7 +205,7 @@ namespace mRemoteNG.Connection.Protocol Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strRdpToggleFullscreenFailed + Environment.NewLine + ex.Message, true); } } - + public void ToggleSmartSize() { try @@ -240,7 +217,7 @@ namespace mRemoteNG.Connection.Protocol Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strRdpToggleSmartSizeFailed + Environment.NewLine + ex.Message, true); } } - + public override void Focus() { try @@ -255,12 +232,13 @@ namespace mRemoteNG.Connection.Protocol Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strRdpFocusFailed + Environment.NewLine + ex.Message, true); } } - + + private Size _controlBeginningSize = new Size(); public override void ResizeBegin(object sender, EventArgs e) { _controlBeginningSize = Control.Size; } - + public override void Resize(object sender, EventArgs e) { if (DoResize() && _controlBeginningSize.IsEmpty) @@ -269,7 +247,7 @@ namespace mRemoteNG.Connection.Protocol } base.Resize(sender, e); } - + public override void ResizeEnd(object sender, EventArgs e) { DoResize(); @@ -360,24 +338,24 @@ namespace mRemoteNG.Connection.Protocol { _rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD } - if (_rdpVersion >= Versions.RDC61 && !((Force & ConnectionRecordImp.Force.NoCredentials) == ConnectionRecordImp.Force.NoCredentials)) + if (_rdpVersion >= Versions.RDC61 && !((Force & ConnectionInfo.Force.NoCredentials) == ConnectionInfo.Force.NoCredentials)) { if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes) { - _rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username; - _rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password; - _rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.Domain; + //_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.Username; + //_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.Password; + //_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.Domain; } else if (_connectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard) { - _rdpClient.TransportSettings2.GatewayCredSharing = 0; + //_rdpClient.TransportSettings2.GatewayCredSharing = 0; } else { - _rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername; - _rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword; - _rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain; - _rdpClient.TransportSettings2.GatewayCredSharing = 0; + //_rdpClient.TransportSettings2.GatewayUsername = _connectionInfo.RDGatewayUsername; + //_rdpClient.TransportSettings2.GatewayPassword = _connectionInfo.RDGatewayPassword; + //_rdpClient.TransportSettings2.GatewayDomain = _connectionInfo.RDGatewayDomain; + //_rdpClient.TransportSettings2.GatewayCredSharing = 0; } } } @@ -394,11 +372,11 @@ namespace mRemoteNG.Connection.Protocol { bool value = false; - if ((Force & ConnectionRecordImp.Force.UseConsoleSession) == ConnectionRecordImp.Force.UseConsoleSession) + if ((Force & ConnectionInfo.Force.UseConsoleSession) == ConnectionInfo.Force.UseConsoleSession) { value = true; } - else if ((Force & ConnectionRecordImp.Force.DontUseConsoleSession) == ConnectionRecordImp.Force.DontUseConsoleSession) + else if ((Force & ConnectionInfo.Force.DontUseConsoleSession) == ConnectionInfo.Force.DontUseConsoleSession) { value = false; } @@ -410,7 +388,7 @@ namespace mRemoteNG.Connection.Protocol if (_rdpVersion >= Versions.RDC61) { Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(My.Language.strRdpSetConsoleSwitch, "6.1"), true); - _rdpClient.AdvancedSettings7.ConnectToAdministerServer = value; + //_rdpClient.AdvancedSettings7.ConnectToAdministerServer = value; } else { @@ -428,7 +406,7 @@ namespace mRemoteNG.Connection.Protocol { try { - if ((Force & ConnectionRecordImp.Force.NoCredentials) == ConnectionRecordImp.Force.NoCredentials) + if ((Force & ConnectionInfo.Force.NoCredentials) == ConnectionInfo.Force.NoCredentials) { return ; } @@ -459,7 +437,7 @@ namespace mRemoteNG.Connection.Protocol { if (My.Settings.Default.DefaultPassword != "") { - _rdpClient.AdvancedSettings2.ClearTextPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey); + _rdpClient.AdvancedSettings2.ClearTextPassword = Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey); } } } @@ -494,7 +472,7 @@ namespace mRemoteNG.Connection.Protocol { try { - if ((this.Force & Connection.ConnectionRecordImp.Force.Fullscreen) == Connection.ConnectionRecordImp.Force.Fullscreen) + if ((this.Force & Connection.ConnectionInfo.Force.Fullscreen) == Connection.ConnectionInfo.Force.Fullscreen) { _rdpClient.FullScreen = true; _rdpClient.DesktopWidth = Screen.FromControl(frmMain.Default).Bounds.Width; @@ -565,22 +543,22 @@ namespace mRemoteNG.Connection.Protocol int pFlags = 0; if (this._connectionInfo.DisplayThemes == false) { - pFlags += System.Convert.ToInt32(Conversion.Int(Connection.Protocol.RDPConnectionProtocolImp.RDPPerformanceFlags.DisableThemes)); + pFlags += System.Convert.ToInt32(Conversion.Int(ProtocolRDP.RDPPerformanceFlags.DisableThemes)); } if (this._connectionInfo.DisplayWallpaper == false) { - pFlags += System.Convert.ToInt32(Conversion.Int(Connection.Protocol.RDPConnectionProtocolImp.RDPPerformanceFlags.DisableWallpaper)); + pFlags += System.Convert.ToInt32(Conversion.Int(ProtocolRDP.RDPPerformanceFlags.DisableWallpaper)); } if (this._connectionInfo.EnableFontSmoothing) { - pFlags += System.Convert.ToInt32(Conversion.Int(Connection.Protocol.RDPConnectionProtocolImp.RDPPerformanceFlags.EnableFontSmoothing)); + pFlags += System.Convert.ToInt32(Conversion.Int(ProtocolRDP.RDPPerformanceFlags.EnableFontSmoothing)); } if (this._connectionInfo.EnableDesktopComposition) { - pFlags += System.Convert.ToInt32(Conversion.Int(Connection.Protocol.RDPConnectionProtocolImp.RDPPerformanceFlags.EnableDesktopComposition)); + pFlags += System.Convert.ToInt32(Conversion.Int(ProtocolRDP.RDPPerformanceFlags.EnableDesktopComposition)); } _rdpClient.AdvancedSettings2.PerformanceFlags = pFlags; @@ -692,7 +670,7 @@ namespace mRemoteNG.Connection.Protocol #endregion #region Public Events & Handlers - public delegate void LeaveFullscreenEventHandler(Connection.Protocol.RDPConnectionProtocolImp sender, System.EventArgs e); + public delegate void LeaveFullscreenEventHandler(ProtocolRDP sender, System.EventArgs e); private LeaveFullscreenEventHandler LeaveFullscreenEvent; public event LeaveFullscreenEventHandler LeaveFullscreen @@ -708,6 +686,110 @@ namespace mRemoteNG.Connection.Protocol } #endregion + #region Enums + public enum Defaults + { + Colors = RDPColors.Colors16Bit, + Sounds = RDPSounds.DoNotPlay, + Resolution = RDPResolutions.FitToWindow, + Port = 3389 + } + + public enum RDPColors + { + [LocalizedAttributes.LocalizedDescription("strRDP256Colors")] + Colors256 = 8, + [LocalizedAttributes.LocalizedDescription("strRDP32768Colors")] + Colors15Bit = 15, + [LocalizedAttributes.LocalizedDescription("strRDP65536Colors")] + Colors16Bit = 16, + [LocalizedAttributes.LocalizedDescription("strRDP16777216Colors")] + Colors24Bit = 24, + [LocalizedAttributes.LocalizedDescription("strRDP4294967296Colors")] + Colors32Bit = 32 + } + + public enum RDPSounds + { + [LocalizedAttributes.LocalizedDescription("strRDPSoundBringToThisComputer")] + BringToThisComputer = 0, + [LocalizedAttributes.LocalizedDescription("strRDPSoundLeaveAtRemoteComputer")] + LeaveAtRemoteComputer = 1, + [LocalizedAttributes.LocalizedDescription("strRDPSoundDoNotPlay")] + DoNotPlay = 2 + } + + private enum RDPPerformanceFlags + { + [Description("strRDPDisableWallpaper")]DisableWallpaper = 0x1, + [Description("strRDPDisableFullWindowdrag")]DisableFullWindowDrag = 0x2, + [Description("strRDPDisableMenuAnimations")]DisableMenuAnimations = 0x4, + [Description("strRDPDisableThemes")]DisableThemes = 0x8, + [Description("strRDPDisableCursorShadow")]DisableCursorShadow = 0x20, + [Description("strRDPDisableCursorblinking")]DisableCursorBlinking = 0x40, + [Description("strRDPEnableFontSmoothing")]EnableFontSmoothing = 0x80, + [Description("strRDPEnableDesktopComposition")]EnableDesktopComposition = 0x100 + } + + public enum RDPResolutions + { + [LocalizedAttributes.LocalizedDescription("strRDPFitToPanel")] + FitToWindow, + [LocalizedAttributes.LocalizedDescription("strFullscreen")] + Fullscreen, + [LocalizedAttributes.LocalizedDescription("strRDPSmartSize")] + SmartSize, + [Description("640x480")]Res640x480, + [Description("800x600")]Res800x600, + [Description("1024x768")]Res1024x768, + [Description("1152x864")]Res1152x864, + [Description("1280x800")]Res1280x800, + [Description("1280x1024")]Res1280x1024, + [Description("1400x1050")]Res1400x1050, + [Description("1440x900")]Res1440x900, + [Description("1600x1024")]Res1600x1024, + [Description("1600x1200")]Res1600x1200, + [Description("1600x1280")]Res1600x1280, + [Description("1680x1050")]Res1680x1050, + [Description("1900x1200")]Res1900x1200, + [Description("1920x1200")]Res1920x1200, + [Description("2048x1536")]Res2048x1536, + [Description("2560x2048")]Res2560x2048, + [Description("3200x2400")]Res3200x2400, + [Description("3840x2400")]Res3840x2400 + } + + public enum AuthenticationLevel + { + [LocalizedAttributes.LocalizedDescription("strAlwaysConnectEvenIfAuthFails")] + NoAuth = 0, + [LocalizedAttributes.LocalizedDescription("strDontConnectWhenAuthFails")] + AuthRequired = 1, + [LocalizedAttributes.LocalizedDescription("strWarnIfAuthFails")] + WarnOnFailedAuth = 2 + } + + public enum RDGatewayUsageMethod + { + [LocalizedAttributes.LocalizedDescription("strNever")] + Never = 0, // TSC_PROXY_MODE_NONE_DIRECT + [LocalizedAttributes.LocalizedDescription("strAlways")] + Always = 1, // TSC_PROXY_MODE_DIRECT + [LocalizedAttributes.LocalizedDescription("strDetect")] + Detect = 2 // TSC_PROXY_MODE_DETECT + } + + public enum RDGatewayUseConnectionCredentials + { + [LocalizedAttributes.LocalizedDescription("strUseDifferentUsernameAndPassword")] + No = 0, + [LocalizedAttributes.LocalizedDescription("strUseSameUsernameAndPassword")] + Yes = 1, + [LocalizedAttributes.LocalizedDescription("strUseSmartCard")] + SmartCard = 2 + } + #endregion + #region Resolution public static Rectangle GetResolutionRectangle(RDPResolutions resolution) { @@ -964,91 +1046,5 @@ namespace mRemoteNG.Connection.Protocol } } #endregion - - #region Events - public delegate void ConnectingEventHandler(object sender); - public event ConnectingEventHandler Connecting - { - add { ConnectingEvent = (ConnectingEventHandler)System.Delegate.Combine(ConnectingEvent, value); } - remove { ConnectingEvent = (ConnectingEventHandler)System.Delegate.Remove(ConnectingEvent, value); } - } - - public delegate void ConnectedEventHandler(object sender); - public event ConnectedEventHandler Connected - { - add { ConnectedEvent = (ConnectedEventHandler)System.Delegate.Combine(ConnectedEvent, value); } - remove { ConnectedEvent = (ConnectedEventHandler)System.Delegate.Remove(ConnectedEvent, value); } - } - - public delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage); - public event DisconnectedEventHandler Disconnected - { - add { DisconnectedEvent = (DisconnectedEventHandler)System.Delegate.Combine(DisconnectedEvent, value); } - remove { DisconnectedEvent = (DisconnectedEventHandler)System.Delegate.Remove(DisconnectedEvent, value); } - } - - public delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage); - public event ErrorOccuredEventHandler ErrorOccured - { - add { ErrorOccuredEvent = (ErrorOccuredEventHandler)System.Delegate.Combine(ErrorOccuredEvent, value); } - remove { ErrorOccuredEvent = (ErrorOccuredEventHandler)System.Delegate.Remove(ErrorOccuredEvent, value); } - } - - public delegate void ClosingEventHandler(object sender); - public event ClosingEventHandler Closing - { - add { ClosingEvent = (ClosingEventHandler)System.Delegate.Combine(ClosingEvent, value); } - remove { ClosingEvent = (ClosingEventHandler)System.Delegate.Remove(ClosingEvent, value); } - } - - public delegate void ClosedEventHandler(object sender); - public event ClosedEventHandler Closed - { - add { ClosedEvent = (ClosedEventHandler)System.Delegate.Combine(ClosedEvent, value); } - remove { ClosedEvent = (ClosedEventHandler)System.Delegate.Remove(ClosedEvent, value); } - } - - - public void Event_Closing(object sender) - { - if (ClosingEvent != null) - ClosingEvent(sender); - } - - public void Event_Closed(object sender) - { - if (ClosedEvent != null) - ClosedEvent(sender); - } - - public void Event_Connecting(object sender) - { - if (ConnectingEvent != null) - ConnectingEvent(sender); - } - - public void Event_Connected(object sender) - { - if (ConnectedEvent != null) - ConnectedEvent(sender); - } - - public void Event_Disconnected(object sender, string DisconnectedMessage) - { - if (DisconnectedEvent != null) - DisconnectedEvent(sender, DisconnectedMessage); - } - - public void Event_ErrorOccured(object sender, string ErrorMsg) - { - if (ErrorOccuredEvent != null) - ErrorOccuredEvent(sender, ErrorMsg); - } - - public void Event_ReconnectGroupCloseClicked() - { - Close(); - } - #endregion } } \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/RDP/RDPEnums.cs b/mRemoteV1/Connection/Protocol/RDP/RDPEnums.cs index 1a82fd6b..d3e4b468 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RDPEnums.cs +++ b/mRemoteV1/Connection/Protocol/RDP/RDPEnums.cs @@ -6,14 +6,6 @@ using System.ComponentModel; namespace mRemoteNG.Connection.Protocol.RDP { - public enum Defaults - { - Colors = RDPColors.Colors16Bit, - Sounds = RDPSounds.DoNotPlay, - Resolution = RDPResolutions.FitToWindow, - Port = 3389 - } - public enum RDPColors { [LocalizedAttributes.LocalizedDescription("strRDP256Colors")] @@ -38,7 +30,7 @@ namespace mRemoteNG.Connection.Protocol.RDP DoNotPlay = 2 } - private enum RDPPerformanceFlags + public enum RDPPerformanceFlags { [Description("strRDPDisableWallpaper")] DisableWallpaper = 0x1, @@ -133,4 +125,4 @@ namespace mRemoteNG.Connection.Protocol.RDP [LocalizedAttributes.LocalizedDescription("strUseSmartCard")] SmartCard = 2 } -} \ No newline at end of file +} diff --git a/mRemoteV1/Connection/Protocol/RDP/RDPVersions.cs b/mRemoteV1/Connection/Protocol/RDP/RDPVersions.cs new file mode 100644 index 00000000..2ca65ddd --- /dev/null +++ b/mRemoteV1/Connection/Protocol/RDP/RDPVersions.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.Connection.Protocol.RDP +{ + public class RDPVersions + { + public static Version RDC60 = new Version(6, 0, 6000); + public static Version RDC61 = new Version(6, 0, 6001); + public static Version RDC70 = new Version(6, 1, 7600); + public static Version RDC80 = new Version(6, 2, 9200); + } +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Rlogin.cs b/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs similarity index 50% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Rlogin.cs rename to mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs index eac2a1ad..6a8b187b 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Rlogin.cs +++ b/mRemoteV1/Connection/Protocol/Rlogin/Connection.Protocol.Rlogin.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Rlogin { - public class Rlogin : PuttyBase + public class ProtocolRlogin : PuttyBase { - public Rlogin() + public ProtocolRlogin() { this.PuttyProtocol = Putty_Protocol.rlogin; } @@ -15,4 +13,4 @@ namespace mRemoteNG.Connection.Protocol Port = 513 } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/RloginConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/RloginConnectionProtocol.cs deleted file mode 100644 index 45cb6e47..00000000 --- a/mRemoteV1/Connection/Protocol/RloginConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class RloginConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH1.cs b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs similarity index 60% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH1.cs rename to mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs index 75c7f01e..53d59a28 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH1.cs +++ b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH1.cs @@ -1,11 +1,11 @@ -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.SSH { - public class SSH1 : PuttyBase + public class ProtocolSSH1 : PuttyBase { - public SSH1() + public ProtocolSSH1() { this.PuttyProtocol = Putty_Protocol.ssh; this.PuttySSHVersion = Putty_SSHVersion.ssh1; diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH2.cs b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs similarity index 60% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH2.cs rename to mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs index 9c0d35f7..2fa12b4f 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.SSH2.cs +++ b/mRemoteV1/Connection/Protocol/SSH/Connection.Protocol.SSH2.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.SSH { - public class SSH2 : PuttyBase + public class ProtocolSSH2 : PuttyBase { - public SSH2() + public ProtocolSSH2() { this.PuttyProtocol = Putty_Protocol.ssh; this.PuttySSHVersion = Putty_SSHVersion.ssh2; diff --git a/mRemoteV1/Connection/Protocol/SSH1ConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/SSH1ConnectionProtocol.cs deleted file mode 100644 index dcb81ee8..00000000 --- a/mRemoteV1/Connection/Protocol/SSH1ConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class SSH1ConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/SSH2ConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/SSH2ConnectionProtocol.cs deleted file mode 100644 index 68870f54..00000000 --- a/mRemoteV1/Connection/Protocol/SSH2ConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class SSH2ConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Serial.cs b/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs similarity index 50% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Serial.cs rename to mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs index 676b5930..9e8d2ffd 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Serial.cs +++ b/mRemoteV1/Connection/Protocol/Serial/Connection.Protocol.Serial.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Serial { - public class Serial : PuttyBase + public class ProtocolSerial : PuttyBase { - public Serial() + public ProtocolSerial() { this.PuttyProtocol = Putty_Protocol.serial; } @@ -15,4 +13,4 @@ namespace mRemoteNG.Connection.Protocol Port = 9600 } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Telnet.cs b/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs similarity index 50% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Telnet.cs rename to mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs index 5d476b8a..7fc93cbf 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.Telnet.cs +++ b/mRemoteV1/Connection/Protocol/Telnet/Connection.Protocol.Telnet.cs @@ -1,11 +1,9 @@ - - -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.Telnet { - public class Telnet : PuttyBase + public class ProtocolTelnet : PuttyBase { - public Telnet() + public ProtocolTelnet() { this.PuttyProtocol = Putty_Protocol.telnet; } @@ -15,4 +13,4 @@ namespace mRemoteNG.Connection.Protocol Port = 23 } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/TelnetConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/TelnetConnectionProtocol.cs deleted file mode 100644 index 3883c53f..00000000 --- a/mRemoteV1/Connection/Protocol/TelnetConnectionProtocol.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - class TelnetConnectionProtocol : ConnectionProtocol - { - } -} diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.VNC.cs b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs similarity index 95% rename from mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.VNC.cs rename to mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs index b5cc8bd8..247e1570 100644 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.VNC.cs +++ b/mRemoteV1/Connection/Protocol/VNC/Connection.Protocol.VNC.cs @@ -5,9 +5,9 @@ using System.ComponentModel; using mRemoteNG.Tools; -namespace mRemoteNG.Connection.Protocol +namespace mRemoteNG.Connection.Protocol.VNC { - public class VNC : Base + public class ProtocolVNC : ProtocolBase { #region Properties public bool SmartSize @@ -25,18 +25,18 @@ namespace mRemoteNG.Connection.Protocol #region Private Declarations private VncSharp.RemoteDesktop _VNC; - private Connection.ConnectionRecordImp Info; + private Connection.ConnectionInfo Info; #endregion #region Public Methods - public VNC() + public ProtocolVNC() { this.Control = new VncSharp.RemoteDesktop(); } - public override bool SetProps() + public override bool Initialize() { - base.SetProps(); + base.Initialize(); try { @@ -153,10 +153,10 @@ namespace mRemoteNG.Connection.Protocol { switch (Keys) { - case Connection.Protocol.VNC.SpecialKeys.CtrlAltDel: + case ProtocolVNC.SpecialKeys.CtrlAltDel: _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlAltDel); break; - case Connection.Protocol.VNC.SpecialKeys.CtrlEsc: + case ProtocolVNC.SpecialKeys.CtrlEsc: _VNC.SendSpecialKeys(VncSharp.SpecialKeys.CtrlEsc); break; } @@ -246,7 +246,7 @@ namespace mRemoteNG.Connection.Protocol _VNC.ConnectComplete += VNCEvent_Connected; _VNC.ConnectionLost += VNCEvent_Disconnected; mRemoteNG.frmMain.clipboardchange += VNCEvent_ClipboardChanged; - if (!(((int)Force & (int)ConnectionRecordImp.Force.NoCredentials) == (int)ConnectionRecordImp.Force.NoCredentials) && !string.IsNullOrEmpty(Info.Password)) + if (!(((int)Force & (int)ConnectionInfo.Force.NoCredentials) == (int)ConnectionInfo.Force.NoCredentials) && !string.IsNullOrEmpty(Info.Password)) { _VNC.GetPassword = VNCEvent_Authenticate; } diff --git a/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs b/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs new file mode 100644 index 00000000..4dd4cc6b --- /dev/null +++ b/mRemoteV1/Connection/Protocol/VNC/VNCEnum.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; +using mRemoteNG.Tools; + +namespace mRemoteNG.Connection.Protocol.VNC +{ + public enum Defaults + { + Port = 5900 + } + + public enum SpecialKeys + { + CtrlAltDel, + CtrlEsc + } + + public enum Compression + { + [LocalizedAttributes.LocalizedDescription("strNoCompression")]CompNone = 99, + [Description("0")]Comp0 = 0, + [Description("1")]Comp1 = 1, + [Description("2")]Comp2 = 2, + [Description("3")]Comp3 = 3, + [Description("4")]Comp4 = 4, + [Description("5")]Comp5 = 5, + [Description("6")]Comp6 = 6, + [Description("7")]Comp7 = 7, + [Description("8")]Comp8 = 8, + [Description("9")]Comp9 = 9 + } + + public enum Encoding + { + [Description("Raw")]EncRaw, + [Description("RRE")]EncRRE, + [Description("CoRRE")]EncCorre, + [Description("Hextile")]EncHextile, + [Description("Zlib")]EncZlib, + [Description("Tight")]EncTight, + [Description("ZlibHex")]EncZLibHex, + [Description("ZRLE")]EncZRLE + } + + public enum AuthMode + { + [LocalizedAttributes.LocalizedDescription("VNC")] + AuthVNC, + [LocalizedAttributes.LocalizedDescription("Windows")] + AuthWin + } + + public enum ProxyType + { + [LocalizedAttributes.LocalizedDescription("strNone")] + ProxyNone, + [LocalizedAttributes.LocalizedDescription("strHttp")] + ProxyHTTP, + [LocalizedAttributes.LocalizedDescription("strSocks5")] + ProxySocks5, + [LocalizedAttributes.LocalizedDescription("strUltraVncRepeater")] + ProxyUltra + } + + public enum Colors + { + [LocalizedAttributes.LocalizedDescription("strNormal")] + ColNormal, + [Description("8-bit")]Col8Bit + } + + public enum SmartSizeMode + { + [LocalizedAttributes.LocalizedDescription("strNoSmartSize")] + SmartSNo, + [LocalizedAttributes.LocalizedDescription("strFree")] + SmartSFree, + [LocalizedAttributes.LocalizedDescription("strAspect")] + SmartSAspect + } +} diff --git a/mRemoteV1/Connection/Protocol/VNCConnectionProtocol.cs b/mRemoteV1/Connection/Protocol/VNCConnectionProtocol.cs deleted file mode 100644 index 10a88aa3..00000000 --- a/mRemoteV1/Connection/Protocol/VNCConnectionProtocol.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection.Protocol -{ - public class VNCConnectionProtocol : ConnectionProtocol - { - Protocols _name; - - public Protocols Name - { - get { return _name; } - } - - public VNCConnectionProtocol() - { - _name = Protocols.VNC; - } - - public void Connect() - { } - - public void Disconnect() - { } - - public void Reconnect() - { } - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.RAW.cs b/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.RAW.cs deleted file mode 100644 index d8a6a1c7..00000000 --- a/mRemoteV1/Connection/Protocol/deprecated/Connection.Protocol.RAW.cs +++ /dev/null @@ -1,17 +0,0 @@ - - -namespace mRemoteNG.Connection.Protocol -{ - public class RAW : Connection.Protocol.PuttyBase - { - public RAW() - { - this.PuttyProtocol = Putty_Protocol.raw; - } - - public enum Defaults - { - Port = 23 - } - } -} diff --git a/mRemoteV1/Connection/ProtocolEnum.cs b/mRemoteV1/Connection/ProtocolEnum.cs deleted file mode 100644 index faf11133..00000000 --- a/mRemoteV1/Connection/ProtocolEnum.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using mRemoteNG.Tools; -using mRemoteNG.Connection.Protocol; - -namespace mRemoteNG.Connection -{ - - public enum Protocols - { - [LocalizedAttributes.LocalizedDescription("strRDP")] - RDP = 0, - [LocalizedAttributes.LocalizedDescription("strVnc")] - VNC = 1, - [LocalizedAttributes.LocalizedDescription("strSsh1")] - SSH1 = 2, - [LocalizedAttributes.LocalizedDescription("strSsh2")] - SSH2 = 3, - [LocalizedAttributes.LocalizedDescription("strTelnet")] - Telnet = 4, - [LocalizedAttributes.LocalizedDescription("strRlogin")] - Rlogin = 5, - [LocalizedAttributes.LocalizedDescription("strRAW")] - RAW = 6, - [LocalizedAttributes.LocalizedDescription("strHttp")] - HTTP = 7, - [LocalizedAttributes.LocalizedDescription("strHttps")] - HTTPS = 8, - [LocalizedAttributes.LocalizedDescription("strICA")] - ICA = 9, - [LocalizedAttributes.LocalizedDescription("strExtApp")] - IntApp = 20 - } - - /* - public class Protocols : GenericEnum - { - public static readonly ConnectionProtocol RDP = new RDPConnectionProtocol(); - public static readonly ConnectionProtocol VNC = new VNCConnectionProtocol(); - public static readonly ConnectionProtocol SSH1 = new SSH1ConnectionProtocol(); - public static readonly ConnectionProtocol SSH2 = new SSH2ConnectionProtocol(); - public static readonly ConnectionProtocol Telnet = new TelnetConnectionProtocol(); - public static readonly ConnectionProtocol Rlogin = new RloginConnectionProtocol(); - public static readonly ConnectionProtocol RAW = new RAWConnectionProtocol(); - public static readonly ConnectionProtocol HTTP = new HttpConnectionProtocol(); - public static readonly ConnectionProtocol HTTPS = new HttpsConnectionProtocol(); - public static readonly ConnectionProtocol ICA = new ICAConnectionProtocol(); - public static readonly ConnectionProtocol IntApp = new OtherConnectionProtocol(); - } - */ -} \ No newline at end of file diff --git a/mRemoteV1/Connection/ProtocolManagerImp.cs b/mRemoteV1/Connection/ProtocolManagerImp.cs deleted file mode 100644 index 70fd43cd..00000000 --- a/mRemoteV1/Connection/ProtocolManagerImp.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using mRemoteNG.Tools; -using System.Collections.Generic; -using mRemoteNG.Connection.Protocol; - -namespace mRemoteNG.Connection -{ - public class ProtocolManagerImp : ProtocolManager - { - private static ProtocolManagerImp _instance; - private IDictionary _enumInterfaceProtocolPairs; - - private ProtocolManagerImp() - { - this.BuildProtocolList(); - } - - private void BuildProtocolList() - { - _enumInterfaceProtocolPairs = new Dictionary(); - _enumInterfaceProtocolPairs.Add(Protocols.HTTP, new HttpConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.HTTPS, new HttpsConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.ICA, new ICAConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.IntApp, new OtherConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.RAW, new RAWConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.RDP, new RDPConnectionProtocolImp()); - _enumInterfaceProtocolPairs.Add(Protocols.Rlogin, new RloginConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.SSH1, new SSH1ConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.SSH2, new SSH2ConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.Telnet, new TelnetConnectionProtocol()); - _enumInterfaceProtocolPairs.Add(Protocols.VNC, new VNCConnectionProtocol()); - } - - public static ConnectionProtocol GetConnectionProtocol(Protocols protocol) - { - return getSingletonInstance()._enumInterfaceProtocolPairs[protocol]; - } - - private static ProtocolManagerImp getSingletonInstance() - { - if (_instance == null) - _instance = new ProtocolManagerImp(); - return _instance; - } - - public static string ProtocolToString(Protocols protocol) - { - return protocol.ToString(); - } - - public static Protocols StringToProtocol(string protocol) - { - try - { - return (Protocols)Enum.Parse(typeof(Protocols), protocol, true); - } - catch (Exception) - { - return Protocols.RDP; - } - } - } -} \ No newline at end of file diff --git a/mRemoteV1/Connection/PuttySession.Info.cs b/mRemoteV1/Connection/PuttySessionInfo.cs similarity index 68% rename from mRemoteV1/Connection/PuttySession.Info.cs rename to mRemoteV1/Connection/PuttySessionInfo.cs index 195d1bcd..8678d48b 100644 --- a/mRemoteV1/Connection/PuttySession.Info.cs +++ b/mRemoteV1/Connection/PuttySessionInfo.cs @@ -1,17 +1,15 @@ -using System; -using Microsoft.VisualBasic; -using System.ComponentModel; +using mRemoteNG.App; using mRemoteNG.Messages; using mRemoteNG.My; -using mRemoteNG.App; using mRemoteNG.Tools; +using System; +using System.ComponentModel; -namespace mRemoteNG.Connection.PuttySession +namespace mRemoteNG.Connection { - public class Info : Connection.ConnectionRecordImp, IComponent - { - #region Commands + public class PuttySessionInfo : ConnectionInfo, IComponent + { [Command(),LocalizedAttributes.LocalizedDisplayName("strPuttySessionSettings")] public void SessionSettings() { @@ -35,20 +33,19 @@ namespace mRemoteNG.Connection.PuttySession Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strErrorCouldNotLaunchPutty + Environment.NewLine + ex.Message, false); } } - #endregion #region Properties [Browsable(false)] - public Root.PuttySessions.Info RootPuttySessionsInfo {get; set;} + public Root.PuttySessions.Info RootPuttySessionsInfo { get; set; } [ReadOnly(true)] - public override string PuttySession {get; set;} + public override string PuttySession { get; set; } [ReadOnly(true)] - public override string Name {get; set;} + public override string Name { get; set; } [ReadOnly(true), Browsable(false)] - public override string Description {get; set;} + public override string Description { get; set; } [ReadOnly(true), Browsable(false)] public override string Icon @@ -65,31 +62,31 @@ namespace mRemoteNG.Connection.PuttySession } [ReadOnly(true)] - public override string Hostname {get; set;} + public override string Hostname { get; set; } [ReadOnly(true)] - public override string Username {get; set;} + public override string Username { get; set; } [ReadOnly(true), Browsable(false)] - public override string Password {get; set;} + public override string Password { get; set; } [ReadOnly(true)] - public override Protocol.Protocols Protocol {get; set;} + public override Protocol.ProtocolType Protocol { get; set; } [ReadOnly(true)] - public override int Port {get; set;} + public override int Port { get; set; } [ReadOnly(true), Browsable(false)] - public override string PreExtApp {get; set;} + public override string PreExtApp { get; set; } [ReadOnly(true), Browsable(false)] - public override string PostExtApp {get; set;} + public override string PostExtApp { get; set; } [ReadOnly(true), Browsable(false)] - public override string MacAddress {get; set;} + public override string MacAddress { get; set; } [ReadOnly(true), Browsable(false)] - public override string UserField {get; set;} + public override string UserField { get; set; } #endregion #region IComponent @@ -109,4 +106,4 @@ namespace mRemoteNG.Connection.PuttySession public event EventHandler Disposed; #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Connection/RDPProtocolOptionsImp.cs b/mRemoteV1/Connection/RDPProtocolOptionsImp.cs deleted file mode 100644 index 6577e4e1..00000000 --- a/mRemoteV1/Connection/RDPProtocolOptionsImp.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Reflection; - -namespace mRemoteNG.Connection -{ - public class RDPProtocolOptionsImp : ConnectionProtocolOptions - { - private Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod _rdGatewayUsageMethod; - private Protocol.RDPConnectionProtocolImp.AuthenticationLevel _rdpAuthenticationLevel; - private Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials _rdGatewayUseConnectionCredentials; - private Protocol.RDPConnectionProtocolImp.RDPResolutions _resolution; - private Protocol.RDPConnectionProtocolImp.RDPSounds _redirectSound; - private Protocol.RDPConnectionProtocolImp.RDPColors _colors; - private string _rdGatewayHostname; - private string _rdGatewayUsername; - private string _rdGatewayPassword; - private string _rdGatewayDomain; - private bool _automaticResize; - private bool _cacheBitmaps; - private bool _displayWallpaper; - private bool _displayThemes; - private bool _enableFontSmoothing; - private bool _enableDesktopComposition; - private bool _redirectKeys; - private bool _redirectDiskDrives; - private bool _redirectPrinters; - private bool _redirectPorts; - private bool _redirectSmartCards; - private bool _useConsoleSession; - private bool _useCredSsp; - private string _loadBalanceInfo; - - - public RDPProtocolOptionsImp() - { - this.SetDefaults(); - } - - public PropertyInfo[] GetSupportedOptions() - { - return this.GetType().GetProperties(); - } - - private void SetDefaults() - { - - } - } -} diff --git a/mRemoteV1/Connection/Resizeable.cs b/mRemoteV1/Connection/Resizeable.cs deleted file mode 100644 index 0a6ef2ef..00000000 --- a/mRemoteV1/Connection/Resizeable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace mRemoteNG.Connection -{ - public interface Resizeable - { - void Resize(System.Object sender, EventArgs e); - void ResizeBegin(System.Object sender, EventArgs e); - void ResizeEnd(System.Object sender, EventArgs e) - } -} diff --git a/mRemoteV1/Container/Container.List.cs b/mRemoteV1/Container/Container.List.cs deleted file mode 100644 index aed5491e..00000000 --- a/mRemoteV1/Container/Container.List.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections; - - -namespace mRemoteNG.Container -{ - public class List : CollectionBase - { - #region Public Properties - public Container.Info this[object Index] - { - get - { - if (Index is Container.Info) - { - return (Container.Info)Index; - } - else - { - return ((Container.Info) (List[System.Convert.ToInt32(Index)])); - } - } - } - - public new int Count - { - get - { - return List.Count; - } - } - #endregion - - #region Public Methods - public Container.Info Add(Container.Info cInfo) - { - this.List.Add(cInfo); - return cInfo; - } - - public void AddRange(Container.Info[] cInfo) - { - foreach (Container.Info cI in cInfo) - { - List.Add(cI); - } - } - - public Container.Info FindByConstantID(string id) - { - foreach (Container.Info contI in List) - { - if (contI.ConnectionRecord.MetaData.ConstantID == id) - { - return contI; - } - } - - return null; - } - - public Container.List Copy() - { - try - { - return (Container.List)this.MemberwiseClone(); - } - catch (Exception) - { - } - - return null; - } - - public new void Clear() - { - this.List.Clear(); - } - #endregion - } -} diff --git a/mRemoteV1/Container/Container.Info.cs b/mRemoteV1/Container/ContainerInfo.cs similarity index 84% rename from mRemoteV1/Container/Container.Info.cs rename to mRemoteV1/Container/ContainerInfo.cs index c4949625..9868a1fb 100644 --- a/mRemoteV1/Container/Container.Info.cs +++ b/mRemoteV1/Container/ContainerInfo.cs @@ -2,13 +2,12 @@ using System; using System.Windows.Forms; using mRemoteNG.Tools; using System.ComponentModel; -using mRemoteNG.Connection; namespace mRemoteNG.Container { [DefaultProperty("Name")] - public class Info + public class ContainerInfo { #region Properties [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), @@ -21,8 +20,8 @@ namespace mRemoteNG.Container LocalizedAttributes.LocalizedDescription("strPropertyDescriptionName")] public string Name { - get { return ConnectionRecord.Name; } - set { ConnectionRecord.Name = value; } + get { return ConnectionInfo.Name; } + set { ConnectionInfo.Name = value; } } private TreeNode _TreeNode; @@ -71,9 +70,9 @@ namespace mRemoteNG.Container get { return this._IsExpanded; } set { this._IsExpanded = value; } } - - private ConnectionRecord _ConnectionInfo = new ConnectionRecordImp(); - public ConnectionRecord ConnectionRecord + + private Connection.ConnectionInfo _ConnectionInfo = new Connection.ConnectionInfo(); + public Connection.ConnectionInfo ConnectionInfo { get { return this._ConnectionInfo; } set { this._ConnectionInfo = value; } @@ -81,12 +80,12 @@ namespace mRemoteNG.Container #endregion #region Methods - public Container.Info Copy() + public Container.ContainerInfo Copy() { - return (Info)this.MemberwiseClone(); + return (ContainerInfo)this.MemberwiseClone(); } - public Info() + public ContainerInfo() { this.SetDefaults(); } diff --git a/mRemoteV1/Container/ContainerList.cs b/mRemoteV1/Container/ContainerList.cs new file mode 100644 index 00000000..8578e9fb --- /dev/null +++ b/mRemoteV1/Container/ContainerList.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections; + + +namespace mRemoteNG.Container +{ + public class ContainerList : CollectionBase + { + public ContainerInfo this[object Index] + { + get + { + if (Index is ContainerInfo) + return (ContainerInfo)Index; + else + return ((ContainerInfo) (List[System.Convert.ToInt32(Index)])); + } + } + + public new int Count + { + get { return List.Count; } + } + + public ContainerList() : base() + { } + + #region Public Methods + public ContainerInfo Add(ContainerInfo containerInfo) + { + this.List.Add(containerInfo); + return containerInfo; + } + + public void AddRange(ContainerInfo[] cInfo) + { + foreach (ContainerInfo containerInfo in cInfo) + { + List.Add(containerInfo); + } + } + + public ContainerInfo FindByConstantID(string id) + { + foreach (ContainerInfo containerInfo in List) + { + if (containerInfo.ConnectionInfo.ConstantID == id) + { + return containerInfo; + } + } + + return null; + } + + public ContainerList Copy() + { + try + { + return (ContainerList)this.MemberwiseClone(); + } + catch (Exception) + { + } + + return null; + } + + public new void Clear() + { + this.List.Clear(); + } + #endregion + } +} diff --git a/mRemoteV1/Credential/Credential.List.cs b/mRemoteV1/Credential/Credential.List.cs deleted file mode 100644 index 5cc53a8b..00000000 --- a/mRemoteV1/Credential/Credential.List.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections; - - -namespace mRemoteNG.Credential -{ - public class List : CollectionBase - { - #region Public Properties - public Credential.CredentialRecordImp this[object Index] - { - get - { - if (Index is Credential.CredentialRecordImp) - { - return (Credential.CredentialRecordImp)Index; - } - else - { - return ((Credential.CredentialRecordImp) (List[System.Convert.ToInt32(Index)])); - } - } - } - - public new int Count - { - get - { - return List.Count; - } - } - #endregion - - #region Public Methods - public Credential.CredentialRecordImp Add(Credential.CredentialRecordImp cInfo) - { - List.Add(cInfo); - return cInfo; - } - - public void AddRange(Credential.CredentialRecordImp[] cInfo) - { - foreach (Credential.CredentialRecordImp cI in cInfo) - { - List.Add(cI); - } - } - - public Credential.List Copy() - { - try - { - return (Credential.List)this.MemberwiseClone(); - } - catch (Exception) - { - } - - return null; - } - - public new void Clear() - { - List.Clear(); - } - #endregion - } -} diff --git a/mRemoteV1/Credential/CredentialRecordImp.cs b/mRemoteV1/Credential/CredentialInfo.cs similarity index 72% rename from mRemoteV1/Credential/CredentialRecordImp.cs rename to mRemoteV1/Credential/CredentialInfo.cs index d323a2a8..b0e624e3 100644 --- a/mRemoteV1/Credential/CredentialRecordImp.cs +++ b/mRemoteV1/Credential/CredentialInfo.cs @@ -4,49 +4,34 @@ using System.ComponentModel; namespace mRemoteNG.Credential { - public class CredentialRecordImp : CredentialRecord + public class CredentialInfo { - #region 1 Display - private string _Name; + private string _Name; + private string _Description; + private string _Username; + private string _Password; + private string _Domain; + + #region Public Properties [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), Browsable(true), LocalizedAttributes.LocalizedDisplayName("strPropertyNameName"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionName")] public string Name { - get - { - return _Name; - } - set - { - _Name = value; - } + get { return _Name; } + set { _Name = value; } } - - private string _Description; + [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), Browsable(true), LocalizedAttributes.LocalizedDisplayName("strPropertyNameDescription"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDescription")] public string Description { - get - { - return _Description; - } - set - { - _Description = value; - } + get { return _Description; } + set { _Description = value; } } - #endregion - - #region 2 Credentials - private string _Username; - private string _Password; - private string _Domain; - [LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2), Browsable(true), @@ -54,31 +39,18 @@ namespace mRemoteNG.Credential LocalizedAttributes.LocalizedDescription("strPropertyDescriptionUsername")] public string Username { - get - { - return _Username; - } - set - { - _Username = value; - } + get { return _Username; } + set { _Username = value; } } [LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2), Browsable(true), LocalizedAttributes.LocalizedDisplayName("strPropertyNamePassword"), LocalizedAttributes.LocalizedDescription("strPropertyDescriptionPassword"), - PasswordPropertyText(true)] - public string Password + PasswordPropertyText(true)]public string Password { - get - { - return _Password; - } - set - { - _Password = value; - } + get { return _Password; } + set { _Password = value; } } [LocalizedAttributes.LocalizedCategory("strCategoryCredentials", 2), @@ -87,14 +59,8 @@ namespace mRemoteNG.Credential LocalizedAttributes.LocalizedDescription("strPropertyDescriptionDomain")] public string Domain { - get - { - return _Domain; - } - set - { - _Domain = value; - } + get { return _Domain; } + set { _Domain = value; } } #endregion } diff --git a/mRemoteV1/Credential/CredentialList.cs b/mRemoteV1/Credential/CredentialList.cs new file mode 100644 index 00000000..88ceb580 --- /dev/null +++ b/mRemoteV1/Credential/CredentialList.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections; + + +namespace mRemoteNG.Credential +{ + public class CredentialList : CollectionBase + { + #region Public Properties + public CredentialInfo this[object Index] + { + get + { + if (Index is CredentialInfo) + { + return (CredentialInfo)Index; + } + else + { + return ((CredentialInfo) (List[Convert.ToInt32(Index)])); + } + } + } + + public new int Count + { + get + { + return List.Count; + } + } + #endregion + + #region Public Methods + public CredentialInfo Add(CredentialInfo credentialInfo) + { + List.Add(credentialInfo); + return credentialInfo; + } + + public void AddRange(CredentialInfo[] cInfo) + { + foreach (CredentialInfo cI in cInfo) + { + List.Add(cI); + } + } + + public CredentialList Copy() + { + try + { + return (CredentialList)this.MemberwiseClone(); + } + catch (Exception) + { + } + + return null; + } + + public new void Clear() + { + List.Clear(); + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/Credential/CredentialRecord.cs b/mRemoteV1/Credential/CredentialRecord.cs deleted file mode 100644 index b7fb15a0..00000000 --- a/mRemoteV1/Credential/CredentialRecord.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; - -namespace mRemoteNG.Credential -{ - public interface CredentialRecord - { - string Username { get; set; } - //SecureString Password { get; set; } - string Password { get; set; } - string Domain { get; set; } - } -} \ No newline at end of file diff --git a/mRemoteV1/Images/ErrorImageType.cs b/mRemoteV1/Images/ErrorImageType.cs new file mode 100644 index 00000000..43465de2 --- /dev/null +++ b/mRemoteV1/Images/ErrorImageType.cs @@ -0,0 +1,9 @@ +namespace mRemoteNG.Images +{ + public enum ErrorImageType + { + _Information = 0, + _Warning = 1, + _Error = 2 + } +} \ No newline at end of file diff --git a/mRemoteV1/Images/Images.Enums.cs b/mRemoteV1/Images/Images.Enums.cs deleted file mode 100644 index b16fe063..00000000 --- a/mRemoteV1/Images/Images.Enums.cs +++ /dev/null @@ -1,23 +0,0 @@ - - -namespace mRemoteNG.Images -{ - public class Enums - { - public enum TreeImage - { - Root = 0, - Container = 1, - ConnectionOpen = 2, - ConnectionClosed = 3, - PuttySessions = 4 - } - - public enum ErrorImage - { - _Information = 0, - _Warning = 1, - _Error = 2 - } - } -} diff --git a/mRemoteV1/Images/TreeImageType.cs b/mRemoteV1/Images/TreeImageType.cs new file mode 100644 index 00000000..956e9574 --- /dev/null +++ b/mRemoteV1/Images/TreeImageType.cs @@ -0,0 +1,11 @@ +namespace mRemoteNG.Images +{ + public enum TreeImageType + { + Root = 0, + Container = 1, + ConnectionOpen = 2, + ConnectionClosed = 3, + PuttySessions = 4 + } +} \ No newline at end of file diff --git a/mRemoteV1/Messages/Messages.Message.cs b/mRemoteV1/Messages/Message.cs similarity index 53% rename from mRemoteV1/Messages/Messages.Message.cs rename to mRemoteV1/Messages/Message.cs index 605d1b4b..ef403e56 100644 --- a/mRemoteV1/Messages/Messages.Message.cs +++ b/mRemoteV1/Messages/Message.cs @@ -3,17 +3,12 @@ using System; namespace mRemoteNG.Messages { - public enum MessageClass - { - InformationMsg = 0, - WarningMsg = 1, - ErrorMsg = 2, - ReportMsg = 3 - } - public class Message { private MessageClass _MsgClass; + private string _MsgText; + private DateTime _MsgDate; + public MessageClass MsgClass { get @@ -25,8 +20,7 @@ namespace mRemoteNG.Messages _MsgClass = value; } } - - private string _MsgText; + public string MsgText { get @@ -38,8 +32,7 @@ namespace mRemoteNG.Messages _MsgText = value; } } - - private DateTime _MsgDate; + public DateTime MsgDate { get @@ -51,5 +44,18 @@ namespace mRemoteNG.Messages _MsgDate = value; } } + + + public Message() + : this(MessageClass.InformationMsg, "", DateTime.Now) + { + } + + public Message(MessageClass messageClass, string messageText, DateTime messageDate) + { + _MsgClass = messageClass; + _MsgText = messageText; + _MsgDate = messageDate; + } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Messages/MessageClassEnum.cs b/mRemoteV1/Messages/MessageClassEnum.cs new file mode 100644 index 00000000..38d1069c --- /dev/null +++ b/mRemoteV1/Messages/MessageClassEnum.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.Messages +{ + public enum MessageClass + { + InformationMsg = 0, + WarningMsg = 1, + ErrorMsg = 2, + ReportMsg = 3 + } +} \ No newline at end of file diff --git a/mRemoteV1/Messages/Messages.Collector.cs b/mRemoteV1/Messages/MessageCollector.cs similarity index 56% rename from mRemoteV1/Messages/Messages.Collector.cs rename to mRemoteV1/Messages/MessageCollector.cs index 346a2aec..69bc9d01 100644 --- a/mRemoteV1/Messages/Messages.Collector.cs +++ b/mRemoteV1/Messages/MessageCollector.cs @@ -3,149 +3,117 @@ using System.Diagnostics; using Microsoft.VisualBasic; using System.Windows.Forms; using mRemoteNG.My; +using mRemoteNG.UI.Window; +using mRemoteNG.App; namespace mRemoteNG.Messages { - public class Collector + public class MessageCollector { - #region Constructors - public Collector(UI.Window.ErrorsAndInfos MessageCollectorForm) - { - this._MCForm = MessageCollectorForm; - CreateTimer(); - } - #endregion + private Timer _ECTimer; + private ErrorAndInfoWindow _MCForm; - #region Private Properties - private Timer ECTimer; - private UI.Window.ErrorsAndInfos _MCForm; - #endregion - - #region Public Properties - public UI.Window.ErrorsAndInfos MCForm + public ErrorAndInfoWindow MCForm { get { return this._MCForm; } set { this._MCForm = value; } } - #endregion + + public MessageCollector(ErrorAndInfoWindow MessageCollectorForm) + { + this._MCForm = MessageCollectorForm; + CreateTimer(); + } #region Public Methods - public void AddMessage(Messages.MessageClass MsgClass, string MsgText, bool OnlyLog = false) + public void AddMessage(MessageClass MsgClass, string MsgText, bool OnlyLog = false) { - Messages.Message nMsg = new Messages.Message(); - nMsg.MsgClass = MsgClass; - nMsg.MsgText = MsgText; - nMsg.MsgDate = DateTime.Now; - - if (Settings.Default.SwitchToMCOnInformation && nMsg.MsgClass == Messages.MessageClass.InformationMsg) - { - Debug.Print("Info: " + nMsg.MsgText); - if (Settings.Default.WriteLogFile) - { - App.Runtime.Log.Info(nMsg.MsgText); - } - - if (OnlyLog) - { - return; - } - - if (Settings.Default.ShowNoMessageBoxes) - { - ECTimer.Enabled = true; - } - else - { - ShowMessageBox(nMsg); - } - } - - if (Settings.Default.SwitchToMCOnWarning && nMsg.MsgClass == Messages.MessageClass.WarningMsg) - { - Debug.Print("Warning: " + nMsg.MsgText); - if (Settings.Default.WriteLogFile) - { - App.Runtime.Log.Warn(nMsg.MsgText); - } - - if (OnlyLog) - { - return; - } - - if (Settings.Default.ShowNoMessageBoxes) - { - ECTimer.Enabled = true; - } - else - { - ShowMessageBox(nMsg); - } - } - - if (Settings.Default.SwitchToMCOnError && nMsg.MsgClass == Messages.MessageClass.ErrorMsg) - { - Debug.Print("Error: " + nMsg.MsgText); - - // Always log error messages - App.Runtime.Log.Error(nMsg.MsgText); - - if (OnlyLog) - { - return; - } - - if (Settings.Default.ShowNoMessageBoxes) - { - ECTimer.Enabled = true; - } - else - { - ShowMessageBox(nMsg); - } - } + Message nMsg = new Message(MsgClass, MsgText, DateTime.Now); if (nMsg.MsgClass == MessageClass.ReportMsg) { - Debug.Print("Report: " + nMsg.MsgText); - - if (Settings.Default.WriteLogFile) - { - App.Runtime.Log.Info(nMsg.MsgText); - } - + AddReportMessage(nMsg); return; } + if (Settings.Default.SwitchToMCOnInformation && nMsg.MsgClass == MessageClass.InformationMsg) + AddInfoMessage(OnlyLog, nMsg); + + if (Settings.Default.SwitchToMCOnWarning && nMsg.MsgClass == MessageClass.WarningMsg) + AddWarningMessage(OnlyLog, nMsg); + + if (Settings.Default.SwitchToMCOnError && nMsg.MsgClass == MessageClass.ErrorMsg) + AddErrorMessage(OnlyLog, nMsg); + + if (!OnlyLog) + { + if (Settings.Default.ShowNoMessageBoxes) + _ECTimer.Enabled = true; + else + ShowMessageBox(nMsg); + + ListViewItem lvItem = BuildListViewItem(nMsg); + AddToList(lvItem); + } + } + + private void AddInfoMessage(bool OnlyLog, Message nMsg) + { + Debug.Print("Info: " + nMsg.MsgText); + if (Settings.Default.WriteLogFile) + Runtime.Log.Info(nMsg.MsgText); + } + + private void AddWarningMessage(bool OnlyLog, Message nMsg) + { + Debug.Print("Warning: " + nMsg.MsgText); + if (Settings.Default.WriteLogFile) + Runtime.Log.Warn(nMsg.MsgText); + } + + private void AddErrorMessage(bool OnlyLog, Message nMsg) + { + Debug.Print("Error: " + nMsg.MsgText); + Runtime.Log.Error(nMsg.MsgText); + } + + private static void AddReportMessage(Message nMsg) + { + Debug.Print("Report: " + nMsg.MsgText); + if (Settings.Default.WriteLogFile) + Runtime.Log.Info(nMsg.MsgText); + } + + private static ListViewItem BuildListViewItem(Message nMsg) + { ListViewItem lvItem = new ListViewItem(); - lvItem.ImageIndex = System.Convert.ToInt32(nMsg.MsgClass); + lvItem.ImageIndex = Convert.ToInt32(nMsg.MsgClass); lvItem.Text = nMsg.MsgText.Replace(Environment.NewLine, " "); lvItem.Tag = nMsg; - - AddToList(lvItem); + return lvItem; } public void AddExceptionMessage(string message, Exception ex, MessageClass msgClass = MessageClass.ErrorMsg, bool logOnly = false) { - AddMessage(msgClass, message + Environment.NewLine + Tools.Misc.GetExceptionMessageRecursive(ex), logOnly); + AddMessage(msgClass, message + Environment.NewLine + Tools.MiscTools.GetExceptionMessageRecursive(ex), logOnly); } -#endregion + #endregion #region Private Methods private void CreateTimer() { - ECTimer = new Timer(); - ECTimer.Enabled = false; - ECTimer.Interval = 300; - ECTimer.Tick += SwitchTimerTick; + _ECTimer = new Timer(); + _ECTimer.Enabled = false; + _ECTimer.Interval = 300; + _ECTimer.Tick += SwitchTimerTick; } private void SwitchTimerTick(object sender, System.EventArgs e) { this.SwitchToMessage(); - this.ECTimer.Enabled = false; + this._ECTimer.Enabled = false; } private void SwitchToMessage() @@ -205,4 +173,4 @@ namespace mRemoteNG.Messages } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Themes/ThemeInfo.cs b/mRemoteV1/Themes/ThemeInfo.cs index 19664253..9a7a39e0 100644 --- a/mRemoteV1/Themes/ThemeInfo.cs +++ b/mRemoteV1/Themes/ThemeInfo.cs @@ -93,16 +93,6 @@ namespace mRemoteNG.Themes return true; } - - public override int GetHashCode() - { - int hash = 29; - foreach (System.Reflection.PropertyInfo propertyInfo in this.GetType().GetProperties()) - { - hash = hash * 17 + System.Convert.ToInt32(propertyInfo.GetValue(this, null)).GetHashCode(); - } - return hash; - } #endregion #region Events diff --git a/mRemoteV1/Themes/ThemeManager.cs b/mRemoteV1/Themes/ThemeManager.cs index 6f17878a..ebd6cd92 100644 --- a/mRemoteV1/Themes/ThemeManager.cs +++ b/mRemoteV1/Themes/ThemeManager.cs @@ -43,7 +43,7 @@ namespace mRemoteNG.Themes themes.Add(DefaultTheme); try { - themes.AddRange(ThemeSerializer.LoadFromXmlFile(Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName))); + themes.AddRange(ThemeSerializer.LoadFromXmlFile(Path.Combine(App.Info.SettingsFileInfo.SettingsPath, App.Info.SettingsFileInfo.ThemesFileName))); } catch (FileNotFoundException) { @@ -55,7 +55,7 @@ namespace mRemoteNG.Themes public static void SaveThemes(List themes) { themes.Remove(DefaultTheme); - ThemeSerializer.SaveToXmlFile(themes, Path.Combine(App.Info.Settings.SettingsPath, App.Info.Settings.ThemesFileName)); + ThemeSerializer.SaveToXmlFile(themes, Path.Combine(App.Info.SettingsFileInfo.SettingsPath, App.Info.SettingsFileInfo.ThemesFileName)); } public static void SaveThemes(ThemeInfo[] themes) diff --git a/mRemoteV1/Tools/ArgumentParser.cs b/mRemoteV1/Tools/ArgumentParser.cs new file mode 100644 index 00000000..f0affe36 --- /dev/null +++ b/mRemoteV1/Tools/ArgumentParser.cs @@ -0,0 +1,250 @@ +using System; +using System.Collections.Generic; +using System.Text; +using mRemoteNG.Connection; + +namespace mRemoteNG.Tools +{ + public class ArgumentParser + { + ConnectionInfo _connectionInfo; + + public ArgumentParser(ConnectionInfo connectionInfo) + { + _connectionInfo = connectionInfo; + } + + public string ParseArguments(string input) + { + int index = 0; + List replacements = new List(); + + do + { + int tokenStart = input.IndexOf("%", index, StringComparison.InvariantCulture); + if (tokenStart == -1) + { + break; + } + + int tokenEnd = input.IndexOf("%", tokenStart + 1, StringComparison.InvariantCulture); + if (tokenEnd == -1) + { + break; + } + + int tokenLength = tokenEnd - tokenStart + 1; + + int variableNameStart = tokenStart + 1; + int variableNameLength = tokenLength - 2; + + bool isEnvironmentVariable = false; + + string variableName = ""; + + if (tokenStart > 0) + { + char tokenStartPrefix = input.Substring(tokenStart - 1, 1).ToCharArray()[0]; + char tokenEndPrefix = input.Substring(tokenEnd - 1, 1).ToCharArray()[0]; + + if (tokenStartPrefix == '\\' && tokenEndPrefix == '\\') + { + isEnvironmentVariable = true; + + // Add the first backslash to the token + tokenStart--; + tokenLength++; + + // Remove the last backslash from the name + variableNameLength--; + } + else if (tokenStartPrefix == '^' && tokenEndPrefix == '^') + { + // Add the first caret to the token + tokenStart--; + tokenLength++; + + // Remove the last caret from the name + variableNameLength--; + + variableName = input.Substring(variableNameStart, variableNameLength); + replacements.Add(new Replacement(tokenStart, tokenLength, string.Format("%{0}%", variableName))); + + index = tokenEnd; + continue; + } + } + + string token = input.Substring(tokenStart, tokenLength); + + EscapeType escape = EscapeType.All; + string prefix = input.Substring(variableNameStart, 1); + switch (prefix) + { + case "-": + escape = EscapeType.ShellMetacharacters; + break; + case "!": + escape = EscapeType.None; + break; + } + + if (!(escape == EscapeType.All)) + { + // Remove the escape character from the name + variableNameStart++; + variableNameLength--; + } + + if (variableNameLength == 0) + { + index = tokenEnd; + continue; + } + + variableName = input.Substring(variableNameStart, variableNameLength); + + string replacementValue = token; + if (!isEnvironmentVariable) + { + replacementValue = GetVariableReplacement(variableName, token); + } + + bool haveReplacement = false; + + if (!(replacementValue == token)) + { + haveReplacement = true; + } + else + { + replacementValue = Environment.GetEnvironmentVariable(variableName); + if (replacementValue != null) + haveReplacement = true; + } + + if (haveReplacement) + { + char trailing = '\0'; + if (tokenEnd + 2 <= input.Length) + trailing = input.Substring(tokenEnd + 1, 1).ToCharArray()[0]; + else + trailing = string.Empty.ToCharArray()[0]; + + if (escape == EscapeType.All) + { + replacementValue = CommandLineArguments.EscapeBackslashes(replacementValue); + if (trailing == '\'') + replacementValue = CommandLineArguments.EscapeBackslashesForTrailingQuote(replacementValue); + } + + if (escape == EscapeType.All | escape == EscapeType.ShellMetacharacters) + replacementValue = CommandLineArguments.EscapeShellMetacharacters(replacementValue); + + replacements.Add(new Replacement(tokenStart, tokenLength, replacementValue)); + index = tokenEnd + 1; + } + else + { + index = tokenEnd; + } + } while (true); + + string result = input; + + for (index = result.Length; index >= 0; index--) + { + foreach (Replacement replacement in replacements) + { + if (!(replacement.Start == index)) + { + continue; + } + + string before = result.Substring(0, replacement.Start); + string after = result.Substring(replacement.Start + replacement.Length); + result = before + replacement.Value + after; + } + } + return result; + } + + private string GetVariableReplacement(string variable, string original) + { + string replacement = ""; + if (_connectionInfo != null) + { + switch (variable.ToLowerInvariant()) + { + case "name": + replacement = _connectionInfo.Name; + break; + case "hostname": + replacement = _connectionInfo.Hostname; + break; + case "port": + replacement = Convert.ToString(_connectionInfo.Port); + break; + case "username": + replacement = _connectionInfo.Username; + break; + case "password": + replacement = _connectionInfo.Password; + break; + case "domain": + replacement = _connectionInfo.Domain; + break; + case "description": + replacement = _connectionInfo.Description; + break; + case "macaddress": + replacement = _connectionInfo.MacAddress; + break; + case "userfield": + replacement = _connectionInfo.UserField; + break; + default: + return original; + } + } + return replacement; + } + + private enum EscapeType + { + All, + ShellMetacharacters, + None + } + + private struct Replacement + { + int _start; + int _length; + string _value; + + public int Start + { + get { return _start; } + set { _start = value; } + } + public int Length + { + get { return _length; } + set { _length = value; } + } + public string Value + { + get { return _value; } + set { _value = value; } + } + + public Replacement(int start, int length, string value) + { + _start = start; + _length = length; + _value = value; + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Tools/CmdArgumentsInterpreter.cs b/mRemoteV1/Tools/CmdArgumentsInterpreter.cs new file mode 100644 index 00000000..b1b5acb2 --- /dev/null +++ b/mRemoteV1/Tools/CmdArgumentsInterpreter.cs @@ -0,0 +1,114 @@ +using mRemoteNG.App; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using System.Text.RegularExpressions; + +namespace mRemoteNG.Tools +{ + // + //* Arguments class: application arguments interpreter + //* + //* Authors: R. LOPES + //* Contributors: R. LOPES + //* Created: 25 October 2002 + //* Modified: 28 October 2002 + //* + //* Version: 1.0 + // + public class CmdArgumentsInterpreter + { + private StringDictionary Parameters; + + // Retrieve a parameter value if it exists + public string this[string Param] + { + get + { + return (Parameters[Param]); + } + } + + public CmdArgumentsInterpreter(string[] Args) + { + Parameters = new StringDictionary(); + Regex Spliter = new Regex("^-{1,2}|^/|=|:", (RegexOptions)(RegexOptions.IgnoreCase | RegexOptions.Compiled)); + Regex Remover = new Regex("^[\'\"]?(.*?)[\'\"]?$", (RegexOptions)(RegexOptions.IgnoreCase | RegexOptions.Compiled)); + string Parameter = null; + string[] Parts = null; + + // Valid parameters forms: + // {-,/,--}param{ ,=,:}((",')value(",')) + // Examples: -param1 value1 --param2 /param3:"Test-:-work" /param4=happy -param5 '--=nice=--' + + try + { + foreach (string Txt in Args) + { + // Look for new parameters (-,/ or --) and a possible enclosed value (=,:) + Parts = Spliter.Split(Txt, 3); + switch (Parts.Length) + { + case 1: + // Found a value (for the last parameter found (space separator)) + if (Parameter != null) + { + if (!Parameters.ContainsKey(Parameter)) + { + Parts[0] = Remover.Replace(Parts[0], "$1"); + Parameters.Add(Parameter, Parts[0]); + } + Parameter = null; + } + // else Error: no parameter waiting for a value (skipped) + break; + case 2: + // Found just a parameter + // The last parameter is still waiting. With no value, set it to true. + if (Parameter != null) + { + if (!Parameters.ContainsKey(Parameter)) + { + Parameters.Add(Parameter, "true"); + } + } + Parameter = Parts[1]; + break; + case 3: + // Parameter with enclosed value + // The last parameter is still waiting. With no value, set it to true. + if (Parameter != null) + { + if (!Parameters.ContainsKey(Parameter)) + { + Parameters.Add(Parameter, "true"); + } + } + Parameter = Parts[1]; + // Remove possible enclosing characters (",') + if (!Parameters.ContainsKey(Parameter)) + { + Parts[2] = Remover.Replace(Parts[2], "$1"); + Parameters.Add(Parameter, Parts[2]); + } + Parameter = null; + break; + } + } + // In case a parameter is still waiting + if (Parameter != null) + { + if (!Parameters.ContainsKey(Parameter)) + { + Parameters.Add(Parameter, "true"); + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Creating new Args failed" + Environment.NewLine + ex.Message, true); + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Tools/EnumWindows.cs b/mRemoteV1/Tools/EnumWindows.cs index 03579729..93b7cd33 100644 --- a/mRemoteV1/Tools/EnumWindows.cs +++ b/mRemoteV1/Tools/EnumWindows.cs @@ -6,7 +6,11 @@ namespace mRemoteNG.Tools { public class EnumWindows { - public static List EnumWindows_Renamed() + public EnumWindows() + { + } + + public List EnumWindows_Renamed() { List handleList = new List(); @@ -18,7 +22,7 @@ namespace mRemoteNG.Tools return handleList; } - public static List EnumChildWindows(IntPtr hWndParent) + public List EnumChildWindows(IntPtr hWndParent) { List handleList = new List(); @@ -30,9 +34,9 @@ namespace mRemoteNG.Tools return handleList; } - private static readonly List> HandleLists = new List>(); + private readonly List> HandleLists = new List>(); - private static bool EnumCallback(int hwnd, int lParam) + private bool EnumCallback(int hwnd, int lParam) { HandleLists[lParam].Add((IntPtr)hwnd); return true; @@ -42,7 +46,7 @@ namespace mRemoteNG.Tools private class Win32 { // ReSharper restore ClassNeverInstantiated.Local - public delegate bool EnumWindowsProc(int hwnd, int lParam); + public delegate bool EnumWindowsProc(int hwnd, int lParam); [DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)] public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, int lParam); [DllImport("user32", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)] diff --git a/mRemoteV1/Tools/ExternalTool.cs b/mRemoteV1/Tools/ExternalTool.cs index 49c59576..3955e5c4 100644 --- a/mRemoteV1/Tools/ExternalTool.cs +++ b/mRemoteV1/Tools/ExternalTool.cs @@ -5,6 +5,8 @@ using System.Diagnostics; using mRemoteNG.App; using System.IO; using System.ComponentModel; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; namespace mRemoteNG.Tools @@ -12,110 +14,88 @@ namespace mRemoteNG.Tools public class ExternalTool { #region Public Properties - public string DisplayName {get; set;} - public string FileName {get; set;} - public bool WaitForExit {get; set;} - public string Arguments {get; set;} - public bool TryIntegrate {get; set;} - public Connection.ConnectionRecordImp ConnectionInfo {get; set;} - + public string DisplayName { get; set; } + public string FileName { get; set; } + public bool WaitForExit { get; set; } + public string Arguments { get; set; } + public bool TryIntegrate { get; set; } + public ConnectionInfo ConnectionInfo { get; set; } + public Icon Icon { get { if (File.Exists(FileName)) - { - return Misc.GetIconFromFile(FileName); - } + return MiscTools.GetIconFromFile(FileName); else - { return null; - } } } - + public Image Image { get { if (Icon != null) - { return Icon.ToBitmap(); - } else - { return null; - } } } #endregion - - #region Constructors + public ExternalTool(string displayName = "", string fileName = "", string arguments = "") { this.DisplayName = displayName; this.FileName = fileName; this.Arguments = arguments; } - #endregion - - #region Public Methods - // Start external app - public void Start(Connection.ConnectionRecordImp startConnectionInfo = null) + + public void Start(ConnectionInfo startConnectionInfo = null) { try { if (string.IsNullOrEmpty(FileName)) - { throw (new InvalidOperationException("FileName cannot be blank.")); - } - + ConnectionInfo = startConnectionInfo; - + if (TryIntegrate) - { StartIntegrated(); - return ; - } - - Process process = new Process(); - process.StartInfo.UseShellExecute = true; - process.StartInfo.FileName = ParseArguments(FileName); - process.StartInfo.Arguments = ParseArguments(Arguments); - - process.Start(); - - if (WaitForExit) - { - process.WaitForExit(); - } + else + StartExternalProcess(); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage("ExternalApp.Start() failed.", ex); } } - - // Start external app integrated + + private void StartExternalProcess() + { + Process process = new Process(); + SetProcessProperties(process, ConnectionInfo); + process.Start(); + + if (WaitForExit) + { + process.WaitForExit(); + } + } + + private void SetProcessProperties(Process process, ConnectionInfo startConnectionInfo) + { + ArgumentParser argParser = new ArgumentParser(startConnectionInfo); + process.StartInfo.UseShellExecute = true; + process.StartInfo.FileName = argParser.ParseArguments(FileName); + process.StartInfo.Arguments = argParser.ParseArguments(Arguments); + } + public void StartIntegrated() { try { - Connection.ConnectionRecordImp newConnectionInfo = default(Connection.ConnectionRecordImp); - if (ConnectionInfo == null) - { - newConnectionInfo = new Connection.ConnectionRecordImp(); - } - else - { - newConnectionInfo = ConnectionInfo.Clone(); - } - - newConnectionInfo.Protocol = Connection.Protocol.Protocols.IntApp; - newConnectionInfo.ExtApp = DisplayName; - newConnectionInfo.Name = DisplayName; - newConnectionInfo.Panel = My.Language.strMenuExternalTools; - + ConnectionInfo newConnectionInfo = BuildConnectionInfoForIntegratedApp(); Runtime.OpenConnection(newConnectionInfo); } catch (Exception ex) @@ -123,351 +103,30 @@ namespace mRemoteNG.Tools Runtime.MessageCollector.AddExceptionMessage(message: "ExternalApp.StartIntegrated() failed.", ex: ex, logOnly: true); } } - - private enum EscapeType - { - All, - ShellMetacharacters, - None - } - - private struct Replacement - { - private int _Start; - private int _Length; - private string _Value; - public Replacement(int start, int length, string value) - { - this._Start = start; - this._Length = length; - this._Value = value; - } - - public int Start - { - get { return _Start; } - set { _Start = value; } - } - public int Length - { - get { return _Length; } - set { _Length = value; } - } - public string Value - { - get { return _Value; } - set { _Value = value; } - } - } - - public string ParseArguments(string input) - { - int index = 0; - List replacements = new List(); - - do - { - int tokenStart = input.IndexOf("%", index, StringComparison.InvariantCulture); - if (tokenStart == -1) - { - break; - } - - int tokenEnd = input.IndexOf("%", tokenStart + 1, StringComparison.InvariantCulture); - if (tokenEnd == -1) - { - break; - } - - int tokenLength = tokenEnd - tokenStart + 1; - - int variableNameStart = tokenStart + 1; - int variableNameLength = tokenLength - 2; - - bool isEnvironmentVariable = false; - - string variableName = ""; - - if (tokenStart > 0) - { - char tokenStartPrefix = input.Substring(tokenStart - 1, 1).ToCharArray()[0]; - char tokenEndPrefix = input.Substring(tokenEnd - 1, 1).ToCharArray()[0]; - - if (tokenStartPrefix == '\\' && tokenEndPrefix == '\\') - { - isEnvironmentVariable = true; - - // Add the first backslash to the token - tokenStart--; - tokenLength++; - - // Remove the last backslash from the name - variableNameLength--; - } - else if (tokenStartPrefix == '^' && tokenEndPrefix == '^') - { - // Add the first caret to the token - tokenStart--; - tokenLength++; - - // Remove the last caret from the name - variableNameLength--; - - variableName = input.Substring(variableNameStart, variableNameLength); - replacements.Add(new Replacement(tokenStart, tokenLength, string.Format("%{0}%", variableName))); - - index = tokenEnd; - continue; - } - } - - string token = input.Substring(tokenStart, tokenLength); - - EscapeType escape = EscapeType.All; - string prefix = input.Substring(variableNameStart, 1); - switch (prefix) - { - case "-": - escape = EscapeType.ShellMetacharacters; - break; - case "!": - escape = EscapeType.None; - break; - } - - if (!(escape == EscapeType.All)) - { - // Remove the escape character from the name - variableNameStart++; - variableNameLength--; - } - - if (variableNameLength == 0) - { - index = tokenEnd; - continue; - } - - variableName = input.Substring(variableNameStart, variableNameLength); - - string replacementValue = token; - if (!isEnvironmentVariable) - { - replacementValue = GetVariableReplacement(variableName, token); - } - - bool haveReplacement = false; - - if (!(replacementValue == token)) - { - haveReplacement = true; - } - else - { - replacementValue = Environment.GetEnvironmentVariable(variableName); - if (replacementValue != null) - { - haveReplacement = true; - } - } - - if (haveReplacement) - { - char trailing = '\0'; - if (tokenEnd + 2 <= input.Length) - { - trailing = input.Substring(tokenEnd + 1, 1).ToCharArray()[0]; - } - else - { - trailing = string.Empty.ToCharArray()[0]; - } - - if (escape == EscapeType.All) - { - replacementValue = CommandLineArguments.EscapeBackslashes(replacementValue); - if (trailing == '\'') - { - replacementValue = CommandLineArguments.EscapeBackslashesForTrailingQuote(replacementValue); - } - } - - if (escape == EscapeType.All | escape == EscapeType.ShellMetacharacters) - { - replacementValue = CommandLineArguments.EscapeShellMetacharacters(replacementValue); - } - - replacements.Add(new Replacement(tokenStart, tokenLength, replacementValue)); - index = tokenEnd + 1; - } - else - { - index = tokenEnd; - } - } while (true); - - string result = input; - - for (index = result.Length; index >= 0; index--) - { - foreach (Replacement replacement in replacements) - { - if (!(replacement.Start == index)) - { - continue; - } - - string before = result.Substring(0, replacement.Start); - string after = result.Substring(replacement.Start + replacement.Length); - result = before + replacement.Value + after; - } - } - - return result; - } - #endregion - - #region Private Methods - private string GetVariableReplacement(string variable, string original) - { - string replacement = ""; - switch (variable.ToLowerInvariant()) - { - case "name": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Name; - } - break; - case "hostname": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Hostname; - } - break; - case "port": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = System.Convert.ToString(ConnectionInfo.Port); - } - break; - case "username": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Username; - } - break; - case "password": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Password; - } - break; - case "domain": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Domain; - } - break; - case "description": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.Description; - } - break; - // ReSharper disable once StringLiteralTypo - case "macaddress": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.MacAddress; - } - break; - // ReSharper disable once StringLiteralTypo - case "userfield": - if (ConnectionInfo == null) - { - replacement = ""; - } - else - { - replacement = ConnectionInfo.UserField; - } - break; - default: - return original; - } - return replacement; - } - #endregion + private ConnectionInfo BuildConnectionInfoForIntegratedApp() + { + ConnectionInfo newConnectionInfo = GetAppropriateInstanceOfConnectionInfo(); + SetConnectionInfoFields(newConnectionInfo); + return newConnectionInfo; + } + + private ConnectionInfo GetAppropriateInstanceOfConnectionInfo() + { + ConnectionInfo newConnectionInfo = default(ConnectionInfo); + if (this.ConnectionInfo == null) + newConnectionInfo = new ConnectionInfo(); + else + newConnectionInfo = this.ConnectionInfo.Copy(); + return newConnectionInfo; + } + + private void SetConnectionInfoFields(ConnectionInfo newConnectionInfo) + { + newConnectionInfo.Protocol = ProtocolType.IntApp; + newConnectionInfo.ExtApp = DisplayName; + newConnectionInfo.Name = DisplayName; + newConnectionInfo.Panel = My.Language.strMenuExternalTools; + } } - - public class ExternalToolsTypeConverter : StringConverter - { - - public static string[] ExternalTools - { - get - { - List externalToolList = new List(); - - // Add a blank entry to signify that no external tool is selected - externalToolList.Add(string.Empty); - - foreach (ExternalTool externalTool in App.Runtime.ExternalTools) - { - externalToolList.Add(externalTool.DisplayName); - } - - return externalToolList.ToArray(); - } - } - - public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) - { - return new StandardValuesCollection(ExternalTools); - } - - public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) - { - return true; - } - - public override bool GetStandardValuesSupported(ITypeDescriptorContext context) - { - return true; - } - } -} +} \ No newline at end of file diff --git a/mRemoteV1/Tools/ExternalToolsTypeConverter.cs b/mRemoteV1/Tools/ExternalToolsTypeConverter.cs new file mode 100644 index 00000000..5fb5cb0b --- /dev/null +++ b/mRemoteV1/Tools/ExternalToolsTypeConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace mRemoteNG.Tools +{ + public class ExternalToolsTypeConverter : StringConverter + { + public static string[] ExternalTools + { + get + { + List externalToolList = new List(); + + // Add a blank entry to signify that no external tool is selected + externalToolList.Add(string.Empty); + + foreach (ExternalTool externalTool in App.Runtime.ExternalTools) + { + externalToolList.Add(externalTool.DisplayName); + } + + return externalToolList.ToArray(); + } + } + + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) + { + return new StandardValuesCollection(ExternalTools); + } + + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) + { + return true; + } + + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + } +} diff --git a/mRemoteV1/Tools/GenericEnum.cs b/mRemoteV1/Tools/GenericEnum.cs deleted file mode 100644 index e69976d3..00000000 --- a/mRemoteV1/Tools/GenericEnum.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace System.Collections.Generic -{ - - public abstract class GenericEnum where T : GenericEnum, new() - { - static readonly List names; - static readonly List values; - static bool allowInstanceExceptions; - - static GenericEnum() - { - Type t = typeof(T); - Type u = typeof(U); - if (t == u) throw new InvalidOperationException(String.Format("{0} and its underlying type cannot be the same", t.Name)); - BindingFlags bf = BindingFlags.Static | BindingFlags.Public; - FieldInfo[] fia = t.GetFields(bf); - names = new List(); - values = new List(); - for (int i = 0; i < fia.Length; i++) - { - if (fia[i].FieldType == u && (fia[i].IsLiteral || fia[i].IsInitOnly)) - { - names.Add(fia[i].Name); - values.Add((U)fia[i].GetValue(null)); - } - } - if (names.Count == 0) throw new InvalidOperationException(String.Format("{0} has no suitable fields", t.Name)); - } - - public static bool AllowInstanceExceptions - { - get { return allowInstanceExceptions; } - set { allowInstanceExceptions = value; } - } - - public static string[] GetNames() - { - return names.ToArray(); - } - - public static string[] GetNames(U value) - { - List nameList = new List(); - for (int i = 0; i < values.Count; i++) - { - if (values[i].Equals(value)) nameList.Add(names[i]); - } - return nameList.ToArray(); - } - - public static U[] GetValues() - { - return values.ToArray(); - } - - public static int[] GetIndices(U value) - { - List indexList = new List(); - for (int i = 0; i < values.Count; i++) - { - if (values[i].Equals(value)) indexList.Add(i); - } - return indexList.ToArray(); - } - - public static int IndexOf(string name) - { - return names.IndexOf(name); - } - - public static U ValueOf(string name) - { - int index = names.IndexOf(name); - if (index >= 0) - { - return values[index]; - } - throw new ArgumentException(String.Format("'{0}' is not a defined name of {1}", name, typeof(T).Name)); - } - - public static string FirstNameWith(U value) - { - int index = values.IndexOf(value); - if (index >= 0) - { - return names[index]; - } - throw new ArgumentException(String.Format("'{0}' is not a defined value of {1}", value, typeof(T).Name)); - } - - public static int FirstIndexWith(U value) - { - int index = values.IndexOf(value); - if (index >= 0) - { - return index; - } - throw new ArgumentException(String.Format("'{0}' is not a defined value of {1}", value, typeof(T).Name)); - } - - public static string NameAt(int index) - { - if (index >= 0 && index < Count) - { - return names[index]; - } - throw new IndexOutOfRangeException(String.Format("Index must be between 0 and {0}", Count - 1)); - } - - public static U ValueAt(int index) - { - if (index >= 0 && index < Count) - { - return values[index]; - } - throw new IndexOutOfRangeException(String.Format("Index must be between 0 and {0}", Count - 1)); - } - - public static Type UnderlyingType - { - get { return typeof(U); } - } - - public static int Count - { - get { return names.Count; } - } - - public static bool IsDefinedName(string name) - { - if (names.IndexOf(name) >= 0) return true; - return false; - } - - public static bool IsDefinedValue(U value) - { - if (values.IndexOf(value) >= 0) return true; - return false; - } - - public static bool IsDefinedIndex(int index) - { - if (index >= 0 && index < Count) return true; - return false; - } - - public static T ByName(string name) - { - if (!IsDefinedName(name)) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("'{0}' is not a defined name of {1}", name, typeof(T).Name)); - return null; - } - T t = new T(); - t._index = names.IndexOf(name); - return t; - } - - public static T ByValue(U value) - { - if (!IsDefinedValue(value)) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("'{0}' is not a defined value of {1}", value, typeof(T).Name)); - return null; - } - T t = new T(); - t._index = values.IndexOf(value); - return t; - } - - public static T ByIndex(int index) - { - if (index < 0 || index >= Count) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("Index must be between 0 and {0}", Count - 1)); - return null; - } - T t = new T(); - t._index = index; - return t; - } - - protected int _index; - - public int Index - { - get { return _index; } - set - { - if (value < 0 || value >= Count) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("Index must be between 0 and {0}", Count - 1)); - return; - } - _index = value; - } - } - - public string Name - { - get { return names[_index]; } - set - { - int index = names.IndexOf(value); - if (index == -1) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("'{0}' is not a defined name of {1}", value, typeof(T).Name)); - return; - } - _index = index; - } - } - - public U Value - { - get { return values[_index]; } - set - { - int index = values.IndexOf(value); - if (index == -1) - { - if (allowInstanceExceptions) throw new ArgumentException(String.Format("'{0}' is not a defined value of {1}", value, typeof(T).Name)); - return; - } - _index = index; - } - } - - public override string ToString() - { - return names[_index]; - } - } -} \ No newline at end of file diff --git a/mRemoteV1/Tools/Tools.Misc.cs b/mRemoteV1/Tools/MiscTools.cs similarity index 54% rename from mRemoteV1/Tools/Tools.Misc.cs rename to mRemoteV1/Tools/MiscTools.cs index 82dd023a..cf2af94a 100644 --- a/mRemoteV1/Tools/Tools.Misc.cs +++ b/mRemoteV1/Tools/MiscTools.cs @@ -1,22 +1,24 @@ -using System; -using System.Drawing; -using System.Data; using Microsoft.VisualBasic; -using System.Windows.Forms; -using System.Reflection; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Collections.Specialized; -using System.Text.RegularExpressions; -using mRemoteNG.Forms; using mRemoteNG.App; -using System.IO; +using mRemoteNG.Forms; +using mRemoteNG.UI.Window; +using System; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Data; using System.Data.SqlClient; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Windows.Forms; namespace mRemoteNG.Tools { - public class Misc + public class MiscTools { private struct SHFILEINFO { @@ -34,7 +36,8 @@ namespace mRemoteNG.Tools private const int SHGFI_ICON = 0x100; private const int SHGFI_SMALLICON = 0x1; //Private Const SHGFI_LARGEICON = &H0 ' Large icon - + + public static Icon GetIconFromFile(string FileName) { try @@ -71,87 +74,11 @@ namespace mRemoteNG.Tools return null; } } - - public delegate void SQLUpdateCheckFinishedEventHandler(bool UpdateAvailable); - private static SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinishedEvent; - - public static event SQLUpdateCheckFinishedEventHandler SQLUpdateCheckFinished - { - add - { - SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler) System.Delegate.Combine(SQLUpdateCheckFinishedEvent, value); - } - remove - { - SQLUpdateCheckFinishedEvent = (SQLUpdateCheckFinishedEventHandler) System.Delegate.Remove(SQLUpdateCheckFinishedEvent, value); - } - } - - public static void IsSQLUpdateAvailableAsync() - { - System.Threading.Thread t = new System.Threading.Thread(IsSQLUpdateAvailableDelegate); - t.SetApartmentState(System.Threading.ApartmentState.STA); - t.Start(); - } + - private static void IsSQLUpdateAvailableDelegate() - { - IsSQLUpdateAvailable(); - } + + - public static bool IsSQLUpdateAvailable() - { - try - { - SqlConnection sqlCon = default(SqlConnection); - SqlCommand sqlQuery = default(SqlCommand); - SqlDataReader sqlRd = default(SqlDataReader); - - DateTime LastUpdateInDB = default(DateTime); - - if (My.Settings.Default.SQLUser != "") - { - sqlCon = new SqlConnection("Data Source=" + My.Settings.Default.SQLHost + ";Initial Catalog=" + My.Settings.Default.SQLDatabaseName + ";User Id=" + My.Settings.Default.SQLUser + ";Password=" + Security.Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), App.Info.General.EncryptionKey)); - } - else - { - sqlCon = new SqlConnection("Data Source=" + My.Settings.Default.SQLHost + ";Initial Catalog=" + My.Settings.Default.SQLDatabaseName + ";Integrated Security=True"); - } - - sqlCon.Open(); - - sqlQuery = new SqlCommand("SELECT * FROM tblUpdate", sqlCon); - sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection); - - sqlRd.Read(); - - if (sqlRd.HasRows) - { - LastUpdateInDB = System.Convert.ToDateTime(sqlRd["LastUpdate"]); - - if (LastUpdateInDB > Runtime.LastSqlUpdate) - { - if (SQLUpdateCheckFinishedEvent != null) - { - SQLUpdateCheckFinishedEvent(true); - } - return true; - } - } - - if (SQLUpdateCheckFinishedEvent != null) - { - SQLUpdateCheckFinishedEvent(false); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "IsSQLUpdateAvailable failed (Tools.Misc)" + Environment.NewLine + ex.Message, true); - } - - return false; - } - public static string PasswordDialog(string passwordName = null, bool verify = true) { PasswordForm passwordForm = new PasswordForm(passwordName, verify); @@ -165,15 +92,17 @@ namespace mRemoteNG.Tools return ""; } } - + + public static string CreateConstantID() { return Guid.NewGuid().ToString(); } - + + public static string LeadingZero(string Number) { - if (System.Convert.ToInt32(Number) < 10) + if (Convert.ToInt32(Number) < 10) { return "0" + Number; } @@ -182,37 +111,50 @@ namespace mRemoteNG.Tools return Number; } } - + + public static string DBDate(DateTime Dt) { string strDate = ""; - - strDate = Dt.Year + LeadingZero(System.Convert.ToString(Dt.Month)) + LeadingZero(System.Convert.ToString(Dt.Day)) + " " + LeadingZero(System.Convert.ToString(Dt.Hour)) + ":" + LeadingZero(System.Convert.ToString(Dt.Minute)) + ":" + LeadingZero(System.Convert.ToString(Dt.Second)); - + strDate = Dt.Year + LeadingZero(Convert.ToString(Dt.Month)) + LeadingZero(Convert.ToString(Dt.Day)) + " " + LeadingZero(Convert.ToString(Dt.Hour)) + ":" + LeadingZero(Convert.ToString(Dt.Minute)) + ":" + LeadingZero(System.Convert.ToString(Dt.Second)); return strDate; } - public static string PrepareForDB(string Text) { - Text = Strings.Replace(Expression: Text, Find: "\'True\'", Replacement: "1", Compare: CompareMethod.Text); - Text = Strings.Replace(Expression: Text, Find: "\'False\'", Replacement: "0", Compare: CompareMethod.Text); - - return Text; + return ReplaceBooleanStringsWithNumbers(Text); } - + private static string ReplaceBooleanStringsWithNumbers(string Text) + { + Text = ReplaceTrueWith1(Text); + Text = ReplaceFalseWith0(Text); + return Text; + } + private static string ReplaceTrueWith1(string Text) + { + return Text.Replace("'True'", "1"); + } + private static string ReplaceFalseWith0(string Text) + { + return Text.Replace("'False'", "0"); + } public static string PrepareValueForDB(string Text) { Text = Strings.Replace(Expression: Text, Find: "\'", Replacement: "\'\'", Compare: CompareMethod.Text); - return Text; } - + + public static object StringToEnum(Type t, string value) { return Enum.Parse(t, value); } - - public static string GetExceptionMessageRecursive(Exception ex, string separator = Environment.NewLine) + + + public static string GetExceptionMessageRecursive(Exception ex) + { + return GetExceptionMessageRecursive(ex, Environment.NewLine); + } + public static string GetExceptionMessageRecursive(Exception ex, string separator) { string message = ex.Message; if (ex.InnerException != null) @@ -222,8 +164,9 @@ namespace mRemoteNG.Tools } return message; } - - public static Image TakeScreenshot(UI.Window.Connection sender) + + + public static Image TakeScreenshot(ConnectionWindow sender) { try { @@ -247,22 +190,22 @@ namespace mRemoteNG.Tools return null; } - + public class EnumTypeConverter : EnumConverter { - private System.Type _enumType; + private Type _enumType; - public EnumTypeConverter(System.Type type) : base(type) + public EnumTypeConverter(Type type) : base(type) { _enumType = type; } - public override bool CanConvertTo(ITypeDescriptorContext context, System.Type destType) + public override bool CanConvertTo(ITypeDescriptorContext context, Type destType) { return destType == typeof(string); } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destType) + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType) { FieldInfo fi = _enumType.GetField(Enum.GetName(_enumType, value)); DescriptionAttribute dna = (DescriptionAttribute) (Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute))); @@ -277,12 +220,12 @@ namespace mRemoteNG.Tools } } - public override bool CanConvertFrom(ITypeDescriptorContext context, System.Type srcType) + public override bool CanConvertFrom(ITypeDescriptorContext context, Type srcType) { return srcType == typeof(string); } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { foreach (FieldInfo fi in _enumType.GetFields()) { @@ -297,7 +240,7 @@ namespace mRemoteNG.Tools return Enum.Parse(_enumType, (string) value); } } - + public class YesNoTypeConverter : TypeConverter { @@ -321,7 +264,7 @@ namespace mRemoteNG.Tools return base.CanConvertTo(context, destinationType); } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value.GetType() == typeof(string)) { @@ -341,7 +284,7 @@ namespace mRemoteNG.Tools return base.ConvertFrom(context, culture, value); } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { @@ -356,16 +299,16 @@ namespace mRemoteNG.Tools return true; } - public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { bool[] bools = new bool[] {true, false}; - System.ComponentModel.TypeConverter.StandardValuesCollection svc = new System.ComponentModel.TypeConverter.StandardValuesCollection(bools); + TypeConverter.StandardValuesCollection svc = new TypeConverter.StandardValuesCollection(bools); return svc; } } - + public class Fullscreen { public Fullscreen(Form handledForm) @@ -416,7 +359,6 @@ namespace mRemoteNG.Tools } _handledForm.WindowState = FormWindowState.Maximized; } - private void ExitFullscreen() { _handledForm.FormBorderStyle = _savedBorderStyle; @@ -424,111 +366,5 @@ namespace mRemoteNG.Tools _handledForm.Bounds = _savedBounds; } } - - - // - //* Arguments class: application arguments interpreter - //* - //* Authors: R. LOPES - //* Contributors: R. LOPES - //* Created: 25 October 2002 - //* Modified: 28 October 2002 - //* - //* Version: 1.0 - // - public class CMDArguments - { - private StringDictionary Parameters; - - // Retrieve a parameter value if it exists - public string this[string Param] - { - get - { - return (Parameters[Param]); - } - } - - public CMDArguments(string[] Args) - { - Parameters = new StringDictionary(); - Regex Spliter = new Regex("^-{1,2}|^/|=|:", (System.Text.RegularExpressions.RegexOptions) (RegexOptions.IgnoreCase | RegexOptions.Compiled)); - Regex Remover = new Regex("^[\'\"]?(.*?)[\'\"]?$", (System.Text.RegularExpressions.RegexOptions) (RegexOptions.IgnoreCase | RegexOptions.Compiled)); - string Parameter = null; - string[] Parts = null; - - // Valid parameters forms: - // {-,/,--}param{ ,=,:}((",')value(",')) - // Examples: -param1 value1 --param2 /param3:"Test-:-work" /param4=happy -param5 '--=nice=--' - - try - { - foreach (string Txt in Args) - { - // Look for new parameters (-,/ or --) and a possible enclosed value (=,:) - Parts = Spliter.Split(Txt, 3); - switch (Parts.Length) - { - case 1: - // Found a value (for the last parameter found (space separator)) - if (Parameter != null) - { - if (!Parameters.ContainsKey(Parameter)) - { - Parts[0] = Remover.Replace(Parts[0], "$1"); - Parameters.Add(Parameter, Parts[0]); - } - Parameter = null; - } - // else Error: no parameter waiting for a value (skipped) - break; - case 2: - // Found just a parameter - // The last parameter is still waiting. With no value, set it to true. - if (Parameter != null) - { - if (!Parameters.ContainsKey(Parameter)) - { - Parameters.Add(Parameter, "true"); - } - } - Parameter = Parts[1]; - break; - case 3: - // Parameter with enclosed value - // The last parameter is still waiting. With no value, set it to true. - if (Parameter != null) - { - if (!Parameters.ContainsKey(Parameter)) - { - Parameters.Add(Parameter, "true"); - } - } - Parameter = Parts[1]; - // Remove possible enclosing characters (",') - if (!Parameters.ContainsKey(Parameter)) - { - Parts[2] = Remover.Replace(Parts[2], "$1"); - Parameters.Add(Parameter, Parts[2]); - } - Parameter = null; - break; - } - } - // In case a parameter is still waiting - if (Parameter != null) - { - if (!Parameters.ContainsKey(Parameter)) - { - Parameters.Add(Parameter, "true"); - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Creating new Args failed" + Environment.NewLine + ex.Message, true); - } - } - } } -} +} \ No newline at end of file diff --git a/mRemoteV1/Tools/ProcessController.cs b/mRemoteV1/Tools/ProcessController.cs index dbb51ad9..38a607ea 100644 --- a/mRemoteV1/Tools/ProcessController.cs +++ b/mRemoteV1/Tools/ProcessController.cs @@ -187,7 +187,8 @@ namespace mRemoteNG.Tools if (Controls.Count == 0) { - Controls = EnumWindows.EnumChildWindows(Handle); + EnumWindows windowEnumerator = new EnumWindows(); + Controls = windowEnumerator.EnumChildWindows(Handle); } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); diff --git a/mRemoteV1/Tools/PuttyProcessController.cs b/mRemoteV1/Tools/PuttyProcessController.cs index c7947540..b62e54ab 100644 --- a/mRemoteV1/Tools/PuttyProcessController.cs +++ b/mRemoteV1/Tools/PuttyProcessController.cs @@ -13,7 +13,7 @@ namespace mRemoteNG.Tools } else { - filename = App.Info.General.PuttyPath; + filename = App.Info.GeneralAppInfo.PuttyPath; } return Start(filename, arguments); } diff --git a/mRemoteV1/Tools/Sorting/Sortable.cs b/mRemoteV1/Tools/Sorting/Sortable.cs new file mode 100644 index 00000000..517a7abb --- /dev/null +++ b/mRemoteV1/Tools/Sorting/Sortable.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace mRemoteNG.Tools.Sorting +{ + public interface Sortable + { + void Sort(); + } +} \ No newline at end of file diff --git a/mRemoteV1/Tools/Sorting/TreeNodeSorter.cs b/mRemoteV1/Tools/Sorting/TreeNodeSorter.cs new file mode 100644 index 00000000..ad1100d1 --- /dev/null +++ b/mRemoteV1/Tools/Sorting/TreeNodeSorter.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Windows.Forms; + +namespace mRemoteNG.Tools.Sorting +{ + public class TreeNodeSorter : IComparer + { + public SortOrder Sorting { get; set; } + + public TreeNodeSorter(SortOrder sortOrder = SortOrder.None) + { + Sorting = sortOrder; + } + + public int Compare(object x, object y) + { + TreeNode tx = (TreeNode)x; + TreeNode ty = (TreeNode)y; + + switch (Sorting) + { + case SortOrder.Ascending: + return string.Compare(tx.Text, ty.Text); + case SortOrder.Descending: + return string.Compare(ty.Text, tx.Text); + default: + return 0; + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Tools/Tools.Controls.cs b/mRemoteV1/Tools/Tools.Controls.cs index fd1b6785..157d58b1 100644 --- a/mRemoteV1/Tools/Tools.Controls.cs +++ b/mRemoteV1/Tools/Tools.Controls.cs @@ -45,8 +45,7 @@ namespace mRemoteNG.Tools return this._Text; } } - - + public class NotificationAreaIcon { private NotifyIcon _nI; @@ -130,7 +129,7 @@ namespace mRemoteNG.Tools { this._cMenCons.DropDownItems.Clear(); - foreach (TreeNode tNode in App.Runtime.Windows.treeForm.tvConnections.Nodes) + foreach (TreeNode tNode in App.Windows.treeForm.tvConnections.Nodes) { AddNodeToMenu(tNode.Nodes, this._cMenCons); } @@ -147,7 +146,7 @@ namespace mRemoteNG.Tools tMenItem.Text = tNode.Text; tMenItem.Tag = tNode; - if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.Container) { tMenItem.Image = My.Resources.Folder; tMenItem.Tag = tNode.Tag; @@ -155,9 +154,9 @@ namespace mRemoteNG.Tools menToolStrip.DropDownItems.Add(tMenItem); AddNodeToMenu(tNode.Nodes, tMenItem); } - else if (Tree.Node.GetNodeType(tNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(tNode) == Tree.Node.Type.PuttySession) + else if (Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.Connection | Tree.Node.GetNodeType(tNode) == Tree.TreeNodeType.PuttySession) { - tMenItem.Image = Runtime.Windows.treeForm.imgListTree.Images[tNode.ImageIndex]; + tMenItem.Image = Windows.treeForm.imgListTree.Images[tNode.ImageIndex]; tMenItem.Tag = tNode.Tag; menToolStrip.DropDownItems.Add(tMenItem); @@ -206,59 +205,59 @@ namespace mRemoteNG.Tools { if (e.Button == MouseButtons.Left) { - if (((System.Windows.Forms.Control)sender).Tag is Connection.ConnectionRecordImp) + if (((System.Windows.Forms.Control)sender).Tag is Connection.ConnectionInfo) { if (frmMain.Default.Visible == false) { ShowForm(); } - App.Runtime.OpenConnection((mRemoteNG.Connection.ConnectionRecordImp)((System.Windows.Forms.Control)sender).Tag); + App.Runtime.OpenConnection((mRemoteNG.Connection.ConnectionInfo)((System.Windows.Forms.Control)sender).Tag); } } } private void cMenExit_Click(System.Object sender, System.EventArgs e) { - App.Runtime.Shutdown.Quit(); + Shutdown.Quit(); } } - + public static SaveFileDialog ConnectionsSaveAsDialog() { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.CheckPathExists = true; - saveFileDialog.InitialDirectory = App.Info.Connections.DefaultConnectionsPath; - saveFileDialog.FileName = App.Info.Connections.DefaultConnectionsFile; + saveFileDialog.InitialDirectory = App.Info.ConnectionsFileInfo.DefaultConnectionsPath; + saveFileDialog.FileName = App.Info.ConnectionsFileInfo.DefaultConnectionsFile; saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = My.Language.strFiltermRemoteXML + "|*.xml|" + My.Language.strFilterAll + "|*.*"; return saveFileDialog; } - + public static SaveFileDialog ConnectionsExportDialog() { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.CheckPathExists = true; - saveFileDialog.InitialDirectory = App.Info.Connections.DefaultConnectionsPath; - saveFileDialog.FileName = App.Info.Connections.DefaultConnectionsFile; + saveFileDialog.InitialDirectory = App.Info.ConnectionsFileInfo.DefaultConnectionsPath; + saveFileDialog.FileName = App.Info.ConnectionsFileInfo.DefaultConnectionsFile; saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = My.Language.strFiltermRemoteXML + "|*.xml|" + My.Language.strFiltermRemoteCSV + "|*.csv|" + My.Language.strFiltervRD2008CSV + "|*.csv|" + My.Language.strFilterAll + "|*.*"; return saveFileDialog; } - + public static OpenFileDialog ConnectionsLoadDialog() { OpenFileDialog lDlg = new OpenFileDialog(); lDlg.CheckFileExists = true; - lDlg.InitialDirectory = App.Info.Connections.DefaultConnectionsPath; + lDlg.InitialDirectory = App.Info.ConnectionsFileInfo.DefaultConnectionsPath; lDlg.Filter = My.Language.strFiltermRemoteXML + "|*.xml|" + My.Language.strFilterAll + "|*.*"; return lDlg; } - + public static OpenFileDialog ImportConnectionsRdpFileDialog() { OpenFileDialog openFileDialog = new OpenFileDialog(); @@ -268,32 +267,5 @@ namespace mRemoteNG.Tools openFileDialog.Multiselect = true; return openFileDialog; } - - public class TreeNodeSorter : IComparer - { - - public System.Windows.Forms.SortOrder Sorting {get; set;} - - public TreeNodeSorter(SortOrder sortOrder = System.Windows.Forms.SortOrder.None) - { - Sorting = sortOrder; - } - - public int Compare(object x, object y) - { - TreeNode tx = (TreeNode) x; - TreeNode ty = (TreeNode) y; - - switch (Sorting) - { - case SortOrder.Ascending: - return string.Compare(tx.Text, ty.Text); - case SortOrder.Descending: - return string.Compare(ty.Text, tx.Text); - default: - return 0; - } - } - } } } \ No newline at end of file diff --git a/mRemoteV1/Tools/Tools.PortScan.cs b/mRemoteV1/Tools/Tools.PortScan.cs index 531fd60d..9a8ce5d1 100644 --- a/mRemoteV1/Tools/Tools.PortScan.cs +++ b/mRemoteV1/Tools/Tools.PortScan.cs @@ -1,70 +1,88 @@ -using System.Collections.Generic; -using System; -using System.Diagnostics; -using Microsoft.VisualBasic; -using System.Collections; -using System.Windows.Forms; -using System.Threading; using mRemoteNG.App; -using System.Net.NetworkInformation; +using mRemoteNG.Connection.Protocol.Http; +using mRemoteNG.Connection.Protocol.SSH; +using mRemoteNG.Connection.Protocol.VNC; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Connection.Protocol.Telnet; +using mRemoteNG.Connection.Protocol.Rlogin; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; using System.Net; +using System.Net.NetworkInformation; +using System.Threading; +using System.Windows.Forms; namespace mRemoteNG.Tools.PortScan { public class ScanHost - { + { + #region Private Variables + private static int _SSHPort = (int)ProtocolSSH1.Defaults.Port; + private static int _TelnetPort = (int)ProtocolTelnet.Defaults.Port; + private static int _HTTPPort = (int)ProtocolHTTP.Defaults.Port; + private static int _HTTPSPort = (int)ProtocolHTTPS.Defaults.Port; + private static int _RloginPort = (int)ProtocolRlogin.Defaults.Port; + private static int _RDPPort = (int)ProtocolRDP.Defaults.Port; + private static int _VNCPort = (int)ProtocolVNC.Defaults.Port; + private string _hostName = ""; + private string _hostIp; + private ArrayList _openPorts = new ArrayList(); + private ArrayList _closedPorts; + private bool _RDP; + private bool _VNC; + private bool _SSH; + private bool _Telnet; + private bool _Rlogin; + private bool _HTTP; + private bool _HTTPS; + #endregion + #region Properties - private static int _SSHPort = (int)Connection.Protocol.SSH1.Defaults.Port; public static int SSHPort { get { return _SSHPort; } set { _SSHPort = value; } } - private static int _TelnetPort = (int)Connection.Protocol.Telnet.Defaults.Port; public static int TelnetPort { get { return _TelnetPort; } set { _TelnetPort = value; } } - private static int _HTTPPort = (int)Connection.Protocol.HTTP.Defaults.Port; public static int HTTPPort { get { return _HTTPPort; } set { _HTTPPort = value; } } - private static int _HTTPSPort = (int)Connection.Protocol.HTTPS.Defaults.Port; public static int HTTPSPort { get { return _HTTPSPort; } set { _HTTPSPort = value; } } - private static int _RloginPort = (int)Connection.Protocol.Rlogin.Defaults.Port; public static int RloginPort { get { return _RloginPort; } set { _RloginPort = value; } } - private static int _RDPPort = (int)Connection.Protocol.RDPConnectionProtocolImp.Defaults.Port; public static int RDPPort { get { return _RDPPort; } set { _RDPPort = value; } } - private static int _VNCPort = (int)Connection.Protocol.VNC.Defaults.Port; public static int VNCPort { get { return _VNCPort; } set { _VNCPort = value; } } - - private string _hostName = ""; + public string HostName { get { return _hostName; } @@ -82,71 +100,61 @@ namespace mRemoteNG.Tools.PortScan return HostName.Split('.')[0]; } } - - private string _hostIp; + public string HostIp { get { return _hostIp; } set { _hostIp = value; } } - - private ArrayList _openPorts = new ArrayList(); + public ArrayList OpenPorts { get { return _openPorts; } set { _openPorts = value; } } - - private ArrayList _closedPorts; + public ArrayList ClosedPorts { get { return _closedPorts; } set { _closedPorts = value; } } - - private bool _RDP; + public bool RDP { get { return _RDP; } set { _RDP = value; } } - - private bool _VNC; + public bool VNC { get { return _VNC; } set { _VNC = value; } } - - private bool _SSH; + public bool SSH { get { return _SSH; } set { _SSH = value; } } - - private bool _Telnet; + public bool Telnet { get { return _Telnet; } set { _Telnet = value; } } - - private bool _Rlogin; + public bool Rlogin { get { return _Rlogin; } set { _Rlogin = value; } } - - private bool _HTTP; + public bool HTTP { get { return _HTTP; } set { _HTTP = value; } } - - private bool _HTTPS; + public bool HTTPS { get { return _HTTPS; } @@ -560,4 +568,4 @@ namespace mRemoteNG.Tools.PortScan } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/Tree/ConnectionTree.cs b/mRemoteV1/Tree/ConnectionTree.cs new file mode 100644 index 00000000..af91cfdd --- /dev/null +++ b/mRemoteV1/Tree/ConnectionTree.cs @@ -0,0 +1,354 @@ +using Microsoft.VisualBasic; +using mRemoteNG.App; +using mRemoteNG.Connection; +using mRemoteNG.Tools.Sorting; +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace mRemoteNG.Tree +{ + public class ConnectionTree + { + private static TreeNode SetNodeToolTip_old_node = null; + private static TreeNode treeNodeToBeSelected; + private static TreeView _TreeView; + + public static TreeView TreeView + { + get { return _TreeView; } + set { _TreeView = value; } + } + + public static TreeNode SelectedNode + { + get + { + return _TreeView.SelectedNode; + } + set + { + treeNodeToBeSelected = value; + SelectNode(); + } + } + + public static void DeleteSelectedNode() + { + try + { + if (SelectedNode == null) + { + return; + } + + if (Tree.Node.GetNodeType(SelectedNode) == TreeNodeType.Root) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "The root item cannot be deleted!"); + } + else if (Tree.Node.GetNodeType(SelectedNode) == TreeNodeType.Container) + { + if (Tree.Node.IsEmpty(SelectedNode) == false) + { + if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeFolder, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) + { + SelectedNode.Remove(); + } + } + else + { + if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeFolderNotEmpty, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) + { + foreach (TreeNode tNode in SelectedNode.Nodes) + { + tNode.Remove(); + } + SelectedNode.Remove(); + } + } + } + else if (Tree.Node.GetNodeType(SelectedNode) == TreeNodeType.Connection) + { + if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeConnection, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle)(MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) + { + SelectedNode.Remove(); + } + } + else + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "Tree item type is unknown so it cannot be deleted!"); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Deleting selected node failed" + Environment.NewLine + ex.Message, true); + } + } + + public static void StartRenameSelectedNode() + { + if (SelectedNode != null) + { + SelectedNode.BeginEdit(); + } + } + + public static void FinishRenameSelectedNode(string newName) + { + ConnectionInfo connectionInfo = SelectedNode.Tag as ConnectionInfo; + if (connectionInfo != null) + Tree.Node.RenameNode(connectionInfo, newName); + } + + public static void SetNodeToolTip(MouseEventArgs e, ToolTip tTip) + { + try + { + if (My.Settings.Default.ShowDescriptionTooltipsInTree) + { + //Find the node under the mouse. + TreeNode new_node = _TreeView.GetNodeAt(e.X, e.Y); + if (new_node.Equals(SetNodeToolTip_old_node)) + { + return; + } + SetNodeToolTip_old_node = new_node; + + //See if we have a node. + if (SetNodeToolTip_old_node == null) + { + tTip.SetToolTip(_TreeView, ""); + } + else + { + //Get this node's object data. + if (Tree.Node.GetNodeType(SetNodeToolTip_old_node) == TreeNodeType.Connection) + { + tTip.SetToolTip(_TreeView, (SetNodeToolTip_old_node.Tag as ConnectionInfo).Description); + } + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SetNodeToolTip failed" + Environment.NewLine + ex.Message, true); + } + } + + public static void ExpandAllNodes() + { + TreeView.BeginUpdate(); + TreeView.ExpandAll(); + TreeView.EndUpdate(); + } + + public static void CollapseAllNodes() + { + TreeView.BeginUpdate(); + foreach (TreeNode treeNode in TreeView.Nodes[0].Nodes) + { + treeNode.Collapse(false); + } + TreeView.EndUpdate(); + } + + public static void MoveNodeDown() + { + try + { + if (SelectedNode != null) + { + if (!(SelectedNode.NextNode == null)) + { + TreeView.BeginUpdate(); + TreeView.Sorted = false; + + TreeNode newNode = (TreeNode)SelectedNode.Clone(); + SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 2, newNode); + SelectedNode.Remove(); + SelectedNode = newNode; + + TreeView.EndUpdate(); + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeDown failed" + Environment.NewLine + ex.Message, true); + } + } + + public static void MoveNodeUp() + { + try + { + if (SelectedNode != null) + { + if (!(SelectedNode.PrevNode == null)) + { + TreeView.BeginUpdate(); + TreeView.Sorted = false; + + TreeNode newNode = (TreeNode)SelectedNode.Clone(); + SelectedNode.Parent.Nodes.Insert(SelectedNode.Index - 1, newNode); + SelectedNode.Remove(); + SelectedNode = newNode; + + TreeView.EndUpdate(); + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeUp failed" + Environment.NewLine + ex.Message, true); + } + } + + public static void Sort(TreeNode treeNode, SortOrder sorting) + { + if (TreeView == null) + return; + + TreeView.BeginUpdate(); + + if (treeNode == null) + { + if (TreeView.Nodes.Count > 0) + treeNode = TreeView.Nodes[0]; + else + return; + } + else if (Tree.Node.GetNodeType(treeNode) == TreeNodeType.Connection) + { + treeNode = treeNode.Parent; + if (treeNode == null) + return; + } + + Sort(treeNode, new TreeNodeSorter(sorting)); + TreeView.EndUpdate(); + } + + private static void Sort(TreeNode treeNode, TreeNodeSorter nodeSorter) + { + // Adapted from http://www.codeproject.com/Tips/252234/ASP-NET-TreeView-Sort + foreach (TreeNode childNode in treeNode.Nodes) + { + Sort(childNode, nodeSorter); + } + + try + { + List sortedNodes = new List(); + TreeNode currentNode = null; + while (treeNode.Nodes.Count > 0) + { + foreach (TreeNode childNode in treeNode.Nodes) + { + if (currentNode == null || nodeSorter.Compare(childNode, currentNode) < 0) + { + currentNode = childNode; + } + } + treeNode.Nodes.Remove(currentNode); + sortedNodes.Add(currentNode); + currentNode = null; + } + + foreach (TreeNode childNode in sortedNodes) + { + treeNode.Nodes.Add(childNode); + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Sort nodes failed" + Environment.NewLine + ex.Message, true); + } + } + + public static TreeNode Find(TreeNode treeNode, string searchFor) + { + TreeNode tmpNode = default(TreeNode); + + try + { + if (IsThisTheNodeWeAreSearchingFor(treeNode, searchFor)) + return treeNode; + + foreach (TreeNode childNode in treeNode.Nodes) + { + tmpNode = Find(childNode, searchFor); + if (!(tmpNode == null)) + { + return tmpNode; + } + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true); + } + + return null; + } + + private static bool IsThisTheNodeWeAreSearchingFor(TreeNode treeNode, string searchFor) + { + return ((treeNode.Text.ToLower()).IndexOf(searchFor.ToLower()) + 1 > 0); + } + + public static TreeNode Find(TreeNode treeNode, ConnectionInfo conInfo) + { + TreeNode tmpNode = default(TreeNode); + try + { + if (treeNode.Tag == conInfo) + return treeNode; + + foreach (TreeNode childNode in treeNode.Nodes) + { + tmpNode = Find(childNode, conInfo); + if (!(tmpNode == null)) + return tmpNode; + } + } + catch (Exception ex) + { + Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true); + } + + return null; + } + + private delegate void ResetTreeDelegate(); + public static void ResetTree() + { + if (TreeView.InvokeRequired) + { + ResetTreeDelegate resetTreeDelegate = new ResetTreeDelegate(ResetTree); + Windows.treeForm.Invoke(resetTreeDelegate); + } + else + { + TreeView.BeginUpdate(); + TreeView.Nodes.Clear(); + TreeView.Nodes.Add(My.Language.strConnections); + TreeView.EndUpdate(); + } + } + + private delegate void SelectNodeCB(); + private static void SelectNode() + { + if (_TreeView.InvokeRequired == true) + { + SelectNodeCB d = new SelectNodeCB(SelectNode); + _TreeView.Invoke(d); + } + else + { + _TreeView.SelectedNode = treeNodeToBeSelected; + } + } + } +} \ No newline at end of file diff --git a/mRemoteV1/Tree/NodeType.cs b/mRemoteV1/Tree/NodeType.cs new file mode 100644 index 00000000..6f39352b --- /dev/null +++ b/mRemoteV1/Tree/NodeType.cs @@ -0,0 +1,12 @@ +namespace mRemoteNG.Tree +{ + public enum TreeNodeType + { + None = 0, + Root = 1, + Container = 2, + Connection = 3, + PuttyRoot = 4, + PuttySession = 5 + } +} diff --git a/mRemoteV1/Tree/Root/Root.Info.cs b/mRemoteV1/Tree/Root/Root.Info.cs index eeda064a..60889ca5 100644 --- a/mRemoteV1/Tree/Root/Root.Info.cs +++ b/mRemoteV1/Tree/Root/Root.Info.cs @@ -47,7 +47,7 @@ namespace mRemoteNG.Root [LocalizedAttributes.LocalizedCategory("strCategoryDisplay", 1), Browsable(true), LocalizedAttributes.LocalizedDisplayName("strPasswordProtect"), - TypeConverter(typeof(Tools.Misc.YesNoTypeConverter))] + TypeConverter(typeof(Tools.MiscTools.YesNoTypeConverter))] public bool Password { get; set; } [Browsable(false)] diff --git a/mRemoteV1/Tree/Tree.Node.cs b/mRemoteV1/Tree/Tree.Node.cs index 8ebae8b9..3a322b94 100644 --- a/mRemoteV1/Tree/Tree.Node.cs +++ b/mRemoteV1/Tree/Tree.Node.cs @@ -1,8 +1,8 @@ -using Microsoft.VisualBasic; using mRemoteNG.App; -using System; -using System.Collections.Generic; using mRemoteNG.Connection; +using mRemoteNG.Container; +using mRemoteNG.Images; +using System; using System.Windows.Forms; @@ -10,71 +10,27 @@ namespace mRemoteNG.Tree { public class Node { - #region Enums - public enum Type - { - None = 0, - Root = 1, - Container = 2, - Connection = 3, - PuttyRoot = 4, - PuttySession = 5 - } - #endregion - - #region Private Variables - private static TreeNode SetNodeToolTip_old_node = null; - private static TreeNode treeNodeToBeSelected; - #endregion - - #region Public Properties - private static TreeView _TreeView; - public static TreeView TreeView - { - get { return _TreeView; } - set { _TreeView = value; } - } - - public static TreeNode SelectedNode - { - get { return _TreeView.SelectedNode; } - set - { - treeNodeToBeSelected = value; - SelectNode(); - } - } - #endregion - #region Public Methods public static string GetConstantID(TreeNode node) { - if (GetNodeType(node) == Type.Connection) - { - return (node.Tag as ConnectionRecord).MetaData.ConstantID; - } - else if (GetNodeType(node) == Type.Container) - { - return (node.Tag as mRemoteNG.Container.Info).ConnectionRecord.MetaData.ConstantID; - } + if (GetNodeType(node) == TreeNodeType.Connection) + return (node.Tag as mRemoteNG.Connection.ConnectionInfo).ConstantID; + else if (GetNodeType(node) == TreeNodeType.Container) + return (node.Tag as mRemoteNG.Container.ContainerInfo).ConnectionInfo.ConstantID; return null; } public static TreeNode GetNodeFromPositionID(int id) { - foreach (Connection.ConnectionRecord conI in Runtime.ConnectionList) + foreach (ConnectionInfo connection in Runtime.ConnectionList) { - if (conI.MetaData.PositionID == id) + if (connection.PositionID == id) { - if (conI.MetaData.IsContainer) - { - return (conI.Parent as Container.Info).TreeNode; - } + if (connection.IsContainer) + return (connection.Parent as ContainerInfo).TreeNode; else - { - return conI.TreeNode; - } + return connection.TreeNode; } } @@ -83,79 +39,58 @@ namespace mRemoteNG.Tree public static TreeNode GetNodeFromConstantID(string id) { - foreach (Connection.ConnectionRecord conI in Runtime.ConnectionList) + foreach (ConnectionInfo connectionInfo in Runtime.ConnectionList) { - if (conI.MetaData.ConstantID == id) + if (connectionInfo.ConstantID == id) { - if (conI.MetaData.IsContainer) - { - return (conI.Parent as Container.Info).TreeNode; - } + if (connectionInfo.IsContainer) + return (connectionInfo.Parent as ContainerInfo).TreeNode; else - { - return conI.TreeNode; - } + return connectionInfo.TreeNode; } } return null; } - public static Tree.Node.Type GetNodeType(TreeNode treeNode) + public static TreeNodeType GetNodeType(TreeNode treeNode) { try { - if (treeNode == null) - { - return Type.None; - } - - if (treeNode.Tag == null) - { - return Type.None; - } + if (treeNode == null || treeNode.Tag == null) + return TreeNodeType.None; if (treeNode.Tag is Root.PuttySessions.Info) - { - return Type.PuttyRoot; - } + return TreeNodeType.PuttyRoot; else if (treeNode.Tag is Root.Info) - { - return Type.Root; - } - else if (treeNode.Tag is Container.Info) - { - return Type.Container; - } - else if (treeNode.Tag is Connection.PuttySession.Info) - { - return Type.PuttySession; - } - else if (treeNode.Tag is Connection.ConnectionRecordImp) - { - return Type.Connection; - } + return TreeNodeType.Root; + else if (treeNode.Tag is ContainerInfo) + return TreeNodeType.Container; + else if (treeNode.Tag is PuttySessionInfo) + return TreeNodeType.PuttySession; + else if (treeNode.Tag is ConnectionInfo) + return TreeNodeType.Connection; } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t get node type" + Environment.NewLine + ex.Message, true); } - return Type.None; + return TreeNodeType.None; } - public static Tree.Node.Type GetNodeTypeFromString(string str) + public static TreeNodeType GetNodeTypeFromString(string str) { try { switch (str.ToLower()) { case "root": - return Type.Root; + return TreeNodeType.Root; case "container": - return Type.Container; + return TreeNodeType.Container; case "connection": - return Type.Connection; + return TreeNodeType.Connection; } } catch (Exception ex) @@ -163,67 +98,7 @@ namespace mRemoteNG.Tree Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t get node type from string" + Environment.NewLine + ex.Message, true); } - return Type.None; - } - - public static TreeNode Find(TreeNode treeNode, string searchFor) - { - TreeNode tmpNode = default(TreeNode); - - try - { - if ((treeNode.Text.ToLower()).IndexOf(searchFor.ToLower()) + 1 > 0) - { - return treeNode; - } - else - { - foreach (TreeNode childNode in treeNode.Nodes) - { - tmpNode = Find(childNode, searchFor); - if (!(tmpNode == null)) - { - return tmpNode; - } - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true); - } - - return null; - } - - public static TreeNode Find(TreeNode treeNode, Connection.ConnectionRecordImp conInfo) - { - TreeNode tmpNode = default(TreeNode); - - try - { - if (treeNode.Tag == conInfo) - { - return treeNode; - } - else - { - foreach (TreeNode childNode in treeNode.Nodes) - { - tmpNode = Find(childNode, conInfo); - if (!(tmpNode == null)) - { - return tmpNode; - } - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Find node failed" + Environment.NewLine + ex.Message, true); - } - - return null; + return TreeNodeType.None; } public static bool IsEmpty(TreeNode treeNode) @@ -231,9 +106,7 @@ namespace mRemoteNG.Tree try { if (treeNode.Nodes.Count <= 0) - { return false; - } } catch (Exception ex) { @@ -243,7 +116,7 @@ namespace mRemoteNG.Tree return true; } - public static TreeNode AddNode(Type nodeType, string name = null) + public static TreeNode AddNode(TreeNodeType nodeType, string name = null) { try { @@ -252,32 +125,28 @@ namespace mRemoteNG.Tree switch (nodeType) { - case Type.Connection: - case Type.PuttySession: + case TreeNodeType.Connection: + case TreeNodeType.PuttySession: defaultName = My.Language.strNewConnection; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; + treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; break; - case Type.Container: + case TreeNodeType.Container: defaultName = My.Language.strNewFolder; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; + treeNode.ImageIndex = (int)TreeImageType.Container; + treeNode.SelectedImageIndex = (int)TreeImageType.Container; break; - case Type.Root: + case TreeNodeType.Root: defaultName = My.Language.strNewRoot; - treeNode.ImageIndex = (int)Images.Enums.TreeImage.Root; - treeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Root; + treeNode.ImageIndex = (int)TreeImageType.Root; + treeNode.SelectedImageIndex = (int)TreeImageType.Root; break; } if (!string.IsNullOrEmpty(name)) - { treeNode.Name = name; - } else - { treeNode.Name = defaultName; - } treeNode.Text = treeNode.Name; return treeNode; @@ -294,337 +163,102 @@ namespace mRemoteNG.Tree { try { - if (GetNodeType(oldTreeNode) == Type.Connection) - { - Connection.ConnectionRecordImp oldConnectionInfo = (Connection.ConnectionRecordImp) oldTreeNode.Tag; - - Connection.ConnectionRecordImp newConnectionInfo = oldConnectionInfo.Clone(); - Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp newInheritance = oldConnectionInfo.Inherit.Copy(); - newInheritance.Parent = newConnectionInfo; - newConnectionInfo.Inherit = newInheritance; - - Runtime.ConnectionList.Add(newConnectionInfo); - - TreeNode newTreeNode = new TreeNode(newConnectionInfo.Name); - newTreeNode.Tag = newConnectionInfo; - newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.ConnectionClosed; - - newConnectionInfo.TreeNode = newTreeNode; - - if (parentNode == null) - { - oldTreeNode.Parent.Nodes.Insert(oldTreeNode.Index + 1, newTreeNode); - TreeView.SelectedNode = newTreeNode; - } - else - { - Container.Info parentContainerInfo = parentNode.Tag as Container.Info; - if (parentContainerInfo != null) - { - newConnectionInfo.Parent = parentContainerInfo; - } - parentNode.Nodes.Add(newTreeNode); - } - } - else if (GetNodeType(oldTreeNode) == Type.Container) - { - Container.Info oldContainerInfo = (Container.Info) oldTreeNode.Tag; - - Container.Info newContainerInfo = oldContainerInfo.Copy(); - Connection.ConnectionRecordImp newConnectionInfo = oldContainerInfo.ConnectionRecord.Clone(); - newContainerInfo.ConnectionRecord = newConnectionInfo; - - TreeNode newTreeNode = new TreeNode(newContainerInfo.Name); - newTreeNode.Tag = newContainerInfo; - newTreeNode.ImageIndex = (int)Images.Enums.TreeImage.Container; - newTreeNode.SelectedImageIndex = (int)Images.Enums.TreeImage.Container; - newContainerInfo.ConnectionRecord.Parent = newContainerInfo; - - Runtime.ContainerList.Add(newContainerInfo); - - if (parentNode == null) - { - oldTreeNode.Parent.Nodes.Insert(oldTreeNode.Index + 1, newTreeNode); - TreeView.SelectedNode = newTreeNode; - } - else - { - parentNode.Nodes.Add(newTreeNode); - } - - foreach (TreeNode childTreeNode in oldTreeNode.Nodes) - { - CloneNode(childTreeNode, newTreeNode); - } - - newTreeNode.Expand(); - } + if (GetNodeType(oldTreeNode) == TreeNodeType.Connection) + CloneConnectionNode(oldTreeNode, parentNode); + else if (GetNodeType(oldTreeNode) == TreeNodeType.Container) + CloneContainerNode(oldTreeNode, parentNode); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, string.Format(My.Language.strErrorCloneNodeFailed, ex.Message)); } } + + private static void CloneContainerNode(TreeNode oldTreeNode, TreeNode parentNode) + { + ContainerInfo oldContainerInfo = (ContainerInfo) oldTreeNode.Tag; + + ContainerInfo newContainerInfo = oldContainerInfo.Copy(); + ConnectionInfo newConnectionInfo = oldContainerInfo.ConnectionInfo.Copy(); + newContainerInfo.ConnectionInfo = newConnectionInfo; + + TreeNode newTreeNode = new TreeNode(newContainerInfo.Name); + newTreeNode.Tag = newContainerInfo; + newTreeNode.ImageIndex = (int)TreeImageType.Container; + newTreeNode.SelectedImageIndex = (int)TreeImageType.Container; + newContainerInfo.ConnectionInfo.Parent = newContainerInfo; + + Runtime.ContainerList.Add(newContainerInfo); + + if (parentNode == null) + { + oldTreeNode.Parent.Nodes.Insert(oldTreeNode.Index + 1, newTreeNode); + ConnectionTree.SelectedNode = newTreeNode; + } + else + { + parentNode.Nodes.Add(newTreeNode); + } + + foreach (TreeNode childTreeNode in oldTreeNode.Nodes) + { + CloneNode(childTreeNode, newTreeNode); + } + + newTreeNode.Expand(); + } + + private static void CloneConnectionNode(TreeNode oldTreeNode, TreeNode parentNode) + { + ConnectionInfo oldConnectionInfo = (Connection.ConnectionInfo)oldTreeNode.Tag; + + ConnectionInfo newConnectionInfo = oldConnectionInfo.Copy(); + ConnectionInfoInheritance newInheritance = oldConnectionInfo.Inherit.Copy(); + newInheritance.Parent = newConnectionInfo; + newConnectionInfo.Inherit = newInheritance; + + Runtime.ConnectionList.Add(newConnectionInfo); + + TreeNode newTreeNode = new TreeNode(newConnectionInfo.Name); + newTreeNode.Tag = newConnectionInfo; + newTreeNode.ImageIndex = (int)TreeImageType.ConnectionClosed; + newTreeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed; + + newConnectionInfo.TreeNode = newTreeNode; + + if (parentNode == null) + { + oldTreeNode.Parent.Nodes.Insert(oldTreeNode.Index + 1, newTreeNode); + ConnectionTree.SelectedNode = newTreeNode; + } + else + { + ContainerInfo parentContainerInfo = parentNode.Tag as Container.ContainerInfo; + if (parentContainerInfo != null) + { + newConnectionInfo.Parent = parentContainerInfo; + } + parentNode.Nodes.Add(newTreeNode); + } + } - public static void SetNodeImage(TreeNode treeNode, Images.Enums.TreeImage Img) + public static void SetNodeImage(TreeNode treeNode, TreeImageType Img) { SetNodeImageIndex(treeNode, (int)Img); } - public static void SetNodeToolTip(MouseEventArgs e, ToolTip tTip) - { - try - { - if (My.Settings.Default.ShowDescriptionTooltipsInTree) - { - //Find the node under the mouse. - TreeNode new_node = _TreeView.GetNodeAt(e.X, e.Y); - if (new_node.Equals(SetNodeToolTip_old_node)) - { - return; - } - SetNodeToolTip_old_node = new_node; - - //See if we have a node. - if (SetNodeToolTip_old_node == null) - { - tTip.SetToolTip(_TreeView, ""); - } - else - { - //Get this node's object data. - if (GetNodeType(SetNodeToolTip_old_node) == Type.Connection) - { - tTip.SetToolTip(_TreeView, (SetNodeToolTip_old_node.Tag as mRemoteNG.Connection.ConnectionRecordImp).Description); - } - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SetNodeToolTip failed" + Environment.NewLine + ex.Message, true); - } - } - - public static void DeleteSelectedNode() - { - try - { - if (SelectedNode == null) - { - return ; - } - - if (Tree.Node.GetNodeType(SelectedNode) == Type.Root) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "The root item cannot be deleted!"); - } - else if (Tree.Node.GetNodeType(SelectedNode) == Type.Container) - { - if (Tree.Node.IsEmpty(SelectedNode) == false) - { - if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeFolder, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle) (MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) - { - SelectedNode.Remove(); - } - } - else - { - if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeFolderNotEmpty, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle) (MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) - { - foreach (TreeNode tNode in SelectedNode.Nodes) - { - tNode.Remove(); - } - SelectedNode.Remove(); - } - } - } - else if (Tree.Node.GetNodeType(SelectedNode) == Type.Connection) - { - if (Interaction.MsgBox(string.Format(My.Language.strConfirmDeleteNodeConnection, SelectedNode.Text), (Microsoft.VisualBasic.MsgBoxStyle) (MsgBoxStyle.YesNo | MsgBoxStyle.Question), null) == MsgBoxResult.Yes) - { - SelectedNode.Remove(); - } - } - else - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "Tree item type is unknown so it cannot be deleted!"); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Deleting selected node failed" + Environment.NewLine + ex.Message, true); - } - } - - public static void StartRenameSelectedNode() - { - if (SelectedNode != null) - { - SelectedNode.BeginEdit(); - } - } - - public static void FinishRenameSelectedNode(string newName) - { - if (newName == null) - { - return ; - } - - if (newName.Length > 0) - { - ((Connection.ConnectionRecordImp)SelectedNode.Tag).Name = newName; - - if (My.Settings.Default.SetHostnameLikeDisplayName) - { - Connection.ConnectionRecordImp connectionInfo = SelectedNode.Tag as Connection.ConnectionRecordImp; - if (connectionInfo != null) - { - connectionInfo.Hostname = newName; - } - } - } - } - - public static void MoveNodeUp() - { - try - { - if (SelectedNode != null) - { - if (!(SelectedNode.PrevNode == null)) - { - TreeView.BeginUpdate(); - TreeView.Sorted = false; + public static void RenameNode(ConnectionInfo connectionInfo, string newName) + { + if (newName == null || newName.Length <= 0) + return; - TreeNode newNode = (TreeNode)SelectedNode.Clone(); - SelectedNode.Parent.Nodes.Insert(SelectedNode.Index - 1, newNode); - SelectedNode.Remove(); - SelectedNode = newNode; - - TreeView.EndUpdate(); - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeUp failed" + Environment.NewLine + ex.Message, true); - } - } - - public static void MoveNodeDown() - { - try - { - if (SelectedNode != null) - { - if (!(SelectedNode.NextNode == null)) - { - TreeView.BeginUpdate(); - TreeView.Sorted = false; - - TreeNode newNode = (TreeNode)SelectedNode.Clone(); - SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 2, newNode); - SelectedNode.Remove(); - SelectedNode = newNode; - - TreeView.EndUpdate(); - } - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "MoveNodeDown failed" + Environment.NewLine + ex.Message, true); - } - } - - public static void ExpandAllNodes() - { - TreeView.BeginUpdate(); - TreeView.ExpandAll(); - TreeView.EndUpdate(); - } - - public static void CollapseAllNodes() - { - TreeView.BeginUpdate(); - foreach (TreeNode treeNode in TreeView.Nodes[0].Nodes) - { - treeNode.Collapse(false); - } - TreeView.EndUpdate(); - } - - public static void Sort(TreeNode treeNode, System.Windows.Forms.SortOrder sorting) - { - if (TreeView == null) - { - return ; - } - - TreeView.BeginUpdate(); - - if (treeNode == null) - { - if (TreeView.Nodes.Count > 0) - { - treeNode = TreeView.Nodes[0]; - } - else - { - return ; - } - } - else if (GetNodeType(treeNode) == Type.Connection) - { - treeNode = treeNode.Parent; - if (treeNode == null) - { - return ; - } - } - - Sort(treeNode, new Tools.Controls.TreeNodeSorter(sorting)); - - TreeView.EndUpdate(); - } - - private delegate void ResetTreeDelegate(); - public static void ResetTree() - { - if (TreeView.InvokeRequired) - { - ResetTreeDelegate resetTreeDelegate = new ResetTreeDelegate(ResetTree); - Runtime.Windows.treeForm.Invoke(resetTreeDelegate); - } - else - { - TreeView.BeginUpdate(); - TreeView.Nodes.Clear(); - TreeView.Nodes.Add(My.Language.strConnections); - TreeView.EndUpdate(); - } + connectionInfo.Name = newName; + if (My.Settings.Default.SetHostnameLikeDisplayName) + connectionInfo.Hostname = newName; } #endregion #region Private Methods - private delegate void SelectNodeCB(); - private static void SelectNode() - { - if (_TreeView.InvokeRequired == true) - { - SelectNodeCB d = new SelectNodeCB(SelectNode); - _TreeView.Invoke(d); - } - else - { - _TreeView.SelectedNode = treeNodeToBeSelected; - } - } - private delegate void SetNodeImageIndexDelegate(TreeNode treeNode, int imageIndex); private static void SetNodeImageIndex(TreeNode treeNode, int imageIndex) { @@ -641,43 +275,6 @@ namespace mRemoteNG.Tree treeNode.ImageIndex = imageIndex; treeNode.SelectedImageIndex = imageIndex; } - - // Adapted from http://www.codeproject.com/Tips/252234/ASP-NET-TreeView-Sort - private static void Sort(TreeNode treeNode, Tools.Controls.TreeNodeSorter nodeSorter) - { - foreach (TreeNode childNode in treeNode.Nodes) - { - Sort(childNode, nodeSorter); - } - - try - { - ConnectionList sortedNodes = new List(); - TreeNode currentNode = null; - while (treeNode.Nodes.Count > 0) - { - foreach (TreeNode childNode in treeNode.Nodes) - { - if (currentNode == null || nodeSorter.Compare(childNode, currentNode) < 0) - { - currentNode = childNode; - } - } - treeNode.Nodes.Remove(currentNode); - sortedNodes.Add(currentNode); - currentNode = null; - } - - foreach (TreeNode childNode in sortedNodes) - { - treeNode.Nodes.Add(childNode); - } - } - catch (Exception ex) - { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Sort nodes failed" + Environment.NewLine + ex.Message, true); - } - } #endregion } } \ No newline at end of file diff --git a/mRemoteV1/UI/Controls/ListView.cs b/mRemoteV1/UI/Controls/ListView.cs index 9b38685b..564fd556 100644 --- a/mRemoteV1/UI/Controls/ListView.cs +++ b/mRemoteV1/UI/Controls/ListView.cs @@ -7,10 +7,9 @@ namespace mRemoteNG.Controls { public class ListView : System.Windows.Forms.ListView { - #region Private Variables - private bool _ShowFocusCues; - private Alignment _LabelAlignment; - #endregion + Brush foreColorBrush = null; + Brush backColorBrush = null; + Pen borderPen = null; #region Public Properties [Category("Appearance"), DefaultValue(typeof(Color), "HighlightText")] @@ -56,99 +55,130 @@ namespace mRemoteNG.Controls #region Protected Methods protected override void OnDrawItem(DrawListViewItemEventArgs e) { - if (!(View == View.Tile)) - { + if (View != View.Tile || e.ItemIndex < 0) base.OnDrawItem(e); - } - if (e.ItemIndex < 0) - { - base.OnDrawItem(e); - } - - Brush foreColorBrush = null; - Brush backColorBrush = null; - Pen borderPen = null; - try - { - if (Focused) - { - borderPen = new Pen(HighlightBorderColor); - } - else - { - borderPen = new Pen(InactiveHighlightBorderColor); - } - - if (e.Item.Selected) - { - if (Focused) - { - foreColorBrush = new SolidBrush(HighlightForeColor); - backColorBrush = new SolidBrush(HighlightBackColor); - } - else - { - foreColorBrush = new SolidBrush(InactiveHighlightForeColor); - backColorBrush = new SolidBrush(InactiveHighlightBackColor); - } - } - else - { - foreColorBrush = new SolidBrush(e.Item.ForeColor); - backColorBrush = new SolidBrush(BackColor); - } - - e.Graphics.FillRectangle(backColorBrush, e.Bounds); - - if (Focused && ShowFocusCues) - { - e.DrawFocusRectangle(); - } - else if (e.Item.Selected) - { - e.Graphics.DrawRectangle(borderPen, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1); - } - - Rectangle imageBounds = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 6, 16, 16); - Rectangle textBounds = e.Bounds; - - if (e.Item.ImageList != null) - { - Image image = null; - if (!string.IsNullOrEmpty(e.Item.ImageKey) && e.Item.ImageList.Images.ContainsKey(e.Item.ImageKey)) - { - image = e.Item.ImageList.Images[e.Item.ImageKey]; - } - else if (!(e.Item.ImageIndex < 0) & e.Item.ImageList.Images.Count > e.Item.ImageIndex) - { - image = e.Item.ImageList.Images[e.Item.ImageIndex]; - } - if (image != null) - { - e.Graphics.DrawImageUnscaledAndClipped(image, imageBounds); - textBounds.X = textBounds.Left + 20; - textBounds.Width = textBounds.Width - 20; - } - } - - e.Graphics.DrawString(e.Item.Text, e.Item.Font, foreColorBrush, textBounds, GetStringFormat()); - } - finally - { - if (foreColorBrush != null) - { - foreColorBrush.Dispose(); - } - if (backColorBrush != null) - { - backColorBrush.Dispose(); - } - if (borderPen != null) - { - borderPen.Dispose(); - } - } + else + CustomDraw(e); } + + private void CustomDraw(DrawListViewItemEventArgs e) + { + try + { + ResetBrushesAndPens(); + BuildBorderPen(); + BuildBrushes(e); + FillBackgroundColor(e); + DrawItemBorder(e); + DrawImageAndText(e); + } + finally + { + DisposeBrushesAndPens(); + } + } + + private void ResetBrushesAndPens() + { + foreColorBrush = null; + backColorBrush = null; + borderPen = null; + } + + private void BuildBorderPen() + { + if (Focused) + borderPen = new Pen(HighlightBorderColor); + borderPen = new Pen(InactiveHighlightBorderColor); + } + + private void BuildBrushes(DrawListViewItemEventArgs e) + { + if (e.Item.Selected) + { + if (Focused) + { + foreColorBrush = new SolidBrush(HighlightForeColor); + backColorBrush = new SolidBrush(HighlightBackColor); + } + else + { + foreColorBrush = new SolidBrush(InactiveHighlightForeColor); + backColorBrush = new SolidBrush(InactiveHighlightBackColor); + } + } + else + { + foreColorBrush = new SolidBrush(e.Item.ForeColor); + backColorBrush = new SolidBrush(BackColor); + } + } + + private void FillBackgroundColor(DrawListViewItemEventArgs e) + { + e.Graphics.FillRectangle(backColorBrush, e.Bounds); + } + + private void DrawImageAndText(DrawListViewItemEventArgs e) + { + Rectangle imageBounds = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 6, 16, 16); + Rectangle textBounds = e.Bounds; + if (e.Item.ImageList != null) + { + Image image = GetItemImage(e); + if (image != null) + { + DrawImage(e, imageBounds, image); + textBounds = UpdateTextBoundsToLeaveRoomForImage(textBounds); + } + } + DrawText(e, textBounds); + } + + private static Image GetItemImage(DrawListViewItemEventArgs e) + { + Image image = null; + if (!string.IsNullOrEmpty(e.Item.ImageKey) && e.Item.ImageList.Images.ContainsKey(e.Item.ImageKey)) + image = e.Item.ImageList.Images[e.Item.ImageKey]; + else if (!(e.Item.ImageIndex < 0) & e.Item.ImageList.Images.Count > e.Item.ImageIndex) + image = e.Item.ImageList.Images[e.Item.ImageIndex]; + return image; + } + + private static void DrawImage(DrawListViewItemEventArgs e, Rectangle imageBounds, Image image) + { + e.Graphics.DrawImageUnscaledAndClipped(image, imageBounds); + } + + private static Rectangle UpdateTextBoundsToLeaveRoomForImage(Rectangle textBounds) + { + textBounds.X = textBounds.Left + 20; + textBounds.Width = textBounds.Width - 20; + return textBounds; + } + + private void DrawText(DrawListViewItemEventArgs e, Rectangle textBounds) + { + e.Graphics.DrawString(e.Item.Text, e.Item.Font, foreColorBrush, textBounds, GetStringFormat()); + } + + private void DrawItemBorder(DrawListViewItemEventArgs e) + { + if (Focused && ShowFocusCues) + e.DrawFocusRectangle(); + else if (e.Item.Selected) + e.Graphics.DrawRectangle(borderPen, e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1); + } + + private void DisposeBrushesAndPens() + { + if (foreColorBrush != null) + foreColorBrush.Dispose(); + if (backColorBrush != null) + backColorBrush.Dispose(); + if (borderPen != null) + borderPen.Dispose(); + } #endregion #region Private Methods @@ -182,19 +212,12 @@ namespace mRemoteNG.Controls } if (RightToLeft.ToString() != null) - { - format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft); - } + format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft); if (LabelWrap) - { - format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags - & ~StringFormatFlags.NoWrap); - } + format.FormatFlags = (StringFormatFlags) (format.FormatFlags & ~StringFormatFlags.NoWrap); else - { - format.FormatFlags = (System.Drawing.StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap); - } + format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap); return format; } @@ -204,22 +227,17 @@ namespace mRemoteNG.Controls [TypeConverter(typeof(ExpandableObjectConverter))] public class Alignment { - #region Private Properties [DefaultValue(VerticalAlignment.Top)] private VerticalAlignment _Vertical = VerticalAlignment.Top; [DefaultValue(HorizontalAlignment.Left)] private HorizontalAlignment _Horizontal = HorizontalAlignment.Left; - #endregion - #region Constructors public Alignment() { - } - #endregion - #region Public Properties + public Alignment(VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment) { Vertical = verticalAlignment; @@ -237,14 +255,11 @@ namespace mRemoteNG.Controls get { return _Horizontal; } set { _Horizontal = value; } } - #endregion - #region Public Methods public override string ToString() { return string.Format("{0}, {1}", Vertical, Horizontal); } - #endregion } #region Enums diff --git a/mRemoteV1/UI/Controls/QuickConnectComboBox.cs b/mRemoteV1/UI/Controls/QuickConnectComboBox.cs index 700c937f..5f60dfb8 100644 --- a/mRemoteV1/UI/Controls/QuickConnectComboBox.cs +++ b/mRemoteV1/UI/Controls/QuickConnectComboBox.cs @@ -111,7 +111,7 @@ namespace mRemoteNG.Controls private struct HistoryItem : IEquatable { - public ConnectionRecordImp ConnectionInfo {get; set;} + public ConnectionInfo ConnectionInfo {get; set;} public bool Equals(HistoryItem other) { @@ -170,7 +170,7 @@ namespace mRemoteNG.Controls return false; } - public void Add(ConnectionRecordImp connectionInfo) + public void Add(ConnectionInfo connectionInfo) { try { @@ -232,14 +232,14 @@ namespace mRemoteNG.Controls public class ProtocolChangedEventArgs : EventArgs { - public ProtocolChangedEventArgs(Protocols protocol) + public ProtocolChangedEventArgs(ProtocolType protocol) { _protocol = protocol; } - private Protocols _protocol; + private ProtocolType _protocol; - public Protocols Protocol + public ProtocolType Protocol { get { diff --git a/mRemoteV1/UI/Forms/ExportForm.cs b/mRemoteV1/UI/Forms/ExportForm.cs index 6cd6376e..09b26b92 100644 --- a/mRemoteV1/UI/Forms/ExportForm.cs +++ b/mRemoteV1/UI/Forms/ExportForm.cs @@ -23,14 +23,14 @@ namespace mRemoteNG.Forms } } - public Config.Connections.Save.Format SaveFormat + public Config.Connections.ConnectionsSaver.Format SaveFormat { get { ExportFormat exportFormat = cboFileFormat.SelectedItem as ExportFormat; if (exportFormat == null) { - return Config.Connections.Save.Format.mRXML; + return Config.Connections.ConnectionsSaver.Format.mRXML; } else { @@ -201,9 +201,9 @@ namespace mRemoteNG.Forms public void ExportForm_Load(object sender, EventArgs e) { cboFileFormat.Items.Clear(); - cboFileFormat.Items.Add(new ExportFormat(Config.Connections.Save.Format.mRXML)); - cboFileFormat.Items.Add(new ExportFormat(Config.Connections.Save.Format.mRCSV)); - cboFileFormat.Items.Add(new ExportFormat(Config.Connections.Save.Format.vRDCSV)); + cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.mRXML)); + cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.mRCSV)); + cboFileFormat.Items.Add(new ExportFormat(Config.Connections.ConnectionsSaver.Format.vRDCSV)); cboFileFormat.SelectedIndex = 0; ApplyLanguage(); @@ -291,8 +291,8 @@ namespace mRemoteNG.Forms private class ExportFormat { #region Public Properties - private Config.Connections.Save.Format _format; - public Config.Connections.Save.Format Format + private Config.Connections.ConnectionsSaver.Format _format; + public Config.Connections.ConnectionsSaver.Format Format { get { @@ -302,7 +302,7 @@ namespace mRemoteNG.Forms #endregion #region Constructors - public ExportFormat(Config.Connections.Save.Format format) + public ExportFormat(Config.Connections.ConnectionsSaver.Format format) { _format = format; } @@ -313,11 +313,11 @@ namespace mRemoteNG.Forms { switch (Format) { - case Config.Connections.Save.Format.mRXML: + case Config.Connections.ConnectionsSaver.Format.mRXML: return Language.strMremoteNgXml; - case Config.Connections.Save.Format.mRCSV: + case Config.Connections.ConnectionsSaver.Format.mRCSV: return Language.strMremoteNgCsv; - case Config.Connections.Save.Format.vRDCSV: + case Config.Connections.ConnectionsSaver.Format.vRDCSV: return Language.strVisionAppRemoteDesktopCsv; default: return Format.ToString(); diff --git a/mRemoteV1/UI/Forms/OptionsForm.Designer.cs b/mRemoteV1/UI/Forms/OptionsForm.Designer.cs index feb6a345..5fdc7aa0 100644 --- a/mRemoteV1/UI/Forms/OptionsForm.Designer.cs +++ b/mRemoteV1/UI/Forms/OptionsForm.Designer.cs @@ -31,76 +31,85 @@ namespace mRemoteNG.Forms [System.Diagnostics.DebuggerStepThrough()] private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); - mRemoteNG.Controls.Alignment Alignment2 = new mRemoteNG.Controls.Alignment(); - this.PagePanel = new System.Windows.Forms.Panel(); - base.Load += new System.EventHandler(OptionsForm_Load); - base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(OptionsForm_FormClosing); - this.OkButton = new System.Windows.Forms.Button(); - this.OkButton.Click += new System.EventHandler(this.OkButton_Click); - this.CancelButtonControl = new System.Windows.Forms.Button(); - this.CancelButtonControl.Click += new System.EventHandler(this.CancelButtonControl_Click); - this.PageListView = new mRemoteNG.Controls.ListView(); - this.PageListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.PageListView_ItemSelectionChanged); - this.PageListView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PageListView_MouseUp); - this.SuspendLayout(); - // - //PagePanel - // - resources.ApplyResources(this.PagePanel, "PagePanel"); - this.PagePanel.Name = "PagePanel"; - // - //OkButton - // - resources.ApplyResources(this.OkButton, "OkButton"); - this.OkButton.Name = "OkButton"; - this.OkButton.UseVisualStyleBackColor = true; - // - //CancelButtonControl - // - this.CancelButtonControl.DialogResult = System.Windows.Forms.DialogResult.Cancel; - resources.ApplyResources(this.CancelButtonControl, "CancelButtonControl"); - this.CancelButtonControl.Name = "CancelButtonControl"; - this.CancelButtonControl.UseVisualStyleBackColor = true; - // - //PageListView - // - this.PageListView.InactiveHighlightBackColor = System.Drawing.SystemColors.Highlight; - this.PageListView.InactiveHighlightBorderColor = System.Drawing.SystemColors.HotTrack; - this.PageListView.InactiveHighlightForeColor = System.Drawing.SystemColors.HighlightText; - Alignment2.Horizontal = mRemoteNG.Controls.HorizontalAlignment.Left; - Alignment2.Vertical = mRemoteNG.Controls.VerticalAlignment.Middle; - this.PageListView.LabelAlignment = Alignment2; - resources.ApplyResources(this.PageListView, "PageListView"); - this.PageListView.MultiSelect = false; - this.PageListView.Name = "PageListView"; - this.PageListView.OwnerDraw = true; - this.PageListView.ShowFocusCues = false; - this.PageListView.TileSize = new System.Drawing.Size(150, 30); - this.PageListView.UseCompatibleStateImageBehavior = false; - this.PageListView.View = System.Windows.Forms.View.Tile; - // - //OptionsForm - // - this.AcceptButton = this.OkButton; - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.CancelButtonControl; - this.Controls.Add(this.CancelButtonControl); - this.Controls.Add(this.OkButton); - this.Controls.Add(this.PagePanel); - this.Controls.Add(this.PageListView); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "OptionsForm"; - this.ShowInTaskbar = false; - this.ResumeLayout(false); - + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); + mRemoteNG.Controls.Alignment alignment1 = new mRemoteNG.Controls.Alignment(); + this.PagePanel = new System.Windows.Forms.Panel(); + this.OkButton = new System.Windows.Forms.Button(); + this.CancelButtonControl = new System.Windows.Forms.Button(); + this.PageListView = new mRemoteNG.Controls.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.SuspendLayout(); + // + // PagePanel + // + resources.ApplyResources(this.PagePanel, "PagePanel"); + this.PagePanel.Name = "PagePanel"; + // + // OkButton + // + resources.ApplyResources(this.OkButton, "OkButton"); + this.OkButton.Name = "OkButton"; + this.OkButton.UseVisualStyleBackColor = true; + this.OkButton.Click += new System.EventHandler(this.OkButton_Click); + // + // CancelButtonControl + // + this.CancelButtonControl.DialogResult = System.Windows.Forms.DialogResult.Cancel; + resources.ApplyResources(this.CancelButtonControl, "CancelButtonControl"); + this.CancelButtonControl.Name = "CancelButtonControl"; + this.CancelButtonControl.UseVisualStyleBackColor = true; + this.CancelButtonControl.Click += new System.EventHandler(this.CancelButtonControl_Click); + // + // PageListView + // + resources.ApplyResources(this.PageListView, "PageListView"); + this.PageListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.PageListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.PageListView.InactiveHighlightBackColor = System.Drawing.SystemColors.Highlight; + this.PageListView.InactiveHighlightBorderColor = System.Drawing.SystemColors.HotTrack; + this.PageListView.InactiveHighlightForeColor = System.Drawing.SystemColors.HighlightText; + alignment1.Horizontal = mRemoteNG.Controls.HorizontalAlignment.Left; + alignment1.Vertical = mRemoteNG.Controls.VerticalAlignment.Middle; + this.PageListView.LabelAlignment = alignment1; + this.PageListView.MultiSelect = false; + this.PageListView.Name = "PageListView"; + this.PageListView.OwnerDraw = true; + this.PageListView.ShowFocusCues = false; + this.PageListView.TileSize = new System.Drawing.Size(100, 30); + this.PageListView.UseCompatibleStateImageBehavior = false; + this.PageListView.View = System.Windows.Forms.View.Tile; + this.PageListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.PageListView_ItemSelectionChanged); + this.PageListView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PageListView_MouseUp); + // + // columnHeader1 + // + resources.ApplyResources(this.columnHeader1, "columnHeader1"); + // + // OptionsForm + // + this.AcceptButton = this.OkButton; + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.CancelButtonControl; + this.Controls.Add(this.CancelButtonControl); + this.Controls.Add(this.OkButton); + this.Controls.Add(this.PagePanel); + this.Controls.Add(this.PageListView); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "OptionsForm"; + this.ShowInTaskbar = false; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OptionsForm_FormClosing); + this.Load += new System.EventHandler(this.OptionsForm_Load); + this.ResumeLayout(false); + } internal mRemoteNG.Controls.ListView PageListView; internal System.Windows.Forms.Panel PagePanel; internal System.Windows.Forms.Button OkButton; internal System.Windows.Forms.Button CancelButtonControl; + private System.Windows.Forms.ColumnHeader columnHeader1; } } \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/OptionsForm.cs b/mRemoteV1/UI/Forms/OptionsForm.cs index 32825861..771734a5 100644 --- a/mRemoteV1/UI/Forms/OptionsForm.cs +++ b/mRemoteV1/UI/Forms/OptionsForm.cs @@ -3,6 +3,7 @@ using mRemoteNG.Forms.OptionsPages; using mRemoteNG.My; using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using System.Windows.Forms; @@ -10,40 +11,51 @@ namespace mRemoteNG.Forms { public partial class OptionsForm { - #region Private Fields private Dictionary _pages; private ImageList _pageIconImageList; private OptionsPage _startPage; private OptionsPage _selectedPage; - #endregion - #region Constructors + public OptionsForm() { // This call is required by the designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call. - - _pages = new Dictionary(); - _pageIconImageList = new ImageList(); _selectedPage = null; - Runtime.FontOverride(this); - _pages.Add(new Forms.OptionsPages.StartupExitPage(), new PageInfo()); - _pages.Add(new AppearancePage(), new PageInfo()); - _pages.Add(new TabsPanelsPage(), new PageInfo()); - _pages.Add(new ConnectionsPage(), new PageInfo()); - _pages.Add(new SqlServerPage(), new PageInfo()); - _pages.Add(new UpdatesPage(), new PageInfo()); - _pages.Add(new ThemePage(), new PageInfo()); - _pages.Add(new KeyboardPage(), new PageInfo()); - _pages.Add(new AdvancedPage(), new PageInfo()); - _startPage = GetPageFromType(typeof(Forms.OptionsPages.StartupExitPage)); - _pageIconImageList.ColorDepth = ColorDepth.Depth32Bit; - PageListView.LargeImageList = _pageIconImageList; + CompileListOfOptionsPages(); + SetImageListForListView(); + SetStartPage(); } - #endregion - + + private void CompileListOfOptionsPages() + { + _pages = new Dictionary(); + _pages.Add(new Forms.OptionsPages.StartupExitPage(), new PageInfo()); + _pages.Add(new AppearancePage(), new PageInfo()); + _pages.Add(new TabsPanelsPage(), new PageInfo()); + _pages.Add(new ConnectionsPage(), new PageInfo()); + _pages.Add(new SqlServerPage(), new PageInfo()); + _pages.Add(new UpdatesPage(), new PageInfo()); + _pages.Add(new ThemePage(), new PageInfo()); + _pages.Add(new KeyboardPage(), new PageInfo()); + _pages.Add(new AdvancedPage(), new PageInfo()); + } + + private void SetImageListForListView() + { + _pageIconImageList = new ImageList(); + _pageIconImageList.ColorDepth = ColorDepth.Depth32Bit; + PageListView.LargeImageList = _pageIconImageList; + //PageListView.SmallImageList = _pageIconImageList; + } + + private void SetStartPage() + { + _startPage = GetPageFromType(typeof(Forms.OptionsPages.StartupExitPage)); + } + #region Public Methods public DialogResult ShowDialog(IWin32Window ownerWindow, Type pageType) { @@ -51,54 +63,48 @@ namespace mRemoteNG.Forms return ShowDialog(ownerWindow); } #endregion - + #region Private Methods #region Event Handlers - public void OptionsForm_Load(System.Object sender, EventArgs e) + public void OptionsForm_Load(Object sender, EventArgs e) { - foreach (KeyValuePair keyValuePair in _pages) - { - OptionsPage page = keyValuePair.Key; - PageInfo pageInfo = keyValuePair.Value; - _pageIconImageList.Images.Add(pageInfo.IconKey, page.PageIcon); - pageInfo.ListViewItem = PageListView.Items.Add(page.PageName, pageInfo.IconKey); - } + AddOptionsPagesToListView(); ApplyLanguage(); LoadSettings(); ShowPage(_startPage); } - - public void OptionsForm_FormClosing(System.Object sender, FormClosingEventArgs e) + + private void AddOptionsPagesToListView() + { + foreach (KeyValuePair keyValuePair in _pages) + { + OptionsPage page = keyValuePair.Key; + PageInfo pageInfo = keyValuePair.Value; + _pageIconImageList.Images.Add(pageInfo.IconKey, page.PageIcon); + ListViewItem item = new ListViewItem(page.PageName, pageInfo.IconKey); + pageInfo.ListViewItem = PageListView.Items.Add(item); + } + } + + public void OptionsForm_FormClosing(Object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) - { SaveSettings(); - } else - { RevertSettings(); - } } - public void PageListView_ItemSelectionChanged(System.Object sender, ListViewItemSelectionChangedEventArgs e) + public void PageListView_ItemSelectionChanged(Object sender, ListViewItemSelectionChangedEventArgs e) { - if (!e.IsSelected) - { + if (!e.IsSelected || _pages.Count < 1) return ; - } - if (_pages.Count < 1) - { - return ; - } OptionsPage page = GetPageFromListViewItem(e.Item); if (_selectedPage != page) - { ShowPage(page); - } SelectNextControl(PageListView, true, true, true, true); } - - public void PageListView_MouseUp(System.Object sender, MouseEventArgs e) + + public void PageListView_MouseUp(Object sender, MouseEventArgs e) { if (PageListView.SelectedIndices.Count == 0) { @@ -107,20 +113,20 @@ namespace mRemoteNG.Forms } SelectNextControl(PageListView, true, true, true, true); } - - public void OkButton_Click(System.Object sender, EventArgs e) + + public void OkButton_Click(Object sender, EventArgs e) { DialogResult = DialogResult.OK; Close(); } - - public void CancelButtonControl_Click(System.Object sender, EventArgs e) + + public void CancelButtonControl_Click(Object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } #endregion - + private void ApplyLanguage() { Text = Language.strMenuOptions; @@ -139,7 +145,7 @@ namespace mRemoteNG.Forms } } } - + private void LoadSettings() { foreach (OptionsPage page in _pages.Keys) @@ -154,7 +160,7 @@ namespace mRemoteNG.Forms } } } - + private void SaveSettings() { foreach (OptionsPage page in _pages.Keys) @@ -169,7 +175,7 @@ namespace mRemoteNG.Forms } } } - + private void RevertSettings() { foreach (OptionsPage page in _pages.Keys) @@ -184,7 +190,7 @@ namespace mRemoteNG.Forms } } } - + private OptionsPage GetPageFromType(Type pageType) { foreach (OptionsPage page in _pages.Keys) @@ -196,7 +202,7 @@ namespace mRemoteNG.Forms } return null; } - + private OptionsPage GetPageFromListViewItem(ListViewItem listViewItem) { foreach (KeyValuePair keyValuePair in _pages) @@ -210,36 +216,44 @@ namespace mRemoteNG.Forms } return null; } - + private void ShowPage(OptionsPage newPage) { - if (_selectedPage != null) - { - OptionsPage oldPage = _selectedPage; - oldPage.Visible = false; - if (_pages.ContainsKey(oldPage)) - { - PageInfo oldPageInfo = _pages[oldPage]; - oldPageInfo.ListViewItem.Selected = false; - } - } - - _selectedPage = newPage; - - if (newPage != null) - { - newPage.Parent = PagePanel; - newPage.Dock = DockStyle.Fill; - newPage.Visible = true; - if (_pages.ContainsKey(newPage)) - { - PageInfo newPageInfo = _pages[newPage]; - newPageInfo.ListViewItem.Selected = true; - } - } + DeactivateOldPage(); + ActivateNewPage(newPage); } + + private void DeactivateOldPage() + { + if (_selectedPage != null) + { + OptionsPage oldPage = _selectedPage; + oldPage.Visible = false; + if (_pages.ContainsKey(oldPage)) + { + PageInfo oldPageInfo = _pages[oldPage]; + oldPageInfo.ListViewItem.Selected = false; + } + } + } + + private void ActivateNewPage(OptionsPage newPage) + { + _selectedPage = newPage; + if (newPage != null) + { + newPage.Parent = PagePanel; + newPage.Dock = DockStyle.Fill; + newPage.Visible = true; + if (_pages.ContainsKey(newPage)) + { + PageInfo newPageInfo = _pages[newPage]; + newPageInfo.ListViewItem.Selected = true; + } + } + } #endregion - + #region Private Classes private class PageInfo { diff --git a/mRemoteV1/UI/Forms/OptionsForm.resx b/mRemoteV1/UI/Forms/OptionsForm.resx index 1984bd75..6ef33168 100644 --- a/mRemoteV1/UI/Forms/OptionsForm.resx +++ b/mRemoteV1/UI/Forms/OptionsForm.resx @@ -195,6 +195,15 @@ 0 + + Left + + + 150 + + + False + 12, 12 @@ -208,7 +217,7 @@ PageListView - mRemoteNG.Controls.ListView, mRemoteNG, Version=1.72.5056.42837, Culture=neutral, PublicKeyToken=null + mRemoteNG.Controls.ListView, mRemoteNG, Version=1.73.5940.35123, Culture=neutral, PublicKeyToken=null $this @@ -255,6 +264,12 @@ Options + + columnHeader1 + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + OptionsForm diff --git a/mRemoteV1/UI/Forms/OptionsPages/AdvancedPage.cs b/mRemoteV1/UI/Forms/OptionsPages/AdvancedPage.cs index 662fb1e0..43d50d73 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/AdvancedPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/AdvancedPage.cs @@ -51,19 +51,19 @@ namespace mRemoteNG.Forms.OptionsPages { base.SaveSettings(); - chkWriteLogFile.Checked = System.Convert.ToBoolean(My.Settings.Default.WriteLogFile); - chkEncryptCompleteFile.Checked = System.Convert.ToBoolean(My.Settings.Default.EncryptCompleteConnectionsFile); - chkAutomaticallyGetSessionInfo.Checked = System.Convert.ToBoolean(My.Settings.Default.AutomaticallyGetSessionInfo); - chkAutomaticReconnect.Checked = System.Convert.ToBoolean(My.Settings.Default.ReconnectOnDisconnect); - numPuttyWaitTime.Value = System.Convert.ToDecimal(My.Settings.Default.MaxPuttyWaitTime); + chkWriteLogFile.Checked = My.Settings.Default.WriteLogFile; + chkEncryptCompleteFile.Checked = My.Settings.Default.EncryptCompleteConnectionsFile; + chkAutomaticallyGetSessionInfo.Checked = My.Settings.Default.AutomaticallyGetSessionInfo; + chkAutomaticReconnect.Checked = My.Settings.Default.ReconnectOnDisconnect; + numPuttyWaitTime.Value = My.Settings.Default.MaxPuttyWaitTime; chkUseCustomPuttyPath.Checked = My.Settings.Default.UseCustomPuttyPath; txtCustomPuttyPath.Text = My.Settings.Default.CustomPuttyPath; SetPuttyLaunchButtonEnabled(); - numUVNCSCPort.Value = System.Convert.ToDecimal(My.Settings.Default.UVNCSCPort); + numUVNCSCPort.Value = My.Settings.Default.UVNCSCPort; - txtXULrunnerPath.Text = System.Convert.ToString(My.Settings.Default.XULRunnerPath); + txtXULrunnerPath.Text = My.Settings.Default.XULRunnerPath; } public override void SaveSettings() @@ -94,7 +94,7 @@ namespace mRemoteNG.Forms.OptionsPages } else { - PuttyBase.PuttyPath = App.Info.General.PuttyPath; + PuttyBase.PuttyPath = App.Info.GeneralAppInfo.PuttyPath; } Config.Putty.Sessions.AddSessionsToTree(); } @@ -126,7 +126,7 @@ namespace mRemoteNG.Forms.OptionsPages using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = string.Format("{0}|*.exe|{1}|*.*", Language.strFilterApplication, Language.strFilterAll); - openFileDialog.FileName = Path.GetFileName(App.Info.General.PuttyPath); + openFileDialog.FileName = Path.GetFileName(App.Info.GeneralAppInfo.PuttyPath); openFileDialog.CheckFileExists = true; openFileDialog.Multiselect = false; @@ -151,7 +151,7 @@ namespace mRemoteNG.Forms.OptionsPages } else { - fileName = App.Info.General.PuttyPath; + fileName = App.Info.GeneralAppInfo.PuttyPath; } puttyProcess.Start(fileName); puttyProcess.SetControlText("Button", "&Cancel", "&Close"); @@ -187,7 +187,7 @@ namespace mRemoteNG.Forms.OptionsPages } else { - puttyPath = App.Info.General.PuttyPath; + puttyPath = App.Info.GeneralAppInfo.PuttyPath; } bool exists = false; diff --git a/mRemoteV1/UI/Forms/OptionsPages/ConnectionsPage.cs b/mRemoteV1/UI/Forms/OptionsPages/ConnectionsPage.cs index 208e5604..57ef0c6e 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/ConnectionsPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/ConnectionsPage.cs @@ -78,18 +78,18 @@ namespace mRemoteNG.Forms.OptionsPages } txtCredentialsUsername.Text = System.Convert.ToString(My.Settings.Default.DefaultUsername); - txtCredentialsPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.General.EncryptionKey); + txtCredentialsPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey); txtCredentialsDomain.Text = System.Convert.ToString(My.Settings.Default.DefaultDomain); - if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Never) + if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Never) { radCloseWarnNever.Checked = true; } - else if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Exit) + else if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Exit) { radCloseWarnExit.Checked = true; } - else if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Multiple) + else if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple) { radCloseWarnMultiple.Checked = true; } @@ -135,24 +135,24 @@ namespace mRemoteNG.Forms.OptionsPages } My.Settings.Default.DefaultUsername = txtCredentialsUsername.Text; - My.Settings.Default.DefaultPassword = Crypt.Encrypt(txtCredentialsPassword.Text, App.Info.General.EncryptionKey); + My.Settings.Default.DefaultPassword = Crypt.Encrypt(txtCredentialsPassword.Text, App.Info.GeneralAppInfo.EncryptionKey); My.Settings.Default.DefaultDomain = txtCredentialsDomain.Text; if (radCloseWarnAll.Checked) { - My.Settings.Default.ConfirmCloseConnection = (int)ConfirmClose.All; + My.Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.All; } if (radCloseWarnMultiple.Checked) { - My.Settings.Default.ConfirmCloseConnection = (int)ConfirmClose.Multiple; + My.Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Multiple; } if (radCloseWarnExit.Checked) { - My.Settings.Default.ConfirmCloseConnection = (int)ConfirmClose.Exit; + My.Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Exit; } if (radCloseWarnNever.Checked) { - My.Settings.Default.ConfirmCloseConnection = (int)ConfirmClose.Never; + My.Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Never; } } diff --git a/mRemoteV1/UI/Forms/OptionsPages/KeyboardPage.cs b/mRemoteV1/UI/Forms/OptionsPages/KeyboardPage.cs index d5d5f43d..5d956957 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/KeyboardPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/KeyboardPage.cs @@ -2,27 +2,35 @@ using System; using System.Windows.Forms; using mRemoteNG.Config; using mRemoteNG.My; +using mRemoteNG.Config.KeyboardShortcuts; namespace mRemoteNG.Forms.OptionsPages { public partial class KeyboardPage { + private KeyboardShortcutMap _keyboardShortcutMap; + private ListViewGroup _tabsListViewGroup; + private ListViewItem _previousTabListViewItem; + private ListViewItem _nextTabListViewItem; + private bool _ignoreKeyboardShortcutTextChanged = false; + + public KeyboardPage() { InitializeComponent(); } - + public override string PageName { get { return Language.strOptionsTabKeyboard; } set {} } - + public override void ApplyLanguage() { base.ApplyLanguage(); - + lblKeyboardShortcuts.Text = Language.strOptionsKeyboardLabelKeyboardShortcuts; btnNewKeyboardShortcut.Text = Language.strOptionsKeyboardButtonNew; btnDeleteKeyboardShortcut.Text = Language.strOptionsKeyboardButtonDelete; @@ -30,42 +38,34 @@ namespace mRemoteNG.Forms.OptionsPages grpModifyKeyboardShortcut.Text = Language.strOptionsKeyboardGroupModifyShortcut; btnResetAllKeyboardShortcuts.Text = Language.strOptionsKeyboardButtonResetAll; } - + public override void LoadSettings() { _tabsListViewGroup = new ListViewGroup(Language.strOptionsKeyboardCommandsGroupTabs); _previousTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsPreviousTab, _tabsListViewGroup); _nextTabListViewItem = new ListViewItem(Language.strOptionsKeyboardCommandsNextTab, _tabsListViewGroup); - - _keyboardShortcutMap = (mRemoteNG.Config.KeyboardShortcutMap)KeyboardShortcuts.Map.Clone(); - + + _keyboardShortcutMap = (KeyboardShortcutMap)KeyboardShortcuts.Map.Clone(); + lvKeyboardCommands.Groups.Add(_tabsListViewGroup); lvKeyboardCommands.Items.Add(_previousTabListViewItem); lvKeyboardCommands.Items.Add(_nextTabListViewItem); _previousTabListViewItem.Selected = true; } - + public override void SaveSettings() { base.SaveSettings(); - + if (_keyboardShortcutMap != null) { KeyboardShortcuts.Map = _keyboardShortcutMap; } } - - #region Private Fields - private KeyboardShortcutMap _keyboardShortcutMap; - private ListViewGroup _tabsListViewGroup; - private ListViewItem _previousTabListViewItem; - private ListViewItem _nextTabListViewItem; - private bool _ignoreKeyboardShortcutTextChanged = false; - #endregion - + #region Private Methods #region Event Handlers - public void lvKeyboardCommands_SelectedIndexChanged(System.Object sender, EventArgs e) + public void lvKeyboardCommands_SelectedIndexChanged(Object sender, EventArgs e) { bool isItemSelected = lvKeyboardCommands.SelectedItems.Count == 1; EnableKeyboardShortcutControls(isItemSelected); @@ -88,7 +88,7 @@ namespace mRemoteNG.Forms.OptionsPages } } - public void lstKeyboardShortcuts_SelectedIndexChanged(System.Object sender, EventArgs e) + public void lstKeyboardShortcuts_SelectedIndexChanged(Object sender, EventArgs e) { bool isItemSelected = lstKeyboardShortcuts.SelectedItems.Count == 1; @@ -119,7 +119,7 @@ namespace mRemoteNG.Forms.OptionsPages _ignoreKeyboardShortcutTextChanged = false; } - public void btnNewKeyboardShortcut_Click(System.Object sender, EventArgs e) + public void btnNewKeyboardShortcut_Click(Object sender, EventArgs e) { foreach (object item in lstKeyboardShortcuts.Items) { @@ -139,7 +139,7 @@ namespace mRemoteNG.Forms.OptionsPages hotModifyKeyboardShortcut.Focus(); } - public void btnDeleteKeyboardShortcut_Click(System.Object sender, EventArgs e) + public void btnDeleteKeyboardShortcut_Click(Object sender, EventArgs e) { int selectedIndex = lstKeyboardShortcuts.SelectedIndex; @@ -159,13 +159,13 @@ namespace mRemoteNG.Forms.OptionsPages lstKeyboardShortcuts.SelectedIndex = selectedIndex; } - public void btnResetAllKeyboardShortcuts_Click(System.Object sender, EventArgs e) + public void btnResetAllKeyboardShortcuts_Click(Object sender, EventArgs e) { - _keyboardShortcutMap = (mRemoteNG.Config.KeyboardShortcutMap)KeyboardShortcuts.DefaultMap.Clone(); + _keyboardShortcutMap = (KeyboardShortcutMap)KeyboardShortcuts.DefaultMap.Clone(); lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs()); } - public void btnResetKeyboardShortcuts_Click(System.Object sender, EventArgs e) + public void btnResetKeyboardShortcuts_Click(Object sender, EventArgs e) { ShortcutCommand command = (ShortcutCommand) (GetSelectedShortcutCommand()); if (command == ShortcutCommand.None) @@ -176,7 +176,7 @@ namespace mRemoteNG.Forms.OptionsPages lvKeyboardCommands_SelectedIndexChanged(this, new EventArgs()); } - public void hotModifyKeyboardShortcut_TextChanged(System.Object sender, EventArgs e) + public void hotModifyKeyboardShortcut_TextChanged(Object sender, EventArgs e) { if (_ignoreKeyboardShortcutTextChanged || lstKeyboardShortcuts.SelectedIndex < 0 | lstKeyboardShortcuts.SelectedIndex >= lstKeyboardShortcuts.Items.Count) { @@ -209,14 +209,14 @@ namespace mRemoteNG.Forms.OptionsPages } } #endregion - + private ShortcutCommand GetSelectedShortcutCommand() { if (!(lvKeyboardCommands.SelectedItems.Count == 1)) { return ShortcutCommand.None; } - + ListViewItem selectedItem = lvKeyboardCommands.SelectedItems[0]; if (selectedItem == _previousTabListViewItem) { @@ -236,17 +236,15 @@ namespace mRemoteNG.Forms.OptionsPages lstKeyboardShortcuts.Enabled = enable; btnNewKeyboardShortcut.Enabled = enable; btnResetKeyboardShortcuts.Enabled = enable; - if (!enable) { btnDeleteKeyboardShortcut.Enabled = false; grpModifyKeyboardShortcut.Enabled = false; hotModifyKeyboardShortcut.Enabled = false; - lstKeyboardShortcuts.Items.Clear(); hotModifyKeyboardShortcut.Text = string.Empty; } } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs index 46029c1c..c8f4bec3 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/SqlServerPage.cs @@ -2,6 +2,8 @@ using System; using mRemoteNG.My; using mRemoteNG.App; using mRemoteNG.Security; +using mRemoteNG.App.Info; +using mRemoteNG.Config.Connections; namespace mRemoteNG.Forms.OptionsPages @@ -41,11 +43,11 @@ namespace mRemoteNG.Forms.OptionsPages { base.SaveSettings(); - chkUseSQLServer.Checked = System.Convert.ToBoolean(My.Settings.Default.UseSQLServer); - txtSQLServer.Text = System.Convert.ToString(My.Settings.Default.SQLHost); - txtSQLDatabaseName.Text = System.Convert.ToString(My.Settings.Default.SQLDatabaseName); - txtSQLUsername.Text = System.Convert.ToString(My.Settings.Default.SQLUser); - txtSQLPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.SQLPass), App.Info.General.EncryptionKey); + chkUseSQLServer.Checked = My.Settings.Default.UseSQLServer; + txtSQLServer.Text = My.Settings.Default.SQLHost; + txtSQLDatabaseName.Text = My.Settings.Default.SQLDatabaseName; + txtSQLUsername.Text = My.Settings.Default.SQLUser; + txtSQLPassword.Text = Crypt.Decrypt(My.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey); } public override void SaveSettings() @@ -56,15 +58,20 @@ namespace mRemoteNG.Forms.OptionsPages My.Settings.Default.SQLHost = txtSQLServer.Text; My.Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text; My.Settings.Default.SQLUser = txtSQLUsername.Text; - My.Settings.Default.SQLPass = Crypt.Encrypt(txtSQLPassword.Text, App.Info.General.EncryptionKey); - - Runtime.Startup.DestroySQLUpdateHandlerAndStopTimer(); - frmMain.Default.UsingSqlServer = System.Convert.ToBoolean(My.Settings.Default.UseSQLServer); - if (My.Settings.Default.UseSQLServer) - { - Runtime.Startup.CreateSQLUpdateHandlerAndStartTimer(); - } + My.Settings.Default.SQLPass = Crypt.Encrypt(txtSQLPassword.Text, GeneralAppInfo.EncryptionKey); + ReinitializeSQLUpdater(); } + + private static void ReinitializeSQLUpdater() + { + Runtime.SQLConnProvider.Dispose(); + frmMain.Default.AreWeUsingSqlServerForSavingConnections = My.Settings.Default.UseSQLServer; + if (My.Settings.Default.UseSQLServer) + { + Runtime.SQLConnProvider = new SqlConnectionsProvider(); + Runtime.SQLConnProvider.Enable(); + } + } public void chkUseSQLServer_CheckedChanged(object sender, EventArgs e) { @@ -78,4 +85,4 @@ namespace mRemoteNG.Forms.OptionsPages txtSQLPassword.Enabled = chkUseSQLServer.Checked; } } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs index abaaced4..3f406ca9 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.cs @@ -6,6 +6,7 @@ using mRemoteNG.App; using mRemoteNG.Security; using mRemoteNG.Tools; using PSTaskDialog; +using mRemoteNG.App.Update; namespace mRemoteNG.Forms.OptionsPages @@ -93,7 +94,7 @@ namespace mRemoteNG.Forms.OptionsPages chkUseProxyAuthentication.Checked = System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication); pnlProxyAuthentication.Enabled = System.Convert.ToBoolean(My.Settings.Default.UpdateProxyUseAuthentication); txtProxyUsername.Text = System.Convert.ToString(My.Settings.Default.UpdateProxyAuthUser); - txtProxyPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), App.Info.General.EncryptionKey); + txtProxyPassword.Text = Crypt.Decrypt(System.Convert.ToString(My.Settings.Default.UpdateProxyAuthPass), App.Info.GeneralAppInfo.EncryptionKey); btnTestProxy.Enabled = System.Convert.ToBoolean(My.Settings.Default.UpdateUseProxy); @@ -132,26 +133,26 @@ namespace mRemoteNG.Forms.OptionsPages My.Settings.Default.UpdateProxyUseAuthentication = chkUseProxyAuthentication.Checked; My.Settings.Default.UpdateProxyAuthUser = txtProxyUsername.Text; - My.Settings.Default.UpdateProxyAuthPass = Crypt.Encrypt(txtProxyPassword.Text, App.Info.General.EncryptionKey); + My.Settings.Default.UpdateProxyAuthPass = Crypt.Encrypt(txtProxyPassword.Text, App.Info.GeneralAppInfo.EncryptionKey); } #endregion #region Private Fields - private App.Update _appUpdate; + private AppUpdater _appUpdate; #endregion - + #region Private Methods #region Event Handlers public void chkCheckForUpdatesOnStartup_CheckedChanged(object sender, EventArgs e) { cboUpdateCheckFrequency.Enabled = chkCheckForUpdatesOnStartup.Checked; } - + public void btnUpdateCheckNow_Click(object sender, EventArgs e) { - Runtime.Windows.Show(UI.Window.Type.Update); + Windows.Show(UI.Window.WindowType.Update); } - + public void chkUseProxyForAutomaticUpdates_CheckedChanged(object sender, EventArgs e) { pnlProxyBasic.Enabled = chkUseProxyForAutomaticUpdates.Checked; @@ -172,7 +173,7 @@ namespace mRemoteNG.Forms.OptionsPages pnlProxyAuthentication.Enabled = false; } } - + public void btnTestProxy_Click(object sender, EventArgs e) { if (_appUpdate != null) @@ -182,8 +183,8 @@ namespace mRemoteNG.Forms.OptionsPages return ; } } - - _appUpdate = new App.Update(); + + _appUpdate = new AppUpdater(); //_appUpdate.Load += _appUpdate.Update_Load; _appUpdate.SetProxySettings(chkUseProxyForAutomaticUpdates.Checked, txtProxyAddress.Text, (int) numProxyPort.Value, chkUseProxyAuthentication.Checked, txtProxyUsername.Text, txtProxyPassword.Text); @@ -194,7 +195,7 @@ namespace mRemoteNG.Forms.OptionsPages _appUpdate.GetUpdateInfoAsync(); } - + public void chkUseProxyAuthentication_CheckedChanged(object sender, EventArgs e) { if (chkUseProxyForAutomaticUpdates.Checked) @@ -210,7 +211,7 @@ namespace mRemoteNG.Forms.OptionsPages } } #endregion - + private void GetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e) { if (InvokeRequired) @@ -219,14 +220,14 @@ namespace mRemoteNG.Forms.OptionsPages Invoke(myDelegate, new object[] {sender, e}); return ; } - + try { _appUpdate.GetUpdateInfoCompletedEvent -= GetUpdateInfoCompleted; - + btnTestProxy.Enabled = true; btnTestProxy.Text = Language.strButtonTestProxy; - + if (e.Cancelled) { return ; @@ -235,14 +236,14 @@ namespace mRemoteNG.Forms.OptionsPages { throw (e.Error); } - + cTaskDialog.ShowCommandBox(this, System.Convert.ToString(Application.ProductName), Language.strProxyTestSucceeded, "", Language.strButtonOK, false); } catch (Exception ex) { - cTaskDialog.ShowCommandBox(this, System.Convert.ToString(Application.ProductName), Language.strProxyTestFailed, Misc.GetExceptionMessageRecursive(ex), "", "", "", Language.strButtonOK, false, eSysIcons.Error, (PSTaskDialog.eSysIcons) 0); + cTaskDialog.ShowCommandBox(this, System.Convert.ToString(Application.ProductName), Language.strProxyTestFailed, MiscTools.GetExceptionMessageRecursive(ex), "", "", "", Language.strButtonOK, false, eSysIcons.Error, (PSTaskDialog.eSysIcons) 0); } } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/PasswordForm.cs b/mRemoteV1/UI/Forms/PasswordForm.cs index 8d336b36..585fe23e 100644 --- a/mRemoteV1/UI/Forms/PasswordForm.cs +++ b/mRemoteV1/UI/Forms/PasswordForm.cs @@ -7,18 +7,14 @@ namespace mRemoteNG.Forms { public partial class PasswordForm { + private string _passwordName; + private bool _Verify = true; + #region Public Properties - private bool _Verify = true; public bool Verify { - get - { - return _Verify; - } - set - { - _Verify = value; - } + get { return _Verify; } + set { _Verify = value; } } public string Password @@ -26,17 +22,13 @@ namespace mRemoteNG.Forms get { if (Verify) - { return txtVerify.Text; - } else - { return txtPassword.Text; - } } } #endregion - + #region Constructors public PasswordForm(string passwordName = null, bool verify = true) { @@ -48,7 +40,7 @@ namespace mRemoteNG.Forms this.Verify = verify; } #endregion - + #region Event Handlers public void frmPassword_Load(object sender, EventArgs e) { @@ -65,6 +57,7 @@ namespace mRemoteNG.Forms public void btnCancel_Click(System.Object sender, EventArgs e) { DialogResult = DialogResult.Cancel; + Close(); } public void btnOK_Click(System.Object sender, EventArgs e) @@ -72,9 +65,7 @@ namespace mRemoteNG.Forms if (Verify) { if (VerifyPassword()) - { DialogResult = DialogResult.OK; - } } else { @@ -87,11 +78,7 @@ namespace mRemoteNG.Forms HideStatus(); } #endregion - - #region Private Fields - private string _passwordName; - #endregion - + #region Private Methods private void ApplyLanguage() { @@ -144,4 +131,4 @@ namespace mRemoteNG.Forms } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/SplashPage.Designer.cs b/mRemoteV1/UI/Forms/SplashPage.Designer.cs new file mode 100644 index 00000000..5ad1b98d --- /dev/null +++ b/mRemoteV1/UI/Forms/SplashPage.Designer.cs @@ -0,0 +1,59 @@ +namespace mRemoteNG.UI.Forms +{ + partial class SplashPage + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // SplashPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImage = global::mRemoteNG.My.Resources.Logo; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.ClientSize = new System.Drawing.Size(492, 128); + this.ControlBox = false; + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(492, 128); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(492, 128); + this.Name = "SplashPage"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SplashPage"; + this.TopMost = true; + this.ResumeLayout(false); + + } + + #endregion + + } +} \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/SplashPage.cs b/mRemoteV1/UI/Forms/SplashPage.cs new file mode 100644 index 00000000..5d0540f0 --- /dev/null +++ b/mRemoteV1/UI/Forms/SplashPage.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace mRemoteNG.UI.Forms +{ + public partial class SplashPage : Form + { + BackgroundWorker splashPageWorker; + + public SplashPage() + { + InitializeComponent(); + InitializeBackgroundWorker(); + } + + public void InitializeBackgroundWorker() + { + splashPageWorker = new BackgroundWorker(); + } + } +} diff --git a/mRemoteV1/UI/Forms/SplashPage.resx b/mRemoteV1/UI/Forms/SplashPage.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/mRemoteV1/UI/Forms/SplashPage.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index 256f6f3d..29cf7b2d 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -13,41 +13,43 @@ using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; +using mRemoteNG.Tree; +using mRemoteNG.Config.KeyboardShortcuts; +using mRemoteNG.Messages; +using mRemoteNG.Tools; +using mRemoteNG.UI.Window; +using mRemoteNG.Config.Settings; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Controls; namespace mRemoteNG { public partial class frmMain { #region Private Variables - // Static Variables private static clipboardchangeEventHandler clipboardchangeEvent; - - // Instance Variables that are private-only private bool _inSizeMove = false; private bool _inMouseActivate = false; private IntPtr fpChainedWindowHandle; private int[] SysMenSubItems = new int[51]; - - // Instance Variables with public getters and setters private FormWindowState _previousWindowState; private bool _isClosing = false; private bool _usingSqlServer = false; private string _connectionsFileName = null; private bool _showFullPathInTitle; - private Connection.ConnectionRecordImp _selectedConnection = null; - public Tools.Misc.Fullscreen _fullscreen; + private ConnectionInfo _selectedConnection = null; + public MiscTools.Fullscreen _fullscreen; #endregion #region Constructors public frmMain() { - _showFullPathInTitle = System.Convert.ToBoolean(Settings.Default.ShowCompleteConsPathInTitle); + _showFullPathInTitle = Settings.Default.ShowCompleteConsPathInTitle; InitializeComponent(); //Added to support default instance behavour in C#. This should be removed at the earliest opportunity. if (defaultInstance == null) - { defaultInstance = this; - } } #endregion @@ -81,22 +83,6 @@ namespace mRemoteNG } #endregion - #region Events - public delegate void clipboardchangeEventHandler(); - - public static event clipboardchangeEventHandler clipboardchange - { - add - { - clipboardchangeEvent = (clipboardchangeEventHandler) System.Delegate.Combine(clipboardchangeEvent, value); - } - remove - { - clipboardchangeEvent = (clipboardchangeEventHandler) System.Delegate.Remove(clipboardchangeEvent, value); - } - } - #endregion - #region Properties public FormWindowState PreviousWindowState { @@ -109,7 +95,7 @@ namespace mRemoteNG get { return _isClosing; } } - public bool UsingSqlServer + public bool AreWeUsingSqlServerForSavingConnections { get { return _usingSqlServer; } set @@ -151,7 +137,7 @@ namespace mRemoteNG } } - public Connection.ConnectionRecordImp SelectedConnection + public ConnectionInfo SelectedConnection { get { return _selectedConnection; } set @@ -165,7 +151,7 @@ namespace mRemoteNG } } - public Tools.Misc.Fullscreen Fullscreen + public MiscTools.Fullscreen Fullscreen { get { return _fullscreen; } set { _fullscreen = value; } @@ -173,38 +159,41 @@ namespace mRemoteNG #endregion #region Startup & Shutdown - public void frmMain_Load(object sender, System.EventArgs e) + public void frmMain_Load(object sender, EventArgs e) { Runtime.MainForm = this; + + Startup.CreateLogger(); + Startup.LogStartupData(); + //Runtime.Startup.CheckCompatibility(); - Runtime.Startup.CreateLogger(); // Create gui config load and save objects - Config.Settings.Load SettingsLoad = new Config.Settings.Load(this); + SettingsLoader settingsLoader = new SettingsLoader(this); + settingsLoader.LoadSettings(); - // Load GUI Configuration - SettingsLoad.LoadSettings(); - - Debug.Print("---------------------------" + Environment.NewLine + "[START] - " + System.Convert.ToString(DateTime.Now)); - Runtime.Startup.ParseCommandLineArgs(); + Debug.Print("---------------------------" + Environment.NewLine + "[START] - " + Convert.ToString(DateTime.Now)); + Startup.ParseCommandLineArgs(); ApplyLanguage(); PopulateQuickConnectProtocolMenu(); ThemeManager.ThemeChanged += ApplyThemes; ApplyThemes(); fpChainedWindowHandle = Native.SetClipboardViewer(this.Handle); - Runtime.MessageCollector = new Messages.Collector(Runtime.Windows.errorsForm); - Runtime.WindowList = new UI.Window.List(); - Tools.IeBrowserEmulation.Register(); - Runtime.Startup.GetConnectionIcons(); - Runtime.Windows.treePanel.Focus(); - Tree.Node.TreeView = Runtime.Windows.treeForm.tvConnections; + Runtime.MessageCollector = new MessageCollector(Windows.errorsForm); + Runtime.WindowList = new WindowList(); + Startup.CreatePanels(); + Startup.SetDefaultLayout(); + IeBrowserEmulation.Register(); + Startup.GetConnectionIcons(); + Windows.treePanel.Focus(); + ConnectionTree.TreeView = Windows.treeForm.tvConnections; if (My.Settings.Default.FirstStart && !My.Settings.Default.LoadConsFromCustomLocation && !System.IO.File.Exists(Runtime.GetStartupConnectionFileName())) { Runtime.NewConnections(Runtime.GetStartupConnectionFileName()); } - - //LoadCredentials() + + //LoadCredentials() Runtime.LoadConnections(); if (!Runtime.IsConnectionsFileLoaded) { @@ -214,21 +203,26 @@ namespace mRemoteNG Config.Putty.Sessions.StartWatcher(); if (My.Settings.Default.StartupComponentsCheck) { - Runtime.Windows.Show(UI.Window.Type.ComponentsCheck); + Windows.Show(WindowType.ComponentsCheck); } - - #if PORTABLE - mMenInfoAnnouncements.Visible = false; - mMenToolsUpdate.Visible = false; - mMenInfoSep2.Visible = false; - #endif - Runtime.Startup.CreateSQLUpdateHandlerAndStartTimer(); + ApplySpecialSettingsForPortableVersion(); + + Startup.CreateConnectionsProvider(); AddSysMenuItems(); Microsoft.Win32.SystemEvents.DisplaySettingsChanged += DisplayChanged; this.Opacity = 1; KeyboardShortcuts.RequestKeyNotifications(Handle); } + + private void ApplySpecialSettingsForPortableVersion() + { + #if PORTABLE + mMenInfoAnnouncements.Visible = false; + mMenToolsUpdate.Visible = false; + mMenInfoSep2.Visible = false; + #endif + } private void ApplyLanguage() { @@ -372,24 +366,21 @@ namespace mRemoteNG // } } - public void frmMain_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) + public void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (!(Runtime.WindowList == null || Runtime.WindowList.Count == 0)) { - UI.Window.Connection connectionWindow = default(UI.Window.Connection); + ConnectionWindow connectionWindow = default(ConnectionWindow); int openConnections = 0; - foreach (UI.Window.Base window in Runtime.WindowList) + foreach (BaseWindow window in Runtime.WindowList) { - connectionWindow = window as UI.Window.Connection; + connectionWindow = window as ConnectionWindow; if (connectionWindow != null) - { openConnections = openConnections + connectionWindow.TabController.TabPages.Count; - } } - if (openConnections > 0 && (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.All | (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Multiple & openConnections > 1) || My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Exit)) + if (openConnections > 0 && (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All | (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple & openConnections > 1) || My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Exit)) { - DialogResult result = cTaskDialog.MessageBox(this, System.Windows.Forms.Application.ProductName, My.Language.strConfirmExitMainInstruction, "", "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.YesNo, eSysIcons.Question, eSysIcons.Question); if (cTaskDialog.VerificationChecked) { @@ -403,34 +394,34 @@ namespace mRemoteNG } } - Runtime.Shutdown.Cleanup(); + Shutdown.Cleanup(); _isClosing = true; if (Runtime.WindowList != null) { - foreach (UI.Window.Base window in Runtime.WindowList) + foreach (BaseWindow window in Runtime.WindowList) { window.Close(); } } - Runtime.Shutdown.StartUpdate(); + Shutdown.StartUpdate(); - Debug.Print("[END] - " + System.Convert.ToString(DateTime.Now)); + Debug.Print("[END] - " + Convert.ToString(DateTime.Now)); } #endregion #region Timer - public void tmrAutoSave_Tick(System.Object sender, System.EventArgs e) + public void tmrAutoSave_Tick(Object sender, EventArgs e) { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, "Doing AutoSave", true); + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Doing AutoSave", true); Runtime.SaveConnections(); } #endregion #region Ext Apps Toolbar - public void cMenToolbarShowText_Click(System.Object sender, System.EventArgs e) + public void cMenToolbarShowText_Click(Object sender, EventArgs e) { SwitchToolBarText(!cMenToolbarShowText.Checked); } @@ -475,13 +466,13 @@ namespace mRemoteNG } } - private void tsExtAppEntry_Click(System.Object sender, System.EventArgs e) + private void tsExtAppEntry_Click(Object sender, EventArgs e) { Tools.ExternalTool extA = (Tools.ExternalTool)((Control)sender).Tag; - - if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttySession) + + if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Connection | Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.PuttySession) { - extA.Start((Connection.ConnectionRecordImp)Tree.Node.SelectedNode.Tag); + extA.Start((ConnectionInfo)ConnectionTree.SelectedNode.Tag); } else { @@ -500,13 +491,9 @@ namespace mRemoteNG else { if (tItem.Image != null) - { tItem.DisplayStyle = ToolStripItemDisplayStyle.Image; - } else - { tItem.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; - } } } @@ -518,7 +505,7 @@ namespace mRemoteNG #region File public void mMenFile_DropDownOpening(System.Object sender, System.EventArgs e) { - if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Root) + if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Root) { mMenFileNewConnection.Enabled = true; mMenFileNewFolder.Enabled = true; @@ -529,7 +516,7 @@ namespace mRemoteNG mMenFileRename.Text = My.Language.strMenuRenameFolder; mMenFileDuplicate.Text = My.Language.strMenuDuplicate; } - else if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Container) + else if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Container) { mMenFileNewConnection.Enabled = true; mMenFileNewFolder.Enabled = true; @@ -540,7 +527,7 @@ namespace mRemoteNG mMenFileRename.Text = My.Language.strMenuRenameFolder; mMenFileDuplicate.Text = My.Language.strMenuDuplicateFolder; } - else if (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.Connection) + else if (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Connection) { mMenFileNewConnection.Enabled = true; mMenFileNewFolder.Enabled = true; @@ -551,7 +538,7 @@ namespace mRemoteNG mMenFileRename.Text = My.Language.strMenuRenameConnection; mMenFileDuplicate.Text = My.Language.strMenuDuplicateConnection; } - else if ((Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttyRoot) || (Tree.Node.GetNodeType(Tree.Node.SelectedNode) == Tree.Node.Type.PuttySession)) + else if ((Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.PuttyRoot) || (Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.PuttySession)) { mMenFileNewConnection.Enabled = false; mMenFileNewFolder.Enabled = false; @@ -575,19 +562,19 @@ namespace mRemoteNG } } - static public void mMenFileNewConnection_Click(System.Object sender, EventArgs e) + static public void mMenFileNewConnection_Click(Object sender, EventArgs e) { - Runtime.Windows.treeForm.AddConnection(); + Windows.treeForm.AddConnection(); Runtime.SaveConnectionsBG(); } - static public void mMenFileNewFolder_Click(System.Object sender, EventArgs e) + static public void mMenFileNewFolder_Click(Object sender, EventArgs e) { - Runtime.Windows.treeForm.AddFolder(); + Windows.treeForm.AddFolder(); Runtime.SaveConnectionsBG(); } - static public void mMenFileNew_Click(System.Object sender, EventArgs e) + static public void mMenFileNew_Click(Object sender, EventArgs e) { SaveFileDialog saveFileDialog = Tools.Controls.ConnectionsSaveAsDialog(); if (!(saveFileDialog.ShowDialog() == DialogResult.OK)) @@ -598,7 +585,7 @@ namespace mRemoteNG Runtime.NewConnections(saveFileDialog.FileName); } - static public void mMenFileLoad_Click(System.Object sender, EventArgs e) + static public void mMenFileLoad_Click(Object sender, EventArgs e) { if (Runtime.IsConnectionsFileLoaded) { @@ -616,68 +603,68 @@ namespace mRemoteNG Runtime.LoadConnections(true); } - static public void mMenFileSave_Click(System.Object sender, EventArgs e) + static public void mMenFileSave_Click(Object sender, EventArgs e) { Runtime.SaveConnections(); } - static public void mMenFileSaveAs_Click(System.Object sender, EventArgs e) + static public void mMenFileSaveAs_Click(Object sender, EventArgs e) { Runtime.SaveConnectionsAs(); } - static public void mMenFileDelete_Click(System.Object sender, EventArgs e) + static public void mMenFileDelete_Click(Object sender, EventArgs e) { - Tree.Node.DeleteSelectedNode(); + ConnectionTree.DeleteSelectedNode(); Runtime.SaveConnectionsBG(); } - static public void mMenFileRename_Click(System.Object sender, EventArgs e) + static public void mMenFileRename_Click(Object sender, EventArgs e) { - Tree.Node.StartRenameSelectedNode(); + ConnectionTree.StartRenameSelectedNode(); Runtime.SaveConnectionsBG(); } - static public void mMenFileDuplicate_Click(System.Object sender, EventArgs e) + static public void mMenFileDuplicate_Click(Object sender, EventArgs e) { - Tree.Node.CloneNode(Tree.Node.SelectedNode); + Tree.Node.CloneNode(ConnectionTree.SelectedNode); Runtime.SaveConnectionsBG(); } - static public void mMenFileImportFromFile_Click(System.Object sender, EventArgs e) + static public void mMenFileImportFromFile_Click(Object sender, EventArgs e) { - Import.ImportFromFile(Runtime.Windows.treeForm.tvConnections.Nodes[0], Runtime.Windows.treeForm.tvConnections.SelectedNode); + Import.ImportFromFile(Windows.treeForm.tvConnections.Nodes[0], Windows.treeForm.tvConnections.SelectedNode); } - static public void mMenFileImportFromActiveDirectory_Click(System.Object sender, EventArgs e) + static public void mMenFileImportFromActiveDirectory_Click(Object sender, EventArgs e) { - Runtime.Windows.Show(UI.Window.Type.ActiveDirectoryImport); + Windows.Show(UI.Window.WindowType.ActiveDirectoryImport); } - static public void mMenFileImportFromPortScan_Click(System.Object sender, EventArgs e) + static public void mMenFileImportFromPortScan_Click(Object sender, EventArgs e) { - Runtime.Windows.Show(UI.Window.Type.PortScan, true); + Windows.Show(UI.Window.WindowType.PortScan, true); } - static public void mMenFileExport_Click(System.Object sender, EventArgs e) + static public void mMenFileExport_Click(Object sender, EventArgs e) { - Export.ExportToFile(Runtime.Windows.treeForm.tvConnections.Nodes[0], Runtime.Windows.treeForm.tvConnections.SelectedNode); + Export.ExportToFile(Windows.treeForm.tvConnections.Nodes[0], Windows.treeForm.tvConnections.SelectedNode); } - static public void mMenFileExit_Click(System.Object sender, EventArgs e) + static public void mMenFileExit_Click(Object sender, EventArgs e) { - Runtime.Shutdown.Quit(); + Shutdown.Quit(); } #endregion #region View - public void mMenView_DropDownOpening(object sender, System.EventArgs e) + public void mMenView_DropDownOpening(object sender, EventArgs e) { - this.mMenViewConnections.Checked = !Runtime.Windows.treeForm.IsHidden; - this.mMenViewConfig.Checked = !Runtime.Windows.configForm.IsHidden; - this.mMenViewErrorsAndInfos.Checked = !Runtime.Windows.errorsForm.IsHidden; - this.mMenViewSessions.Checked = !Runtime.Windows.sessionsForm.IsHidden; - this.mMenViewScreenshotManager.Checked = !Runtime.Windows.screenshotForm.IsHidden; + this.mMenViewConnections.Checked = !Windows.treeForm.IsHidden; + this.mMenViewConfig.Checked = !Windows.configForm.IsHidden; + this.mMenViewErrorsAndInfos.Checked = !Windows.errorsForm.IsHidden; + this.mMenViewSessions.Checked = !Windows.sessionsForm.IsHidden; + this.mMenViewScreenshotManager.Checked = !Windows.screenshotForm.IsHidden; this.mMenViewExtAppsToolbar.Checked = tsExternalTools.Visible; this.mMenViewQuickConnectToolbar.Checked = tsQuickConnect.Visible; @@ -692,135 +679,131 @@ namespace mRemoteNG } if (this.mMenViewConnectionPanels.DropDownItems.Count > 0) - { this.mMenViewConnectionPanels.Enabled = true; - } else - { this.mMenViewConnectionPanels.Enabled = false; - } } - private void ConnectionPanelMenuItem_Click(object sender, System.EventArgs e) + private void ConnectionPanelMenuItem_Click(object sender, EventArgs e) { - (((System.Windows.Forms.Control)sender).Tag as UI.Window.Base).Show(this.pnlDock); - (((System.Windows.Forms.Control)sender).Tag as UI.Window.Base).Focus(); + (((Control)sender).Tag as BaseWindow).Show(this.pnlDock); + (((Control)sender).Tag as BaseWindow).Focus(); } - public void mMenViewSessions_Click(object sender, System.EventArgs e) + public void mMenViewSessions_Click(object sender, EventArgs e) { if (this.mMenViewSessions.Checked == false) { - Runtime.Windows.sessionsPanel.Show(this.pnlDock); + Windows.sessionsPanel.Show(this.pnlDock); this.mMenViewSessions.Checked = true; } else { - Runtime.Windows.sessionsPanel.Hide(); + Windows.sessionsPanel.Hide(); this.mMenViewSessions.Checked = false; } } - public void mMenViewConnections_Click(System.Object sender, System.EventArgs e) + public void mMenViewConnections_Click(Object sender, EventArgs e) { if (this.mMenViewConnections.Checked == false) { - Runtime.Windows.treePanel.Show(this.pnlDock); + Windows.treePanel.Show(this.pnlDock); this.mMenViewConnections.Checked = true; } else { - Runtime.Windows.treePanel.Hide(); + Windows.treePanel.Hide(); this.mMenViewConnections.Checked = false; } } - public void mMenViewConfig_Click(System.Object sender, System.EventArgs e) + public void mMenViewConfig_Click(Object sender, EventArgs e) { if (this.mMenViewConfig.Checked == false) { - Runtime.Windows.configPanel.Show(this.pnlDock); + Windows.configPanel.Show(this.pnlDock); this.mMenViewConfig.Checked = true; } else { - Runtime.Windows.configPanel.Hide(); + Windows.configPanel.Hide(); this.mMenViewConfig.Checked = false; } } - public void mMenViewErrorsAndInfos_Click(System.Object sender, System.EventArgs e) + public void mMenViewErrorsAndInfos_Click(Object sender, EventArgs e) { if (this.mMenViewErrorsAndInfos.Checked == false) { - Runtime.Windows.errorsPanel.Show(this.pnlDock); + Windows.errorsPanel.Show(this.pnlDock); this.mMenViewErrorsAndInfos.Checked = true; } else { - Runtime.Windows.errorsPanel.Hide(); + Windows.errorsPanel.Hide(); this.mMenViewErrorsAndInfos.Checked = false; } } - public void mMenViewScreenshotManager_Click(System.Object sender, System.EventArgs e) + public void mMenViewScreenshotManager_Click(Object sender, EventArgs e) { if (this.mMenViewScreenshotManager.Checked == false) { - Runtime.Windows.screenshotPanel.Show(this.pnlDock); + Windows.screenshotPanel.Show(this.pnlDock); this.mMenViewScreenshotManager.Checked = true; } else { - Runtime.Windows.screenshotPanel.Hide(); + Windows.screenshotPanel.Hide(); this.mMenViewScreenshotManager.Checked = false; } } - public void mMenViewJumpToConnectionsConfig_Click(object sender, System.EventArgs e) + public void mMenViewJumpToConnectionsConfig_Click(object sender, EventArgs e) { - if (pnlDock.ActiveContent == Runtime.Windows.treePanel) + if (pnlDock.ActiveContent == Windows.treePanel) { - Runtime.Windows.configForm.Activate(); + Windows.configForm.Activate(); } else { - Runtime.Windows.treeForm.Activate(); + Windows.treeForm.Activate(); } } - public void mMenViewJumpToSessionsScreenshots_Click(object sender, System.EventArgs e) + public void mMenViewJumpToSessionsScreenshots_Click(object sender, EventArgs e) { - if (pnlDock.ActiveContent == Runtime.Windows.sessionsPanel) + if (pnlDock.ActiveContent == Windows.sessionsPanel) { - Runtime.Windows.screenshotForm.Activate(); + Windows.screenshotForm.Activate(); } else { - Runtime.Windows.sessionsForm.Activate(); + Windows.sessionsForm.Activate(); } } - public void mMenViewJumpToErrorsInfos_Click(object sender, System.EventArgs e) + public void mMenViewJumpToErrorsInfos_Click(object sender, EventArgs e) { - Runtime.Windows.errorsForm.Activate(); + Windows.errorsForm.Activate(); } - public void mMenViewResetLayout_Click(System.Object sender, System.EventArgs e) + public void mMenViewResetLayout_Click(Object sender, EventArgs e) { DialogResult msgBoxResult = MessageBox.Show(Language.strConfirmResetLayout, "", MessageBoxButtons.YesNo); if (msgBoxResult == DialogResult.Yes) { - App.Runtime.Startup.SetDefaultLayout(); + Startup.SetDefaultLayout(); } } - public void mMenViewAddConnectionPanel_Click(System.Object sender, System.EventArgs e) + public void mMenViewAddConnectionPanel_Click(Object sender, EventArgs e) { Runtime.AddPanel(); } - public void mMenViewExtAppsToolbar_Click(System.Object sender, System.EventArgs e) + public void mMenViewExtAppsToolbar_Click(Object sender, EventArgs e) { if (mMenViewExtAppsToolbar.Checked == false) { @@ -834,7 +817,7 @@ namespace mRemoteNG } } - public void mMenViewQuickConnectToolbar_Click(System.Object sender, System.EventArgs e) + public void mMenViewQuickConnectToolbar_Click(Object sender, EventArgs e) { if (mMenViewQuickConnectToolbar.Checked == false) { @@ -848,7 +831,7 @@ namespace mRemoteNG } } - public void mMenViewFullscreen_Click(System.Object sender, System.EventArgs e) + public void mMenViewFullscreen_Click(Object sender, EventArgs e) { Fullscreen.Value = !Fullscreen.Value; mMenViewFullscreen.Checked = Fullscreen.Value; @@ -856,39 +839,39 @@ namespace mRemoteNG #endregion #region Tools - public void mMenToolsUpdate_Click(System.Object sender, System.EventArgs e) + public void mMenToolsUpdate_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.Update); + Windows.Show(WindowType.Update); } - public void mMenToolsSSHTransfer_Click(System.Object sender, System.EventArgs e) + public void mMenToolsSSHTransfer_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.SSHTransfer); + Windows.Show(WindowType.SSHTransfer); } - public void mMenToolsUVNCSC_Click(System.Object sender, System.EventArgs e) + public void mMenToolsUVNCSC_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.UltraVNCSC); + Windows.Show(WindowType.UltraVNCSC); } - public void mMenToolsExternalApps_Click(System.Object sender, System.EventArgs e) + public void mMenToolsExternalApps_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.ExternalApps); + Windows.Show(WindowType.ExternalApps); } - public void mMenToolsPortScan_Click(System.Object sender, EventArgs e) + public void mMenToolsPortScan_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.PortScan, false); + Windows.Show(WindowType.PortScan, false); } - public void mMenToolsComponentsCheck_Click(System.Object sender, System.EventArgs e) + public void mMenToolsComponentsCheck_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.ComponentsCheck); + Windows.Show(WindowType.ComponentsCheck); } - public void mMenToolsOptions_Click(System.Object sender, System.EventArgs e) + public void mMenToolsOptions_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.Options); + Windows.Show(WindowType.Options); } #endregion @@ -898,7 +881,7 @@ namespace mRemoteNG try { mnuQuickConnectProtocol.Items.Clear(); - foreach (FieldInfo fieldInfo in typeof(Connection.Protocol.Protocols).GetFields()) + foreach (FieldInfo fieldInfo in typeof(ProtocolType).GetFields()) { if (!(fieldInfo.Name == "value__" || fieldInfo.Name == "IntApp")) { @@ -906,7 +889,7 @@ namespace mRemoteNG if (fieldInfo.Name == My.Settings.Default.QuickConnectProtocol) { menuItem.Checked = true; - btnQuickConnect.Text = System.Convert.ToString(My.Settings.Default.QuickConnectProtocol); + btnQuickConnect.Text = My.Settings.Default.QuickConnectProtocol; } mnuQuickConnectProtocol.Items.Add(menuItem); } @@ -914,16 +897,16 @@ namespace mRemoteNG } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionMessage("PopulateQuickConnectProtocolMenu() failed.", ex, Messages.MessageClass.ErrorMsg, true); + Runtime.MessageCollector.AddExceptionMessage("PopulateQuickConnectProtocolMenu() failed.", ex, MessageClass.ErrorMsg, true); } } - public void lblQuickConnect_Click(System.Object sender, EventArgs e) + public void lblQuickConnect_Click(Object sender, EventArgs e) { cmbQuickConnect.Focus(); } - public void cmbQuickConnect_ConnectRequested(object sender, Controls.QuickConnectComboBox.ConnectRequestedEventArgs e) + public void cmbQuickConnect_ConnectRequested(object sender, QuickConnectComboBox.ConnectRequestedEventArgs e) { btnQuickConnect_ButtonClick(sender, e); } @@ -932,27 +915,27 @@ namespace mRemoteNG { try { - Connection.ConnectionRecordImp connectionInfo = Runtime.CreateQuickConnect(cmbQuickConnect.Text.Trim(), Connection.Protocol.ProtocolManagerImp.StringToProtocol(System.Convert.ToString(My.Settings.Default.QuickConnectProtocol))); + ConnectionInfo connectionInfo = Runtime.CreateQuickConnect(cmbQuickConnect.Text.Trim(), Connection.Protocol.Converter.StringToProtocol(My.Settings.Default.QuickConnectProtocol)); if (connectionInfo == null) { cmbQuickConnect.Focus(); return ; } cmbQuickConnect.Add(connectionInfo); - Runtime.OpenConnection(connectionInfo, Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump); } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionMessage("btnQuickConnect_ButtonClick() failed.", ex, Messages.MessageClass.ErrorMsg, true); + Runtime.MessageCollector.AddExceptionMessage("btnQuickConnect_ButtonClick() failed.", ex, MessageClass.ErrorMsg, true); } } - public void cmbQuickConnect_ProtocolChanged(object sender, Controls.QuickConnectComboBox.ProtocolChangedEventArgs e) + public void cmbQuickConnect_ProtocolChanged(object sender, QuickConnectComboBox.ProtocolChangedEventArgs e) { - SetQuickConnectProtocol(Connection.Protocol.ProtocolManagerImp.ProtocolToString(e.Protocol)); + SetQuickConnectProtocol(Connection.Protocol.Converter.ProtocolToString(e.Protocol)); } - public void btnQuickConnect_DropDownItemClicked(System.Object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e) + public void btnQuickConnect_DropDownItemClicked(Object sender, ToolStripItemClickedEventArgs e) { SetQuickConnectProtocol(e.ClickedItem.Text); } @@ -964,51 +947,47 @@ namespace mRemoteNG foreach (ToolStripMenuItem menuItem in mnuQuickConnectProtocol.Items) { if (menuItem.Text == protocol) - { menuItem.Checked = true; - } else - { menuItem.Checked = false; - } } } #endregion #region Info - public void mMenInfoHelp_Click(System.Object sender, System.EventArgs e) + public void mMenInfoHelp_Click(Object sender, EventArgs e) { - Runtime.Windows.Show(UI.Window.Type.Help); + Windows.Show(WindowType.Help); } - public void mMenInfoForum_Click(System.Object sender, System.EventArgs e) + public void mMenInfoForum_Click(Object sender, EventArgs e) { - App.Runtime.GoToForum(); + Runtime.GoToForum(); } - public void mMenInfoBugReport_Click(System.Object sender, System.EventArgs e) + public void mMenInfoBugReport_Click(Object sender, EventArgs e) { - App.Runtime.GoToBugs(); + Runtime.GoToBugs(); } - public void mMenInfoWebsite_Click(System.Object sender, System.EventArgs e) + public void mMenInfoWebsite_Click(Object sender, EventArgs e) { - App.Runtime.GoToWebsite(); + Runtime.GoToWebsite(); } - public void mMenInfoDonate_Click(System.Object sender, System.EventArgs e) + public void mMenInfoDonate_Click(Object sender, EventArgs e) { - App.Runtime.GoToDonate(); + Runtime.GoToDonate(); } - public void mMenInfoAnnouncements_Click(System.Object sender, System.EventArgs e) + public void mMenInfoAnnouncements_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.Announcement); + Windows.Show(WindowType.Announcement); } - public void mMenInfoAbout_Click(System.Object sender, System.EventArgs e) + public void mMenInfoAbout_Click(Object sender, EventArgs e) { - App.Runtime.Windows.Show(UI.Window.Type.About); + Windows.Show(WindowType.About); } #endregion #endregion @@ -1017,7 +996,7 @@ namespace mRemoteNG public void btnConnections_DropDownOpening(object sender, EventArgs e) { btnConnections.DropDownItems.Clear(); - foreach (TreeNode treeNode in Runtime.Windows.treeForm.tvConnections.Nodes) + foreach (TreeNode treeNode in Windows.treeForm.tvConnections.Nodes) { AddNodeToMenu(treeNode.Nodes, btnConnections); } @@ -1033,7 +1012,7 @@ namespace mRemoteNG menuItem.Text = treeNode.Text; menuItem.Tag = treeNode; - if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Container) + if (Tree.Node.GetNodeType(treeNode) == TreeNodeType.Container) { menuItem.Image = My.Resources.Folder; menuItem.Tag = treeNode.Tag; @@ -1041,9 +1020,9 @@ namespace mRemoteNG toolStripMenuItem.DropDownItems.Add(menuItem); AddNodeToMenu(treeNode.Nodes, menuItem); } - else if (Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.Connection | Tree.Node.GetNodeType(treeNode) == Tree.Node.Type.PuttySession) + else if (Tree.Node.GetNodeType(treeNode) == TreeNodeType.Connection | Tree.Node.GetNodeType(treeNode) == TreeNodeType.PuttySession) { - menuItem.Image = Runtime.Windows.treeForm.imgListTree.Images[treeNode.ImageIndex]; + menuItem.Image = Windows.treeForm.imgListTree.Images[treeNode.ImageIndex]; menuItem.Tag = treeNode.Tag; toolStripMenuItem.DropDownItems.Add(menuItem); @@ -1054,17 +1033,17 @@ namespace mRemoteNG } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionMessage("frmMain.AddNodeToMenu() failed", ex, Messages.MessageClass.ErrorMsg, true); + Runtime.MessageCollector.AddExceptionMessage("frmMain.AddNodeToMenu() failed", ex, MessageClass.ErrorMsg, true); } } - private static void ConnectionsMenuItem_MouseUp(System.Object sender, System.Windows.Forms.MouseEventArgs e) + private static void ConnectionsMenuItem_MouseUp(Object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (((System.Windows.Forms.Control)sender).Tag is Connection.ConnectionRecordImp) + if (((Control)sender).Tag is ConnectionInfo) { - Runtime.OpenConnection((Connection.ConnectionRecordImp)((System.Windows.Forms.Control)sender).Tag); + Runtime.OpenConnection((ConnectionInfo)((Control)sender).Tag); } } } @@ -1102,7 +1081,7 @@ namespace mRemoteNG ActivateConnection(); } - protected override void WndProc(ref Message m) + protected override void WndProc(ref System.Windows.Forms.Message m) { // Listen for and handle operating system messages try @@ -1130,8 +1109,8 @@ namespace mRemoteNG { // Simulate a mouse event since one wasn't generated by Windows Point clientMousePosition = control.PointToClient(MousePosition); - System.Int32 temp_wLow = clientMousePosition.X; - System.Int32 temp_wHigh = clientMousePosition.Y; + Int32 temp_wLow = clientMousePosition.X; + Int32 temp_wHigh = clientMousePosition.Y; Native.SendMessage(control.Handle, Native.WM_LBUTTONDOWN, Native.MK_LBUTTON, Native.MAKELPARAM(ref temp_wLow, ref temp_wHigh)); clientMousePosition.X = temp_wLow; clientMousePosition.Y = temp_wHigh; @@ -1162,7 +1141,7 @@ namespace mRemoteNG { if (SysMenSubItems[i] == m.WParam.ToInt32()) { - Runtime.Screens.SendFormToScreen(Screen.AllScreens[i]); + Screens.SendFormToScreen(Screen.AllScreens[i]); break; } } @@ -1207,15 +1186,15 @@ namespace mRemoteNG private void ActivateConnection() { - if (pnlDock.ActiveDocument is UI.Window.Connection) + if (pnlDock.ActiveDocument is ConnectionWindow) { - UI.Window.Connection cW = pnlDock.ActiveDocument as UI.Window.Connection; + ConnectionWindow cW = pnlDock.ActiveDocument as ConnectionWindow; if (cW.TabController.SelectedTab != null) { Crownwood.Magic.Controls.TabPage tab = cW.TabController.SelectedTab; Connection.InterfaceControl ifc = (Connection.InterfaceControl)tab.Tag; ifc.Protocol.Focus(); - (ifc.FindForm() as UI.Window.Connection).RefreshIC(); + (ifc.FindForm() as ConnectionWindow).RefreshIC(); } } } @@ -1223,7 +1202,7 @@ namespace mRemoteNG public void pnlDock_ActiveDocumentChanged(object sender, EventArgs e) { ActivateConnection(); - UI.Window.Connection connectionWindow = pnlDock.ActiveDocument as UI.Window.Connection; + ConnectionWindow connectionWindow = pnlDock.ActiveDocument as ConnectionWindow; if (connectionWindow != null) { connectionWindow.UpdateSelectedConnection(); @@ -1243,7 +1222,7 @@ namespace mRemoteNG if (Runtime.IsConnectionsFileLoaded) { - if (UsingSqlServer) + if (AreWeUsingSqlServerForSavingConnections) { titleBuilder.Append(separator); titleBuilder.Append(Language.strSQLServer.TrimEnd(':')); @@ -1287,7 +1266,7 @@ namespace mRemoteNG int nonConnectionPanelCount = 0; foreach (DockContent document in pnlDock.Documents) { - if ((closingDocument == null || document != closingDocument) && !(document is UI.Window.Connection)) + if ((closingDocument == null || document != closingDocument) && !(document is ConnectionWindow)) { nonConnectionPanelCount++; } @@ -1312,12 +1291,12 @@ namespace mRemoteNG private void SelectTabRelative(int relativeIndex) { - if (!(pnlDock.ActiveDocument is UI.Window.Connection)) + if (!(pnlDock.ActiveDocument is ConnectionWindow)) { return ; } - UI.Window.Connection connectionWindow = (UI.Window.Connection)pnlDock.ActiveDocument; + ConnectionWindow connectionWindow = (ConnectionWindow)pnlDock.ActiveDocument; Crownwood.Magic.Controls.TabControl tabController = connectionWindow.TabController; int newIndex = tabController.SelectedIndex + relativeIndex; @@ -1364,5 +1343,20 @@ namespace mRemoteNG Runtime.SystemMenu.InsertMenuItem(Runtime.SystemMenu.SystemMenuHandle, 1, Tools.SystemMenu.Flags.MF_BYPOSITION | Tools.SystemMenu.Flags.MF_SEPARATOR, IntPtr.Zero, null); } #endregion + + #region Events + public delegate void clipboardchangeEventHandler(); + public static event clipboardchangeEventHandler clipboardchange + { + add + { + clipboardchangeEvent = (clipboardchangeEventHandler)System.Delegate.Combine(clipboardchangeEvent, value); + } + remove + { + clipboardchangeEvent = (clipboardchangeEventHandler)System.Delegate.Remove(clipboardchangeEvent, value); + } + } + #endregion } } \ No newline at end of file diff --git a/mRemoteV1/UI/UI.Window.List.cs b/mRemoteV1/UI/UI.Window.List.cs deleted file mode 100644 index 208d90de..00000000 --- a/mRemoteV1/UI/UI.Window.List.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections; -using System.Windows.Forms; - - - -namespace mRemoteNG.UI.Window -{ - public class List : CollectionBase - { - #region Public Properties - public UI.Window.Base this[object Index] - { - get - { - this.CleanUp(); - if (Index is UI.Window.Base) - { - if (Index as UI.Window.Base != null) - { - return (UI.Window.Base)Index; - } - } - else - { - if (List.Count - 1 >= (int)Index) - { - if (List[System.Convert.ToInt32(Index)] != null) - { - return List[System.Convert.ToInt32(Index)] as UI.Window.Base; - } - } - } - - return null; - } - } - - public new int Count - { - get - { - this.CleanUp(); - return List.Count; - } - } - #endregion - - #region Public Methods - public void Add(UI.Window.Base uiWindow) - { - this.List.Add(uiWindow); - //AddHandler uiWindow.FormClosing, AddressOf uiFormClosing - } - - public void AddRange(UI.Window.Base[] uiWindow) - { - foreach (Form uW in uiWindow) - { - this.List.Add(uW); - } - } - - public void Remove(UI.Window.Base uiWindow) - { - this.List.Remove(uiWindow); - } - - public UI.Window.Base FromString(string uiWindow) - { - this.CleanUp(); - - for (int i = 0; i <= this.List.Count - 1; i++) - { - if (this[i].Text == uiWindow.Replace("&", "&&")) - { - return this[i]; - } - } - - return null; - } - #endregion - - #region Private Methods - private void CleanUp() - { - for (int i = 0; i <= this.List.Count - 1; i++) - { - if (i > this.List.Count - 1) - { - CleanUp(); - return; - } - if ((this.List[i] as UI.Window.Base).IsDisposed) - { - this.List.RemoveAt(i); - CleanUp(); - return; - } - } - } - #endregion - - #region Event Handlers - private void uiFormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) - { - this.List.Remove(sender); - } - #endregion - } -} diff --git a/mRemoteV1/UI/Windows/UI.Window.About.cs b/mRemoteV1/UI/Window/AboutWindow.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.About.cs rename to mRemoteV1/UI/Window/AboutWindow.cs index 75b3b1aa..385ed158 100644 --- a/mRemoteV1/UI/Windows/UI.Window.About.cs +++ b/mRemoteV1/UI/Window/AboutWindow.cs @@ -8,7 +8,7 @@ using mRemoteNG.App; namespace mRemoteNG.UI.Window { - public class About : Base + public class AboutWindow : BaseWindow { #region Form Init internal System.Windows.Forms.Label lblCopyright; @@ -252,9 +252,9 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public About(DockContent Panel) + public AboutWindow(DockContent Panel) { - this.WindowType = Type.About; + this.WindowType = WindowType.About; this.DockPnl = Panel; this.InitializeComponent(); App.Runtime.FontOverride(this); diff --git a/mRemoteV1/UI/Windows/UI.Window.About.resx b/mRemoteV1/UI/Window/AboutWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.About.resx rename to mRemoteV1/UI/Window/AboutWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.Designer.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs similarity index 97% rename from mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.Designer.cs rename to mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs index e268ef65..cb8c0090 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.Designer.cs +++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class ActiveDirectoryImport : Base + public partial class ActiveDirectoryImportWindow : BaseWindow { #region Windows Form Designer generated code private void InitializeComponent() @@ -11,7 +11,7 @@ namespace mRemoteNG.UI.Window this.Load += new System.EventHandler(ADImport_Load); this.btnImport.Click += new System.EventHandler(this.btnImport_Click); this.txtDomain = new System.Windows.Forms.TextBox(); - this.txtDomain.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(mRemoteNG.UI.Window.ActiveDirectoryImport.txtDomain_PreviewKeyDown); + this.txtDomain.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(mRemoteNG.UI.Window.ActiveDirectoryImportWindow.txtDomain_PreviewKeyDown); this.txtDomain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDomain_KeyDown); this.lblDomain = new System.Windows.Forms.Label(); this.btnChangeDomain = new System.Windows.Forms.Button(); diff --git a/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs new file mode 100644 index 00000000..4d06ee4e --- /dev/null +++ b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.cs @@ -0,0 +1,84 @@ +using System; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; +using mRemoteNG.App; + + +namespace mRemoteNG.UI.Window +{ + public partial class ActiveDirectoryImportWindow : BaseWindow + { + #region Constructors + public ActiveDirectoryImportWindow(DockContent panel) + { + InitializeComponent(); + Runtime.FontOverride(this); + WindowType = WindowType.ActiveDirectoryImport; + DockPnl = panel; + } + #endregion + + #region Private Methods + #region Event Handlers + public void ADImport_Load(object sender, EventArgs e) + { + ApplyLanguage(); + txtDomain.Text = ActiveDirectoryTree.Domain; + EnableDisableImportButton(); + } + + public void btnImport_Click(Object sender, EventArgs e) + { + Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath); + DialogResult = DialogResult.OK; + Close(); + } + + static public void txtDomain_PreviewKeyDown(Object sender, PreviewKeyDownEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + e.IsInputKey = true; + } + } + + public void txtDomain_KeyDown(Object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + ChangeDomain(); + e.SuppressKeyPress = true; + } + } + + public void btnChangeDomain_Click(Object sender, EventArgs e) + { + ChangeDomain(); + } + + public void ActiveDirectoryTree_ADPathChanged(object sender) + { + EnableDisableImportButton(); + } + #endregion + + private void ApplyLanguage() + { + btnImport.Text = My.Language.strButtonImport; + lblDomain.Text = My.Language.strLabelDomain; + btnChangeDomain.Text = My.Language.strButtonChange; + } + + private void ChangeDomain() + { + ActiveDirectoryTree.Domain = txtDomain.Text; + ActiveDirectoryTree.Refresh(); + } + + private void EnableDisableImportButton() + { + btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.ADPath); + } + #endregion + } +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.resx b/mRemoteV1/UI/Window/ActiveDirectoryImportWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.resx rename to mRemoteV1/UI/Window/ActiveDirectoryImportWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Announcement.Designer.cs b/mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs similarity index 96% rename from mRemoteV1/UI/Windows/UI.Window.Announcement.Designer.cs rename to mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs index 96d4c557..1163255c 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Announcement.Designer.cs +++ b/mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class Announcement + public partial class AnnouncementWindow { #region Windows Form Designer generated code internal System.Windows.Forms.WebBrowser webBrowser; diff --git a/mRemoteV1/UI/Windows/UI.Window.Announcement.cs b/mRemoteV1/UI/Window/AnnouncementWindow.cs similarity index 89% rename from mRemoteV1/UI/Windows/UI.Window.Announcement.cs rename to mRemoteV1/UI/Window/AnnouncementWindow.cs index 3d5b7779..73d00185 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Announcement.cs +++ b/mRemoteV1/UI/Window/AnnouncementWindow.cs @@ -3,23 +3,24 @@ using System.ComponentModel; using mRemoteNG.My; using WeifenLuo.WinFormsUI.Docking; using mRemoteNG.App; +using mRemoteNG.App.Update; namespace mRemoteNG.UI.Window { - public partial class Announcement : Base + public partial class AnnouncementWindow : BaseWindow { #region Public Methods - public Announcement(DockContent panel) + public AnnouncementWindow(DockContent panel) { - WindowType = Type.Announcement; + WindowType = WindowType.Announcement; DockPnl = panel; InitializeComponent(); } #endregion #region Private Fields - private App.Update _appUpdate; + private AppUpdater _appUpdate; #endregion #region Private Methods @@ -48,7 +49,7 @@ namespace mRemoteNG.UI.Window { if (_appUpdate == null) { - _appUpdate = new App.Update(); + _appUpdate = new AppUpdater(); //_appUpdate.Load += _appUpdate.Update_Load; } else if (_appUpdate.IsGetAnnouncementInfoRunning) diff --git a/mRemoteV1/UI/Windows/UI.Window.Announcement.resx b/mRemoteV1/UI/Window/AnnouncementWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Announcement.resx rename to mRemoteV1/UI/Window/AnnouncementWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Base.cs b/mRemoteV1/UI/Window/BaseWindow.cs similarity index 86% rename from mRemoteV1/UI/Windows/UI.Window.Base.cs rename to mRemoteV1/UI/Window/BaseWindow.cs index 09410fdc..84821f66 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Base.cs +++ b/mRemoteV1/UI/Window/BaseWindow.cs @@ -1,25 +1,24 @@ -using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public class Base : DockContent + public class BaseWindow : DockContent { #region Private Variables - private Type _WindowType; + private WindowType _WindowType; private DockContent _DockPnl; #endregion #region Constructors - public Base() + public BaseWindow() { //InitializeComponent(); } #endregion #region Public Properties - public Type WindowType + public WindowType WindowType { get { return this._WindowType; } set { this._WindowType = value; } diff --git a/mRemoteV1/UI/Windows/UI.Window.ComponentsCheck.cs b/mRemoteV1/UI/Window/ComponentsCheckWindow.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.ComponentsCheck.cs rename to mRemoteV1/UI/Window/ComponentsCheckWindow.cs index dc0716b4..4a78df0d 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ComponentsCheck.cs +++ b/mRemoteV1/UI/Window/ComponentsCheckWindow.cs @@ -4,11 +4,12 @@ using WeifenLuo.WinFormsUI.Docking; using System.IO; using mRemoteNG.App; using System.Threading; +using mRemoteNG.Connection.Protocol.RDP; namespace mRemoteNG.UI.Window { - public class ComponentsCheck : Base + public class ComponentsCheckWindow : BaseWindow { #region Form Stuff internal System.Windows.Forms.PictureBox pbCheck1; @@ -451,9 +452,9 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public ComponentsCheck(DockContent Panel) + public ComponentsCheckWindow(DockContent Panel) { - this.WindowType = Type.ComponentsCheck; + this.WindowType = WindowType.ComponentsCheck; this.DockPnl = Panel; this.InitializeComponent(); } @@ -514,9 +515,9 @@ namespace mRemoteNG.UI.Window System.Windows.Forms.Application.DoEvents(); } - if (!(new Version(System.Convert.ToString(rdpClient.Version)) >= mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.Versions.RDC60)) + if (!(new Version(System.Convert.ToString(rdpClient.Version)) >= ProtocolRDP.Versions.RDC60)) { - throw (new Exception(string.Format("Found RDC Client version {0} but version {1} or higher is required.", rdpClient.Version, mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.Versions.RDC60))); + throw (new Exception(string.Format("Found RDC Client version {0} but version {1} or higher is required.", rdpClient.Version, ProtocolRDP.Versions.RDC60))); } pbCheck1.Image = My.Resources.Good_Symbol; diff --git a/mRemoteV1/UI/Windows/UI.Window.ComponentsCheck.resx b/mRemoteV1/UI/Window/ComponentsCheckWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.ComponentsCheck.resx rename to mRemoteV1/UI/Window/ComponentsCheckWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Config.cs b/mRemoteV1/UI/Window/ConfigWindow.cs similarity index 91% rename from mRemoteV1/UI/Windows/UI.Window.Config.cs rename to mRemoteV1/UI/Window/ConfigWindow.cs index 4d822105..7a5844be 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Config.cs +++ b/mRemoteV1/UI/Window/ConfigWindow.cs @@ -1,5 +1,7 @@ using mRemoteNG.App; -using mRemoteNG.Connection.Protocol; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Connection.Protocol.VNC; using mRemoteNG.Messages; using mRemoteNG.My; using mRemoteNG.Root; @@ -15,7 +17,7 @@ using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public class Config : Base + public class ConfigWindow : BaseWindow { #region Form Init internal System.Windows.Forms.ToolStripButton btnShowProperties; @@ -293,9 +295,9 @@ namespace mRemoteNG.UI.Window #endregion #region Constructors - public Config(DockContent Panel) + public ConfigWindow(DockContent Panel) { - this.WindowType = Type.Config; + this.WindowType = WindowType.Config; this.DockPnl = Panel; this.InitializeComponent(); } @@ -496,16 +498,16 @@ namespace mRemoteNG.UI.Window this.btnIcon.Image = null; - if (Obj is mRemoteNG.Connection.ConnectionRecordImp) //CONNECTION INFO + if (Obj is mRemoteNG.Connection.ConnectionInfo) //CONNECTION INFO { - if (((mRemoteNG.Connection.ConnectionRecordImp)Obj).IsContainer == false) //NO CONTAINER + if (((mRemoteNG.Connection.ConnectionInfo)Obj).IsContainer == false) //NO CONTAINER { if (this.PropertiesVisible) //Properties selected { this.pGrid.SelectedObject = Obj; this.btnShowProperties.Enabled = true; - if (((mRemoteNG.Connection.ConnectionRecordImp)Obj).Parent != null) + if (((mRemoteNG.Connection.ConnectionInfo)Obj).Parent != null) { this.btnShowInheritance.Enabled = true; } @@ -522,7 +524,7 @@ namespace mRemoteNG.UI.Window { this.pGrid.SelectedObject = Obj; - if (((mRemoteNG.Connection.ConnectionRecordImp)Obj).IsDefault) //Is the default connection + if (((mRemoteNG.Connection.ConnectionInfo)Obj).IsDefault) //Is the default connection { this.btnShowProperties.Enabled = true; this.btnShowInheritance.Enabled = false; @@ -545,7 +547,7 @@ namespace mRemoteNG.UI.Window } else if (this.InheritanceVisible) //Inheritance selected { - this.pGrid.SelectedObject = ((mRemoteNG.Connection.ConnectionRecordImp)Obj).Inherit; + this.pGrid.SelectedObject = ((mRemoteNG.Connection.ConnectionInfo)Obj).Inherit; this.btnShowProperties.Enabled = true; this.btnShowInheritance.Enabled = true; @@ -568,12 +570,12 @@ namespace mRemoteNG.UI.Window this.PropertiesVisible = true; } } - else if (((mRemoteNG.Connection.ConnectionRecordImp)Obj).IsContainer) //CONTAINER + else if (((mRemoteNG.Connection.ConnectionInfo)Obj).IsContainer) //CONTAINER { this.pGrid.SelectedObject = Obj; this.btnShowProperties.Enabled = true; - if (((mRemoteNG.Container.Info)((mRemoteNG.Connection.ConnectionRecordImp)Obj).Parent).Parent != null) + if (((mRemoteNG.Container.ContainerInfo)((mRemoteNG.Connection.ConnectionInfo)Obj).Parent).Parent != null) { this.btnShowInheritance.Enabled = true; } @@ -589,7 +591,7 @@ namespace mRemoteNG.UI.Window this.PropertiesVisible = true; } - Icon conIcon = mRemoteNG.Connection.Icon.FromString(System.Convert.ToString(((mRemoteNG.Connection.ConnectionRecordImp)Obj).Icon)); + Icon conIcon = mRemoteNG.Connection.ConnectionIcon.FromString(System.Convert.ToString(((mRemoteNG.Connection.ConnectionInfo)Obj).Icon)); if (conIcon != null) { this.btnIcon.Image = conIcon.ToBitmap(); @@ -625,7 +627,7 @@ namespace mRemoteNG.UI.Window } pGrid.SelectedObject = Obj; } - else if (Obj is mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp) //INHERITANCE + else if (Obj is ConnectionInfoInheritance) //INHERITANCE { this.pGrid.SelectedObject = Obj; @@ -637,9 +639,9 @@ namespace mRemoteNG.UI.Window this.btnShowDefaultProperties.Enabled = false; this.btnShowDefaultInheritance.Enabled = false; this.btnIcon.Enabled = true; - this.btnHostStatus.Enabled = !((mRemoteNG.Connection.ConnectionRecordImp)((mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp)Obj).Parent).IsContainer; + this.btnHostStatus.Enabled = !((ConnectionInfo)((ConnectionInfoInheritance)Obj).Parent).IsContainer; this.InheritanceVisible = true; - Icon conIcon = mRemoteNG.Connection.Icon.FromString(System.Convert.ToString(((mRemoteNG.Connection.ConnectionRecordImp)((mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp)Obj).Parent).Icon)); + Icon conIcon = ConnectionIcon.FromString(Convert.ToString(((ConnectionInfo)((ConnectionInfoInheritance)Obj).Parent).Icon)); if (conIcon != null) { this.btnIcon.Image = conIcon.ToBitmap(); @@ -776,18 +778,18 @@ namespace mRemoteNG.UI.Window { try { - if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionInfo) { if (e.ChangedItem.Label == My.Language.strPropertyNameProtocol) { - ((mRemoteNG.Connection.ConnectionRecordImp)this.pGrid.SelectedObject).SetDefaultPort(); + ((mRemoteNG.Connection.ConnectionInfo)this.pGrid.SelectedObject).SetDefaultPort(); } else if (e.ChangedItem.Label == My.Language.strPropertyNameName) { - App.Runtime.Windows.treeForm.tvConnections.SelectedNode.Text = System.Convert.ToString(((System.Windows.Forms.Control)this.pGrid.SelectedObject).Name); - if (My.Settings.Default.SetHostnameLikeDisplayName && this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + Windows.treeForm.tvConnections.SelectedNode.Text = System.Convert.ToString(((System.Windows.Forms.Control)this.pGrid.SelectedObject).Name); + if (My.Settings.Default.SetHostnameLikeDisplayName && this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionInfo) { - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = (mRemoteNG.Connection.ConnectionRecordImp) this.pGrid.SelectedObject; + mRemoteNG.Connection.ConnectionInfo connectionInfo = (mRemoteNG.Connection.ConnectionInfo) this.pGrid.SelectedObject; if (!string.IsNullOrEmpty(connectionInfo.Name)) { connectionInfo.Hostname = connectionInfo.Name; @@ -796,7 +798,7 @@ namespace mRemoteNG.UI.Window } else if (e.ChangedItem.Label == My.Language.strPropertyNameIcon) { - Icon conIcon = mRemoteNG.Connection.Icon.FromString(System.Convert.ToString(((mRemoteNG.Connection.ConnectionRecordImp)this.pGrid.SelectedObject).Icon)); + Icon conIcon = mRemoteNG.Connection.ConnectionIcon.FromString(System.Convert.ToString(((mRemoteNG.Connection.ConnectionInfo)this.pGrid.SelectedObject).Icon)); if (conIcon != null) { this.btnIcon.Image = conIcon.ToBitmap(); @@ -807,7 +809,7 @@ namespace mRemoteNG.UI.Window this.SetHostStatus(this.pGrid.SelectedObject); } - if (((mRemoteNG.Connection.ConnectionRecordImp)this.pGrid.SelectedObject).IsDefault) + if (((mRemoteNG.Connection.ConnectionInfo)this.pGrid.SelectedObject).IsDefault) { App.Runtime.DefaultConnectionToSettings(); } @@ -831,7 +833,7 @@ namespace mRemoteNG.UI.Window passwordName = Path.GetFileName(Runtime.GetStartupConnectionFileName()); } - string password = Tools.Misc.PasswordDialog(passwordName); + string password = Tools.MiscTools.PasswordDialog(passwordName); if (string.IsNullOrEmpty(password)) { @@ -849,9 +851,9 @@ namespace mRemoteNG.UI.Window } } - if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp) + if (this.pGrid.SelectedObject is ConnectionInfoInheritance) { - if (((mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp)this.pGrid.SelectedObject).IsDefault) + if (((ConnectionInfoInheritance)this.pGrid.SelectedObject).IsDefault) { App.Runtime.DefaultInheritanceToSettings(); } @@ -880,13 +882,13 @@ namespace mRemoteNG.UI.Window { System.Collections.Generic.List strHide = new System.Collections.Generic.List(); - if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionInfo) { - mRemoteNG.Connection.ConnectionRecordImp conI = (mRemoteNG.Connection.ConnectionRecordImp)pGrid.SelectedObject; + mRemoteNG.Connection.ConnectionInfo conI = (mRemoteNG.Connection.ConnectionInfo)pGrid.SelectedObject; switch (conI.Protocol) { - case mRemoteNG.Connection.Protocol.Protocols.RDP: + case mRemoteNG.Connection.Protocol.ProtocolType.RDP: strHide.Add("ExtApp"); strHide.Add("ICAEncryption"); strHide.Add("PuttySession"); @@ -902,7 +904,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCProxyUsername"); strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); - if (conI.RDGatewayUsageMethod == mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUsageMethod.Never) + if (conI.RDGatewayUsageMethod == ProtocolRDP.RDGatewayUsageMethod.Never) { strHide.Add("RDGatewayDomain"); strHide.Add("RDGatewayHostname"); @@ -910,18 +912,18 @@ namespace mRemoteNG.UI.Window strHide.Add("RDGatewayUseConnectionCredentials"); strHide.Add("RDGatewayUsername"); } - else if (conI.RDGatewayUseConnectionCredentials == mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.RDGatewayUseConnectionCredentials.Yes) + else if (conI.RDGatewayUseConnectionCredentials == ProtocolRDP.RDGatewayUseConnectionCredentials.Yes) { strHide.Add("RDGatewayDomain"); strHide.Add("RDGatewayPassword"); strHide.Add("RDGatewayUsername"); } - if (!(conI.Resolution == RDPConnectionProtocolImp.RDPResolutions.FitToWindow || conI.Resolution == RDPConnectionProtocolImp.RDPResolutions.Fullscreen)) + if (!(conI.Resolution == ProtocolRDP.RDPResolutions.FitToWindow || conI.Resolution == ProtocolRDP.RDPResolutions.Fullscreen)) { strHide.Add("AutomaticResize"); } break; - case mRemoteNG.Connection.Protocol.Protocols.VNC: + case mRemoteNG.Connection.Protocol.ProtocolType.VNC: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -950,12 +952,12 @@ namespace mRemoteNG.UI.Window strHide.Add("AutomaticResize"); strHide.Add("UseConsoleSession"); strHide.Add("UseCredSsp"); - if (conI.VNCAuthMode == mRemoteNG.Connection.Protocol.VNC.AuthMode.AuthVNC) + if (conI.VNCAuthMode == ProtocolVNC.AuthMode.AuthVNC) { strHide.Add("Username"); strHide.Add("Domain"); } - if (conI.VNCProxyType == mRemoteNG.Connection.Protocol.VNC.ProxyType.ProxyNone) + if (conI.VNCProxyType == ProtocolVNC.ProxyType.ProxyNone) { strHide.Add("VNCProxyIP"); strHide.Add("VNCProxyPassword"); @@ -963,7 +965,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCProxyUsername"); } break; - case mRemoteNG.Connection.Protocol.Protocols.SSH1: + case mRemoteNG.Connection.Protocol.ProtocolType.SSH1: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1004,7 +1006,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.SSH2: + case mRemoteNG.Connection.Protocol.ProtocolType.SSH2: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1045,7 +1047,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.Telnet: + case mRemoteNG.Connection.Protocol.ProtocolType.Telnet: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1088,7 +1090,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.Rlogin: + case mRemoteNG.Connection.Protocol.ProtocolType.Rlogin: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1131,7 +1133,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.RAW: + case mRemoteNG.Connection.Protocol.ProtocolType.RAW: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1174,7 +1176,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.HTTP: + case mRemoteNG.Connection.Protocol.ProtocolType.HTTP: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1215,7 +1217,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.HTTPS: + case mRemoteNG.Connection.Protocol.ProtocolType.HTTPS: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1255,7 +1257,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.ICA: + case mRemoteNG.Connection.Protocol.ProtocolType.ICA: strHide.Add("DisplayThemes"); strHide.Add("DisplayWallpaper"); strHide.Add("EnableFontSmoothing"); @@ -1293,7 +1295,7 @@ namespace mRemoteNG.UI.Window strHide.Add("VNCSmartSizeMode"); strHide.Add("VNCViewOnly"); break; - case mRemoteNG.Connection.Protocol.Protocols.IntApp: + case mRemoteNG.Connection.Protocol.ProtocolType.IntApp: strHide.Add("CacheBitmaps"); strHide.Add("Colors"); strHide.Add("DisplayThemes"); @@ -1630,15 +1632,15 @@ namespace mRemoteNG.UI.Window private void btnShowProperties_Click(object sender, System.EventArgs e) { - if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp) + if (this.pGrid.SelectedObject is ConnectionInfoInheritance) { - if (((mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp)this.pGrid.SelectedObject).IsDefault) + if (((ConnectionInfoInheritance)this.pGrid.SelectedObject).IsDefault) { this.PropertiesVisible = true; this.InheritanceVisible = false; this.DefaultPropertiesVisible = false; this.DefaultInheritanceVisible = false; - this.SetPropertyGridObject((mRemoteNG.Root.Info)App.Runtime.Windows.treeForm.tvConnections.SelectedNode.Tag); + this.SetPropertyGridObject((mRemoteNG.Root.Info)Windows.treeForm.tvConnections.SelectedNode.Tag); } else { @@ -1646,25 +1648,25 @@ namespace mRemoteNG.UI.Window this.InheritanceVisible = false; this.DefaultPropertiesVisible = false; this.DefaultInheritanceVisible = false; - this.SetPropertyGridObject(((mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp)this.pGrid.SelectedObject).Parent); + this.SetPropertyGridObject(((ConnectionInfoInheritance)this.pGrid.SelectedObject).Parent); } } - else if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + else if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionInfo) { - if (((mRemoteNG.Connection.ConnectionRecordImp)this.pGrid.SelectedObject).IsDefault) + if (((ConnectionInfo)this.pGrid.SelectedObject).IsDefault) { this.PropertiesVisible = true; this.InheritanceVisible = false; this.DefaultPropertiesVisible = false; this.DefaultInheritanceVisible = false; - this.SetPropertyGridObject((mRemoteNG.Root.Info)App.Runtime.Windows.treeForm.tvConnections.SelectedNode.Tag); + this.SetPropertyGridObject((mRemoteNG.Root.Info)Windows.treeForm.tvConnections.SelectedNode.Tag); } } } private void btnShowDefaultProperties_Click(object sender, System.EventArgs e) { - if (this.pGrid.SelectedObject is mRemoteNG.Root.Info|| this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp.ConnectionRecordInheritanceImp) + if (this.pGrid.SelectedObject is mRemoteNG.Root.Info|| this.pGrid.SelectedObject is ConnectionInfoInheritance) { this.PropertiesVisible = false; this.InheritanceVisible = false; @@ -1676,19 +1678,19 @@ namespace mRemoteNG.UI.Window private void btnShowInheritance_Click(object sender, System.EventArgs e) { - if (this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + if (this.pGrid.SelectedObject is ConnectionInfo) { this.PropertiesVisible = false; this.InheritanceVisible = true; this.DefaultPropertiesVisible = false; this.DefaultInheritanceVisible = false; - this.SetPropertyGridObject(((mRemoteNG.Connection.ConnectionRecordImp)this.pGrid.SelectedObject).Inherit); + this.SetPropertyGridObject(((ConnectionInfo)this.pGrid.SelectedObject).Inherit); } } private void btnShowDefaultInheritance_Click(object sender, System.EventArgs e) { - if (this.pGrid.SelectedObject is mRemoteNG.Root.Info|| this.pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp) + if (this.pGrid.SelectedObject is mRemoteNG.Root.Info|| this.pGrid.SelectedObject is ConnectionInfo) { this.PropertiesVisible = false; this.InheritanceVisible = false; @@ -1707,15 +1709,15 @@ namespace mRemoteNG.UI.Window { try { - if (pGrid.SelectedObject is mRemoteNG.Connection.ConnectionRecordImp&& !(pGrid.SelectedObject is mRemoteNG.Connection.PuttySession.Info)) + if (pGrid.SelectedObject is ConnectionInfo&& !(pGrid.SelectedObject is PuttySessionInfo)) { this.cMenIcons.Items.Clear(); - foreach (string iStr in mRemoteNG.Connection.Icon.Icons) + foreach (string iStr in ConnectionIcon.Icons) { ToolStripMenuItem tI = new ToolStripMenuItem(); tI.Text = iStr; - tI.Image = mRemoteNG.Connection.Icon.FromString(iStr).ToBitmap(); + tI.Image = ConnectionIcon.FromString(iStr).ToBitmap(); tI.Click += IconMenu_Click; this.cMenIcons.Items.Add(tI); @@ -1734,7 +1736,7 @@ namespace mRemoteNG.UI.Window { try { - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = (mRemoteNG.Connection.ConnectionRecordImp)pGrid.SelectedObject; + ConnectionInfo connectionInfo = (ConnectionInfo)pGrid.SelectedObject; if (connectionInfo == null) { return ; @@ -1752,7 +1754,7 @@ namespace mRemoteNG.UI.Window return ; } - Icon connectionIcon = mRemoteNG.Connection.Icon.FromString(iconName); + Icon connectionIcon = ConnectionIcon.FromString(iconName); if (connectionIcon == null) { return ; @@ -1829,9 +1831,9 @@ namespace mRemoteNG.UI.Window { this.btnHostStatus.Image = My.Resources.HostStatus_Check; // To check status, ConnectionInfo must be an mRemoteNG.Connection.Info that is not a container - if (ConnectionInfo is mRemoteNG.Connection.ConnectionRecordImp) + if (ConnectionInfo is mRemoteNG.Connection.ConnectionInfo) { - if (((mRemoteNG.Connection.ConnectionRecordImp)ConnectionInfo).IsContainer) + if (((mRemoteNG.Connection.ConnectionInfo)ConnectionInfo).IsContainer) { return; } @@ -1842,7 +1844,7 @@ namespace mRemoteNG.UI.Window } this.btnHostStatus.Tag = "checking"; - HostName = ((mRemoteNG.Connection.ConnectionRecordImp)ConnectionInfo).Hostname; + HostName = ((mRemoteNG.Connection.ConnectionInfo)ConnectionInfo).Hostname; pThread = new System.Threading.Thread(new System.Threading.ThreadStart(CheckHostAlive)); pThread.SetApartmentState(System.Threading.ApartmentState.STA); pThread.IsBackground = true; diff --git a/mRemoteV1/UI/Windows/UI.Window.Config.resx b/mRemoteV1/UI/Window/ConfigWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Config.resx rename to mRemoteV1/UI/Window/ConfigWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Tree.Designer.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.Tree.Designer.cs rename to mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs index 5e8e767b..652394fd 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Tree.Designer.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class Tree : Base + public partial class ConnectionTreeWindow : BaseWindow { #region Windows Form Designer generated code private System.ComponentModel.Container components = null; diff --git a/mRemoteV1/UI/Windows/UI.Window.Tree.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs similarity index 77% rename from mRemoteV1/UI/Windows/UI.Window.Tree.cs rename to mRemoteV1/UI/Window/ConnectionTreeWindow.cs index 6b92ed5a..f0a5e2a9 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Tree.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -1,15 +1,19 @@ +using mRemoteNG.App; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Container; +using mRemoteNG.Messages; +using mRemoteNG.My; +using mRemoteNG.Tree; using System; using System.Drawing; -using Microsoft.VisualBasic; using System.Windows.Forms; -using mRemoteNG.App; -using mRemoteNG.My; using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public partial class Tree : Base + public partial class ConnectionTreeWindow : BaseWindow { #region Form Stuff public void Tree_Load(object sender, EventArgs e) @@ -83,11 +87,11 @@ namespace mRemoteNG.UI.Window txtSearch.ForeColor = Themes.ThemeManager.ActiveTheme.SearchBoxTextPromptColor; } #endregion - + #region Public Methods - public Tree(DockContent panel) + public ConnectionTreeWindow(DockContent panel) { - WindowType = Type.Tree; + WindowType = WindowType.Tree; DockPnl = panel; InitializeComponent(); FillImageList(); @@ -102,11 +106,11 @@ namespace mRemoteNG.UI.Window tvConnections_AfterSelect(tvConnections, new TreeViewEventArgs(tvConnections.SelectedNode, TreeViewAction.ByMouse)); } #endregion - + #region Public Properties public ToolTip DescriptionTooltip {get; set;} #endregion - + #region Private Methods private void FillImageList() { @@ -134,9 +138,9 @@ namespace mRemoteNG.UI.Window try { cMenTreeDelete.ShortcutKeys = Keys.Delete; - - mRemoteNG.Tree.Node.FinishRenameSelectedNode(e.Label); - Runtime.Windows.configForm.pGrid_SelectedObjectChanged(); + + ConnectionTree.FinishRenameSelectedNode(e.Label); + Windows.configForm.pGrid_SelectedObjectChanged(); ShowHideTreeContextMenuItems(e.Node); Runtime.SaveConnectionsBG(); } @@ -150,26 +154,26 @@ namespace mRemoteNG.UI.Window { try { - if ((mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.Connection) || (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.PuttySession)) + if ((mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.Connection) || (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.PuttySession)) { - Runtime.Windows.configForm.SetPropertyGridObject(e.Node.Tag); + Windows.configForm.SetPropertyGridObject(e.Node.Tag); } - else if (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.Container) + else if (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.Container) { - Runtime.Windows.configForm.SetPropertyGridObject((e.Node.Tag as Container.Info).ConnectionRecord); + Windows.configForm.SetPropertyGridObject((e.Node.Tag as Container.ContainerInfo).ConnectionInfo); } - else if ((mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.Root) || (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.PuttyRoot)) + else if ((mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.Root) || (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.PuttyRoot)) { - Runtime.Windows.configForm.SetPropertyGridObject(e.Node.Tag); + Windows.configForm.SetPropertyGridObject(e.Node.Tag); } else { return; } - Runtime.Windows.configForm.pGrid_SelectedObjectChanged(); + Windows.configForm.pGrid_SelectedObjectChanged(); ShowHideTreeContextMenuItems(e.Node); - Runtime.Windows.sessionsForm.GetSessions(true); + Windows.sessionsForm.GetSessions(true); Runtime.LastSelected = mRemoteNG.Tree.Node.GetConstantID(e.Node); } @@ -189,15 +193,15 @@ namespace mRemoteNG.UI.Window if (e.Button == MouseButtons.Left) { if (My.Settings.Default.SingleClickOnConnectionOpensIt && - (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.Connection | - mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.PuttySession)) + (mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.Connection | + mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.PuttySession)) { Runtime.OpenConnection(); } - if (My.Settings.Default.SingleClickSwitchesToOpenConnection && mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.Node.Type.Connection) + if (My.Settings.Default.SingleClickSwitchesToOpenConnection && mRemoteNG.Tree.Node.GetNodeType(e.Node) == mRemoteNG.Tree.TreeNodeType.Connection) { - Runtime.SwitchToOpenConnection((mRemoteNG.Connection.ConnectionRecordImp)e.Node.Tag); + Runtime.SwitchToOpenConnection((mRemoteNG.Connection.ConnectionInfo)e.Node.Tag); } } } @@ -209,8 +213,8 @@ namespace mRemoteNG.UI.Window static public void tvConnections_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { - if (mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) == mRemoteNG.Tree.Node.Type.Connection | - mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) == mRemoteNG.Tree.Node.Type.PuttySession) + if (mRemoteNG.Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Connection | + mRemoteNG.Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.PuttySession) { Runtime.OpenConnection(); } @@ -220,7 +224,7 @@ namespace mRemoteNG.UI.Window { try { - mRemoteNG.Tree.Node.SetNodeToolTip(e, DescriptionTooltip); + ConnectionTree.SetNodeToolTip(e, DescriptionTooltip); } catch (Exception ex) { @@ -258,35 +262,35 @@ namespace mRemoteNG.UI.Window cMenTree.Enabled = true; EnableMenuItemsRecursive(cMenTree.Items); - if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.Connection) + if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.Connection) { - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = (mRemoteNG.Connection.ConnectionRecordImp)selectedNode.Tag; + ConnectionInfo connectionInfo = (ConnectionInfo)selectedNode.Tag; if (connectionInfo.OpenConnections.Count == 0) { cMenTreeDisconnect.Enabled = false; } - if (!(connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH1 | - connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH2)) + if (!(connectionInfo.Protocol == ProtocolType.SSH1 | + connectionInfo.Protocol == ProtocolType.SSH2)) { cMenTreeToolsTransferFile.Enabled = false; } - if (!(connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP | connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.ICA)) + if (!(connectionInfo.Protocol == ProtocolType.RDP | connectionInfo.Protocol == ProtocolType.ICA)) { cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false; cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false; } - if (connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.IntApp) + if (connectionInfo.Protocol == ProtocolType.IntApp) { cMenTreeConnectWithOptionsNoCredentials.Enabled = false; } } - else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.PuttySession) + else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.PuttySession) { - mRemoteNG.Connection.PuttySession.Info puttySessionInfo = (mRemoteNG.Connection.PuttySession.Info)selectedNode.Tag; + PuttySessionInfo puttySessionInfo = (PuttySessionInfo)selectedNode.Tag; cMenTreeAddConnection.Enabled = false; cMenTreeAddFolder.Enabled = false; @@ -296,7 +300,7 @@ namespace mRemoteNG.UI.Window cMenTreeDisconnect.Enabled = false; } - if (!(puttySessionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH1 | puttySessionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH2)) + if (!(puttySessionInfo.Protocol == ProtocolType.SSH1 | puttySessionInfo.Protocol == ProtocolType.SSH2)) { cMenTreeToolsTransferFile.Enabled = false; } @@ -310,19 +314,19 @@ namespace mRemoteNG.UI.Window cMenTreeMoveUp.Enabled = false; cMenTreeMoveDown.Enabled = false; } - else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.Container) + else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.Container) { cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = false; cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = false; cMenTreeDisconnect.Enabled = false; int openConnections = 0; - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = default(mRemoteNG.Connection.ConnectionRecordImp); + ConnectionInfo connectionInfo = default(ConnectionInfo); foreach (TreeNode node in selectedNode.Nodes) { - if (node.Tag is mRemoteNG.Connection.ConnectionRecordImp) + if (node.Tag is ConnectionInfo) { - connectionInfo = (mRemoteNG.Connection.ConnectionRecordImp)node.Tag; + connectionInfo = (ConnectionInfo)node.Tag; openConnections = openConnections + connectionInfo.OpenConnections.Count; } } @@ -334,7 +338,7 @@ namespace mRemoteNG.UI.Window cMenTreeToolsTransferFile.Enabled = false; cMenTreeToolsExternalApps.Enabled = false; } - else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.Root) + else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.Root) { cMenTreeConnect.Enabled = false; cMenTreeConnectWithOptions.Enabled = false; @@ -349,7 +353,7 @@ namespace mRemoteNG.UI.Window cMenTreeMoveUp.Enabled = false; cMenTreeMoveDown.Enabled = false; } - else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.PuttyRoot) + else if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.PuttyRoot) { cMenTreeAddConnection.Enabled = false; cMenTreeAddFolder.Enabled = false; @@ -377,7 +381,7 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Drag and Drop static public void tvConnections_DragDrop(object sender, DragEventArgs e) { @@ -403,7 +407,7 @@ namespace mRemoteNG.UI.Window return; } - if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.Node.Type.Root) + if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.TreeNodeType.Root) { return; } @@ -420,7 +424,7 @@ namespace mRemoteNG.UI.Window //the TreeView root nodes, otherwise add it to the end of //the dropNode child nodes - if (mRemoteNG.Tree.Node.GetNodeType(targetNode) == mRemoteNG.Tree.Node.Type.Root | mRemoteNG.Tree.Node.GetNodeType(targetNode) == mRemoteNG.Tree.Node.Type.Container) + if (mRemoteNG.Tree.Node.GetNodeType(targetNode) == mRemoteNG.Tree.TreeNodeType.Root | mRemoteNG.Tree.Node.GetNodeType(targetNode) == mRemoteNG.Tree.TreeNodeType.Container) { targetNode.Nodes.Insert(0, dropNode); } @@ -429,23 +433,23 @@ namespace mRemoteNG.UI.Window targetNode.Parent.Nodes.Insert(targetNode.Index + 1, dropNode); } - if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.Node.Type.Connection | mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.Node.Type.Container) + if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.TreeNodeType.Connection | mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.TreeNodeType.Container) { - if (mRemoteNG.Tree.Node.GetNodeType(dropNode.Parent) == mRemoteNG.Tree.Node.Type.Container) + if (mRemoteNG.Tree.Node.GetNodeType(dropNode.Parent) == mRemoteNG.Tree.TreeNodeType.Container) { - ((mRemoteNG.Container.Info)dropNode.Tag).Parent = (mRemoteNG.Container.Info)dropNode.Parent.Tag; + ((mRemoteNG.Container.ContainerInfo)dropNode.Tag).Parent = (mRemoteNG.Container.ContainerInfo)dropNode.Parent.Tag; } - else if (mRemoteNG.Tree.Node.GetNodeType(dropNode.Parent) == mRemoteNG.Tree.Node.Type.Root) + else if (mRemoteNG.Tree.Node.GetNodeType(dropNode.Parent) == mRemoteNG.Tree.TreeNodeType.Root) { - if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.Node.Type.Connection) + if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.TreeNodeType.Connection) { - ((mRemoteNG.Connection.ConnectionRecordImp)dropNode.Tag).Parent = null; - ((mRemoteNG.Connection.ConnectionRecordImp)dropNode.Tag).Inherit.TurnOffInheritanceCompletely(); + ((mRemoteNG.Connection.ConnectionInfo)dropNode.Tag).Parent = null; + ((mRemoteNG.Connection.ConnectionInfo)dropNode.Tag).Inherit.TurnOffInheritanceCompletely(); } - else if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.Node.Type.Container) + else if (mRemoteNG.Tree.Node.GetNodeType(dropNode) == mRemoteNG.Tree.TreeNodeType.Container) { - ((mRemoteNG.Container.Info)dropNode.Tag).Parent = null; - ((mRemoteNG.Container.Info)dropNode.Tag).ConnectionRecord.Inherit.TurnOffInheritanceCompletely(); + ((mRemoteNG.Container.ContainerInfo)dropNode.Tag).Parent = null; + ((mRemoteNG.Container.ContainerInfo)dropNode.Tag).ConnectionInfo.Inherit.TurnOffInheritanceCompletely(); } } } @@ -547,7 +551,7 @@ namespace mRemoteNG.UI.Window { return ; } - if (dragTreeNode.Tag is mRemoteNG.Connection.PuttySession.Info|| !(dragTreeNode.Tag is mRemoteNG.Connection.ConnectionRecordImp|| dragTreeNode.Tag is Container.Info)) + if (dragTreeNode.Tag is PuttySessionInfo|| !(dragTreeNode.Tag is ConnectionInfo|| dragTreeNode.Tag is ContainerInfo)) { tvConnections.SelectedNode = dragTreeNode; return ; @@ -558,11 +562,11 @@ namespace mRemoteNG.UI.Window } catch (Exception ex) { - Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "tvConnections_ItemDrag (UI.Window.Tree) failed" + Environment.NewLine + ex.Message, true); + Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "tvConnections_ItemDrag (UI.Window.Tree) failed" + Environment.NewLine + ex.Message, true); } } #endregion - + #region Tree Context Menu public void cMenTreeAddConnection_Click(System.Object sender, EventArgs e) { @@ -578,32 +582,32 @@ namespace mRemoteNG.UI.Window static public void cMenTreeConnect_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } static public void cMenTreeConnectWithOptionsConnectToConsoleSession_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.UseConsoleSession | mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.UseConsoleSession | mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } static public void cMenTreeConnectWithOptionsNoCredentials_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.NoCredentials); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.NoCredentials); } static public void cMenTreeConnectWithOptionsDontConnectToConsoleSession_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.DontUseConsoleSession | mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.DontUseConsoleSession | mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } static public void cMenTreeConnectWithOptionsConnectInFullscreen_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.Fullscreen | mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.Fullscreen | mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } static public void cMenTreeConnectWithOptionsChoosePanelBeforeConnecting_Click(System.Object sender, EventArgs e) { - Runtime.OpenConnection(mRemoteNG.Connection.ConnectionRecordImp.Force.OverridePanel | mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + Runtime.OpenConnection(mRemoteNG.Connection.ConnectionInfo.Force.OverridePanel | mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } public void cMenTreeDisconnect_Click(System.Object sender, EventArgs e) @@ -619,7 +623,7 @@ namespace mRemoteNG.UI.Window public void mMenSortAscending_Click(System.Object sender, EventArgs e) { tvConnections.BeginUpdate(); - mRemoteNG.Tree.Node.Sort(tvConnections.Nodes[0], SortOrder.Ascending); + ConnectionTree.Sort(tvConnections.Nodes[0], SortOrder.Ascending); tvConnections.EndUpdate(); Runtime.SaveConnectionsBG(); } @@ -627,7 +631,7 @@ namespace mRemoteNG.UI.Window public void cMenTreeToolsSortAscending_Click(System.Object sender, EventArgs e) { tvConnections.BeginUpdate(); - mRemoteNG.Tree.Node.Sort(tvConnections.SelectedNode, SortOrder.Ascending); + ConnectionTree.Sort(tvConnections.SelectedNode, SortOrder.Ascending); tvConnections.EndUpdate(); Runtime.SaveConnectionsBG(); } @@ -635,7 +639,7 @@ namespace mRemoteNG.UI.Window public void cMenTreeToolsSortDescending_Click(System.Object sender, EventArgs e) { tvConnections.BeginUpdate(); - mRemoteNG.Tree.Node.Sort(tvConnections.SelectedNode, SortOrder.Descending); + ConnectionTree.Sort(tvConnections.SelectedNode, SortOrder.Descending); tvConnections.EndUpdate(); Runtime.SaveConnectionsBG(); } @@ -658,48 +662,48 @@ namespace mRemoteNG.UI.Window static public void cMenTreeRename_Click(System.Object sender, EventArgs e) { - mRemoteNG.Tree.Node.StartRenameSelectedNode(); + ConnectionTree.StartRenameSelectedNode(); Runtime.SaveConnectionsBG(); } static public void cMenTreeDelete_Click(System.Object sender, EventArgs e) { - mRemoteNG.Tree.Node.DeleteSelectedNode(); + ConnectionTree.DeleteSelectedNode(); Runtime.SaveConnectionsBG(); } static public void cMenTreeImportFile_Click(System.Object sender, EventArgs e) { - Import.ImportFromFile(Runtime.Windows.treeForm.tvConnections.Nodes[0], Runtime.Windows.treeForm.tvConnections.SelectedNode, true); + Import.ImportFromFile(Windows.treeForm.tvConnections.Nodes[0], Windows.treeForm.tvConnections.SelectedNode, true); } static public void cMenTreeImportActiveDirectory_Click(System.Object sender, EventArgs e) { - Runtime.Windows.Show(Type.ActiveDirectoryImport); + Windows.Show(WindowType.ActiveDirectoryImport); } static public void cMenTreeImportPortScan_Click(System.Object sender, EventArgs e) { - Runtime.Windows.Show(UI.Window.Type.PortScan, true); + Windows.Show(UI.Window.WindowType.PortScan, true); } static public void cMenTreeExportFile_Click(System.Object sender, EventArgs e) { - Export.ExportToFile(Runtime.Windows.treeForm.tvConnections.Nodes[0], Runtime.Windows.treeForm.tvConnections.SelectedNode); + Export.ExportToFile(Windows.treeForm.tvConnections.Nodes[0], Windows.treeForm.tvConnections.SelectedNode); } static public void cMenTreeMoveUp_Click(System.Object sender, EventArgs e) { - mRemoteNG.Tree.Node.MoveNodeUp(); + ConnectionTree.MoveNodeUp(); Runtime.SaveConnectionsBG(); } static public void cMenTreeMoveDown_Click(System.Object sender, EventArgs e) { - mRemoteNG.Tree.Node.MoveNodeDown(); + ConnectionTree.MoveNodeDown(); Runtime.SaveConnectionsBG(); } #endregion - + #region Context Menu Actions public void AddConnection() { @@ -710,7 +714,7 @@ namespace mRemoteNG.UI.Window tvConnections.SelectedNode = tvConnections.Nodes[0]; } - TreeNode newTreeNode = mRemoteNG.Tree.Node.AddNode(mRemoteNG.Tree.Node.Type.Connection); + TreeNode newTreeNode = mRemoteNG.Tree.Node.AddNode(mRemoteNG.Tree.TreeNodeType.Connection); if (newTreeNode == null) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "UI.Window.Tree.AddConnection() failed." + Environment.NewLine + "mRemoteNG.Tree.Node.AddNode() returned Nothing.", true); @@ -718,19 +722,19 @@ namespace mRemoteNG.UI.Window } TreeNode containerNode = tvConnections.SelectedNode; - if (mRemoteNG.Tree.Node.GetNodeType(containerNode) == mRemoteNG.Tree.Node.Type.Connection) + if (mRemoteNG.Tree.Node.GetNodeType(containerNode) == mRemoteNG.Tree.TreeNodeType.Connection) { containerNode = containerNode.Parent; } - mRemoteNG.Connection.ConnectionRecordImp newConnectionInfo = new mRemoteNG.Connection.ConnectionRecordImp(); - if (mRemoteNG.Tree.Node.GetNodeType(containerNode) == mRemoteNG.Tree.Node.Type.Root) + mRemoteNG.Connection.ConnectionInfo newConnectionInfo = new mRemoteNG.Connection.ConnectionInfo(); + if (mRemoteNG.Tree.Node.GetNodeType(containerNode) == mRemoteNG.Tree.TreeNodeType.Root) { newConnectionInfo.Inherit.TurnOffInheritanceCompletely(); } else { - newConnectionInfo.Parent = (mRemoteNG.Container.Info)containerNode.Tag; + newConnectionInfo.Parent = (mRemoteNG.Container.ContainerInfo)containerNode.Tag; } newConnectionInfo.TreeNode = newTreeNode; @@ -752,12 +756,12 @@ namespace mRemoteNG.UI.Window { try { - TreeNode newNode = mRemoteNG.Tree.Node.AddNode(mRemoteNG.Tree.Node.Type.Container); - Container.Info newContainerInfo = new Container.Info(); + TreeNode newNode = mRemoteNG.Tree.Node.AddNode(TreeNodeType.Container); + ContainerInfo newContainerInfo = new ContainerInfo(); newNode.Tag = newContainerInfo; newContainerInfo.TreeNode = newNode; - - TreeNode selectedNode = mRemoteNG.Tree.Node.SelectedNode; + + TreeNode selectedNode = ConnectionTree.SelectedNode; TreeNode parentNode = default(TreeNode); if (selectedNode == null) { @@ -765,7 +769,7 @@ namespace mRemoteNG.UI.Window } else { - if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == mRemoteNG.Tree.Node.Type.Connection) + if (mRemoteNG.Tree.Node.GetNodeType(selectedNode) == TreeNodeType.Connection) { parentNode = selectedNode.Parent; } @@ -775,17 +779,17 @@ namespace mRemoteNG.UI.Window } } - newContainerInfo.ConnectionRecord = new mRemoteNG.Connection.ConnectionRecordImp(newContainerInfo); - newContainerInfo.ConnectionRecord.Name = newNode.Text; + newContainerInfo.ConnectionInfo = new mRemoteNG.Connection.ConnectionInfo(newContainerInfo); + newContainerInfo.ConnectionInfo.Name = newNode.Text; // We can only inherit from a container node, not the root node or connection nodes - if (mRemoteNG.Tree.Node.GetNodeType(parentNode) == mRemoteNG.Tree.Node.Type.Container) + if (mRemoteNG.Tree.Node.GetNodeType(parentNode) == mRemoteNG.Tree.TreeNodeType.Container) { newContainerInfo.Parent = parentNode.Tag; } else { - newContainerInfo.ConnectionRecord.Inherit.TurnOffInheritanceCompletely(); + newContainerInfo.ConnectionInfo.Inherit.TurnOffInheritanceCompletely(); } Runtime.ContainerList.Add(newContainerInfo); @@ -806,22 +810,22 @@ namespace mRemoteNG.UI.Window { if (tvConnections.SelectedNode != null) { - if (tvConnections.SelectedNode.Tag is mRemoteNG.Connection.ConnectionRecordImp) + if (tvConnections.SelectedNode.Tag is ConnectionInfo) { - mRemoteNG.Connection.ConnectionRecordImp conI = (mRemoteNG.Connection.ConnectionRecordImp)tvConnections.SelectedNode.Tag; + ConnectionInfo conI = (ConnectionInfo)tvConnections.SelectedNode.Tag; for (int i = 0; i <= conI.OpenConnections.Count - 1; i++) { conI.OpenConnections[i].Disconnect(); } } - if (tvConnections.SelectedNode.Tag is Container.Info) + if (tvConnections.SelectedNode.Tag is ContainerInfo) { foreach (TreeNode n in tvConnections.SelectedNode.Nodes) { - if (n.Tag is mRemoteNG.Connection.ConnectionRecordImp) + if (n.Tag is ConnectionInfo) { - mRemoteNG.Connection.ConnectionRecordImp conI = (mRemoteNG.Connection.ConnectionRecordImp)n.Tag; + ConnectionInfo conI = (ConnectionInfo)n.Tag; for (int i = 0; i <= conI.OpenConnections.Count - 1; i++) { conI.OpenConnections[i].Disconnect(); @@ -841,14 +845,14 @@ namespace mRemoteNG.UI.Window { try { - Runtime.Windows.Show(Type.SSHTransfer); + Windows.Show(WindowType.SSHTransfer); - mRemoteNG.Connection.ConnectionRecordImp conI = (mRemoteNG.Connection.ConnectionRecordImp)mRemoteNG.Tree.Node.SelectedNode.Tag; + ConnectionInfo conI = (ConnectionInfo)ConnectionTree.SelectedNode.Tag; - Runtime.Windows.sshtransferForm.Hostname = conI.Hostname; - Runtime.Windows.sshtransferForm.Username = conI.Username; - Runtime.Windows.sshtransferForm.Password = conI.Password; - Runtime.Windows.sshtransferForm.Port = System.Convert.ToString(conI.Port); + Windows.sshtransferForm.Hostname = conI.Hostname; + Windows.sshtransferForm.Username = conI.Username; + Windows.sshtransferForm.Password = conI.Password; + Windows.sshtransferForm.Port = System.Convert.ToString(conI.Port); } catch (Exception ex) { @@ -887,9 +891,9 @@ namespace mRemoteNG.UI.Window { try { - if (mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) == mRemoteNG.Tree.Node.Type.Connection | mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) == mRemoteNG.Tree.Node.Type.PuttySession) + if (mRemoteNG.Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.Connection | mRemoteNG.Tree.Node.GetNodeType(ConnectionTree.SelectedNode) == TreeNodeType.PuttySession) { - externalTool.Start((mRemoteNG.Connection.ConnectionRecordImp)mRemoteNG.Tree.Node.SelectedNode.Tag); + externalTool.Start((ConnectionInfo)ConnectionTree.SelectedNode.Tag); } } catch (Exception ex) @@ -898,11 +902,11 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Menu static public void mMenViewExpandAllFolders_Click(System.Object sender, EventArgs e) { - mRemoteNG.Tree.Node.ExpandAllNodes(); + ConnectionTree.ExpandAllNodes(); } public void mMenViewCollapseAllFolders_Click(System.Object sender, EventArgs e) @@ -914,10 +918,10 @@ namespace mRemoteNG.UI.Window tvConnections.SelectedNode.EndEdit(false); } } - mRemoteNG.Tree.Node.CollapseAllNodes(); + ConnectionTree.CollapseAllNodes(); } #endregion - + #region Search public void txtSearch_GotFocus(object sender, EventArgs e) { @@ -967,7 +971,7 @@ namespace mRemoteNG.UI.Window public void txtSearch_TextChanged(System.Object sender, EventArgs e) { - tvConnections.SelectedNode = mRemoteNG.Tree.Node.Find(tvConnections.Nodes[0], txtSearch.Text); + tvConnections.SelectedNode = ConnectionTree.Find(tvConnections.Nodes[0], txtSearch.Text); } public void tvConnections_KeyPress(object sender, KeyPressEventArgs e) @@ -994,7 +998,7 @@ namespace mRemoteNG.UI.Window { if (e.KeyCode == Keys.Enter) { - if (tvConnections.SelectedNode.Tag is mRemoteNG.Connection.ConnectionRecordImp) + if (tvConnections.SelectedNode.Tag is mRemoteNG.Connection.ConnectionInfo) { e.Handled = true; Runtime.OpenConnection(); @@ -1024,4 +1028,4 @@ namespace mRemoteNG.UI.Window } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.Tree.resx b/mRemoteV1/UI/Window/ConnectionTreeWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Tree.resx rename to mRemoteV1/UI/Window/ConnectionTreeWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Connection.cs b/mRemoteV1/UI/Window/ConnectionWindow.cs similarity index 89% rename from mRemoteV1/UI/Windows/UI.Window.Connection.cs rename to mRemoteV1/UI/Window/ConnectionWindow.cs index 60583ce9..0addd51d 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Connection.cs +++ b/mRemoteV1/UI/Window/ConnectionWindow.cs @@ -7,11 +7,13 @@ using mRemoteNG.App; using WeifenLuo.WinFormsUI.Docking; using PSTaskDialog; using mRemoteNG.Config; - +using mRemoteNG.Connection.Protocol.VNC; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.Connection.Protocol; namespace mRemoteNG.UI.Window { - public class Connection : UI.Window.Base + public class ConnectionWindow : BaseWindow { #region Form Init internal System.Windows.Forms.ContextMenuStrip cmenTab; @@ -42,7 +44,7 @@ namespace mRemoteNG.UI.Window this.Load += new System.EventHandler(Connection_Load); this.DockStateChanged += new System.EventHandler(Connection_DockStateChanged); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Connection_FormClosing); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Connection)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectionWindow)); this.TabController = new Crownwood.Magic.Controls.TabControl(); this.TabController.ClosePressed += new System.EventHandler(this.TabController_ClosePressed); this.TabController.DoubleClickTab += new Crownwood.Magic.Controls.TabControl.DoubleClickTabHandler(this.TabController_DoubleClickTab); @@ -249,21 +251,21 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public Connection(DockContent Panel, string FormText = "") + public ConnectionWindow(DockContent Panel, string FormText = "") { if (FormText == "") { FormText = My.Language.strNewPanel; } - this.WindowType = Type.Connection; + this.WindowType = WindowType.Connection; this.DockPnl = Panel; this.InitializeComponent(); this.Text = FormText; this.TabText = FormText; } - public Crownwood.Magic.Controls.TabPage AddConnectionTab(mRemoteNG.Connection.ConnectionRecordImp conI) + public Crownwood.Magic.Controls.TabPage AddConnectionTab(mRemoteNG.Connection.ConnectionInfo conI) { try { @@ -305,7 +307,7 @@ namespace mRemoteNG.UI.Window nTab.Title = nTab.Title.Replace("&", "&&"); - System.Drawing.Icon conIcon = mRemoteNG.Connection.Icon.FromString(conI.Icon); + System.Drawing.Icon conIcon = mRemoteNG.Connection.ConnectionIcon.FromString(conI.Icon); if (conIcon != null) { nTab.Icon = conIcon; @@ -415,8 +417,8 @@ namespace mRemoteNG.UI.Window private void Connection_FormClosing(object sender, FormClosingEventArgs e) { if (!frmMain.Default.IsClosing && - ((My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.All & TabController.TabPages.Count > 0) || - (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.Multiple & TabController.TabPages.Count > 1))) + ((My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All & TabController.TabPages.Count > 0) || + (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.Multiple & TabController.TabPages.Count > 1))) { DialogResult result = cTaskDialog.MessageBox(this, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, string.Format(My.Language.strConfirmCloseConnectionPanelMainInstruction, this.Text), "", "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.YesNo, eSysIcons.Question, eSysIcons.Question); if (cTaskDialog.VerificationChecked) @@ -500,7 +502,7 @@ namespace mRemoteNG.UI.Window private void CloseConnectionTab() { Crownwood.Magic.Controls.TabPage selectedTab = TabController.SelectedTab; - if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmClose.All) + if (My.Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All) { DialogResult result = cTaskDialog.MessageBox(this, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.ProductName, string.Format(My.Language.strConfirmCloseConnectionMainInstruction, selectedTab.Title), "", "", "", My.Language.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.YesNo, eSysIcons.Question, eSysIcons.Question); if (cTaskDialog.VerificationChecked) @@ -547,7 +549,7 @@ namespace mRemoteNG.UI.Window { if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", true)) { - App.Runtime.OpenConnection((mRemoteNG.Connection.ConnectionRecordImp)((System.Windows.Forms.TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode", true)).Tag, this, mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); + App.Runtime.OpenConnection((mRemoteNG.Connection.ConnectionInfo)((System.Windows.Forms.TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode", true)).Tag, this, mRemoteNG.Connection.ConnectionInfo.Force.DoNotJump); } } @@ -583,9 +585,9 @@ namespace mRemoteNG.UI.Window return; } - if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP) + if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.RDP) { - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp rdp = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp)IC.Protocol; + ProtocolRDP rdp = (ProtocolRDP)IC.Protocol; cmenTabFullscreen.Enabled = true; cmenTabFullscreen.Checked = rdp.Fullscreen; @@ -599,7 +601,7 @@ namespace mRemoteNG.UI.Window cmenTabSmartSize.Enabled = false; } - if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.VNC) + if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.VNC) { this.cmenTabSendSpecialKeys.Enabled = true; this.cmenTabViewOnly.Enabled = true; @@ -609,7 +611,7 @@ namespace mRemoteNG.UI.Window this.cmenTabRefreshScreen.Enabled = true; this.cmenTabTransferFile.Enabled = false; - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; this.cmenTabSmartSize.Checked = vnc.SmartSize; this.cmenTabViewOnly.Checked = vnc.ViewOnly; } @@ -622,7 +624,7 @@ namespace mRemoteNG.UI.Window this.cmenTabTransferFile.Enabled = false; } - if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH1 | IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH2) + if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.SSH1 | IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.SSH2) { this.cmenTabTransferFile.Enabled = true; } @@ -648,7 +650,7 @@ namespace mRemoteNG.UI.Window { cmenTab.Close(); Application.DoEvents(); - Runtime.Windows.screenshotForm.AddScreenshot(Tools.Misc.TakeScreenshot(this)); + Windows.screenshotForm.AddScreenshot(Tools.MiscTools.TakeScreenshot(this)); } private void cmenTabSmartSize_Click(System.Object sender, System.EventArgs e) @@ -683,12 +685,12 @@ namespace mRemoteNG.UI.Window private void cmenTabSendSpecialKeysCtrlAltDel_Click(System.Object sender, System.EventArgs e) { - this.SendSpecialKeys(mRemoteNG.Connection.Protocol.VNC.SpecialKeys.CtrlAltDel); + this.SendSpecialKeys(ProtocolVNC.SpecialKeys.CtrlAltDel); } private void cmenTabSendSpecialKeysCtrlEsc_Click(System.Object sender, System.EventArgs e) { - this.SendSpecialKeys(mRemoteNG.Connection.Protocol.VNC.SpecialKeys.CtrlEsc); + this.SendSpecialKeys(ProtocolVNC.SpecialKeys.CtrlEsc); } private void cmenTabFullscreen_Click(System.Object sender, System.EventArgs e) @@ -733,14 +735,14 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp) + if (IC.Protocol is ProtocolRDP) { - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp rdp = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp)IC.Protocol; + ProtocolRDP rdp = (ProtocolRDP)IC.Protocol; rdp.ToggleSmartSize(); } - else if (IC.Protocol is mRemoteNG.Connection.Protocol.VNC) + else if (IC.Protocol is ProtocolVNC) { - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.ToggleSmartSize(); } } @@ -762,11 +764,11 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH1 | IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.SSH2) + if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.SSH1 | IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.SSH2) { SSHTransferFile(); } - else if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.VNC) + else if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.VNC) { VNCTransferFile(); } @@ -786,14 +788,14 @@ namespace mRemoteNG.UI.Window mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - Runtime.Windows.Show(Type.SSHTransfer); + Windows.Show(WindowType.SSHTransfer); - mRemoteNG.Connection.ConnectionRecordImp conI = IC.Info; + mRemoteNG.Connection.ConnectionInfo conI = IC.Info; - Runtime.Windows.sshtransferForm.Hostname = conI.Hostname; - Runtime.Windows.sshtransferForm.Username = conI.Username; - Runtime.Windows.sshtransferForm.Password = conI.Password; - Runtime.Windows.sshtransferForm.Port = System.Convert.ToString(conI.Port); + Windows.sshtransferForm.Hostname = conI.Hostname; + Windows.sshtransferForm.Username = conI.Username; + Windows.sshtransferForm.Password = conI.Password; + Windows.sshtransferForm.Port = System.Convert.ToString(conI.Port); } catch (Exception ex) { @@ -806,7 +808,7 @@ namespace mRemoteNG.UI.Window try { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.StartFileTransfer(); } catch (Exception ex) @@ -825,11 +827,11 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.VNC) + if (IC.Protocol is ProtocolVNC) { cmenTabViewOnly.Checked = !cmenTabViewOnly.Checked; - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.ToggleViewOnly(); } } @@ -851,9 +853,9 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.VNC) + if (IC.Protocol is ProtocolVNC) { - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.StartChat(); } } @@ -875,9 +877,9 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.VNC) + if (IC.Protocol is ProtocolVNC) { - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.RefreshScreen(); } } @@ -889,7 +891,7 @@ namespace mRemoteNG.UI.Window } } - private void SendSpecialKeys(mRemoteNG.Connection.Protocol.VNC.SpecialKeys Keys) + private void SendSpecialKeys(ProtocolVNC.SpecialKeys Keys) { try { @@ -899,9 +901,9 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.VNC) + if (IC.Protocol is ProtocolVNC) { - mRemoteNG.Connection.Protocol.VNC vnc = (mRemoteNG.Connection.Protocol.VNC)IC.Protocol; + ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.SendSpecialKeys(Keys); } } @@ -923,9 +925,9 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Protocol is mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp) + if (IC.Protocol is ProtocolRDP) { - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp rdp = (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp)IC.Protocol; + ProtocolRDP rdp = (ProtocolRDP)IC.Protocol; rdp.ToggleFullscreen(); } } @@ -993,16 +995,11 @@ namespace mRemoteNG.UI.Window { try { - if (this.TabController.SelectedTab != null) + if (this.TabController.SelectedTab != null && this.TabController.SelectedTab.Tag is InterfaceControl) { - if (this.TabController.SelectedTab.Tag is mRemoteNG.Connection.InterfaceControl) - { - mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - - ExtA.Start(IC.Info); - } + InterfaceControl IC = (InterfaceControl)this.TabController.SelectedTab.Tag; + ExtA.Start(IC.Info); } - } catch (Exception ex) { @@ -1014,14 +1011,10 @@ namespace mRemoteNG.UI.Window { try { - if (this.TabController.SelectedTab != null) + if (this.TabController.SelectedTab != null && this.TabController.SelectedTab.Tag is InterfaceControl) { - if (this.TabController.SelectedTab.Tag is mRemoteNG.Connection.InterfaceControl) - { - mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - - IC.Protocol.Close(); - } + InterfaceControl IC = (InterfaceControl)this.TabController.SelectedTab.Tag; + IC.Protocol.Close(); } } catch (Exception ex) @@ -1034,15 +1027,11 @@ namespace mRemoteNG.UI.Window { try { - if (this.TabController.SelectedTab != null) + if (this.TabController.SelectedTab != null && this.TabController.SelectedTab.Tag is InterfaceControl) { - if (this.TabController.SelectedTab.Tag is mRemoteNG.Connection.InterfaceControl) - { - mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - - App.Runtime.OpenConnection(IC.Info, mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); - _ignoreChangeSelectedTabClick = false; - } + InterfaceControl IC = (InterfaceControl)this.TabController.SelectedTab.Tag; + Runtime.OpenConnection(IC.Info, ConnectionInfo.Force.DoNotJump); + _ignoreChangeSelectedTabClick = false; } } catch (Exception ex) @@ -1055,17 +1044,11 @@ namespace mRemoteNG.UI.Window { try { - if (this.TabController.SelectedTab != null) + if (this.TabController.SelectedTab != null && this.TabController.SelectedTab.Tag is InterfaceControl) { - if (this.TabController.SelectedTab.Tag is mRemoteNG.Connection.InterfaceControl) - { - mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - mRemoteNG.Connection.ConnectionRecordImp conI = IC.Info; - - IC.Protocol.Close(); - - App.Runtime.OpenConnection(conI, mRemoteNG.Connection.ConnectionRecordImp.Force.DoNotJump); - } + InterfaceControl IC = (InterfaceControl)this.TabController.SelectedTab.Tag; + IC.Protocol.Close(); + Runtime.OpenConnection(IC.Info, ConnectionInfo.Force.DoNotJump); } } catch (Exception ex) @@ -1079,7 +1062,7 @@ namespace mRemoteNG.UI.Window try { string nTitle = Interaction.InputBox(Prompt: My.Language.strNewTitle + ":", DefaultResponse: this.TabController.SelectedTab.Title.Replace("&&", "&")); - + if (!string.IsNullOrEmpty(nTitle)) { this.TabController.SelectedTab.Title = nTitle.Replace("&", "&&"); @@ -1095,7 +1078,7 @@ namespace mRemoteNG.UI.Window #region Protocols public void Prot_Event_Closed(object sender) { - mRemoteNG.Connection.Protocol.Base Prot = (mRemoteNG.Connection.Protocol.Base)sender; + ProtocolBase Prot = (ProtocolBase) sender; CloseTab((Crownwood.Magic.Controls.TabPage) Prot.InterfaceControl.Parent); } #endregion @@ -1231,9 +1214,9 @@ namespace mRemoteNG.UI.Window { mRemoteNG.Connection.InterfaceControl IC = (mRemoteNG.Connection.InterfaceControl)this.TabController.SelectedTab.Tag; - if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.VNC) + if (IC.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.VNC) { - (IC.Protocol as mRemoteNG.Connection.Protocol.VNC).RefreshScreen(); + (IC.Protocol as ProtocolVNC).RefreshScreen(); } } } @@ -1261,7 +1244,7 @@ namespace mRemoteNG.UI.Window InterfaceControl interfaceControl = TabController.SelectedTab.Tag as InterfaceControl; if (interfaceControl != null && interfaceControl.Info != null) { - if (interfaceControl.Info.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP) + if (interfaceControl.Info.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.RDP) { interfaceControl.Protocol.Focus(); return ; // Do not pass to base class diff --git a/mRemoteV1/UI/Windows/UI.Window.Connection.resx b/mRemoteV1/UI/Window/ConnectionWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Connection.resx rename to mRemoteV1/UI/Window/ConnectionWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.ErrorsAndInfos.cs b/mRemoteV1/UI/Window/ErrorAndInfoWindow.cs similarity index 98% rename from mRemoteV1/UI/Windows/UI.Window.ErrorsAndInfos.cs rename to mRemoteV1/UI/Window/ErrorAndInfoWindow.cs index e73aa22d..742f5229 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ErrorsAndInfos.cs +++ b/mRemoteV1/UI/Window/ErrorAndInfoWindow.cs @@ -10,7 +10,7 @@ using mRemoteNG.App; namespace mRemoteNG.UI.Window { - public class ErrorsAndInfos : Base + public class ErrorAndInfoWindow : BaseWindow { #region Form Init internal System.Windows.Forms.PictureBox pbError; @@ -203,9 +203,9 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public ErrorsAndInfos(DockContent Panel) + public ErrorAndInfoWindow(DockContent Panel) { - this.WindowType = Type.ErrorsAndInfos; + this.WindowType = WindowType.ErrorsAndInfos; this.DockPnl = Panel; this.InitializeComponent(); this.LayoutVertical(); @@ -321,7 +321,7 @@ namespace mRemoteNG.UI.Window } else { - App.Runtime.Windows.treeForm.Show(frmMain.Default.pnlDock); + Windows.treeForm.Show(frmMain.Default.pnlDock); } } catch (Exception) diff --git a/mRemoteV1/UI/Windows/UI.Window.ErrorsAndInfos.resx b/mRemoteV1/UI/Window/ErrorAndInfoWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.ErrorsAndInfos.resx rename to mRemoteV1/UI/Window/ErrorAndInfoWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.ExternalTools.Designer.cs b/mRemoteV1/UI/Window/ExternalToolsWindow.Designer.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.ExternalTools.Designer.cs rename to mRemoteV1/UI/Window/ExternalToolsWindow.Designer.cs index 416ea078..99b2877d 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ExternalTools.Designer.cs +++ b/mRemoteV1/UI/Window/ExternalToolsWindow.Designer.cs @@ -1,7 +1,7 @@ namespace mRemoteNG.UI.Window { - public partial class ExternalTools : Base + public partial class ExternalToolsWindow : BaseWindow { #region Windows Form Designer generated code internal System.Windows.Forms.ColumnHeader FilenameColumnHeader; @@ -33,7 +33,7 @@ namespace mRemoteNG.UI.Window this.components = new System.ComponentModel.Container(); this.Load += new System.EventHandler(ExternalTools_Load); base.FormClosed += new System.Windows.Forms.FormClosedEventHandler(ExternalTools_FormClosed); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExternalTools)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExternalToolsWindow)); this.ToolsListView = new System.Windows.Forms.ListView(); this.ToolsListView.SelectedIndexChanged += new System.EventHandler(this.ToolsListView_SelectedIndexChanged); this.ToolsListView.DoubleClick += new System.EventHandler(this.ToolsListView_DoubleClick); diff --git a/mRemoteV1/UI/Windows/UI.Window.ExternalTools.cs b/mRemoteV1/UI/Window/ExternalToolsWindow.cs similarity index 97% rename from mRemoteV1/UI/Windows/UI.Window.ExternalTools.cs rename to mRemoteV1/UI/Window/ExternalToolsWindow.cs index 7822df24..a55c36e3 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ExternalTools.cs +++ b/mRemoteV1/UI/Window/ExternalToolsWindow.cs @@ -9,14 +9,14 @@ using mRemoteNG.My; namespace mRemoteNG.UI.Window { - public partial class ExternalTools : Base + public partial class ExternalToolsWindow : BaseWindow { #region Constructors - public ExternalTools(DockContent panel) + public ExternalToolsWindow(DockContent panel) { InitializeComponent(); - WindowType = Type.ExternalApps; + WindowType = WindowType.ExternalApps; DockPnl = panel; } #endregion @@ -35,7 +35,7 @@ namespace mRemoteNG.UI.Window static public void ExternalTools_FormClosed(System.Object sender, FormClosedEventArgs e) { - mRemoteNG.Config.Settings.Save.SaveExternalAppsToXML(); + mRemoteNG.Config.Settings.SettingsSaver.SaveExternalAppsToXML(); } public void NewTool_Click(System.Object sender, EventArgs e) diff --git a/mRemoteV1/UI/Windows/UI.Window.ExternalTools.resx b/mRemoteV1/UI/Window/ExternalToolsWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.ExternalTools.resx rename to mRemoteV1/UI/Window/ExternalToolsWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Help.cs b/mRemoteV1/UI/Window/HelpWindow.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.Help.cs rename to mRemoteV1/UI/Window/HelpWindow.cs index 1e40a57d..b2cbc817 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Help.cs +++ b/mRemoteV1/UI/Window/HelpWindow.cs @@ -5,7 +5,7 @@ using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public class Help : Base + public class HelpWindow : BaseWindow { #region Form Init @@ -215,9 +215,9 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public Help(DockContent Panel) + public HelpWindow(DockContent Panel) { - this.WindowType = Type.Help; + this.WindowType = WindowType.Help; this.DockPnl = Panel; this.InitializeComponent(); diff --git a/mRemoteV1/UI/Windows/UI.Window.Help.resx b/mRemoteV1/UI/Window/HelpWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Help.resx rename to mRemoteV1/UI/Window/HelpWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.PortScan.Designer.cs b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.PortScan.Designer.cs rename to mRemoteV1/UI/Window/PortScanWindow.Designer.cs index 551e7e16..1d984338 100644 --- a/mRemoteV1/UI/Windows/UI.Window.PortScan.Designer.cs +++ b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class PortScan : Base + public partial class PortScanWindow : BaseWindow { #region Windows Form Designer generated code @@ -34,7 +34,7 @@ namespace mRemoteNG.UI.Window private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PortScan)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PortScanWindow)); this.ipStart = new IPTextBox.IPTextBox(); base.Load += new System.EventHandler(PortScan_Load); this.ipEnd = new IPTextBox.IPTextBox(); diff --git a/mRemoteV1/UI/Windows/UI.Window.PortScan.cs b/mRemoteV1/UI/Window/PortScanWindow.cs similarity index 94% rename from mRemoteV1/UI/Windows/UI.Window.PortScan.cs rename to mRemoteV1/UI/Window/PortScanWindow.cs index 7d644d4e..26a2fdd3 100644 --- a/mRemoteV1/UI/Windows/UI.Window.PortScan.cs +++ b/mRemoteV1/UI/Window/PortScanWindow.cs @@ -9,14 +9,14 @@ using mRemoteNG.App; namespace mRemoteNG.UI.Window { - public partial class PortScan : Base + public partial class PortScanWindow : BaseWindow { #region Constructors - public PortScan(DockContent panel, bool import) + public PortScanWindow(DockContent panel, bool import) { InitializeComponent(); - WindowType = Type.PortScan; + WindowType = WindowType.PortScan; DockPnl = panel; _import = import; } @@ -129,7 +129,7 @@ namespace mRemoteNG.UI.Window public void btnImport_Click(System.Object sender, EventArgs e) { - mRemoteNG.Connection.Protocol.Protocols protocol = (mRemoteNG.Connection.Protocol.Protocols)Tools.Misc.StringToEnum(typeof(mRemoteNG.Connection.Protocol.Protocols), System.Convert.ToString(cbProtocol.SelectedItem)); + mRemoteNG.Connection.Protocol.ProtocolType protocol = (mRemoteNG.Connection.Protocol.ProtocolType)Tools.MiscTools.StringToEnum(typeof(mRemoteNG.Connection.Protocol.ProtocolType), System.Convert.ToString(cbProtocol.SelectedItem)); List hosts = new List(); foreach (ListViewItem item in lvHosts.SelectedItems) @@ -276,4 +276,4 @@ namespace mRemoteNG.UI.Window } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.PortScan.resx b/mRemoteV1/UI/Window/PortScanWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.PortScan.resx rename to mRemoteV1/UI/Window/PortScanWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.SSHTransfer.cs b/mRemoteV1/UI/Window/SSHTransferWindow.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.SSHTransfer.cs rename to mRemoteV1/UI/Window/SSHTransferWindow.cs index bdf7eece..6746002f 100644 --- a/mRemoteV1/UI/Windows/UI.Window.SSHTransfer.cs +++ b/mRemoteV1/UI/Window/SSHTransferWindow.cs @@ -1,16 +1,16 @@ -using System; using Microsoft.VisualBasic; -using System.Windows.Forms; -using WeifenLuo.WinFormsUI.Docking; -using Tamir.SharpSsh; +using mRemoteNG.App; +using System; using System.IO; using System.Threading; -using mRemoteNG.App; +using System.Windows.Forms; +using Tamir.SharpSsh; +using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public class SSHTransfer : Base + public class SSHTransferWindow : BaseWindow { #region Form Init internal System.Windows.Forms.ProgressBar pbStatus; @@ -36,7 +36,7 @@ namespace mRemoteNG.UI.Window private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SSHTransfer)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SSHTransferWindow)); this.grpFiles = new System.Windows.Forms.GroupBox(); this.Load += new System.EventHandler(SSHTransfer_Load); this.lblLocalFile = new System.Windows.Forms.Label(); @@ -307,12 +307,12 @@ namespace mRemoteNG.UI.Window } #endregion - + #region Private Properties private SshTransferProtocolBase sshT; private OpenFileDialog oDlg; #endregion - + #region Public Properties public string Hostname { @@ -362,7 +362,7 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Form Stuff private void SSHTransfer_Load(object sender, System.EventArgs e) { @@ -386,7 +386,7 @@ namespace mRemoteNG.UI.Window Text = My.Language.strMenuSSHFileTransfer; } #endregion - + #region Private Methods private void StartTransfer(SSHTransferProtocol Protocol) { @@ -565,11 +565,11 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Public Methods - public SSHTransfer(DockContent Panel) + public SSHTransferWindow(DockContent Panel) { - this.WindowType = Type.SSHTransfer; + this.WindowType = WindowType.SSHTransfer; this.DockPnl = Panel; this.InitializeComponent(); @@ -578,7 +578,7 @@ namespace mRemoteNG.UI.Window this.oDlg.CheckFileExists = true; } #endregion - + #region Form Stuff private void btnBrowse_Click(System.Object sender, System.EventArgs e) { @@ -603,11 +603,11 @@ namespace mRemoteNG.UI.Window } } #endregion - + private enum SSHTransferProtocol { SCP = 0, SFTP = 1 } } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.SSHTransfer.resx b/mRemoteV1/UI/Window/SSHTransferWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.SSHTransfer.resx rename to mRemoteV1/UI/Window/SSHTransferWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.ScreenshotManager.cs b/mRemoteV1/UI/Window/ScreenshotManagerWindow.cs similarity index 97% rename from mRemoteV1/UI/Windows/UI.Window.ScreenshotManager.cs rename to mRemoteV1/UI/Window/ScreenshotManagerWindow.cs index 1dfe4f99..b5ea460c 100644 --- a/mRemoteV1/UI/Windows/UI.Window.ScreenshotManager.cs +++ b/mRemoteV1/UI/Window/ScreenshotManagerWindow.cs @@ -9,7 +9,7 @@ using System.IO; namespace mRemoteNG.UI.Window { - public class ScreenshotManager : Base + public class ScreenshotManagerWindow : BaseWindow { #region Form Init internal System.Windows.Forms.MenuStrip msMain; @@ -158,9 +158,9 @@ namespace mRemoteNG.UI.Window #endregion #region Public Methods - public ScreenshotManager(DockContent Panel) + public ScreenshotManagerWindow(DockContent Panel) { - this.WindowType = Type.ScreenshotManager; + this.WindowType = WindowType.ScreenshotManager; this.DockPnl = Panel; this.InitializeComponent(); } @@ -309,7 +309,7 @@ namespace mRemoteNG.UI.Window { if (ctrl is PictureBox) { - (ctrl as PictureBox).Image.Save(this.dlgSaveAllImages.SelectedPath + "\\Screenshot_" + Tools.Misc.LeadingZero(System.Convert.ToString(pCount)) +".png", System.Drawing.Imaging.ImageFormat.Png); + (ctrl as PictureBox).Image.Save(this.dlgSaveAllImages.SelectedPath + "\\Screenshot_" + Tools.MiscTools.LeadingZero(System.Convert.ToString(pCount)) +".png", System.Drawing.Imaging.ImageFormat.Png); pCount++; } } diff --git a/mRemoteV1/UI/Windows/UI.Window.ScreenshotManager.resx b/mRemoteV1/UI/Window/ScreenshotManagerWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.ScreenshotManager.resx rename to mRemoteV1/UI/Window/ScreenshotManagerWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Sessions.Designer.cs b/mRemoteV1/UI/Window/SessionsWindow.Designer.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.Sessions.Designer.cs rename to mRemoteV1/UI/Window/SessionsWindow.Designer.cs index 197e1f27..2f016dba 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Sessions.Designer.cs +++ b/mRemoteV1/UI/Window/SessionsWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class Sessions + public partial class SessionsWindow { #region Windows Form Designer generated code private System.ComponentModel.Container components = null; @@ -15,7 +15,7 @@ namespace mRemoteNG.UI.Window this.components = new System.ComponentModel.Container(); this.Load += new System.EventHandler(Sessions_Load); System.Windows.Forms.ContextMenuStrip sessionMenu = default(System.Windows.Forms.ContextMenuStrip); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Sessions)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SessionsWindow)); this.sessionMenuRetrieve = new System.Windows.Forms.ToolStripMenuItem(); this.sessionMenuRetrieve.Click += new System.EventHandler(this.sessionMenuRetrieve_Click); this.sessionMenuLogoff = new System.Windows.Forms.ToolStripMenuItem(); diff --git a/mRemoteV1/UI/Windows/UI.Window.Sessions.cs b/mRemoteV1/UI/Window/SessionsWindow.cs similarity index 80% rename from mRemoteV1/UI/Windows/UI.Window.Sessions.cs rename to mRemoteV1/UI/Window/SessionsWindow.cs index 4ab04c17..ce943818 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Sessions.cs +++ b/mRemoteV1/UI/Window/SessionsWindow.cs @@ -1,25 +1,28 @@ -using System; -using Microsoft.VisualBasic; -using System.Windows.Forms; -using System.Threading; -using mRemoteNG.My; -using WeifenLuo.WinFormsUI.Docking; using mRemoteNG.App; +using mRemoteNG.Connection; +using mRemoteNG.Connection.Protocol; +using mRemoteNG.Connection.Protocol.RDP; +using mRemoteNG.My; +using mRemoteNG.Tree; +using System; +using System.Threading; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public partial class Sessions : Base + public partial class SessionsWindow : BaseWindow { #region Private Fields private Thread _getSessionsThread; private bool _retrieved = false; #endregion - + #region Public Methods - public Sessions(DockContent panel) + public SessionsWindow(DockContent panel) { - WindowType = Type.Sessions; + WindowType = WindowType.Sessions; DockPnl = panel; InitializeComponent(); } @@ -38,13 +41,13 @@ namespace mRemoteNG.UI.Window try { - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = mRemoteNG.Tree.Node.SelectedNode.Tag as mRemoteNG.Connection.ConnectionRecordImp; + ConnectionInfo connectionInfo = ConnectionTree.SelectedNode.Tag as ConnectionInfo; if (connectionInfo == null) { return ; } - if (!(connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP | connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.ICA)) + if (!(connectionInfo.Protocol == ProtocolType.RDP | connectionInfo.Protocol == ProtocolType.ICA)) { return ; } @@ -64,7 +67,7 @@ namespace mRemoteNG.UI.Window if (string.IsNullOrEmpty(data.Password)) { - data.Password = Security.Crypt.Decrypt(Settings.Default.DefaultPassword, App.Info.General.EncryptionKey); + data.Password = Security.Crypt.Decrypt(Settings.Default.DefaultPassword, App.Info.GeneralAppInfo.EncryptionKey); } if (string.IsNullOrEmpty(data.Domain)) @@ -97,14 +100,14 @@ namespace mRemoteNG.UI.Window { return ; } - - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = mRemoteNG.Tree.Node.SelectedNode.Tag as mRemoteNG.Connection.ConnectionRecordImp; + + ConnectionInfo connectionInfo = ConnectionTree.SelectedNode.Tag as ConnectionInfo; if (connectionInfo == null) { return ; } - if (!(connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP)) + if (!(connectionInfo.Protocol == ProtocolType.RDP)) { return ; } @@ -137,7 +140,7 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Private Methods #region Form Stuff public void Sessions_Load(object sender, EventArgs e) @@ -166,7 +169,7 @@ namespace mRemoteNG.UI.Window } Security.Impersonator impersonator = new Security.Impersonator(); - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.TerminalSessions terminalSessions = new mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.TerminalSessions(); + ProtocolRDP.TerminalSessions terminalSessions = new ProtocolRDP.TerminalSessions(); int serverHandle = 0; try { @@ -201,10 +204,10 @@ namespace mRemoteNG.UI.Window } // Get sessions from an already impersonated and connected TerminalSessions object - private void GetSessions(mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.TerminalSessions terminalSessions, int serverHandle) + private void GetSessions(ProtocolRDP.TerminalSessions terminalSessions, int serverHandle) { - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.SessionsCollection rdpSessions = terminalSessions.GetSessions(serverHandle); - foreach (mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.Session session in rdpSessions) + ProtocolRDP.SessionsCollection rdpSessions = terminalSessions.GetSessions(serverHandle); + foreach (ProtocolRDP.Session session in rdpSessions) { ListViewItem item = new ListViewItem(); item.Tag = session.SessionId; @@ -224,7 +227,7 @@ namespace mRemoteNG.UI.Window } Security.Impersonator impersonator = new Security.Impersonator(); - mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.TerminalSessions terminalSessions = new mRemoteNG.Connection.Protocol.RDPConnectionProtocolImp.TerminalSessions(); + ProtocolRDP.TerminalSessions terminalSessions = new ProtocolRDP.TerminalSessions(); int serverHandle = 0; try { @@ -295,14 +298,14 @@ namespace mRemoteNG.UI.Window private void menuSession_Opening(object sender, System.ComponentModel.CancelEventArgs e) { - mRemoteNG.Connection.ConnectionRecordImp connectionInfo = default(mRemoteNG.Connection.ConnectionRecordImp); - if (mRemoteNG.Tree.Node.TreeView == null || mRemoteNG.Tree.Node.SelectedNode == null) + mRemoteNG.Connection.ConnectionInfo connectionInfo = default(mRemoteNG.Connection.ConnectionInfo); + if (mRemoteNG.Tree.ConnectionTree.TreeView == null || mRemoteNG.Tree.ConnectionTree.SelectedNode == null) { connectionInfo = null; } else { - connectionInfo = mRemoteNG.Tree.Node.SelectedNode.Tag as mRemoteNG.Connection.ConnectionRecordImp; + connectionInfo = mRemoteNG.Tree.ConnectionTree.SelectedNode.Tag as ConnectionInfo; } if (connectionInfo == null) @@ -313,7 +316,7 @@ namespace mRemoteNG.UI.Window return ; } - if (connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP & sessionList.SelectedItems.Count > 0) + if (connectionInfo.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.RDP & sessionList.SelectedItems.Count > 0) { sessionMenuLogoff.Enabled = true; } @@ -322,7 +325,7 @@ namespace mRemoteNG.UI.Window sessionMenuLogoff.Enabled = false; } - if (connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.RDP | connectionInfo.Protocol == mRemoteNG.Connection.Protocol.Protocols.ICA) + if (connectionInfo.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.RDP | connectionInfo.Protocol == mRemoteNG.Connection.Protocol.ProtocolType.ICA) { sessionMenuRetrieve.Enabled = true; } @@ -351,7 +354,7 @@ namespace mRemoteNG.UI.Window KillSession(); } #endregion - + #region Private Classes private class BackgroundData { @@ -363,4 +366,4 @@ namespace mRemoteNG.UI.Window } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.Sessions.resx b/mRemoteV1/UI/Window/SessionsWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Sessions.resx rename to mRemoteV1/UI/Window/SessionsWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.UltraVNCSC.cs b/mRemoteV1/UI/Window/UltraVNCWindow.cs similarity index 96% rename from mRemoteV1/UI/Windows/UI.Window.UltraVNCSC.cs rename to mRemoteV1/UI/Window/UltraVNCWindow.cs index 068e3556..5a318690 100644 --- a/mRemoteV1/UI/Windows/UI.Window.UltraVNCSC.cs +++ b/mRemoteV1/UI/Window/UltraVNCWindow.cs @@ -6,9 +6,8 @@ using WeifenLuo.WinFormsUI.Docking; namespace mRemoteNG.UI.Window { - public class UltraVNCSC : Base + public class UltraVNCWindow : BaseWindow { - #region Form Init internal System.Windows.Forms.ToolStrip tsMain; internal System.Windows.Forms.Panel pnlContainer; @@ -16,7 +15,7 @@ namespace mRemoteNG.UI.Window private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UltraVNCSC)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UltraVNCWindow)); this.tsMain = new System.Windows.Forms.ToolStrip(); this.Load += new System.EventHandler(UltraVNCSC_Load); this.btnDisconnect = new System.Windows.Forms.ToolStripButton(); @@ -70,20 +69,20 @@ namespace mRemoteNG.UI.Window } #endregion - + #region Declarations //Private WithEvents vnc As AxCSC_ViewerXControl #endregion - + #region Public Methods - public UltraVNCSC(DockContent Panel) + public UltraVNCWindow(DockContent Panel) { - this.WindowType = Type.UltraVNCSC; + this.WindowType = WindowType.UltraVNCSC; this.DockPnl = Panel; this.InitializeComponent(); } #endregion - + #region Private Methods private void UltraVNCSC_Load(object sender, System.EventArgs e) { @@ -151,9 +150,8 @@ namespace mRemoteNG.UI.Window { //vnc.Dispose() Dispose(); - Runtime.Windows.Show(Type.UltraVNCSC); + Windows.Show(WindowType.UltraVNCSC); } #endregion - } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.UltraVNCSC.resx b/mRemoteV1/UI/Window/UltraVNCWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.UltraVNCSC.resx rename to mRemoteV1/UI/Window/UltraVNCWindow.resx diff --git a/mRemoteV1/UI/Windows/UI.Window.Update.Designer.cs b/mRemoteV1/UI/Window/UpdateWindow.Designer.cs similarity index 99% rename from mRemoteV1/UI/Windows/UI.Window.Update.Designer.cs rename to mRemoteV1/UI/Window/UpdateWindow.Designer.cs index d12cb184..5cb5423a 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Update.Designer.cs +++ b/mRemoteV1/UI/Window/UpdateWindow.Designer.cs @@ -2,7 +2,7 @@ namespace mRemoteNG.UI.Window { - public partial class Update + public partial class UpdateWindow { #region Windows Form Designer generated code internal System.Windows.Forms.Label lblStatus; diff --git a/mRemoteV1/UI/Windows/UI.Window.Update.cs b/mRemoteV1/UI/Window/UpdateWindow.cs similarity index 94% rename from mRemoteV1/UI/Windows/UI.Window.Update.cs rename to mRemoteV1/UI/Window/UpdateWindow.cs index d9d08ca3..cc1d0ffe 100644 --- a/mRemoteV1/UI/Windows/UI.Window.Update.cs +++ b/mRemoteV1/UI/Window/UpdateWindow.cs @@ -7,22 +7,23 @@ using mRemoteNG.My; using WeifenLuo.WinFormsUI.Docking; using System.IO; using mRemoteNG.App; +using mRemoteNG.App.Update; namespace mRemoteNG.UI.Window { - public partial class Update : Base + public partial class UpdateWindow : BaseWindow { #region Public Methods - public Update(DockContent panel) + public UpdateWindow(DockContent panel) { - WindowType = Type.Update; + WindowType = WindowType.Update; DockPnl = panel; InitializeComponent(); Runtime.FontOverride(this); } #endregion - + #region Form Stuff public void Update_Load(object sender, EventArgs e) { @@ -63,18 +64,18 @@ namespace mRemoteNG.UI.Window Process.Start(linkUri.ToString()); } #endregion - + #region Private Fields - private App.Update _appUpdate; + private AppUpdater _appUpdate; private bool _isUpdateDownloadHandlerDeclared = false; #endregion - + #region Private Methods private void CheckForUpdate() { if (_appUpdate == null) { - _appUpdate = new App.Update(); + _appUpdate = new AppUpdater(); //_appUpdate.Load += _appUpdate.Update_Load; } else if (_appUpdate.IsGetUpdateInfoRunning) @@ -129,7 +130,7 @@ namespace mRemoteNG.UI.Window lblStatus.ForeColor = Color.OrangeRed; pnlUpdate.Visible = true; - App.Update.UpdateInfo updateInfo = _appUpdate.CurrentUpdateInfo; + UpdateInfo updateInfo = _appUpdate.CurrentUpdateInfo; lblLatestVersion.Text = updateInfo.Version.ToString(); lblLatestVersionLabel.Visible = true; lblLatestVersion.Visible = true; @@ -157,7 +158,7 @@ namespace mRemoteNG.UI.Window if (_appUpdate.CurrentUpdateInfo != null) { - App.Update.UpdateInfo updateInfo = _appUpdate.CurrentUpdateInfo; + UpdateInfo updateInfo = _appUpdate.CurrentUpdateInfo; if (updateInfo.IsValid && updateInfo.Version != null) { lblLatestVersion.Text = updateInfo.Version.ToString(); @@ -229,7 +230,7 @@ namespace mRemoteNG.UI.Window } } #endregion - + #region Events private void DownloadUpdateProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e) { @@ -254,7 +255,7 @@ namespace mRemoteNG.UI.Window if (MessageBox.Show(Language.strUpdateDownloadComplete, Language.strMenuCheckForUpdates, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { - Runtime.Shutdown.Quit(_appUpdate.CurrentUpdateInfo.UpdateFilePath); + Shutdown.Quit(_appUpdate.CurrentUpdateInfo.UpdateFilePath); return ; } else @@ -269,4 +270,4 @@ namespace mRemoteNG.UI.Window } #endregion } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.Update.resx b/mRemoteV1/UI/Window/UpdateWindow.resx similarity index 100% rename from mRemoteV1/UI/Windows/UI.Window.Update.resx rename to mRemoteV1/UI/Window/UpdateWindow.resx diff --git a/mRemoteV1/UI/WindowList.cs b/mRemoteV1/UI/WindowList.cs new file mode 100644 index 00000000..65aa99e1 --- /dev/null +++ b/mRemoteV1/UI/WindowList.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections; +using System.Windows.Forms; + + + +namespace mRemoteNG.UI.Window +{ + public class WindowList : CollectionBase + { + #region Public Properties + public BaseWindow this[object Index] + { + get + { + this.CleanUp(); + if (Index is BaseWindow) + return IndexByObject(Index); + else if (Index is Int32) + return IndexByNumber(Convert.ToInt32(Index)); + + return null; + } + } + + public new int Count + { + get + { + this.CleanUp(); + return List.Count; + } + } + #endregion + + #region Public Methods + public void Add(BaseWindow uiWindow) + { + this.List.Add(uiWindow); + //AddHandler uiWindow.FormClosing, AddressOf uiFormClosing + } + + public void AddRange(BaseWindow[] uiWindow) + { + foreach (Form uW in uiWindow) + { + this.List.Add(uW); + } + } + + public void Remove(BaseWindow uiWindow) + { + this.List.Remove(uiWindow); + } + + public BaseWindow FromString(string uiWindow) + { + this.CleanUp(); + for (int i = 0; i < this.List.Count; i++) + { + if (this[i].Text == uiWindow.Replace("&", "&&")) + { + return this[i]; + } + } + + return null; + } + #endregion + + + private void CleanUp() + { + for (int i = 0; i <= this.List.Count - 1; i++) + { + if (i > this.List.Count - 1) + { + CleanUp(); + return; + } + if ((this.List[i] as BaseWindow).IsDisposed) + { + this.List.RemoveAt(i); + CleanUp(); + return; + } + } + } + + private BaseWindow IndexByObject(object Index) + { + try + { + int objectIndex = this.List.IndexOf(Index); + return IndexByNumber(objectIndex); + } + catch (ArgumentOutOfRangeException e) + { + throw new ArgumentOutOfRangeException(e.ParamName, "Object was not present in the collection."); + } + } + + private BaseWindow IndexByNumber(int Index) + { + try + { + return this.List[Index] as BaseWindow; + } + catch (ArgumentOutOfRangeException e) + { + throw new ArgumentOutOfRangeException(e.ParamName, e.ActualValue, "Index was out of bounds"); + } + } + + private void uiFormClosing(object sender, FormClosingEventArgs e) + { + this.List.Remove(sender); + } + } +} \ No newline at end of file diff --git a/mRemoteV1/UI/UI.Window.Type.cs b/mRemoteV1/UI/WindowType.cs similarity index 93% rename from mRemoteV1/UI/UI.Window.Type.cs rename to mRemoteV1/UI/WindowType.cs index 2e70a9ba..476a7c2c 100644 --- a/mRemoteV1/UI/UI.Window.Type.cs +++ b/mRemoteV1/UI/WindowType.cs @@ -1,8 +1,6 @@ - - namespace mRemoteNG.UI.Window { - public enum Type + public enum WindowType { Tree = 0, Connection = 1, @@ -22,4 +20,4 @@ namespace mRemoteNG.UI.Window ComponentsCheck = 17, Announcement = 18 } -} +} \ No newline at end of file diff --git a/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.cs b/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.cs deleted file mode 100644 index dfdd3b3c..00000000 --- a/mRemoteV1/UI/Windows/UI.Window.ActiveDirectoryImport.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Windows.Forms; -using WeifenLuo.WinFormsUI.Docking; -using mRemoteNG.App; - - -namespace mRemoteNG.UI.Window -{ - public partial class ActiveDirectoryImport : Base - { -#region Constructors - public ActiveDirectoryImport(DockContent panel) - { - InitializeComponent(); - - Runtime.FontOverride(this); - - WindowType = Type.ActiveDirectoryImport; - DockPnl = panel; - } -#endregion - -#region Private Methods -#region Event Handlers - public void ADImport_Load(object sender, EventArgs e) - { - ApplyLanguage(); - - txtDomain.Text = ActiveDirectoryTree.Domain; - EnableDisableImportButton(); - } - - public void btnImport_Click(System.Object sender, EventArgs e) - { - Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath); - DialogResult = DialogResult.OK; - Close(); - } - - static public void txtDomain_PreviewKeyDown(System.Object sender, PreviewKeyDownEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - e.IsInputKey = true; - } - } - - public void txtDomain_KeyDown(System.Object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - ChangeDomain(); - e.SuppressKeyPress = true; - } - } - - public void btnChangeDomain_Click(System.Object sender, EventArgs e) - { - ChangeDomain(); - } - - public void ActiveDirectoryTree_ADPathChanged(object sender) - { - EnableDisableImportButton(); - } -#endregion - - private void ApplyLanguage() - { - btnImport.Text = My.Language.strButtonImport; - lblDomain.Text = My.Language.strLabelDomain; - btnChangeDomain.Text = My.Language.strButtonChange; - } - - private void ChangeDomain() - { - ActiveDirectoryTree.Domain = txtDomain.Text; - ActiveDirectoryTree.Refresh(); - } - - private void EnableDisableImportButton() - { - btnImport.Enabled = !string.IsNullOrEmpty(ActiveDirectoryTree.ADPath); - } -#endregion - } -} diff --git a/mRemoteV1/bin/Debug Portable/AxInterop.MSTSCLib.dll b/mRemoteV1/bin/Debug Portable/AxInterop.MSTSCLib.dll index e83e0d83..08e92945 100644 Binary files a/mRemoteV1/bin/Debug Portable/AxInterop.MSTSCLib.dll and b/mRemoteV1/bin/Debug Portable/AxInterop.MSTSCLib.dll differ diff --git a/mRemoteV1/bin/Debug Portable/AxInterop.WFICALib.dll b/mRemoteV1/bin/Debug Portable/AxInterop.WFICALib.dll index 73558a32..f4efb0a8 100644 Binary files a/mRemoteV1/bin/Debug Portable/AxInterop.WFICALib.dll and b/mRemoteV1/bin/Debug Portable/AxInterop.WFICALib.dll differ diff --git a/mRemoteV1/bin/Debug Portable/SharedLibraryNG.dll b/mRemoteV1/bin/Debug Portable/SharedLibraryNG.dll index c34ec1bb..5b8fa80d 100644 Binary files a/mRemoteV1/bin/Debug Portable/SharedLibraryNG.dll and b/mRemoteV1/bin/Debug Portable/SharedLibraryNG.dll differ diff --git a/mRemoteV1/bin/Debug Portable/SharedLibraryNG.pdb b/mRemoteV1/bin/Debug Portable/SharedLibraryNG.pdb index 838e9e47..ed132cc6 100644 Binary files a/mRemoteV1/bin/Debug Portable/SharedLibraryNG.pdb and b/mRemoteV1/bin/Debug Portable/SharedLibraryNG.pdb differ diff --git a/mRemoteV1/bin/Debug Portable/mRemoteNG.vshost.exe b/mRemoteV1/bin/Debug Portable/mRemoteNG.vshost.exe index a2140ff2..efafb539 100644 Binary files a/mRemoteV1/bin/Debug Portable/mRemoteNG.vshost.exe and b/mRemoteV1/bin/Debug Portable/mRemoteNG.vshost.exe differ diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index 680c4627..94bdeba7 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -86,7 +86,7 @@ bin\Debug Portable\ 1591,660,661 full - x86 + AnyCPU PORTABLE AllRules.ruleset @@ -167,56 +167,69 @@ - - - - - + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + + + + + + + + + Component @@ -229,7 +242,7 @@ Component - + AdvancedPage.cs @@ -298,42 +311,42 @@ - + - - - - Connection.InterfaceControl.cs + + + + InterfaceControl.cs - + Component - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + frmChoosePanel.cs @@ -352,14 +365,14 @@ Form - + True True Language.resx - - + + True @@ -393,89 +406,95 @@ - + - + Form - - UI.Window.ActiveDirectoryImport.cs + + SplashPage.cs - + Form - - UI.Window.Announcement.cs + + ActiveDirectoryImportWindow.cs - + Form - + + AnnouncementWindow.cs + + Form - + Form - + Form - + Form - + + Form + + Form ExportForm.cs - - UI.Window.ExternalTools.cs + + ExternalToolsWindow.cs - + Form - + Form - - - UI.Window.PortScan.cs + + + PortScanWindow.cs - + Form Form - + Form - - UI.Window.Sessions.cs + + SessionsWindow.cs - + Form - + Form - - UI.Window.Tree.cs + + ConnectionTreeWindow.cs - + Form - - + + Form - - UI.Window.Update.cs + + UpdateWindow.cs - + Form @@ -581,72 +600,75 @@ ReconnectGroup.cs Designer - - UI.Window.About.cs + + SplashPage.cs + + + AboutWindow.cs Designer - - UI.Window.ActiveDirectoryImport.cs + + ActiveDirectoryImportWindow.cs Designer - - UI.Window.Announcement.cs + + AnnouncementWindow.cs Designer - - UI.Window.ComponentsCheck.cs + + ComponentsCheckWindow.cs Designer - + Designer - UI.Window.Config.cs + ConfigWindow.cs - - UI.Window.Connection.cs + + ConnectionWindow.cs Designer - - UI.Window.ErrorsAndInfos.cs + + ErrorAndInfoWindow.cs Designer - - UI.Window.ExternalTools.cs + + ExternalToolsWindow.cs Designer - - UI.Window.Help.cs + + HelpWindow.cs Designer - - UI.Window.PortScan.cs + + PortScanWindow.cs Designer ExportForm.cs Designer - - UI.Window.ScreenshotManager.cs + + ScreenshotManagerWindow.cs Designer - - UI.Window.Sessions.cs + + SessionsWindow.cs Designer - - UI.Window.SSHTransfer.cs + + SSHTransferWindow.cs Designer - - UI.Window.Tree.cs + + ConnectionTreeWindow.cs Designer - - UI.Window.UltraVNCSC.cs + + UltraVNCWindow.cs Designer - - UI.Window.Update.cs + + UpdateWindow.cs Designer diff --git a/mRemoteV1/obj/Debug Portable/AxInterop.MSTSCLib.dll b/mRemoteV1/obj/Debug Portable/AxInterop.MSTSCLib.dll index e83e0d83..08e92945 100644 Binary files a/mRemoteV1/obj/Debug Portable/AxInterop.MSTSCLib.dll and b/mRemoteV1/obj/Debug Portable/AxInterop.MSTSCLib.dll differ diff --git a/mRemoteV1/obj/Debug Portable/AxInterop.WFICALib.dll b/mRemoteV1/obj/Debug Portable/AxInterop.WFICALib.dll index 73558a32..f4efb0a8 100644 Binary files a/mRemoteV1/obj/Debug Portable/AxInterop.WFICALib.dll and b/mRemoteV1/obj/Debug Portable/AxInterop.WFICALib.dll differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.Forms.OptionsForm.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.Forms.OptionsForm.resources index 46a06663..200159ed 100644 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.Forms.OptionsForm.resources and b/mRemoteV1/obj/Debug Portable/mRemoteNG.Forms.OptionsForm.resources differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.About.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.About.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.About.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ActiveDirectoryImport.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ActiveDirectoryImport.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ActiveDirectoryImport.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Announcement.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Announcement.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Announcement.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ComponentsCheck.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ComponentsCheck.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ComponentsCheck.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Config.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Config.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Config.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Connection.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Connection.resources deleted file mode 100644 index d683f1bc..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Connection.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ErrorsAndInfos.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ErrorsAndInfos.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ErrorsAndInfos.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ExternalTools.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ExternalTools.resources deleted file mode 100644 index 835c6e3a..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ExternalTools.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Help.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Help.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Help.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.PortScan.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.PortScan.resources deleted file mode 100644 index ee8745ca..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.PortScan.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.SSHTransfer.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.SSHTransfer.resources deleted file mode 100644 index bf76a916..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.SSHTransfer.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ScreenshotManager.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ScreenshotManager.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.ScreenshotManager.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Sessions.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Sessions.resources deleted file mode 100644 index adca77a1..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Sessions.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Tree.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Tree.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Tree.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.UltraVNCSC.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.UltraVNCSC.resources deleted file mode 100644 index a5345de6..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.UltraVNCSC.resources and /dev/null differ diff --git a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Update.resources b/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Update.resources deleted file mode 100644 index 06c24d06..00000000 Binary files a/mRemoteV1/obj/Debug Portable/mRemoteNG.UI.Window.Update.resources and /dev/null differ diff --git a/packages/NSubstitute.1.10.0.0/BreakingChanges.txt b/packages/NSubstitute.1.10.0.0/BreakingChanges.txt new file mode 100644 index 00000000..3cbb6c5c --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/BreakingChanges.txt @@ -0,0 +1,199 @@ +================================================================================================ +1.10.0 Release +================================================================================================ + +Substitutes will now automatically return an empty `IQueryable` for +members that return that type. Tests previously relying on a +substitute `IQueryable` will no longer work properly. + +Reason: +Code that uses an `IQueryable` can now run using the auto-subbed +value without causing null pointer exceptions (see issue #67). + +Fix: +Avoid mocking `IQueryable` where possible -- configure members +to return a real `IQueryable` instead. +If a substitute is required, explicitly configure the call to return +a substitute: + + sub.MyQueryable().Returns(Substitute.For>()); + + +================================================================================================ +1.9.1 Release +================================================================================================ + +Substitutes set up to throw exception for methods with return type Task +cause compilation to fail due to the call being ambiguous (CS0121). +"The call is ambiguous between the following methods or properties: +.Returns> and .Returns" + +Reason: +To make it easier to stub async methods. See issue #189. + +Fix: +Specify generic type argument explicitly. If Method() returns string: +Old: sub.Method().Returns(x => { throw new Exception() }); +New: sub.Method().Returns(x => { throw new Exception() }); + +================================================================================================ +1.8.0 Release +================================================================================================ + +Incorrect use of argument matchers outside of a member call, particularly within a +Returns(), will now throw an exception (instead of causing unexpected behaviour +in other tests: see https://github.com/nsubstitute/NSubstitute/issues/149). + +Reason: +Prevent accidental incorrect use from causing hard-to-find errors in unrelated tests. + +Fix: +Do not use argument matchers in Returns() or outside of where an argument is normally used. +Correct use: sub.Method(Arg.Any()).Returns("hi") +Incorrect use: sub.Method().Returns(Arg.Any()) + +================================================================================================ +1.7.0 Release +================================================================================================ + +Auto-substitute for pure virtual classes with at least one public static method, which +means some methods and properties on substitutes that used to return null by default will now +return a new substitute of that type. + +Reason: +Keep consistency with the behaviour of other pure virtual classes. + +Fix: +Explicitly return null from methods and property getters when required for a test. +e.g. sub.Method().Returns(x => null); + +------------------------------------------------------------------------------------------------ + +Moved `Received.InOrder` feature from `NSubstitute.Experimental` to main `NSubstitute` namespace. +Obsoleted original `NSubstitute.Experimental.Received`. + +This can result in ambiguous reference compiler errors and obsolete member compiler earnings. + +Reason: +Promoted experimental Received feature to core library. + +Fix: +Import `NSubstitute` namespace instead of `NSubstitute.Experimental`. +(If `NSubstitute` is already imported just delete the `using NSubstitute.Experimental;` line from your fixtures.) + +================================================================================================ +1.5.0 Release +================================================================================================ + +The base object methods (Equals, GetHashCode and ToString) for substitute objects of classes that +extend those methods now return the result of calling the actual implementation of those methods +rather than the default value for the return type. This means that places where you relied on +.Equals returning false, .ToString returning null and .GetHashCode returning 0 because the actual +methods weren't called will now call the actual implementation. + +Reason: +Substitute objects of classes that overrode those methods that were used as parameters for +setting up return values or checking received calls weren't able to be directly used within the +call, e.g. instead of: + +someObject.SomeCall(aSubstitute).Returns(1); + +You previously needed to have: + +someObject.SomeCall(Arg.Is(a => a == aSubstitute)).Returns(1); + +However, now you can use the former, which is much more terse and consistent with the way other +Returns or Received calls work. + +This means that substitute objects will now always work like .NET objects rather than being +inconsistent when the class being substituted overrode any of those base object methods. + +Fix: +There is no workaround to change the behaviour of .Equals, .GetHashCode or .ToString. If you have +a use case to change the behaviour of these methods please lodge an issue at the NSubstitute +Github site. + +------------------------------------------------------------------------------------------------ + +In rare cases the new `Returns()` and `ReturnsForAnyArgs()` overloads can cause compilation to fail due to the call being ambiguous (CS0121). + +Reason: +The new overloads allow a sequence of callbacks to be used for return values. A common example is return several values, then throwing an exception. + +Fix: +Remove the ambiguity by explicitly casting the arguments types or by using lambda syntax. +e.g. sub.Call().Returns(x => null, x => null); + +================================================================================================ +1.4.0 Release +================================================================================================ + +Auto-substitute from substitutes of `Func` delegates (following the same rules as auto-subbing +for methods and properties). So the delegate returned from `Substitute.For>()` will +return a substitute of `IFoo`. This means some substitutes for delegates that used to return +null will now return a new substitute. + +Reason: +Reduced setup when substituting for `Func` delegates, and consistency with behaviour for +properties and methods. + +Fix: +Explicitly return null from substitute delegates when required for a test. +e.g. subFunc().Returns(x => null); + + +================================================================================================ +1.2.0 Release +================================================================================================ + +Auto-substitute for pure virtual classes (in addition to interfaces and delegate types), which +means some methods and properties on substitutes that used to return null by default will now +return a new substitute of that type. + +Reason: +Cut down the code required to configure substitute members that return interface-like types +(e.g. ASP.NET web abstractions like HttpContextBase) which are safe to create and proxy. + +Safe classes are those with all their public methods and properties defined as virtual or +abstract, and containing a default, parameterless constructor defined as public or protected. + +Fix: +Explicitly return null from methods and property getters when required for a test. +e.g. sub.Method().Returns(x => null); + + +================================================================================================ +0.9.5 Release +================================================================================================ + +Raise.Event(...) methods renamed to Raise.EventWith() signature would often conflict with the +Raise.Event() method which is used to raise all types of events. + +Raise.Event() will now always work for any event type, while +Raise.EventWith() can be used as a shortcut to raise +EventHandler-style events with a particular argument. + +Fix: +Replace Raise.Event() calls with equivalent Raise.EventWith() call. + +------------------------------------------------------------------------------------------------ +Raise.Action() methods removed + +Reason: +The Raise.Event() method can be used to raise all delegate events, including Actions. +Raise.Action() was removed so there is a consistent way of raising all delegate events. + +Fix: +- Replace Raise.Action() calls with Raise.Event(). +- Replace Raise.Action(T arg) calls with Raise.Event>(arg). +- Replace Raise.Action(T1 x, T2 y) calls with Raise.Event>(x, y). + + +================================================================================================ +0.9.0 Release +================================================================================================ + +No breaking changes. diff --git a/packages/NSubstitute.1.10.0.0/CHANGELOG.txt b/packages/NSubstitute.1.10.0.0/CHANGELOG.txt new file mode 100644 index 00000000..29892de0 --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/CHANGELOG.txt @@ -0,0 +1,151 @@ +### 1.10.0 (March 2016) +* [NEW] Callbacks builder for more control over When..Do callbacks. Thanks to bartoszgolek. (#202, #200) +* [NEW] Auto-substitute for IQueryable. Thanks to emragins. (#67) +* [FIX] Fix bug when showing params arguments for value types (#214) +* [FIX] Fix bug when showing params arguments for Received.InOrder calls (#211) + +### 1.9.2 (October 2015) +* [UPDATE] Mark Exceptions as [Serializable]. Thanks to David Mann. (#201) +* [FIX] Fix bug with concurrently creating delegate substitutes. Thanks to Alexandr Nikitin. (#205) + +### 1.9.1 (October 2015) +* [FIX] Fix bug introduced in 1.9.0 that made checking a call was Received() clear previously stubbed values for that call. + +### 1.9.0 (October 2015) +* [NEW] Allow awaiting of async methods with Received()/DidNotReceive(). Thanks to Marcio Rinaldi for this contribution. (#190, #191) +* [NEW] Task-specific Returns methods to make it easier to stub async methods. Thanks to Antony Koch for implementing this, and thanks to Marius Gundersen and Alexandr Nikitin for the suggestion and discussion regarding the change. (#189) (Also thanks to Jake Ginnivan who tried adding this back in #91, but I didn't merge that part of the PR in. Sorry!) +* [NEW] ReturnsForAll extension method. Thanks to Mike Hanson for this contribution. (#198, #196) + +### 1.8.2 (May 2015) +* [NEW] Convenience .ReturnsNull() extensions in NSubstitute.ReturnsExtensions. Thanks to Michal Wereda for this contribution. (#181) +* [NEW] CallInfo.ArgAt(int) added to match argument at a given position and cast to the required type. Thanks to @jotabe-net for this contribution. (#175) +* [NEW] Convenience Throws() extensions in NSubstitute.ExceptionExtensions (sub.MyCall().Throws(ex)). Thanks to Michal Wereda for this contribution. Thanks also to Geir Sagberg for helpful suggestions relating to this feature. (#172) + +### 1.8.1 (December 2014) +* [FIX] Fix for methods returning multidimensional arrays. Thanks to Alexandr Nikitin. (#170) + +### 1.8.0 (November 2014) +* [NEW] Convenience methods for throwing exceptions with When-Do. Thanks to Geir Sagberg for this contribution. +* [FIX] Throw exception when arg matcher used within Returns. (#149) + +### 1.7.2 (March 2014) +* [FIX] Basic support for types that return dynamic. Thanks to Alexandr Nikitin. (#75) +* [NEW] Auto-subbing for observables. Thanks to Paul Betts. + +### 1.7.1 (January 2014) +* [FIX] Ambiguous arg exception with out/ref parameters. Thanks to Alexandr Nikitin. (#129) + +### 1.7.0 (January 2014) +* [NEW] Partial subs (Substitute.ForPartsOf()). Thanks to Alexandr Nikitin for tonnes of hard work on this feature (and for putting up with a vacillating project owner :)). +* [UPDATE] Received.InOrder moved out of Experimental namespace. +* [FIX] Argument matching with optional parameters. Thanks to Peter Wiles. (#111) +* [FIX] Argument matching with out/ref. Thanks to Kevin Bosman. (#111) +* [FIX] The default return value for any call that returns a concrete type that is purely virtual, but also has at least one public static method in it will be a substitute rather than null. Thanks to Robert Moore (@robdmoore) for this contribution. (#118) + +### 1.6.1 (June 2013) +* [FIX] Detect and throw on type mismatches in Returns() caused by Returns(ConfigureOtherSub()). +* [FIX] Support raising exceptions that do not implement a serialisation constructor (#110). Thanks to Alexandr Nikitin for this contribution. + +### 1.6.0 (April 2013) +* [NEW] .AndDoes() method for chaining a callback after a Returns(). (#98) +* [FIX] Handling calls with params argument of value types, thanks to Eric Winkler. +* [FIX] Can now substitute for interfaces implementing System.Windows.IDataObject, thanks to Johan Appelgren. +* [UPDATE] Improved XML doc comments, thanks to David Gardiner. + +### 1.5.0 (January 2013) +* [EXPERIMENTAL] Asserting ordered call sequences +* [FIX] Arg.Invoke with four arguments now passes fourth arg correctly (#88). Thanks to Ville Salonen (@VilleSalonen) for finding and patching this. +* [FIX] Substitute objects now use actual implementation for base object methods (Equals, GetHashCode, ToString). Thanks to Robert Moore (@robdmoore) for this contribution. (#77) +* [NEW] Auto-substitute for Task/Task. Task will use substitute rules that T would use. Thanks to Jake Ginnivan (@JakeGinnivan) for this contribution. +* [NEW] Match derived types for generic calls (#97). Thanks to Iain Ballard for this contribution. +* [NEW] Returns now supports passing multiple callbacks, which makes it easier to combine stubbing multiple return values followed by throwing an exception (#99). Thanks to Alexandr Nikitin for this contribution. + +### 1.4.3 (August 2012) +* [FIX] Updated to Castle.Core 3.1.0 to fix an issue proxying generic methods with a struct constraint (#83). + +### 1.4.2 (July 2012) +* [FIX] Issue using NET40 build on Mono (due to NET45 build tools incompatibility) + +### 1.4.1 (June 2012) +* [FIX] Fix matching Nullable arguments when arg value is null. Thanks to Magnus Olstad Hansen (@maggedotno) for this contribution. (#78) +* [UPDATE] Updated to Castle.Core 3.0.0. + +### 1.4.0 (May 2012) +* [NEW] [BREAKING] Auto-substitute for types returned from substitutes of delegates/Funcs (follows same auto-substitute rules as for methods and properties). Thanks to Sauli Tähkäpää for implementing this feature. (#52) +* [NEW] Show details of params arguments when displaying received calls. Thanks to Sauli Tähkäpää for implementing this feature. (#65) +* [FIX] Race condition between checking received calls and building the exception could cause nonsensical exception messages like "Expected 5, actually received 5" when called concurrently. (#64) + +### 1.3.0 (Nov 2011) +* [NEW] Support for Received(times) to assert a call was received a certain number of times. Thanks to Abi Bellamkonda for this contribution. (#63) +* [FIX] Improved support for calling substitutes from multiple threads. (#62) + +### 1.2.1 (Oct 2011) +* [FIX] Some combinations of Arg.Do and Returns() caused incorrect values to be returned. (#59) +* [UPDATE] WCF ServiceContractAttribute no longer applied to proxies. (#60) +* [FIX] Passing null could cause argument actions to fail. (#61) +* [FIX] Calls to virtual methods from constructors of classes being substituted for are no longer recorded, to prevent non-obvious behaviour when calling Returns() on an auto-substituted value. (#57) + +### 1.2.0 (Sep 2011) +* [NEW] Arg.Do() syntax for capturing arguments passed to a method and performing some action with them whenever the method is called. +* [NEW] Arg.Invoke() syntax for invoking callbacks passed as arguments to a method whenever the method is called. +* [NEW] Basic support for setting out/ref parameters. +* [FIX] Property behaviour for indexed properties (Issue #53) +* [UPDATE] [BREAKING] Auto-substitute for pure virtual classes, including common ASP.NET web abstractions. Use .Returns(x=>null) to explicitly return null from these members if required. Thanks to Tatham Oddie for original idea and patch, and Krzysztof Kozmic for suggesting and defining which classes would be safe to automatically proxy. +* [UPDATE] Changed layout of package for eventual support for multiple framework targets. +* [FIX] Failure to match calls with ref arguments using ReceivedWithAnyArgs(). +* [FIX] Incorrect ambiguous args exception when supplying value type arg specs for object arguments. + +### 1.1.0 (May 2011) +* [UPDATE] Updated to Castle.Core 2.5.3. +* [FIX] Fixed bug when raising a delegate event with a null argument. +* [FIX] CallInfo.Arg() now works more reliably, including for null arguments. +* [FIX] Better exception when accidentally calling substitute extension method with a null reference (e.g. foo.Received().Call() when foo is null) +* [UPDATE] Exceptions thrown in custom argument matchers (Arg.Is(x => ...)) will now silently fail to match the argument, rather than allowing exceptions to bubble up. +* [NEW] Support for test fixtures run in parallel. + +### 1.0.0 (Dec 2010) +* [FIX] Using Returns(null) for value types throws, rather than returning default(T). + +0.9.5 Release Candidate +* [FIX] Fixed bug when trying to return null from a call to a substitute. +* [FIX] Equals() for class substitutes fixed by not intercepting Object methods Equals(), ToString() and GetHashCode(). +* [NEW] Raise.Event() methods to raise any type of event, including delegates. +* [BREAKING] Raise.Action() methods removed. Use Raise.Event() (e.g. Raise.Event>()). +* [BREAKING] Renamed Raise.Event() methods to Raise.EventWith(). +* [UPDATE] Arg matchers can be specified using more specific, compatible type (Arg.Is(..) for arg of type object). +* [NEW] NSubstitute website and documentation http://nsubstitute.github.com +* [FIX] Formating for argument matchers that take predicate functions. +* [FIX] Match single argument matcher passed to params arg (#34) +* [FIX] Detect ambiguous arg matchers in additional case (#31) +* [FIX] Can modify event handler subscriptions from within event callback +* [UPDATE] Update to Castle.Core 2.5.2 +* [FIX] Can substitute for SynchronizationContext in .NET4 (fixed in Castle.Core) +* [NEW] NSubstitute available as NuPack package + +### 0.9.0 Beta 1 +* [FIX] Now handles argument specifiers used for params arguments correctly +* [UPDATE] Updated to Castle.Core 2.5 final. + +### 0.1.3 alpha 4 +* [NEW] Support auto/recursive substituting for members that return interfaces or delegates. +* [NEW] Support auto substituting for members that return arrays and strings (return empty values rather than null). +* [NEW] Raise.Event() will now attempt to construct arguments with default ctors, so in most cases they will not need to be explictly provided. +* [UPDATE] Added support for raising events with custom delegate types. +* [UPDATE] Formatting for event subscription and unsubscription calls in call received/not received exceptions. +* [UPDATE] Updated to pre-release build of Castle.Core 2.5 to get dynamic proxy to support modopts. +* [FIX] Throw correct exception when raising an event and event handler throws. (Fix by Rodrigo Perera) +* [FIX] Record call as received when it throws an exception from the When..Do callback. + +### 0.1.2 alpha 3 +* [NEW] Marked non-matching parameters in the actual calls listed for CallNotReceivedException messages. +* [NEW] Added WhenForAnyArgs..Do syntax for callbacks. +* [UPDATE] Updated arg matching to be smarter when matchers are not used for all args. +* [FIX] Fixed bug when substituting for delegates with multiple parameters. +* [FIX] Removed redundant cast operator which sometimes caused the compiler trouble in resolving Raise.Event(). + +### 0.1.1 alpha 2 +* [NEW] Added ReturnsForAnyArgs() extension methods +* [FIX] Compiled for Any CPU to run on x64 platforms + +### 0.1.0 alpha +* Initial release diff --git a/packages/NSubstitute.1.10.0.0/LICENSE.txt b/packages/NSubstitute.1.10.0.0/LICENSE.txt new file mode 100644 index 00000000..4d1337d6 --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ http://www.opensource.org/licenses/bsd-license.php ] \ No newline at end of file diff --git a/packages/NSubstitute.1.10.0.0/NSubstitute.1.10.0.0.nupkg b/packages/NSubstitute.1.10.0.0/NSubstitute.1.10.0.0.nupkg new file mode 100644 index 00000000..a067842b Binary files /dev/null and b/packages/NSubstitute.1.10.0.0/NSubstitute.1.10.0.0.nupkg differ diff --git a/packages/NSubstitute.1.10.0.0/README.txt b/packages/NSubstitute.1.10.0.0/README.txt new file mode 100644 index 00000000..6cbac80f --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/README.txt @@ -0,0 +1,113 @@ +NSubstitute +======== + +Visit the [NSubstitute website](http://nsubstitute.github.com) for more information. + +### What is it? + +NSubstitute is designed as a friendly substitute for .NET mocking libraries. + +It is an attempt to satisfy our craving for a mocking library with a succinct syntax that helps us keep the focus on the intention of our tests, rather than on the configuration of our test doubles. We've tried to make the most frequently required operations obvious and easy to use, keeping less usual scenarios discoverable and accessible, and all the while maintaining as much natural language as possible. + +Perfect for those new to testing, and for others who would just like to to get their tests written with less noise and fewer lambdas. + +### Getting help + +If you have questions or feedback on NSubstitute, head on over to the [NSubstitute discussion group](http://groups.google.com/group/nsubstitute). + +### Basic use + +Let's say we have a basic calculator interface: + + + public interface ICalculator + { + int Add(int a, int b); + string Mode { get; set; } + event Action PoweringUp; + } + + + +We can ask NSubstitute to create a substitute instance for this type. We could ask for a stub, mock, fake, spy, test double etc., but why bother when we just want to substitute an instance we have some control over? + + + _calculator = Substitute.For(); + + +Now we can tell our substitute to return a value for a call: + + + _calculator.Add(1, 2).Returns(3); + Assert.That(_calculator.Add(1, 2), Is.EqualTo(3)); + + +We can check that our substitute received a call, and did not receive others: + + + _calculator.Add(1, 2); + _calculator.Received().Add(1, 2); + _calculator.DidNotReceive().Add(5, 7); + + +If our Received() assertion fails, NSubstitute tries to give us some help as to what the problem might be: + + + NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching: + Add(1, 2) + Actually received no matching calls. + Received 2 non-matching calls (non-matching arguments indicated with '*' characters): + Add(1, *5*) + Add(*4*, *7*) + +We can also work with properties using the Returns syntax we use for methods, or just stick with plain old property setters (for read/write properties): + + + _calculator.Mode.Returns("DEC"); + Assert.That(_calculator.Mode, Is.EqualTo("DEC")); + + _calculator.Mode = "HEX"; + Assert.That(_calculator.Mode, Is.EqualTo("HEX")); + + +NSubstitute supports argument matching for setting return values and asserting a call was received: + + + _calculator.Add(10, -5); + _calculator.Received().Add(10, Arg.Any()); + _calculator.Received().Add(10, Arg.Is(x => x < 0)); + + +We can use argument matching as well as passing a function to Returns() to get some more behaviour out of our substitute (possibly too much, but that's your call): + + + _calculator + .Add(Arg.Any(), Arg.Any()) + .Returns(x => (int)x[0] + (int)x[1]); + Assert.That(_calculator.Add(5, 10), Is.EqualTo(15)); + + +Returns() can also be called with multiple arguments to set up a sequence of return values. + + + _calculator.Mode.Returns("HEX", "DEC", "BIN"); + Assert.That(_calculator.Mode, Is.EqualTo("HEX")); + Assert.That(_calculator.Mode, Is.EqualTo("DEC")); + Assert.That(_calculator.Mode, Is.EqualTo("BIN")); + + +Finally, we can raise events on our substitutes (unfortunately C# dramatically restricts the extent to which this syntax can be cleaned up): + + + bool eventWasRaised = false; + _calculator.PoweringUp += () => eventWasRaised = true; + + _calculator.PoweringUp += Raise.Event(); + Assert.That(eventWasRaised); + + +### Building + +If you have Visual Studio 2008, 2010, 2012, 2013, or 2015 you should be able to compile NSubstitute and run the unit tests using the NUnit GUI or console test runner (see the ThirdParty directory). Note that some tests are marked `[Pending]` and are not meant to pass at present, so it is a good idea to exclude tests in the Pending category from test runs. +To do full builds you'll also need Ruby, as the jekyll gem is used to generate the website. + diff --git a/packages/NSubstitute.1.10.0.0/acknowledgements.txt b/packages/NSubstitute.1.10.0.0/acknowledgements.txt new file mode 100644 index 00000000..2d6c0eff --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/acknowledgements.txt @@ -0,0 +1,54 @@ +The aim of this file is to acknowledge the software projects that have been used to create NSubstitute, particularly those distributed as Open Source Software. They have been invaluable in helping us produce this software. + +# Software distributed with/compiled into NSubstitute + +## Castle.Core +NSubstitute is built on the Castle.Core library, particularly Castle.DynamicProxy which is used for generating proxies for types and intercepting calls made to them so that NSubstitute can record them. + +Castle.Core is maintained by the Castle Project [http://www.castleproject.org/] and is released under the Apache License, Version 2.0 [http://www.apache.org/licenses/LICENSE-2.0.html]. + +# Software used to help build NSubstitute + +## NUnit [http://www.nunit.org/] +NUnit is used for coding and running unit and integration tests for NSubstitute. It is distributed under an open source zlib/libpng based license [http://www.opensource.org/licenses/zlib-license.html]. + +## Rhino Mocks [http://www.ayende.com/projects/rhino-mocks.aspx] +Used for mocking parts of the NSubstitute mocking framework for testing. It is distributed under the BSD license [http://www.opensource.org/licenses/bsd-license.php]. + +## Moq [http://moq.me/] +Moq is not used in NSubstitute, but was a great source of inspiration. Moq pioneered Arrange-Act-Assert (AAA) mocking syntax for .NET, as well as removing the distinction between mocks and stubs, both of which have become important parts of NSubstitute. Moq is available under the BSD license [http://www.opensource.org/licenses/bsd-license.php]. + +## NuPack [http://nupack.codeplex.com/] +Used for packaging NSubstitute for distribution as a nu package. Distributed under the Apache License, Version 2.0 [http://www.apache.org/licenses/LICENSE-2.0.html]. + +## Jekyll [http://jekyllrb.com/] +Static website generator written in Ruby, used for NSubstitute's website and documentation. Distributed under the MIT license [http://www.opensource.org/licenses/bsd-license.php]. + +## SyntaxHighlighter [http://alexgorbatchev.com/SyntaxHighlighter/] +Open source, JavaScript, client-side code highlighter used for highlighting code samples on the NSubstitute website. Distributed under the MIT License [http://en.wikipedia.org/wiki/MIT_License] and the GPL [http://www.gnu.org/copyleft/lesser.html]. + +## FAKE [http://fsharp.github.io/FAKE/] +FAKE (F# Make) is used for NSubstitute's build. It is inspired by `make` and `rake`. FAKE is distributed under a dual Apache 2 / MS-PL license [https://github.com/fsharp/FAKE/blob/master/License.txt]. + +## Microsoft .NET Framework [http://www.microsoft.com/net/] +NSubstitute is coded in C# and compiled using Microsoft .NET. It can also run and compile under Mono [http://www.mono-project.com], an open source implementation of the open .NET standards for C# and the CLI. + +Microsoft's .NET Framework is available under a EULA (and possibly other licenses like MS Reference Source License). +Mono is available under four open source licenses for different parts of the project (including MIT/X11, GPL, MS-Pl). These are described on the project site [http://www.mono-project.com/Licensing]. + +## Microsoft Ilmerge [http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx] +Used for combining assemblies so NSubstitute can be distributed as a single DLL. Available for use under a EULA as described on the ilmerge site. + +## Microsoft Reactive Extensions for .NET (Rx) [http://msdn.microsoft.com/en-us/devlabs/ee794896] +Used to provide .NET 3.5 with some of the neat concurrency helper classes that ship with out of the box with .NET 4.0. Distributed under a EULA [http://msdn.microsoft.com/en-us/devlabs/ff394099]. + +## 7-Zip [http://www.7-zip.org/] +7-zip is used to ZIP up NSubstitute distributions as part of the automated build process. Distributed under a mixed GNU LGPL / unRAR licence [http://www.7-zip.org/license.txt]. + +# Other acknowledgements + +## Software developers +Yes, you! To everyone who has tried to get better at the craft and science of programming, especially those of you who have talked, tweeted, blogged, screencasted, and/or contributed software or ideas to the community. + +No software developers were harmed to any significant extent during the production of NSubstitute, although some had to get by on reduced sleep. + diff --git a/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.XML b/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.XML new file mode 100644 index 00000000..9e461d25 --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.XML @@ -0,0 +1,719 @@ + + + + NSubstitute + + + + + Argument matchers used for specifying calls to substitutes. + + + + + Match any argument value compatible with type . + + + + + + + Match argument that is equal to . + + + + + + + + Match argument that satisfies . + If the throws an exception for an argument it will be treated as non-matching. + + + + + + + + Invoke any argument whenever a matching call is made to the substitute. + + + + + + Invoke any argument with specified argument whenever a matching call is made to the substitute. + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + Arguments to pass to delegate. + + + + + Capture any argument compatible with type and use it to call the function + whenever a matching call is made to the substitute. + + + + + + + + Perform this chain of callbacks and/or always callback when called. + + + + + Perform as first in chain of callback when called. + + + + + + + Perform this action always when callback is called. + + + + + + + Throw exception returned by function as first callback in chain of callback when called. + + + + + + + Throw this exception as first callback in chain of callback when called. + + + + + + + Throw exception returned by function always when callback is called. + + The type of the exception. + The throw this. + + + + + Throw this exception always when callback is called. + + The type of the exception. + The exception. + + + + + Perform the given action for every call. + + The action to perform for every call + + + + + Perform this action once in chain of called callbacks. + + + + + + + Keep doing this action after the other callbacks have run. + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Throw exception returned by function once when called in a chain of callbacks. + + The type of the exception + Produce the exception to throw for a CallInfo + + + + + Throw this exception once when called in a chain of callbacks. + + The type of the exception + The exception to throw + + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Describes how the does not match the condition specified by this class, or + if a detailed description can not be provided for the argument. + + + Description of the non-match, or if no description can be provided. + + + + Adds a callback to execute for matching calls. + + an action to call + + + + + Combines two enumerables into a new enumerable using the given selector. + + + + + + + + + + This implementation was sanity-checked against the + Edulinq implementation and + Eric Lippert's implementation. + + + + + Checks if the instance can be used when a is expected. + + + + + + + + Join the using . + + + + + + + + Particularly poor implementation of Maybe/Option type. + This is just filling an immediate need; use FSharpOption or XSharpx or similar for a + real implementation. + + + + + + Delegates to ThreadLocal<T>, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions. + These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll + just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway). + + + + + + Standard substitute behaviour; replace all calls with substituted behaviour. + + + + + Partial substitute; use base behaviour unless explicitly overriden. + + + + + Throw an exception for this call. + + + Exception to throw + + + + + Throw an exception of the given type for this call. + + Type of exception to throw + + + + + + Throw an exception for this call, as generated by the specified function. + + + Func creating exception object + + + + + Throw an exception for this call made with any arguments. + + + Exception to throw + + + + + Throws an exception of the given type for this call made with any arguments. + + Type of exception to throw + + + + + + Throws an exception for this call made with any arguments, as generated by the specified function. + + + Func creating exception object + + + + + *EXPERIMENTAL* Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + Matches arguments of type or compatible type. + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Configure default return value for all methods that return the specified type + + + + + + + + + Configure default return value for all methods that return the specified type, calculated by a function + + + + + + + + + Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Clears last call router on SubstitutionContext for routes that do not require it. + + + This is to help prevent static state bleeding over into future calls. + + + + + Get the arguments passed to this call. + + Array of all arguments passed to this call + + + + Gets the types of all the arguments passed to this call. + + Array of types of all arguments passed to this call + + + + Gets the argument of type `T` passed to this call. This will throw if there are no arguments + of this type, or if there is more than one matching argument. + + The type of the argument to retrieve + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the argument passed to this call at the specified position converted to type `T`. + This will throw if there are no arguments, if the argument is out of range or if it + cannot be converted to the specified type. + + The type of the argument to retrieve + + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the nth argument to this call. + + Index of argument + The value of the argument at the given index + + + + Raise an event for an EventHandler<TEventArgs> event with the provided and . + + + + + Raise an event for an EventHandler<TEventArgs> event with the substitute as the sender and the provided . + + + + + Raise an event for an EventHandler<EventArgsT> event with the substitute as the sender + and with a default instance of . + + + + + Raise an event for an EventHandler or EventHandler<EventArgs> event with the substitute + as the sender and with empty EventArgs. + + + + + Raise an event of type with the provided arguments. If no arguments are provided + NSubstitute will try to provide reasonable defaults. + + + + + Create a substitute for one or more types. For example: Substitute.For<ISomeType>() + + + + + Substitute for an interface or class. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute for the interface or class. + + + + Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + If additional interfaces are required use the overload. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2 and T3. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The types of interfaces or a type of class and multiple interfaces the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute implementing the specified types. + + + + Create a substitute for a class that behaves just like a real instance of the class, but also + records calls made to its virtual members and allows for specific members to be substituted + by using When(() => call).DoNotCallBase() or by + setting a value to return value for that member. + + The type to substitute for parts of. Must be a class; not a delegate or interface. + + An instance of the class that will execute real methods when called, but allows parts to be selectively + overridden via `Returns` and `When..DoNotCallBase`. + + + + Set a return value for this call. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call made with any arguments. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call made with any arguments, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Checks this substitute has received the following call. + + + + + + + + Checks this substitute has received the following call the required number of times. + + + + + + + + + Checks this substitute has not received the following call. + + + + + + + + Checks this substitute has received the following call with any arguments. + + + + + + + + Checks this substitute has received the following call with any arguments the required number of times. + + + + + + + + + Checks this substitute has not received the following call with any arguments. + + + + + + + + Forget all the calls this substitute has received. + + + + + Note that this will not clear any results set up for the substitute using Returns(). + + + + + Perform an action when this member is called. + Must be followed by to provide the callback. + + + + + + + + + Perform an action when this member is called with any arguments. + Must be followed by to provide the callback. + + + + + + + + + Returns the calls received by this substitute. + + + + + + + + Create a substitute for the given types. + + + + + + + + Create an instance of the given types, with calls configured to call the base implementation + where possible. Parts of the instance can be substituted using + Returns(). + + + + + + + + Perform this action when called. + + + + + + Perform this configured callcback when called. + + + + + + Do not call the base implementation on future calls. For use with partial substitutes. + + + + + Throw the specified exception when called. + + + + + Throw an exception of the given type when called. + + + + + Throw an exception generated by the specified function when called. + + + + + Set null as returned value for this call. + + + + + + + + Set null as returned value for this call made with any arguments. + + + + + + + diff --git a/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.dll b/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.dll new file mode 100644 index 00000000..3051d487 Binary files /dev/null and b/packages/NSubstitute.1.10.0.0/lib/net35/NSubstitute.dll differ diff --git a/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.XML b/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.XML new file mode 100644 index 00000000..13fd4651 --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.XML @@ -0,0 +1,759 @@ + + + + NSubstitute + + + + + Argument matchers used for specifying calls to substitutes. + + + + + Match any argument value compatible with type . + + + + + + + Match argument that is equal to . + + + + + + + + Match argument that satisfies . + If the throws an exception for an argument it will be treated as non-matching. + + + + + + + + Invoke any argument whenever a matching call is made to the substitute. + + + + + + Invoke any argument with specified argument whenever a matching call is made to the substitute. + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + Arguments to pass to delegate. + + + + + Capture any argument compatible with type and use it to call the function + whenever a matching call is made to the substitute. + + + + + + + + Perform this chain of callbacks and/or always callback when called. + + + + + Perform as first in chain of callback when called. + + + + + + + Perform this action always when callback is called. + + + + + + + Throw exception returned by function as first callback in chain of callback when called. + + + + + + + Throw this exception as first callback in chain of callback when called. + + + + + + + Throw exception returned by function always when callback is called. + + The type of the exception. + The throw this. + + + + + Throw this exception always when callback is called. + + The type of the exception. + The exception. + + + + + Perform the given action for every call. + + The action to perform for every call + + + + + Perform this action once in chain of called callbacks. + + + + + + + Keep doing this action after the other callbacks have run. + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Throw exception returned by function once when called in a chain of callbacks. + + The type of the exception + Produce the exception to throw for a CallInfo + + + + + Throw this exception once when called in a chain of callbacks. + + The type of the exception + The exception to throw + + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Describes how the does not match the condition specified by this class, or + if a detailed description can not be provided for the argument. + + + Description of the non-match, or if no description can be provided. + + + + Adds a callback to execute for matching calls. + + an action to call + + + + + Combines two enumerables into a new enumerable using the given selector. + + + + + + + + + + This implementation was sanity-checked against the + Edulinq implementation and + Eric Lippert's implementation. + + + + + Checks if the instance can be used when a is expected. + + + + + + + + Join the using . + + + + + + + + Particularly poor implementation of Maybe/Option type. + This is just filling an immediate need; use FSharpOption or XSharpx or similar for a + real implementation. + + + + + + Delegates to ThreadLocal<T>, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions. + These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll + just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway). + + + + + + Standard substitute behaviour; replace all calls with substituted behaviour. + + + + + Partial substitute; use base behaviour unless explicitly overriden. + + + + + Throw an exception for this call. + + + Exception to throw + + + + + Throw an exception of the given type for this call. + + Type of exception to throw + + + + + + Throw an exception for this call, as generated by the specified function. + + + Func creating exception object + + + + + Throw an exception for this call made with any arguments. + + + Exception to throw + + + + + Throws an exception of the given type for this call made with any arguments. + + Type of exception to throw + + + + + + Throws an exception for this call made with any arguments, as generated by the specified function. + + + Func creating exception object + + + + + *EXPERIMENTAL* Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + Matches arguments of type or compatible type. + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Configure default return value for all methods that return the specified type + + + + + + + + + Configure default return value for all methods that return the specified type, calculated by a function + + + + + + + + + Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Clears last call router on SubstitutionContext for routes that do not require it. + + + This is to help prevent static state bleeding over into future calls. + + + + + Get the arguments passed to this call. + + Array of all arguments passed to this call + + + + Gets the types of all the arguments passed to this call. + + Array of types of all arguments passed to this call + + + + Gets the argument of type `T` passed to this call. This will throw if there are no arguments + of this type, or if there is more than one matching argument. + + The type of the argument to retrieve + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the argument passed to this call at the specified position converted to type `T`. + This will throw if there are no arguments, if the argument is out of range or if it + cannot be converted to the specified type. + + The type of the argument to retrieve + + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the nth argument to this call. + + Index of argument + The value of the argument at the given index + + + + Raise an event for an EventHandler<TEventArgs> event with the provided and . + + + + + Raise an event for an EventHandler<TEventArgs> event with the substitute as the sender and the provided . + + + + + Raise an event for an EventHandler<EventArgsT> event with the substitute as the sender + and with a default instance of . + + + + + Raise an event for an EventHandler or EventHandler<EventArgs> event with the substitute + as the sender and with empty EventArgs. + + + + + Raise an event of type with the provided arguments. If no arguments are provided + NSubstitute will try to provide reasonable defaults. + + + + + Create a substitute for one or more types. For example: Substitute.For<ISomeType>() + + + + + Substitute for an interface or class. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute for the interface or class. + + + + Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + If additional interfaces are required use the overload. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2 and T3. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The types of interfaces or a type of class and multiple interfaces the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute implementing the specified types. + + + + Create a substitute for a class that behaves just like a real instance of the class, but also + records calls made to its virtual members and allows for specific members to be substituted + by using When(() => call).DoNotCallBase() or by + setting a value to return value for that member. + + The type to substitute for parts of. Must be a class; not a delegate or interface. + + An instance of the class that will execute real methods when called, but allows parts to be selectively + overridden via `Returns` and `When..DoNotCallBase`. + + + + Set a return value for this call. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call. The value(s) to be returned will be wrapped in Tasks. + + + + Value to return. Will be wrapped in a Task + Optionally use these functions next + + + + + Set a return value for this call, calculated by the provided function. The value(s) to be returned will be wrapped in Tasks. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call made with any arguments. The value(s) to be returned will be wrapped in Tasks. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call made with any arguments, calculated by the provided function. The value(s) to be returned will be wrapped in Tasks. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call made with any arguments. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call made with any arguments, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Checks this substitute has received the following call. + + + + + + + + Checks this substitute has received the following call the required number of times. + + + + + + + + + Checks this substitute has not received the following call. + + + + + + + + Checks this substitute has received the following call with any arguments. + + + + + + + + Checks this substitute has received the following call with any arguments the required number of times. + + + + + + + + + Checks this substitute has not received the following call with any arguments. + + + + + + + + Forget all the calls this substitute has received. + + + + + Note that this will not clear any results set up for the substitute using Returns(). + + + + + Perform an action when this member is called. + Must be followed by to provide the callback. + + + + + + + + + Perform an action when this member is called with any arguments. + Must be followed by to provide the callback. + + + + + + + + + Returns the calls received by this substitute. + + + + + + + + Create a substitute for the given types. + + + + + + + + Create an instance of the given types, with calls configured to call the base implementation + where possible. Parts of the instance can be substituted using + Returns(). + + + + + + + + Perform this action when called. + + + + + + Perform this configured callcback when called. + + + + + + Do not call the base implementation on future calls. For use with partial substitutes. + + + + + Throw the specified exception when called. + + + + + Throw an exception of the given type when called. + + + + + Throw an exception generated by the specified function when called. + + + + + Set null as returned value for this call. + + + + + + + + Set null as returned value for this call made with any arguments. + + + + + + + diff --git a/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.dll b/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.dll new file mode 100644 index 00000000..9803f023 Binary files /dev/null and b/packages/NSubstitute.1.10.0.0/lib/net40/NSubstitute.dll differ diff --git a/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.XML b/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.XML new file mode 100644 index 00000000..13fd4651 --- /dev/null +++ b/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.XML @@ -0,0 +1,759 @@ + + + + NSubstitute + + + + + Argument matchers used for specifying calls to substitutes. + + + + + Match any argument value compatible with type . + + + + + + + Match argument that is equal to . + + + + + + + + Match argument that satisfies . + If the throws an exception for an argument it will be treated as non-matching. + + + + + + + + Invoke any argument whenever a matching call is made to the substitute. + + + + + + Invoke any argument with specified argument whenever a matching call is made to the substitute. + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + + + + + + + + + + + + Invoke any argument with specified arguments whenever a matching call is made to the substitute. + + + Arguments to pass to delegate. + + + + + Capture any argument compatible with type and use it to call the function + whenever a matching call is made to the substitute. + + + + + + + + Perform this chain of callbacks and/or always callback when called. + + + + + Perform as first in chain of callback when called. + + + + + + + Perform this action always when callback is called. + + + + + + + Throw exception returned by function as first callback in chain of callback when called. + + + + + + + Throw this exception as first callback in chain of callback when called. + + + + + + + Throw exception returned by function always when callback is called. + + The type of the exception. + The throw this. + + + + + Throw this exception always when callback is called. + + The type of the exception. + The exception. + + + + + Perform the given action for every call. + + The action to perform for every call + + + + + Perform this action once in chain of called callbacks. + + + + + + + Keep doing this action after the other callbacks have run. + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Keep throwing this exception after the other callbacks have run. + + + + + + + + Throw exception returned by function once when called in a chain of callbacks. + + The type of the exception + Produce the exception to throw for a CallInfo + + + + + Throw this exception once when called in a chain of callbacks. + + The type of the exception + The exception to throw + + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Describes how the does not match the condition specified by this class, or + if a detailed description can not be provided for the argument. + + + Description of the non-match, or if no description can be provided. + + + + Adds a callback to execute for matching calls. + + an action to call + + + + + Combines two enumerables into a new enumerable using the given selector. + + + + + + + + + + This implementation was sanity-checked against the + Edulinq implementation and + Eric Lippert's implementation. + + + + + Checks if the instance can be used when a is expected. + + + + + + + + Join the using . + + + + + + + + Particularly poor implementation of Maybe/Option type. + This is just filling an immediate need; use FSharpOption or XSharpx or similar for a + real implementation. + + + + + + Delegates to ThreadLocal<T>, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions. + These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll + just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway). + + + + + + Standard substitute behaviour; replace all calls with substituted behaviour. + + + + + Partial substitute; use base behaviour unless explicitly overriden. + + + + + Throw an exception for this call. + + + Exception to throw + + + + + Throw an exception of the given type for this call. + + Type of exception to throw + + + + + + Throw an exception for this call, as generated by the specified function. + + + Func creating exception object + + + + + Throw an exception for this call made with any arguments. + + + Exception to throw + + + + + Throws an exception of the given type for this call made with any arguments. + + Type of exception to throw + + + + + + Throws an exception for this call made with any arguments, as generated by the specified function. + + + Func creating exception object + + + + + *EXPERIMENTAL* Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Provides a specification for arguments for use with . + Can additionally implement to give descriptions when arguments do not match. + + Matches arguments of type or compatible type. + + + + Checks whether the satisfies the condition of the matcher. + If this throws an exception the argument will be treated as non-matching. + + + + + + + Configure default return value for all methods that return the specified type + + + + + + + + + Configure default return value for all methods that return the specified type, calculated by a function + + + + + + + + + Asserts the calls to the substitutes contained in the given Action were + received by these substitutes in the same order. Calls to property getters are not included + in the assertion. + + Action containing calls to substitutes in the expected order + + + + Clears last call router on SubstitutionContext for routes that do not require it. + + + This is to help prevent static state bleeding over into future calls. + + + + + Get the arguments passed to this call. + + Array of all arguments passed to this call + + + + Gets the types of all the arguments passed to this call. + + Array of types of all arguments passed to this call + + + + Gets the argument of type `T` passed to this call. This will throw if there are no arguments + of this type, or if there is more than one matching argument. + + The type of the argument to retrieve + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the argument passed to this call at the specified position converted to type `T`. + This will throw if there are no arguments, if the argument is out of range or if it + cannot be converted to the specified type. + + The type of the argument to retrieve + + The argument passed to the call, or throws if there is not exactly one argument of this type + + + + Gets the nth argument to this call. + + Index of argument + The value of the argument at the given index + + + + Raise an event for an EventHandler<TEventArgs> event with the provided and . + + + + + Raise an event for an EventHandler<TEventArgs> event with the substitute as the sender and the provided . + + + + + Raise an event for an EventHandler<EventArgsT> event with the substitute as the sender + and with a default instance of . + + + + + Raise an event for an EventHandler or EventHandler<EventArgs> event with the substitute + as the sender and with empty EventArgs. + + + + + Raise an event of type with the provided arguments. If no arguments are provided + NSubstitute will try to provide reasonable defaults. + + + + + Create a substitute for one or more types. For example: Substitute.For<ISomeType>() + + + + + Substitute for an interface or class. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute for the interface or class. + + + + Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + If additional interfaces are required use the overload. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The type of interface or class to substitute. + An additional interface or class (maximum of one class) the substitute should implement. + An additional interface or class (maximum of one class) the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute of type T1, that also implements T2 and T3. + + + + Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. + Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members + can be recorded or have return values specified. + + The types of interfaces or a type of class and multiple interfaces the substitute should implement. + Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. + A substitute implementing the specified types. + + + + Create a substitute for a class that behaves just like a real instance of the class, but also + records calls made to its virtual members and allows for specific members to be substituted + by using When(() => call).DoNotCallBase() or by + setting a value to return value for that member. + + The type to substitute for parts of. Must be a class; not a delegate or interface. + + An instance of the class that will execute real methods when called, but allows parts to be selectively + overridden via `Returns` and `When..DoNotCallBase`. + + + + Set a return value for this call. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call. The value(s) to be returned will be wrapped in Tasks. + + + + Value to return. Will be wrapped in a Task + Optionally use these functions next + + + + + Set a return value for this call, calculated by the provided function. The value(s) to be returned will be wrapped in Tasks. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call made with any arguments. The value(s) to be returned will be wrapped in Tasks. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call made with any arguments, calculated by the provided function. The value(s) to be returned will be wrapped in Tasks. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Set a return value for this call made with any arguments. + + + + Value to return + Optionally return these values next + + + + + Set a return value for this call made with any arguments, calculated by the provided function. + + + + Function to calculate the return value + Optionally use these functions next + + + + + Checks this substitute has received the following call. + + + + + + + + Checks this substitute has received the following call the required number of times. + + + + + + + + + Checks this substitute has not received the following call. + + + + + + + + Checks this substitute has received the following call with any arguments. + + + + + + + + Checks this substitute has received the following call with any arguments the required number of times. + + + + + + + + + Checks this substitute has not received the following call with any arguments. + + + + + + + + Forget all the calls this substitute has received. + + + + + Note that this will not clear any results set up for the substitute using Returns(). + + + + + Perform an action when this member is called. + Must be followed by to provide the callback. + + + + + + + + + Perform an action when this member is called with any arguments. + Must be followed by to provide the callback. + + + + + + + + + Returns the calls received by this substitute. + + + + + + + + Create a substitute for the given types. + + + + + + + + Create an instance of the given types, with calls configured to call the base implementation + where possible. Parts of the instance can be substituted using + Returns(). + + + + + + + + Perform this action when called. + + + + + + Perform this configured callcback when called. + + + + + + Do not call the base implementation on future calls. For use with partial substitutes. + + + + + Throw the specified exception when called. + + + + + Throw an exception of the given type when called. + + + + + Throw an exception generated by the specified function when called. + + + + + Set null as returned value for this call. + + + + + + + + Set null as returned value for this call made with any arguments. + + + + + + + diff --git a/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.dll b/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.dll new file mode 100644 index 00000000..1aec5864 Binary files /dev/null and b/packages/NSubstitute.1.10.0.0/lib/net45/NSubstitute.dll differ diff --git a/packages/NUnit.3.2.0/CHANGES.txt b/packages/NUnit.3.2.0/CHANGES.txt new file mode 100644 index 00000000..dc431225 --- /dev/null +++ b/packages/NUnit.3.2.0/CHANGES.txt @@ -0,0 +1,986 @@ +NUnit 3.2 - March 5, 2016 + +Framework + + * Added an Order attribute that defines the order in which tests are run + * Added Assert.ThrowsAsync for testing if async methods throw an exception + * You can now compare unlike collections using Is.EquivalentTo().Using(...) + * Added the ability to add custom message formatters to MsgUtils + * TestCaseSourceAttribute now optionally takes an array of parameters that can be passed to the source method + * Added Is.Zero and Is.Not.Zero to the fluent syntax as a shorter option for Is.EqualTo(0) and Is.Not.EqualTo(0) + +Engine + + * Engine extensions can be installed via NuGet packages + +Issues Resolved + + * 170 Test Order Attribute + * 300 Create an NUnit Visual Studio Template + * 464 Async delegate assertions + * 532 Batch runner for Silverlight tests + * 533 Separate NUnitLite runner and autorunner + * 681 NUnit agent cannot resolve test dependency assemblies when mixed mode initialization runs in the default AppDomain + * 793 Replace CoreEngine by use of Extensions + * 907 Console report tests are too fragile + * 922 Wrap Console in NUnitLite + * 930 Switch from MSBuild based build system to Cake + * 981 Define NUnit Versioning for post-3.0 Development + * 1004 Poor formatting of results for Assert.AreEqual(DateTimeOffset, DateTimeOffset) + * 1018 ArgumentException when 2.x version of NUnit Framework is in the bin directory + * 1022 Support Comparing Unlike Collections using Is.EquivalentTo().Using(...) + * 1044 Re-order Test Summary Errors/Failures + * 1066 ApartmentAttribute and TestCaseAttribute(s) do not work together + * 1103 Can't use TestCaseData from base class + * 1109 NullReferenceException when using inherited property for ValueSource + * 1113 Console runner and xml output consistency + * 1117 Fix misbehaviour of Throws.Exception with non-void returning functions + * 1120 NUnitProject should parse .nunit project files containing Xml Declarations + * 1121 Usage of field set to null as value source leads to somewhat cryptic error + * 1122 Region may be disposed before test delegate is executed + * 1133 Provide a way to install extensions as nuget packages + * 1136 Don't allow V2 framework to update in V2 driver tests + * 1171 A bug when using Assert.That() with Is.Not.Empty + * 1185 Engine finds .NET 4.0 Client Profile twice + * 1187 ITestAssemblyRunner.StopRun as implemented by NUnitTestAssemblyRunner + * 1195 name attribute in test-suite and test-results element of output xml is different to nunit 2.6.4 using nunit2-format + * 1196 Custom value formatter for v3 via MsgUtils + * 1210 Available runtimes issues + * 1230 Add ability for testcasedatasource to have parameters passed to methods + * 1233 Add TestAssemblyRunner tests to both portable and silverlight builds + * 1234 Have default NUnitLite Runner Program.cs return exit code + * 1236 Make Appveyor NuGet feed more useable + * 1246 Introduce Is.Zero syntax to test for zero + * 1252 Exception thrown when any assembly is not found + * 1261 TypeHelper.GetDisplayName generates the wrong name for generic types with nested classes + * 1278 Fix optional parameters in TestCaseAttribute + * 1282 TestCase using Params Behaves Oddly + * 1283 Engine should expose available frameworks. + * 1286 value of the time attribute in nunit2 outputs depends on the machine culture + * 1297 NUnit.Engine nuget package improvements + * 1301 Assert.AreNotSame evaluates ToString unnecessarily + +NUnit 3.0.1 - December 1, 2015 + +Console Runner + + * The Nunit.Runners NuGet package was updated to become a meta-package that pulls in the NUnit.Console package + * Reinstated the --pause command line option that will display a message box allowing you to attach a debugger if the --debug option does not work + +Issues Resolved + + * 994 Add max number of Agents to the NUnit project file + * 1014 Ensure NUnit API assembly updates with MSI installs + * 1024 Added --pause flag to console runner + * 1030 Update Nunit.Runners package to 3.0 + * 1033 "No arguments were provided" with Theory and Values combination + * 1035 Check null arguments + * 1037 Async tests not working on Windows 10 Universal + * 1041 NUnit2XmlResult Writer is reporting Sucess when test fails + * 1042 NUnit2 reports on 3.0 is different than 2.6.4 + * 1046 FloatingPointNumerics.AreAlmostEqualUlps throws OverflowException + * 1049 Cannot select Generic tests from command line + * 1050 Do not expose System.Runtime.CompilerServices.ExtensionAttribute to public + * 1054 Create nuget feeds for CI builds on Appveyor + * 1055 nunit3 console runner --where option does not return error on invalid selection string + * 1060 Remove "Version 3" from NUnit Nuget Package + * 1061 Nunit30Settings.xml becomes corrupted + * 1062 Console.WriteLine statements in "OneTimeSetUp" and "OneTimeTearDown" annotated methods are not directed to the console when using nunit3-console.exe runner + * 1063 Error in Random Test + +NUnit 3.0.0 Final Release - November 15, 2015 + +Issues Resolved + + * 635 Mono 4.0 Support + +NUnit 3.0.0 Release Candidate 3 - November 13, 2015 + +Engine + + * The engine now only sets the config file for project.nunit to project.config if project.config exists. Otherwise, each assembly uses its own config, provided it is run in a separate AppDomain by itself. + + NOTE: It is not possible for multiple assemblies in the same AppDomain to use different configs. This is not an NUnit limitation, it's just how configs work! + +Issues Resolved + + * 856 Extensions support for third party runners in NUnit 3.0 + * 1003 Delete TeamCityEventHandler as it is not used + * 1015 Specifying .nunit project and --framework on command line causes crash + * 1017 Remove Assert.Multiple from framework + +NUnit 3.0.0 Release Candidate 2 - November 8, 2015 + +Engine + + * The IDriverFactory extensibility interface has been modified. + +Issues Resolved + + * 970 Define PARALLEL in CF build of nunitlite + * 978 It should be possible to determine version of NUnit using nunit console tool + * 983 Inconsistent return codes depending on ProcessModel + * 986 Update docs for parallel execution + * 988 Don't run portable tests from NUnit Console + * 990 V2 driver is passing invalid filter elements to NUnit + * 991 Mono.Options should not be exposed to public directly + * 993 Give error message when a regex filter is used with NUnit V2 + * 997 Add missing XML Documentation + * 1008 NUnitLite namespace not updated in the NuGet Packages + +NUnit 3.0.0 Release Candidate - November 1, 2015 + +Framework + + * The portable build now supports ASP.NET 5 and the new Core CLR. + + NOTE: The `nunit3-console` runner cannot run tests that reference the portable build. + You may run such tests using NUnitLite or a platform-specific runner. + + * `TestCaseAttribute` and `TestCaseData` now allow modifying the test name without replacing it entirely. + * The Silverlight packages are now separate downloads. + +NUnitLite + + * The NUnitLite runner now produces the same output display and XML results as the console runner. + +Engine + + * The format of the XML result file has been finalized and documented. + +Console Runner + + * The console runner program is now called `nunit3-console`. + * Console runner output has been modified so that the summary comes at the end, to reduce the need for scrolling. + +Issues Resolved + + * 59 Length of generated test names should be limited + * 68 Customization of test case name generation + * 404 Split tests between nunitlite.runner and nunit.framework + * 575 Add support for ASP.NET 5 and the new Core CLR + * 783 Package separately for Silverlight + * 833 Intermittent failure of WorkItemQueueTests.StopQueue_WithWorkers + * 859 NUnit-Console output - move Test Run Summary to end + * 867 Remove Warnings from Ignored tests + * 868 Review skipped tests + * 887 Move environment and settings elements to the assembly suite in the result file + * 899 Colors for ColorConsole on grey background are too light + * 904 InternalPreserveStackTrace is not supported on all Portable platforms + * 914 Unclear error message from console runner when assembly has no tests + * 916 Console runner dies when test agent dies + * 918 Console runner --where parameter is case sensitive + * 920 Remove addins\nunit.engine.api.dll from NuGet package + * 929 Rename nunit-console.exe + * 931 Remove beta warnings from NuGet packages + * 936 Explicit skipped tests not displayed + * 939 Installer complains about .NET even if already installed + * 940 Confirm or modify list of packages for release + * 947 Breaking API change in ValueSourceAttribute + * 949 Update copyright in NUnit Console + * 954 NUnitLite XML output is not consistent with the engine's + * 955 NUnitLite does not display the where clause + * 959 Restore filter options for NUnitLite portable build + * 960 Intermittent failure of CategoryFilterTests + * 967 Run Settings Report is not being displayed. + +NUnit 3.0.0 Beta 5 - October 16, 2015 + +Framework + + * Parameterized test cases now support nullable arguments. + * The NUnit framework may now be built for the .NET Core framework. Note that this is only available through building the source code. A binary will be available in the next release. + +Engine + + * The engine now runs multiple test assemblies in parallel by default + * The output XML now includes more information about the test run, including the text of the command used, any engine settings and the filter used to select tests. + * Extensions may now specify data in an identifying attribute, for use by the engine in deciding whether to load that extension. + + +Console Runner + + * The console now displays all settings used by the engine to run tests as well as the filter used to select tests. + * The console runner accepts a new option --maxagents. If multiple assemblies are run in separate processes, this value may be used to limit the number that are executed simultaneously in parallel. + * The console runner no longer accepts the --include and --exclude options. Instead, the new --where option provides a more general way to express which tests will be executed, such as --where "cat==Fast && Priority==High". See the docs for details of the syntax. + * The new --debug option causes NUnit to break in the debugger immediately before tests are run. This simplifies debugging, especially when the test is run in a separate process. + +Issues Resolved + + * 41 Check for zeroes in Assert messages + * 254 Finalize XML format for test results + * 275 NUnitEqualityComparer fails to compare IEquatable where second object is derived from T + * 304 Run test Assemblies in parallel + * 374 New syntax for selecting tests to be run + * 515 OSPlatform.IsMacOSX doesn't work + * 573 nunit-console hangs on Mac OS X after all tests have run + * 669 TeamCity service message should have assembly name as a part of test name. + * 689 The TeamCity service message "testFinished" should have an integer value in the "duration" attribute + * 713 Include command information in XML + * 719 We have no way to configure tests for several assemblies using NUnit project file and the common installation from msi file + * 735 Workers number in xml report file cannot be found + * 784 Build Portable Framework on Linux + * 790 Allow Extensions to provide data through an attribute + * 794 Make it easier to debug tests as well as NUnit itself + * 801 NUnit calls Dispose multiple times + * 814 Support nullable types with TestCase + * 818 Possible error in Merge Pull Request #797 + * 821 Wrapped method results in loss of result information + * 822 Test for Debugger in NUnitTestAssemblyRunner probably should not be in CF build + * 824 Remove unused System.Reflection using statements + * 826 Randomizer uniqueness tests fail randomly! + * 828 Merge pull request #827 (issue 826) + * 830 Add ability to report test results synchronously to test runners + * 837 Enumerators not disposed when comparing IEnumerables + * 840 Add missing copyright notices + * 844 Pull Request #835 (Issue #814) does not build in CF + * 847 Add new --process:inprocess and --inprocess options + * 850 Test runner fails if test name contains invalid xml characters + * 851 'Exclude' console option is not working in NUnit Lite + * 853 Cannot run NUnit Console from another directory + * 860 Use CDATA section for message, stack-trace and output elements of XML + * 863 Eliminate core engine + * 865 Intermittent failures of StopWatchTests + * 869 Tests that use directory separator char to determine platform misreport Linux on MaxOSX + * 870 NUnit Console Runtime Environment misreports on MacOSX + * 874 Add .NET Core Framework + * 878 Cannot exclude MacOSX or XBox platforms when running on CF + * 892 Fixed test runner returning early when executing more than one test run. + * 894 Give nunit.engine and nunit.engine.api assemblies strong names + * 896 NUnit 3.0 console runner not placing test result xml in --work directory + +NUnit 3.0.0 Beta 4 - August 25, 2015 + +Framework + + * A new RetryAttribute allows retrying of failing tests. + * New SupersetConstraint and Is.SupersetOf syntax complement SubsetConstraint. + * Tests skipped due to ExplicitAttribute are now reported as skipped. + +Engine + + * We now use Cecil to examine assemblies prior to loading them. + * Extensions are no longer based on Mono.Addins but use our own extension framework. + +Issues Resolved + + * 125 3rd-party dependencies should be downloaded on demand + * 283 What should we do when a user extension does something bad? + * 585 RetryAttribute + * 642 Restructure MSBuild script + * 649 Change how we zip packages + * 654 ReflectionOnlyLoad and ReflectionOnlyLoadFrom + * 664 Invalid "id" attribute in the report for case "test started" + * 685 In the some cases when tests cannot be started NUnit returns exit code "0" + * 728 Missing Assert.That overload + * 741 Explicit Tests get run when using --exclude + * 746 Framework should send events for all tests + * 747 NUnit should apply attributes even if test is non-runnable + * 749 Review Use of Mono.Addins for Engine Extensibility + * 750 Include Explicit Tests in Test Results + * 753 Feature request: Is.SupersetOf() assertion constraint + * 755 TimeOut attribute doesn't work with TestCaseSource Attribute + * 757 Implement some way to wait for execution to complete in ITestEngineRunner + * 760 Packaging targets do not run on Linux + * 766 Added overloads for True()/False() accepting booleans + * 778 Build and build.cmd scripts invoke nuget.exe improperly + * 780 Teamcity fix + * 782 No sources for 2.6.4 + +NUnit 3.0.0 Beta 3 - July 15, 2015 + +Framework + + * The RangeAttribute has been extended to support more data types including + uint, long and ulong + * Added platform support for Windows 10 and fixed issues with Windows 8 and + 8.1 support + * Added async support to the portable version of NUnit Framework + * The named members of the TestCaseSource and ValueSource attributes must now be + static. + * RandomAttribute has been extended to add support for new data types including + uint, long, ulong, short, ushort, float, byte and sbyte + * TestContext.Random has also been extended to add support for new data types including + uint, long, ulong, short, ushort, float, byte, sbyte and decimal + * Removed the dependency on Microsoft.Bcl.Async from the NUnit Framework assembly + targeting .NET 4.0. If you want to write async tests in .NET 4.0, you will need + to reference the NuGet package yourself. + * Added a new TestFixtureSource attribute which is the equivalent to TestCaseSource + but provides for instantiation of fixtures. + * Significant improvements have been made in how NUnit deduces the type arguments of + generic methods based on the arguments provided. + +Engine + + * If the target framework is not specified, test assemblies that are compiled + to target .NET 4.5 will no longer run in .NET 4.0 compatibility mode + + Console + + * If the console is run without arguments, it will now display help + +Issues Resolved + + * 47 Extensions to RangeAttribute + * 237 System.Uri .ctor works not properly under Nunit + * 244 NUnit should properly distinguish between .NET 4.0 and 4.5 + * 310 Target framework not specified on the AppDomain when running against .Net 4.5 + * 321 Rationalize how we count tests + * 472 Overflow exception and DivideByZero exception from the RangeAttribute + * 524 int and char do not compare correctly? + * 539 Truncation of string arguments + * 544 AsyncTestMethodTests for 4.5 Framework fails frequently on Travis CI + * 656 Unused parameter in Console.WriteLine found + * 670 Failing Tests in TeamCity Build + * 673 Ensure proper disposal of engine objects + * 674 Engine does not release test assemblies + * 679 Windows 10 Support + * 682 Add Async Support to Portable Framework + * 683 Make FrameworkController available in portable build + * 687 TestAgency does not launch agent process correctly if runtime type is not specified (i.e. v4.0) + * 692 PlatformAttribute_OperatingSystemBitNess fails when running in 32-bit process + * 693 Generic Test Method cannot determine type arguments for fixture when passed as IEnumerable + * 698 Require TestCaseSource and ValueSource named members to be static + * 703 TeamCity non-equal flowid for 'testStarted' and 'testFinished' messages + * 712 Extensions to RandomAttribute + * 715 Provide a data source attribute at TestFixture Level + * 718 RangeConstraint gives error with from and two args of differing types + * 723 Does nunit.nuspec require dependency on Microsoft.Bcl.Async? + * 724 Adds support for Nullable to Assert.IsTrue and Assert.IsFalse + * 734 Console without parameters doesn't show help + +NUnit 3.0.0 Beta 2 - May 12, 2015 + +Framework + + * The Compact Framework version of the framework is now packaged separately + and will be distributed as a ZIP file and as a NuGet package. + * The NUnit 2.x RepeatAttribute was added back into the framework. + * Added Throws.ArgumentNullException + * Added GetString methods to NUnit.Framework.Internal.RandomGenerator to + create repeatable random strings for testing + * When checking the equality of DateTimeOffset, you can now use the + WithSameOffset modifier + * Some classes intended for internal usage that were public for testing + have now been made internal. Additional classes will be made internal + for the final 3.0 release. + +Engine + + * Added a core engine which is a non-extensible, minimal engine for use by + devices and similar situations where reduced functionality is compensated + for by reduced size and simplicity of usage. See + https://github.com/nunit/dev/wiki/Core-Engine for more information. + +Issues Resolved + + * 22 Add OSArchitecture Attribute to Environment node in result xml + * 24 Assert on Dictionary Content + * 48 Explicit seems to conflict with Ignore + * 168 Create NUnit 3.0 documentation + * 196 Compare DateTimeOffsets including the offset in the comparison + * 217 New icon for the 3.0 release + * 316 NUnitLite TextUI Runner + * 320 No Tests found: Using parametrized Fixture and TestCaseSource + * 360 Better exception message when using non-BCL class in property + * 454 Rare registry configurations may cause NUnit to fail + * 478 RepeatAttribute + * 481 Testing multiple assemblies in nunitlite + * 538 Potential bug using TestContext in constructors + * 546 Enable Parallel in NUnitLite/CF (or more) builds + * 551 TextRunner not passing the NumWorkers option to the ITestAssemblyRunner + * 556 Executed tests should always return a non-zero duration + * 559 Fix text of NuGet packages + * 560 Fix PackageVersion property on wix install projects + * 562 Program.cs in NUnitLite NuGet package is incorrect + * 564 NUnitLite Nuget package is Beta 1a, Framework is Beta 1 + * 565 NUnitLite Nuget package adds Program.cs to a VB Project + * 568 Isolate packaging from building + * 570 ThrowsConstraint failure message should include stack trace of actual exception + * 576 Throws.ArgumentNullException would be nice + * 577 Documentation on some members of Throws falsely claims that they return `TargetInvocationException` constraints + * 579 No documentation for recommended usage of TestCaseSourceAttribute + * 580 TeamCity Service Message Uses Incorrect Test Name with NUnit2Driver + * 582 Test Ids Are Not Unique + * 583 TeamCity service messages to support parallel test execution + * 584 Non-runnable assembly has incorrect ResultState + * 609 Add support for integration with TeamCity + * 611 Remove unused --teamcity option from CF build of NUnitLite + * 612 MaxTime doesn't work when used for TestCase + * 621 Core Engine + * 622 nunit-console fails when use --output + * 628 Modify IService interface and simplify ServiceContext + * 631 Separate packaging for the compact framework + * 646 ConfigurationManager.AppSettings Params Return Null under Beta 1 + * 648 Passing 2 or more test assemblies targeting > .NET 2.0 to nunit-console fails + +NUnit 3.0.0 Beta 1 - March 25, 2015 + +General + + * There is now a master windows installer for the framework, engine and console runner. + +Framework + + * We no longer create a separate framework build for .NET 3.5. The 2.0 and + 3.5 builds were essentially the same, so the former should now be used + under both runtimes. + * A new Constraint, DictionaryContainsKeyConstraint, may be used to test + that a specified key is present in a dictionary. + * LevelOfParallelizationAttribute has been renamed to LevelOfParallelismAttribute. + * The Silverlight runner now displays output in color and includes any + text output created by the tests. + * The class and method names of each test are included in the output xml + where applicable. + * String arguments used in test case names are now truncated to 40 rather + than 20 characters. + +Engine + + * The engine API has now been finalized. It permits specifying a minimum + version of the engine that a runner is able to use. The best installed + version of the engine will be loaded. Third-party runners may override + the selection process by including a copy of the engine in their + installation directory and specifying that it must be used. + * The V2 framework driver now uses the event listener and test listener + passed to it by the runner. This corrects several outstanding issues + caused by events not being received and allows selecting V2 tests to + be run from the command-line, in the same way that V3 tests are selected. + +Console + + * The console now defaults to not using shadowcopy. There is a new option + --shadowcopy to turn it on if needed. + +Issues Resolved + + * 224 Silverlight Support + * 318 TestActionAttribute: Retrieving the TestFixture + * 428 Add ExpectedExceptionAttribute to C# samples + * 440 Automatic selection of Test Engine to use + * 450 Create master install that includes the framework, engine and console installs + * 477 Assert does not work with ArraySegment + * 482 nunit-console has multiple errors related to -framework option + * 483 Adds constraint for asserting that a dictionary contains a particular key + * 484 Missing file in NUnit.Console nuget package + * 485 Can't run v2 tests with nunit-console 3.0 + * 487 NUnitLite can't load assemblies by their file name + * 488 Async setup and teardown still don't work + * 497 Framework installer shold register the portable framework + * 504 Option --workers:0 is ignored + * 508 Travis builds with failure in engine tests show as successful + * 509 Under linux, not all mono profiles are listed as available + * 512 Drop the .NET 3.5 build + * 517 V2 FrameworkDriver does not make use of passed in TestEventListener + * 523 Provide an option to disable shadowcopy in NUnit v3 + * 528 V2 FrameworkDriver does not make use of passed in TestFilter + * 530 Color display for Silverlight runner + * 531 Display text output from tests in Silverlight runner + * 534 Add classname and methodname to test result xml + * 541 Console help doesn't indicate defaults + +NUnit 3.0.0 Alpha 5 - January 30, 2015 + +General + + * A Windows installer is now included in the release packages. + +Framework + + * TestCaseAttribute now allows arguments with default values to be omitted. Additionaly, it accepts a Platform property to specify the platforms on which the test case should be run. + * TestFixture and TestCase attributes now enforce the requirement that a reason needs to be provided when ignoring a test. + * SetUp, TearDown, OneTimeSetUp and OneTimeTearDown methods may now be async. + * String arguments over 20 characters in length are truncated when used as part of a test name. + +Engine + + * The engine is now extensible using Mono.Addins. In this release, extension points are provided for FrameworkDrivers, ProjectLoaders and OutputWriters. The following addins are bundled as a part of NUnit: + * A FrameworkDriver that allows running NUnit V2 tests under NUnit 3.0. + * ProjectLoaders for NUnit and Visual Studio projects. + * An OutputWriter that creates XML output in NUnit V2 format. + * DomainUsage now defaults to Multiple if not specified by the runner + +Console + + * New options supported: + * --testlist provides a list of tests to run in a file + * --stoponerror indicates that the run should terminate when any test fails. + +Issues Resolved + + * 20 TestCaseAttribute needs Platform property. + * 60 NUnit should support async setup, teardown, fixture setup and fixture teardown. + * 257 TestCaseAttribute should not require parameters with default values to be specified. + * 266 Pluggable framework drivers. + * 368 Create addin model. + * 369 Project loader addins + * 370 OutputWriter addins + * 403 Move ConsoleOptions.cs and Options.cs to Common and share... + * 419 Create Windows Installer for NUnit. + * 427 [TestFixture(Ignore=true)] should not be allowed. + * 437 Errors in tests under Linux due to hard-coded paths. + * 441 NUnit-Console should support --testlist option + * 442 Add --stoponerror option back to nunit-console. + * 456 Fix memory leak in RuntimeFramework. + * 459 Remove the Mixed Platforms build configuration. + * 468 Change default domain usage to multiple. + * 469 Truncate string arguments in test names in order to limit the length. + +NUnit 3.0.0 Alpha 4 - December 30, 2014 + +Framework + + * ApartmentAttribute has been added, replacing STAAttribute and MTAAttribute. + * Unnecessary overloads of Assert.That and Assume.That have been removed. + * Multiple SetUpFixtures may be specified in a single namespace. + * Improvements to the Pairwise strategy test case generation algorithm. + * The new NUnitLite runner --testlist option, allows a list of tests to be kept in a file. + +Engine + + * A driver is now included, which allows running NUnit 2.x tests under NUnit 3.0. + * The engine can now load and run tests specified in a number of project formats: + * NUnit (.nunit) + * Visual Studio C# projects (.csproj) + * Visual Studio F# projects (.vjsproj) + * Visual Studio Visual Basic projects (.vbproj) + * Visual Studio solutions (.sln) + * Legacy C++ and Visual JScript projects (.csproj and .vjsproj) are also supported + * Support for the current C++ format (.csxproj) is not yet available + * Creation of output files like TestResult.xml in various formats is now a + service of the engine, available to any runner. + +Console + + * The command-line may now include any number of assemblies and/or supported projects. + +Issues Resolved + + * 37 Multiple SetUpFixtures should be permitted on same namespace + * 210 TestContext.WriteLine in an AppDomain causes an error + * 227 Add support for VS projects and solutions + * 231 Update C# samples to use NUnit 3.0 + * 233 Update F# samples to use NUnit 3.0 + * 234 Update C++ samples to use NUnit 3.0 + * 265 Reorganize console reports for nunit-console and nunitlite + * 299 No full path to assembly in XML file under Compact Framework + * 301 Command-line length + * 363 Make Xml result output an engine service + * 377 CombiningStrategyAttributes don't work correctly on generic methods + * 388 Improvements to NUnitLite runner output + * 390 Specify exactly what happens when a test times out + * 396 ApartmentAttribute + * 397 CF nunitlite runner assembly has the wrong name + * 407 Assert.Pass() with ]]> in message crashes console runner + * 414 Simplify Assert overloads + * 416 NUnit 2.x Framework Driver + * 417 Complete work on NUnit projects + * 420 Create Settings file in proper location + +NUnit 3.0.0 Alpha 3 - November 29, 2014 + +Breaking Changes + + * NUnitLite tests must reference both the nunit.framework and nunitlite assemblies. + +Framework + + * The NUnit and NUnitLite frameworks have now been merged. There is no longer any distinction + between them in terms of features, although some features are not available on all platforms. + * The release includes two new framework builds: compact framework 3.5 and portable. The portable + library is compatible with .NET 4.5, Silverlight 5.0, Windows 8, Windows Phone 8.1, + Windows Phone Silverlight 8, Mono for Android and MonoTouch. + * A number of previously unsupported features are available for the Compact Framework: + - Generic methods as tests + - RegexConstraint + - TimeoutAttribute + - FileAssert, DirectoryAssert and file-related constraints + +Engine + + * The logic of runtime selection has now changed so that each assembly runs by default + in a separate process using the runtime for which it was built. + * On 64-bit systems, each test process is automatically created as 32-bit or 64-bit, + depending on the platform specified for the test assembly. + +Console + + * The console runner now runs tests in a separate process per assembly by default. They may + still be run in process or in a single separate process by use of command-line options. + * The console runner now starts in the highest version of the .NET runtime available, making + it simpler to debug tests by specifying that they should run in-process on the command-line. + * The -x86 command-line option is provided to force execution in a 32-bit process on a 64-bit system. + * A writeability check is performed for each output result file before trying to run the tests. + * The -teamcity option is now supported. + +Issues Resolved + + * 12 Compact framework should support generic methods + * 145 NUnit-console fails if test result message contains invalid xml characters + * 155 Create utility classes for platform-specific code + * 223 Common code for NUnitLite console runner and NUnit-Console + * 225 Compact Framework Support + * 238 Improvements to running 32 bit tests on a 64 bit system + * 261 Add portable nunitlite build + * 284 NUnitLite Unification + * 293 CF does not have a CurrentDirectory + * 306 Assure NUnit can write resultfile + * 308 Early disposal of runners + * 309 NUnit-Console should support incremental output under TeamCity + * 325 Add RegexConstraint to compact framework build + * 326 Add TimeoutAttribute to compact framework build + * 327 Allow generic test methods in the compact framework + * 328 Use .NET Stopwatch class for compact framework builds + * 331 Alpha 2 CF does not build + * 333 Add parallel execution to desktop builds of NUnitLite + * 334 Include File-related constraints and syntax in NUnitLite builds + * 335 Re-introduce 'Classic' NUnit syntax in NUnitLite + * 336 Document use of separate obj directories per build in our projects + * 337 Update Standard Defines page for .NET 3.0 + * 341 Move the NUnitLite runners to separate assemblies + * 367 Refactor XML Escaping Tests + * 372 CF Build TestAssemblyRunnerTests + * 373 Minor CF Test Fixes + * 378 Correct documentation for PairwiseAttribute + * 386 Console Output Improvements + +NUnit 3.0.0 Alpha 2 - November 2, 2014 + +Breaking Changes + + * The console runner no longer displays test results in the debugger. + * The NUnitLite compact framework 2.0 build has been removed. + * All addin support has been removed from the framework. Documentation of NUnit 3.0 extensibility features will be published in time for the beta release. In the interim, please ask for support on the nunit-discuss list. + +General + + * A separate solution has been created for Linux + * We now have continuous integration builds under both Travis and Appveyor + * The compact framework 3.5 build is now working and will be supported in future releases. + +New Features + + * The console runner now automatically detects 32- versus 64-bit test assemblies. + * The NUnitLite report output has been standardized to match that of nunit-console. + * The NUnitLite command-line has been standardized to match that of nunit-console where they share the same options. + * Both nunit-console and NUnitLite now display output in color. + * ActionAttributes now allow specification of multiple targets on the attribute as designed. This didn't work in the first alpha. + * OneTimeSetUp and OneTimeTearDown failures are now shown on the test report. Individual test failures after OneTimeSetUp failure are no longer shown. + * The console runner refuses to run tests build with older versions of NUnit. A plugin will be available to run older tests in the future. + +Issues Resolved + + * 222 Color console for NUnitLite + * 229 Timing failures in tests + * 241 Remove reference to Microslft BCL packages + * 243 Create solution for Linux + * 245 Multiple targets on action attributes not implemented + * 246 C++ tests do not compile in VS2013 + * 247 Eliminate trace display when running tests in debug + * 255 Add new result states for more precision in where failures occur + * 256 ContainsConstraint break when used with AndConstraint + * 264 Stacktrace displays too many entries + * 269 Add manifest to nunit-console and nunit-agent + * 270 OneTimeSetUp failure results in too much output + * 271 Invalid tests should be treated as errors + * 274 Command line options should be case insensitive + * 276 NUnit-console should not reference nunit.framework + * 278 New result states (ChildFailure and SetupFailure) break NUnit2XmlOutputWriter + * 282 Get tests for NUnit2XmlOutputWriter working + * 288 Set up Appveyor CI build + * 290 Stack trace still displays too many items + * 315 NUnit 3.0 alpha: Cannot run in console on my assembly + * 319 CI builds are not treating test failures as failures of the build + * 322 Remove Stopwatch tests where they test the real .NET Stopwatch + +NUnit 3.0.0 Alpha 1 - September 22, 2014 + +Breaking Changes + + * Legacy suites are no longer supported + * Assert.NullOrEmpty is no longer supported (Use Is.Null.Or.Empty) + +General + + * MsBuild is now used for the build rather than NAnt + * The framework test harness has been removed now that nunit-console is at a point where it can run the tests. + +New Features + + * Action Attributes have been added with the same features as in NUnit 2.6.3. + * TestContext now has a method that allows writing to the XML output. + * TestContext.CurrentContext.Result now provides the error message and stack trace during teardown. + * Does prefix operator supplies several added constraints. + +Issues Resolved + + * 6 Log4net not working with NUnit + * 13 Standardize commandline options for nunitlite runner + * 17 No allowance is currently made for nullable arguents in TestCase parameter conversions + * 33 TestCaseSource cannot refer to a parameterized test fixture + * 54 Store message and stack trace in TestContext for use in TearDown + * 111 Implement Changes to File, Directory and Path Assertions + * 112 Implement Action Attributes + * 156 Accessing multiple AppDomains within unit tests result in SerializationException + * 163 Add --trace option to NUnitLite + * 167 Create interim documentation for the alpha release + * 169 Design and implement distribution of NUnit packages + * 171 Assert.That should work with any lambda returning bool + * 175 Test Harness should return an error if any tests fail + * 180 Errors in Linux CI build + * 181 Replace NAnt with MsBuild / XBuild + * 183 Standardize commandline options for test harness + * 188 No output from NUnitLite when selected test is not found + * 189 Add string operators to Does prefix + * 193 TestWorkerTests.BusyExecutedIdleEventsCalledInSequence fails occasionally + * 197 Deprecate or remove Assert.NullOrEmpty + * 202 Eliminate legacy suites + * 203 Combine framework, engine and console runner in a single solution and repository + * 209 Make Ignore attribute's reason mandatory + * 215 Running 32-bit tests on a 64-bit OS + * 219 Teardown failures are not reported + +Console Issues Resolved (Old nunit-console project, now combined with nunit) + + * 2 Failure in TestFixtureSetUp is not reported correctly + * 5 CI Server for nunit-console + * 6 System.NullReferenceException on start nunit-console-x86 + * 21 NUnitFrameworkDriverTests fail if not run from same directory + * 24 'Debug' value for /trace option is deprecated in 2.6.3 + * 38 Confusing Excluded categories output + +NUnit 2.9.7 - August 8, 2014 + +Breaking Changes + + * NUnit no longer supports void async test methods. You should use a Task return Type instead. + * The ExpectedExceptionAttribute is no longer supported. Use Assert.Throws() or Assert.That(..., Throws) instead for a more precise specification of where the exception is expected to be thrown. + +New Features + + * Parallel test execution is supported down to the Fixture level. Use ParallelizableAttribute to indicate types that may be run in parallel. + * Async tests are supported for .NET 4.0 if the user has installed support for them. + * A new FileExistsConstraint has been added along with FileAssert.Exists and FileAssert.DoesNotExist + * ExpectedResult is now supported on simple (non-TestCase) tests. + * The Ignore attribute now takes a named parameter Until, which allows specifying a date after which the test is no longer ignored. + * The following new values are now recognized by PlatformAttribute: Win7, Win8, Win8.1, Win2012Server, Win2012ServerR2, NT6.1, NT6.2, 32-bit, 64-bit + * TimeoutAttribute is now supported under Silverlight + * ValuesAttribute may be used without any values on an enum or boolean argument. All possible values are used. + * You may now specify a tolerance using Within when testing equality of DateTimeOffset values. + * The XML output now includes a start and end time for each test. + +Issues Resolved + + * 8 [SetUpFixture] is not working as expected + * 14 CI Server for NUnit Framework + * 21 Is.InRange Constraint Ambiguity + * 27 Values attribute support for enum types + * 29 Specifying a tolerance with "Within" doesn't work for DateTimeOffset data types + * 31 Report start and end time of test execution + * 36 Make RequiresThread, RequiresSTA, RequiresMTA inheritable + * 45 Need of Enddate together with Ignore + * 55 Incorrect XML comments for CollectionAssert.IsSubsetOf + * 62 Matches(Constraint) does not work as expected + * 63 Async support should handle Task return type without state machine + * 64 AsyncStateMachineAttribute should only be checked by name + * 65 Update NUnit Wiki to show the new location of samples + * 66 Parallel Test Execution within test assemblies + * 67 Allow Expected Result on simple tests + * 70 EquivalentTo isn't compatible with IgnoreCase for dictioneries + * 75 Async tests should be supported for projects that target .NET 4.0 + * 82 nunit-framework tests are timing out on Linux + * 83 Path-related tests fail on Linux + * 85 Culture-dependent NUnit tests fail on non-English machine + * 88 TestCaseSourceAttribute documentation + * 90 EquivalentTo isn't compatible with IgnoreCase for char + * 100 Changes to Tolerance definitions + * 110 Add new platforms to PlatformAttribute + * 113 Remove ExpectedException + * 118 Workarounds for missing InternalPreserveStackTrace in mono + * 121 Test harness does not honor the --worker option when set to zero + * 129 Standardize Timeout in the Silverlight build + * 130 Add FileAssert.Exists and FileAssert.DoesNotExist + * 132 Drop support for void async methods + * 153 Surprising behavior of DelayedConstraint pollingInterval + * 161 Update API to support stopping an ongoing test run + +NOTE: Bug Fixes below this point refer to the number of the bug in Launchpad. + +NUnit 2.9.6 - October 4, 2013 + +Main Features + + * Separate projects for nunit-console and nunit.engine + * New builds for .NET 4.5 and Silverlight + * TestContext is now supported + * External API is now stable; internal interfaces are separate from API + * Tests may be run in parallel on separate threads + * Solutions and projects now use VS2012 (except for Compact framework) + +Bug Fixes + + * 463470 We should encapsulate references to pre-2.0 collections + * 498690 Assert.That() doesn't like properties with scoped setters + * 501784 Theory tests do not work correctly when using null parameters + * 531873 Feature: Extraction of unit tests from NUnit test assembly and calling appropriate one + * 611325 Allow Teardown to detect if last test failed + * 611938 Generic Test Instances disappear + * 655882 Make CategoryAttribute inherited + * 664081 Add Server2008 R2 and Windows 7 to PlatformAttribute + * 671432 Upgrade NAnt to Latest Release + * 676560 Assert.AreEqual does not support IEquatable + * 691129 Add Category parameter to TestFixture + * 697069 Feature request: dynamic location for TestResult.xml + * 708173 NUnit's logic for comparing arrays - use Comparer if it is provided + * 709062 "System.ArgumentException : Cannot compare" when the element is a list + * 712156 Tests cannot use AppDomain.SetPrincipalPolicy + * 719184 Platformdependency in src/ClientUtilities/util/Services/DomainManager.cs:40 + * 719187 Using Path.GetTempPath() causes conflicts in shared temporary folders + * 735851 Add detection of 3.0, 3.5 and 4.0 frameworks to PlatformAttribute + * 736062 Deadlock when EventListener performs a Trace call + EventPump synchronisation + * 756843 Failing assertion does not show non-linear tolerance mode + * 766749 net-2.0\nunit-console-x86.exe.config should have a element and also enable loadFromRemoteSources + * 770471 Assert.IsEmpty does not support IEnumerable + * 785460 Add Category parameter to TestCaseSourceAttribute + * 787106 EqualConstraint provides inadequate failure information for IEnumerables + * 792466 TestContext MethodName + * 794115 HashSet incorrectly reported + * 800089 Assert.Throws() hides details of inner AssertionException + * 848713 Feature request: Add switch for console to break on any test case error + * 878376 Add 'Exactly(n)' to the NUnit constraint syntax + * 882137 When no tests are run, higher level suites display as Inconclusive + * 882517 NUnit 2.5.10 doesn't recognize TestFixture if there are only TestCaseSource inside + * 885173 Tests are still executed after cancellation by user + * 885277 Exception when project calls for a runtime using only 2 digits + * 885604 Feature request: Explicit named parameter to TestCaseAttribute + * 890129 DelayedConstraint doesn't appear to poll properties of objects + * 892844 Not using Mono 4.0 profile under Windows + * 893919 DelayedConstraint fails polling properties on references which are initially null + * 896973 Console output lines are run together under Linux + * 897289 Is.Empty constraint has unclear failure message + * 898192 Feature Request: Is.Negative, Is.Positive + * 898256 IEnumerable for Datapoints doesn't work + * 899178 Wrong failure message for parameterized tests that expect exceptions + * 904841 After exiting for timeout the teardown method is not executed + * 908829 TestCase attribute does not play well with variadic test functions + * 910218 NUnit should add a trailing separator to the ApplicationBase + * 920472 CollectionAssert.IsNotEmpty must dispose Enumerator + * 922455 Add Support for Windows 8 and Windows 2012 Server to PlatformAttribute + * 928246 Use assembly.Location instead of assembly.CodeBase + * 958766 For development work under TeamCity, we need to support nunit2 formatted output under direct-runner + * 1000181 Parameterized TestFixture with System.Type as constructor arguments fails + * 1000213 Inconclusive message Not in report output + * 1023084 Add Enum support to RandomAttribute + * 1028188 Add Support for Silverlight + * 1029785 Test loaded from remote folder failed to run with exception System.IODirectory + * 1037144 Add MonoTouch support to PlatformAttribute + * 1041365 Add MaxOsX and Xbox support to platform attribute + * 1057981 C#5 async tests are not supported + * 1060631 Add .NET 4.5 build + * 1064014 Simple async tests should not return Task + * 1071164 Support async methods in usage scenarios of Throws constraints + * 1071343 Runner.Load fails on CF if the test assembly contains a generic method + * 1071861 Error in Path Constraints + * 1072379 Report test execution time at a higher resolution + * 1074568 Assert/Assume should support an async method for the ActualValueDelegate + * 1082330 Better Exception if SetCulture attribute is applied multiple times + * 1111834 Expose Random Object as part of the test context + * 1111838 Include Random Seed in Test Report + * 1172979 Add Category Support to nunitlite Runner + * 1203361 Randomizer uniqueness tests sometimes fail + * 1221712 When non-existing test method is specified in -test, result is still "Tests run: 1, Passed: 1" + * 1223294 System.NullReferenceException thrown when ExpectedExceptionAttribute is used in a static class + * 1225542 Standardize commandline options for test harness + +Bug Fixes in 2.9.6 But Not Listed Here in the Release + + * 541699 Silverlight Support + * 1222148 /framework switch does not recognize net-4.5 + * 1228979 Theories with all test cases inconclusive are not reported as failures + + +NUnit 2.9.5 - July 30, 2010 + +Bug Fixes + + * 483836 Allow non-public test fixtures consistently + * 487878 Tests in generic class without proper TestFixture attribute should be invalid + * 498656 TestCase should show array values in GUI + * 513989 Is.Empty should work for directories + * 519912 Thread.CurrentPrincipal Set In TestFixtureSetUp Not Maintained Between Tests + * 532488 constraints from ConstraintExpression/ConstraintBuilder are not reusable + * 590717 categorie contains dash or trail spaces is not selectable + * 590970 static TestFixtureSetUp/TestFixtureTearDown methods in base classes are not run + * 595683 NUnit console runner fails to load assemblies + * 600627 Assertion message formatted poorly by PropertyConstraint + * 601108 Duplicate test using abstract test fixtures + * 601645 Parametered test should try to convert data type from source to parameter + * 605432 ToString not working properly for some properties + * 606548 Deprecate Directory Assert in 2.5 and remove it in 3.0 + * 608875 NUnit Equality Comparer incorrectly defines equality for Dictionary objects + +NUnit 2.9.4 - May 4, 2010 + +Bug Fixes + + * 419411 Fixture With No Tests Shows as Non-Runnable + * 459219 Changes to thread princpal cause failures under .NET 4.0 + * 459224 Culture test failure under .NET 4.0 + * 462019 Line endings needs to be better controlled in source + * 462418 Assume.That() fails if I specify a message + * 483845 TestCase expected return value cannot be null + * 488002 Should not report tests in abstract class as invalid + * 490679 Category in TestCaseData clashes with Category on ParameterizedMethodSuite + * 501352 VS2010 projects have not been updated for new directory structure + * 504018 Automatic Values For Theory Test Parameters Not Provided For bool And enum + * 505899 'Description' parameter in both TestAttribute and TestCaseAttribute is not allowed + * 523335 TestFixtureTearDown in static class not executed + * 556971 Datapoint(s)Attribute should work on IEnumerable as well as on Arrays + * 561436 SetCulture broken with 2.5.4 + * 563532 DatapointsAttribute should be allowed on properties and methods + +NUnit 2.9.3 - October 26, 2009 + +Main Features + + * Created new API for controlling framework + * New builds for .Net 3.5 and 4.0, compact framework 3.5 + * Support for old style tests has been removed + * New adhoc runner for testing the framework + +Bug Fixes + + * 432805 Some Framework Tests don't run on Linux + * 440109 Full Framework does not support "Contains" + +NUnit 2.9.2 - September 19, 2009 + +Main Features + + * NUnitLite code is now merged with NUnit + * Added NUnitLite runner to the framework code + * Added Compact framework builds + +Bug Fixes + + * 430100 Assert.Catch should return T + * 432566 NUnitLite shows empty string as argument + * 432573 Mono test should be at runtime + +NUnit 2.9.1 - August 27, 2009 + +General + + * Created a separate project for the framework and framework tests + * Changed license to MIT / X11 + * Created Windows installer for the framework + +Bug Fixes + + * 400502 NUnitEqualityComparer.StreamsE­qual fails for same stream + * 400508 TestCaseSource attirbute is not working when Type is given + * 400510 TestCaseData variable length ctor drops values + * 417557 Add SetUICultureAttribute from NUnit 2.5.2 + * 417559 Add Ignore to TestFixture, TestCase and TestCaseData + * 417560 Merge Assert.Throws and Assert.Catch changes from NUnit 2.5.2 + * 417564 TimeoutAttribute on Assembly diff --git a/packages/NUnit.3.2.0/LICENSE.txt b/packages/NUnit.3.2.0/LICENSE.txt new file mode 100644 index 00000000..1a8c7b8f --- /dev/null +++ b/packages/NUnit.3.2.0/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2016 Charlie Poole + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/packages/NUnit.3.2.0/NOTICES.txt b/packages/NUnit.3.2.0/NOTICES.txt new file mode 100644 index 00000000..02f3f84d --- /dev/null +++ b/packages/NUnit.3.2.0/NOTICES.txt @@ -0,0 +1,5 @@ +NUnit 3.0 is based on earlier versions of NUnit, with Portions + +Copyright (c) 2002-2014 Charlie Poole or +Copyright (c) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or +Copyright (c) 2000-2002 Philip A. Craig diff --git a/packages/NUnit.3.2.0/NUnit.3.2.0.nupkg b/packages/NUnit.3.2.0/NUnit.3.2.0.nupkg new file mode 100644 index 00000000..2dda5df9 Binary files /dev/null and b/packages/NUnit.3.2.0/NUnit.3.2.0.nupkg differ diff --git a/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.dll b/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.dll new file mode 100644 index 00000000..682227ca Binary files /dev/null and b/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.dll differ diff --git a/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.xml b/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.xml new file mode 100644 index 00000000..acd4bd7c --- /dev/null +++ b/packages/NUnit.3.2.0/lib/dotnet/nunit.framework.xml @@ -0,0 +1,15715 @@ + + + + nunit.framework + + + + + AssemblyHelper provides static methods for working + with assemblies. + + + + + Gets the path from which the assembly defining a type was loaded. + + The Type. + The path. + + + + Gets the path from which an assembly was loaded. + For builds where this is not possible, returns + the name of the assembly. + + The assembly. + The path. + + + + Gets the AssemblyName of an assembly. + + The assembly + An AssemblyName + + + + Loads an assembly given a string, which is the AssemblyName + + + + + + + Interface for logging within the engine + + + + + Logs the specified message at the error level. + + The message. + + + + Logs the specified message at the error level. + + The message. + The arguments. + + + + Logs the specified message at the warning level. + + The message. + + + + Logs the specified message at the warning level. + + The message. + The arguments. + + + + Logs the specified message at the info level. + + The message. + + + + Logs the specified message at the info level. + + The message. + The arguments. + + + + Logs the specified message at the debug level. + + The message. + + + + Logs the specified message at the debug level. + + The message. + The arguments. + + + + InternalTrace provides facilities for tracing the execution + of the NUnit framework. Tests and classes under test may make use + of Console writes, System.Diagnostics.Trace or various loggers and + NUnit itself traps and processes each of them. For that reason, a + separate internal trace is needed. + + Note: + InternalTrace uses a global lock to allow multiple threads to write + trace messages. This can easily make it a bottleneck so it must be + used sparingly. Keep the trace Level as low as possible and only + insert InternalTrace writes where they are needed. + TODO: add some buffering and a separate writer thread as an option. + TODO: figure out a way to turn on trace in specific classes only. + + + + + Gets a flag indicating whether the InternalTrace is initialized + + + + + Initialize the internal trace using a provided TextWriter and level + + A TextWriter + The InternalTraceLevel + + + + Get a named Logger + + + + + + Get a logger named for a particular Type. + + + + + InternalTraceLevel is an enumeration controlling the + level of detailed presented in the internal log. + + + + + Use the default settings as specified by the user. + + + + + Do not display any trace messages + + + + + Display Error messages only + + + + + Display Warning level and higher messages + + + + + Display informational and higher messages + + + + + Display debug messages and higher - i.e. all messages + + + + + Display debug messages and higher - i.e. all messages + + + + + A trace listener that writes to a separate file per domain + and process using it. + + + + + Construct an InternalTraceWriter that writes to a + TextWriter provided by the caller. + + + + + + Returns the character encoding in which the output is written. + + The character encoding in which the output is written. + + + + Writes a character to the text string or stream. + + The character to write to the text stream. + + + + Writes a string to the text string or stream. + + The string to write. + + + + Writes a string followed by a line terminator to the text string or stream. + + The string to write. If is null, only the line terminator is written. + + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. + + + + + Provides internal logging to the NUnit framework + + + + + Initializes a new instance of the class. + + The name. + The log level. + The writer where logs are sent. + + + + Logs the message at error level. + + The message. + + + + Logs the message at error level. + + The message. + The message arguments. + + + + Logs the message at warm level. + + The message. + + + + Logs the message at warning level. + + The message. + The message arguments. + + + + Logs the message at info level. + + The message. + + + + Logs the message at info level. + + The message. + The message arguments. + + + + Logs the message at debug level. + + The message. + + + + Logs the message at debug level. + + The message. + The message arguments. + + + + Waits for pending asynchronous operations to complete, if appropriate, + and returns a proper result of the invocation by unwrapping task results + + The raw result of the method invocation + The unwrapped result, if necessary + + + + CombinatorialStrategy creates test cases by using all possible + combinations of the parameter data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Provides data from fields marked with the DatapointAttribute or the + DatapointsAttribute. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + Built-in SuiteBuilder for all types of test classes. + + + + + Checks to see if the provided Type is a fixture. + To be considered a fixture, it must be a non-abstract + class with one or more attributes implementing the + IFixtureBuilder interface or one or more methods + marked as tests. + + The fixture type to check + True if the fixture can be built, false if not + + + + Build a TestSuite from TypeInfo provided. + + The fixture type to build + A TestSuite built from that type + + + + We look for attributes implementing IFixtureBuilder at one level + of inheritance at a time. Attributes on base classes are not used + unless there are no fixture builder attributes at all on the derived + class. This is by design. + + The type being examined for attributes + A list of the attributes found. + + + + Class to build ether a parameterized or a normal NUnitTestMethod. + There are four cases that the builder must deal with: + 1. The method needs no params and none are provided + 2. The method needs params and they are provided + 3. The method needs no params but they are provided in error + 4. The method needs params but they are not provided + This could have been done using two different builders, but it + turned out to be simpler to have just one. The BuildFrom method + takes a different branch depending on whether any parameters are + provided, but all four cases are dealt with in lower-level methods + + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + A Test representing one or more method invocations + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + The test suite being built, to which the new test would be added + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + The test fixture being populated, or null + A Test representing one or more method invocations + + + + Builds a ParameterizedMethodSuite containing individual test cases. + + The method for which a test is to be built. + The list of test cases to include. + A ParameterizedMethodSuite populated with test cases + + + + Build a simple, non-parameterized TestMethod for this method. + + The MethodInfo for which a test is to be built + The test suite for which the method is being built + A TestMethod. + + + + Class that can build a tree of automatic namespace + suites from a group of fixtures. + + + + + NamespaceDictionary of all test suites we have created to represent + namespaces. Used to locate namespace parent suites for fixtures. + + + + + The root of the test suite being created by this builder. + + + + + Initializes a new instance of the class. + + The root suite. + + + + Gets the root entry in the tree created by the NamespaceTreeBuilder. + + The root suite. + + + + Adds the specified fixtures to the tree. + + The fixtures to be added. + + + + Adds the specified fixture to the tree. + + The fixture to be added. + + + + NUnitTestCaseBuilder is a utility class used by attributes + that build test cases. + + + + + Constructs an + + + + + Builds a single NUnitTestMethod, either as a child of the fixture + or as one of a set of test cases under a ParameterizedTestMethodSuite. + + The MethodInfo from which to construct the TestMethod + The suite or fixture to which the new test will be added + The ParameterSet to be used, or null + + + + + Helper method that checks the signature of a TestMethod and + any supplied parameters to determine if the test is valid. + + Currently, NUnitTestMethods are required to be public, + non-abstract methods, either static or instance, + returning void. They may take arguments but the _values must + be provided or the TestMethod is not considered runnable. + + Methods not meeting these criteria will be marked as + non-runnable and the method will return false in that case. + + The TestMethod to be checked. If it + is found to be non-runnable, it will be modified. + Parameters to be used for this test, or null + True if the method signature is valid, false if not + + The return value is no longer used internally, but is retained + for testing purposes. + + + + + NUnitTestFixtureBuilder is able to build a fixture given + a class marked with a TestFixtureAttribute or an unmarked + class containing test methods. In the first case, it is + called by the attribute and in the second directly by + NUnitSuiteBuilder. + + + + + Build a TestFixture from type provided. A non-null TestSuite + must always be returned, since the method is generally called + because the user has marked the target class as a fixture. + If something prevents the fixture from being used, it should + be returned nonetheless, labelled as non-runnable. + + An ITypeInfo for the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + Overload of BuildFrom called by tests that have arguments. + Builds a fixture using the provided type and information + in the ITestFixtureData object. + + The TypeInfo for which to construct a fixture. + An object implementing ITestFixtureData or null. + + + + + Method to add test cases to the newly constructed fixture. + + The fixture to which cases should be added + + + + Method to create a test case from a MethodInfo and add + it to the fixture being built. It first checks to see if + any global TestCaseBuilder addin wants to build the + test case. If not, it uses the internal builder + collection maintained by this fixture builder. + + The default implementation has no test case builders. + Derived classes should add builders to the collection + in their constructor. + + The method for which a test is to be created + The test suite being built. + A newly constructed Test + + + + PairwiseStrategy creates test cases by combining the parameter + data so that all possible pairs of data items are used. + + + + The number of test cases that cover all possible pairs of test function + parameters values is significantly less than the number of test cases + that cover all possible combination of test function parameters values. + And because different studies show that most of software failures are + caused by combination of no more than two parameters, pairwise testing + can be an effective ways to test the system when it's impossible to test + all combinations of parameters. + + + The PairwiseStrategy code is based on "jenny" tool by Bob Jenkins: + http://burtleburtle.net/bob/math/jenny.html + + + + + + FleaRand is a pseudo-random number generator developed by Bob Jenkins: + http://burtleburtle.net/bob/rand/talksmall.html#flea + + + + + Initializes a new instance of the FleaRand class. + + The seed. + + + + FeatureInfo represents coverage of a single value of test function + parameter, represented as a pair of indices, Dimension and Feature. In + terms of unit testing, Dimension is the index of the test parameter and + Feature is the index of the supplied value in that parameter's list of + sources. + + + + + Initializes a new instance of FeatureInfo class. + + Index of a dimension. + Index of a feature. + + + + A FeatureTuple represents a combination of features, one per test + parameter, which should be covered by a test case. In the + PairwiseStrategy, we are only trying to cover pairs of features, so the + tuples actually may contain only single feature or pair of features, but + the algorithm itself works with triplets, quadruples and so on. + + + + + Initializes a new instance of FeatureTuple class for a single feature. + + Single feature. + + + + Initializes a new instance of FeatureTuple class for a pair of features. + + First feature. + Second feature. + + + + TestCase represents a single test case covering a list of features. + + + + + Initializes a new instance of TestCaseInfo class. + + A number of features in the test case. + + + + PairwiseTestCaseGenerator class implements an algorithm which generates + a set of test cases which covers all pairs of possible values of test + function. + + + + The algorithm starts with creating a set of all feature tuples which we + will try to cover (see method). This set + includes every single feature and all possible pairs of features. We + store feature tuples in the 3-D collection (where axes are "dimension", + "feature", and "all combinations which includes this feature"), and for + every two feature (e.g. "A" and "B") we generate both ("A", "B") and + ("B", "A") pairs. This data structure extremely reduces the amount of + time needed to calculate coverage for a single test case (this + calculation is the most time-consuming part of the algorithm). + + + Then the algorithm picks one tuple from the uncovered tuple, creates a + test case that covers this tuple, and then removes this tuple and all + other tuples covered by this test case from the collection of uncovered + tuples. + + + Picking a tuple to cover + + + There are no any special rules defined for picking tuples to cover. We + just pick them one by one, in the order they were generated. + + + Test generation + + + Test generation starts from creating a completely random test case which + covers, nevertheless, previously selected tuple. Then the algorithm + tries to maximize number of tuples which this test covers. + + + Test generation and maximization process repeats seven times for every + selected tuple and then the algorithm picks the best test case ("seven" + is a magic number which provides good results in acceptable time). + + Maximizing test coverage + + To maximize tests coverage, the algorithm walks thru the list of mutable + dimensions (mutable dimension is a dimension that are not included in + the previously selected tuple). Then for every dimension, the algorithm + walks thru the list of features and checks if this feature provides + better coverage than randomly selected feature, and if yes keeps this + feature. + + + This process repeats while it shows progress. If the last iteration + doesn't improve coverage, the process ends. + + + In addition, for better results, before start every iteration, the + algorithm "scrambles" dimensions - so for every iteration dimension + probes in a different order. + + + + + + Creates a set of test cases for specified dimensions. + + + An array which contains information about dimensions. Each element of + this array represents a number of features in the specific dimension. + + + A set of test cases. + + + + + Gets the test cases generated by this strategy instance. + + A set of test cases. + + + + The ParameterDataProvider class implements IParameterDataProvider + and hosts one or more individual providers. + + + + + Construct with a collection of individual providers + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + ParameterDataSourceProvider supplies individual argument _values for + single parameters using attributes implementing IParameterDataSource. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + SequentialStrategy creates test cases by using all of the + parameter data sources in parallel, substituting null + when any of them run out of data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ContextSettingsCommand applies specified changes to the + TestExecutionContext prior to running a test. No special + action is needed after the test runs, since the prior + context will be restored automatically. + + + + + The CommandStage enumeration represents the defined stages + of execution for a series of TestCommands. The int _values + of the enum are used to apply decorators in the proper + order. Lower _values are applied first and are therefore + "closer" to the actual test execution. + + + No CommandStage is defined for actual invocation of the test or + for creation of the context. Execution may be imagined as + proceeding from the bottom of the list upwards, with cleanup + after the test running in the opposite order. + + + + + Use an application-defined default value. + + + + + Make adjustments needed before and after running + the raw test - that is, after any SetUp has run + and before TearDown. + + + + + Run SetUp and TearDown for the test. This stage is used + internally by NUnit and should not normally appear + in user-defined decorators. + + + + + Make adjustments needed before and after running + the entire test - including SetUp and TearDown. + + + + + TODO: Documentation needed for class + + + + TODO: Documentation needed for field + + + + TODO: Documentation needed for constructor + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The inner command. + The max time allowed in milliseconds + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext + + The context in which the test should run. + A TestResult + + + + OneTimeSetUpCommand runs any one-time setup methods for a suite, + constructing the user test object if necessary. + + + + + Constructs a OneTimeSetUpCommand for a suite + + The suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run after Setup + + + + Overridden to run the one-time setup for a suite. + + The TestExecutionContext to be used. + A TestResult + + + + OneTimeTearDownCommand performs any teardown actions + specified for a suite and calls Dispose on the user + test object, if any. + + + + + Construct a OneTimeTearDownCommand + + The test suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run before teardown. + + + + Overridden to run the teardown methods specified on the test. + + The TestExecutionContext to be used. + A TestResult + + + + SetUpTearDownCommand runs any SetUp methods for a suite, + runs the test and then runs any TearDown methods. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + SetUpTearDownItem holds the setup and teardown methods + for a single level of the inheritance hierarchy. + + + + + Construct a SetUpTearDownNode + + A list of setup methods for this level + A list teardown methods for this level + + + + Returns true if this level has any methods at all. + This flag is used to discard levels that do nothing. + + + + + Run SetUp on this level. + + The execution context to use for running. + + + + Run TearDown for this level. + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The test being skipped. + + + + Overridden to simply set the CurrentResult to the + appropriate Skipped state. + + The execution context for the test + A TestResult + + + + TestActionCommand runs the BeforeTest actions for a test, + then runs the test and finally runs the AfterTestActions. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TestActionItem represents a single execution of an + ITestAction. It is used to track whether the BeforeTest + method has been called and suppress calling the + AfterTest method if it has not. + + + + + Construct a TestActionItem + + The ITestAction to be included + + + + Run the BeforeTest method of the action and remember that it has been run. + + The test to which the action applies + + + + Run the AfterTest action, but only if the BeforeTest + action was actually run. + + The test to which the action applies + + + + TestCommand is the abstract base class for all test commands + in the framework. A TestCommand represents a single stage in + the execution of a test, e.g.: SetUp/TearDown, checking for + Timeout, verifying the returned result from a method, etc. + + TestCommands may decorate other test commands so that the + execution of a lower-level command is nested within that + of a higher level command. All nested commands are executed + synchronously, as a single unit. Scheduling test execution + on separate threads is handled at a higher level, using the + task dispatcher. + + + + + Construct a TestCommand for a test. + + The test to be executed + + + + Gets the test associated with this command. + + + + + Runs the test in a specified context, returning a TestResult. + + The TestExecutionContext to be used for running the test. + A TestResult + + + + TestMethodCommand is the lowest level concrete command + used to run actual test cases. + + + + + Initializes a new instance of the class. + + The test. + + + + Runs the test, saving a TestResult in the execution context, as + well as returning it. If the test has an expected result, it + is asserts on that value. Since failed tests and errors throw + an exception, this command must be wrapped in an outer command, + will handle that exception and records the failure. This role + is usually played by the SetUpTearDown command. + + The execution context + + + + TheoryResultCommand adjusts the result of a Theory so that + it fails if all the results were inconclusive. + + + + + Constructs a TheoryResultCommand + + The command to be wrapped by this one + + + + Overridden to call the inner command and adjust the result + in case all chlid results were inconclusive. + + + + + + + CultureDetector is a helper class used by NUnit to determine + whether a test should be run based on the current culture. + + + + + Default constructor uses the current culture. + + + + + Construct a CultureDetector for a particular culture for testing. + + The culture to be used + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + Tests to determine if the current culture is supported + based on a culture attribute. + + The attribute to examine + + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + ExceptionHelper provides static methods for working with exceptions + + + + + Rethrows an exception, preserving its stack trace + + The exception to rethrow + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined message string. + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined stack trace. + + + + Gets the stack trace of the exception. + + The exception. + A string representation of the stack trace. + + + + A utility class to create TestCommands + + + + + Gets the command to be executed before any of + the child tests are run. + + A TestCommand + + + + Gets the command to be executed after all of the + child tests are run. + + A TestCommand + + + + Creates a test command for use in running this test. + + + + + + Creates a command for skipping a test. The result returned will + depend on the test RunState. + + + + + Builds the set up tear down list. + + Type of the fixture. + Type of the set up attribute. + Type of the tear down attribute. + A list of SetUpTearDownItems + + + + A CompositeWorkItem represents a test suite and + encapsulates the execution of the suite as well + as all its child tests. + + + + + List of Child WorkItems + + + + + A count of how many tests in the work item have a value for the Order Property + + + + + Construct a CompositeWorkItem for executing a test suite + using a filter to select child tests. + + The TestSuite to be executed + A filter used to select child tests + + + + Method that actually performs the work. Overridden + in CompositeWorkItem to do setup, run all child + items and then do teardown. + + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + A signed integer that indicates the relative values of and , as shown in the following table.Value Meaning Less than zero is less than .Zero equals .Greater than zero is greater than . + + The first object to compare.The second object to compare. + + + + Sorts tests under this suite. + + + + + Cancel (abort or stop) a CompositeWorkItem and all of its children + + true if the CompositeWorkItem and all of its children should be aborted, false if it should allow all currently running tests to complete + + + + A simplified implementation of .NET 4 CountdownEvent + for use in earlier versions of .NET. Only the methods + used by NUnit are implemented. + + + + + Construct a CountdownEvent + + The initial count + + + + Gets the initial count established for the CountdownEvent + + + + + Gets the current count remaining for the CountdownEvent + + + + + Decrement the count by one + + + + + Block the thread until the count reaches zero + + + + + An IWorkItemDispatcher handles execution of work items. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + true if the IWorkItemDispatcher should abort all currently running WorkItems, false if it should allow all currently running WorkItems to complete + + + + A SimpleWorkItem represents a single test case and is + marked as completed immediately upon execution. This + class is also used for skipped or ignored test suites. + + + + + Construct a simple work item for a test. + + The test to be executed + The filter used to select this test + + + + Method that performs actually performs the work. + + + + + SimpleWorkItemDispatcher handles execution of WorkItems by + directly executing them. It is provided so that a dispatcher + is always available in the context, thereby simplifying the + code needed to run child tests. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and a thread is created on which to + run it. Subsequent calls come from the top level + item or its descendants on the proper thread. + + The item to dispatch + + + + Cancel (abort or stop) the ongoing run. + If no run is in process, the call has no effect. + + true if the run should be aborted, false if it should allow its currently running test to complete + + + + A WorkItem may be an individual test case, a fixture or + a higher level grouping of tests. All WorkItems inherit + from the abstract WorkItem class, which uses the template + pattern to allow derived classes to perform work in + whatever way is needed. + + A WorkItem is created with a particular TestExecutionContext + and is responsible for re-establishing that context in the + current thread before it begins or resumes execution. + + + + + Creates a work item. + + The test for which this WorkItem is being created. + The filter to be used in selecting any child Tests. + + + + + Construct a WorkItem for a particular test. + + The test that the WorkItem will run + + + + Initialize the TestExecutionContext. This must be done + before executing the WorkItem. + + + Originally, the context was provided in the constructor + but delaying initialization of the context until the item + is about to be dispatched allows changes in the parent + context during OneTimeSetUp to be reflected in the child. + + The TestExecutionContext to use + + + + Event triggered when the item is complete + + + + + Gets the current state of the WorkItem + + + + + The test being executed by the work item + + + + + The execution context + + + + + The test actions to be performed before and after this test + + + + + The test result + + + + + Execute the current work item, including any + child work items. + + + + + Cancel (abort or stop) a WorkItem + + true if the WorkItem should be aborted, false if it should run to completion + + + + Method that performs actually performs the work. It should + set the State to WorkItemState.Complete when done. + + + + + Method called by the derived class when all work is complete + + + + + The current state of a work item + + + + + Ready to run or continue + + + + + Work Item is executing + + + + + Complete + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Gets or sets the maximum line length for this writer + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a given + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The result of the constraint that failed + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The ConstraintResult for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + Gets the element name + + Element name + + + + ClassName filter selects tests based on the class FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + A base class for multi-part filters + + + + + Constructs an empty CompositeFilter + + + + + Constructs a CompositeFilter from an array of filters + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return a list of the composing filters. + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + IdFilter selects tests based on their id + + + + + Construct an IdFilter for a single value + + The id the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a MethodNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter + + The filter to be negated + + + + Gets the base filter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + PropertyFilter is able to select or exclude tests + based on their properties. + + + + + + Construct a PropertyFilter using a property name and expected value + + A property name + The expected value of the property + + + + Check whether the filter matches a test + + The test to be matched + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + TestName filter selects tests based on their Name + + + + + Construct a TestNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + ValueMatchFilter selects tests based on some value, which + is expected to be contained in the test. + + + + + Returns the value matched by the filter - used for testing + + + + + Indicates whether the value is a regular expression + + + + + Construct a ValueMatchFilter for a single value. + + The value to be included. + + + + Match the input provided by the derived class + + The value to be matchedT + True for a match, false otherwise. + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + GenericMethodHelper is able to deduce the Type arguments for + a generic method from the actual arguments provided. + + + + + Construct a GenericMethodHelper for a method + + MethodInfo for the method to examine + + + + Return the type argments for the method, deducing them + from the arguments actually provided. + + The arguments to the method + An array of type arguments. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + The MethodWrapper class wraps a MethodInfo so that it may + be used in a platform-independent manner. + + + + + Construct a MethodWrapper for a Type and a MethodInfo. + + + + + Construct a MethodInfo for a given Type and method name. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the spcified type are defined on the method. + + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Thrown when an assertion failed. Here to preserve the inner + exception and hence its stack trace. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + The ParameterWrapper class wraps a ParameterInfo so that it may + be used in a platform-independent manner. + + + + + Construct a ParameterWrapper for a given method and parameter + + + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter. + + + + + Gets the underlying ParameterInfo + + + + + Gets the Type of the parameter + + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the specified type are defined on the parameter. + + + + + A PropertyBag represents a collection of name value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + + + + Adds a key/value pair to the property set + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + + True if their are _values present, otherwise false + + + + + Gets a collection containing all the keys in the property set + + + + + + Gets or sets the list of _values for a particular key + + + + + Returns an XmlNode representating the current PropertyBag. + + Not used + An XmlNode representing the PropertyBag + + + + Returns an XmlNode representing the PropertyBag after + adding it as a child of the supplied parent node. + + The parent node. + Not used + + + + + The PropertyNames class provides static constants for the + standard property ids that NUnit uses on tests. + + + + + The FriendlyName of the AppDomain in which the assembly is running + + + + + The selected strategy for joining parameter data into test cases + + + + + The process ID of the executing assembly + + + + + The stack trace from any data provider that threw + an exception. + + + + + The reason a test was not run + + + + + The author of the tests + + + + + The ApartmentState required for running the test + + + + + The categories applying to a test + + + + + The Description of a test + + + + + The number of threads to be used in running tests + + + + + The maximum time in ms, above which the test is considered to have failed + + + + + The ParallelScope associated with a test + + + + + The number of times the test should be repeated + + + + + Indicates that the test should be run on a separate thread + + + + + The culture to be set for a test + + + + + The UI culture to be set for a test + + + + + The type that is under test + + + + + The timeout value for the test + + + + + The test will be ignored until the given date + + + + + The optional Order the test will run in + + + + + Randomizer returns a set of random _values in a repeatable + way, to allow re-running of tests if necessary. It extends + the .NET Random class, providing random values for a much + wider range of types. + + The class is used internally by the framework to generate + test case data and is also exposed for use by users through + the TestContext.Random property. + + + For consistency with the underlying Random Type, methods + returning a single value use the prefix "Next..." Those + without an argument return a non-negative value up to + the full positive range of the Type. Overloads are provided + for specifying a maximum or a range. Methods that return + arrays or strings use the prefix "Get..." to avoid + confusion with the single-value methods. + + + + + Initial seed used to create randomizers for this run + + + + + Get a Randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same _values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Create a new Randomizer using the next seed + available to ensure that each randomizer gives + a unique sequence of values. + + + + + + Default constructor + + + + + Construct based on seed value + + + + + + Returns a random unsigned int. + + + + + Returns a random unsigned int less than the specified maximum. + + + + + Returns a random unsigned int within a specified range. + + + + + Returns a non-negative random short. + + + + + Returns a non-negative random short less than the specified maximum. + + + + + Returns a non-negative random short within a specified range. + + + + + Returns a random unsigned short. + + + + + Returns a random unsigned short less than the specified maximum. + + + + + Returns a random unsigned short within a specified range. + + + + + Returns a random long. + + + + + Returns a random long less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random ulong. + + + + + Returns a random ulong less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random Byte + + + + + Returns a random Byte less than the specified maximum. + + + + + Returns a random Byte within a specified range + + + + + Returns a random SByte + + + + + Returns a random sbyte less than the specified maximum. + + + + + Returns a random sbyte within a specified range + + + + + Returns a random bool + + + + + Returns a random bool based on the probablility a true result + + + + + Returns a random double between 0.0 and the specified maximum. + + + + + Returns a random double within a specified range. + + + + + Returns a random float. + + + + + Returns a random float between 0.0 and the specified maximum. + + + + + Returns a random float within a specified range. + + + + + Returns a random enum value of the specified Type as an object. + + + + + Returns a random enum value of the specified Type. + + + + + Default characters for random functions. + + Default characters are the English alphabet (uppercase & lowercase), arabic numerals, and underscore + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + string representing the set of characters from which to construct the resulting string + A random string of arbitrary length + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + A random string of arbitrary length + Uses DefaultStringChars as the input character set + + + + Generate a random string based on the characters from the input string. + + A random string of the default length + Uses DefaultStringChars as the input character set + + + + Returns a random decimal. + + + + + Returns a random decimal between positive zero and the specified maximum. + + + + + Returns a random decimal within a specified range, which is not + permitted to exceed decimal.MaxVal in the current implementation. + + + A limitation of this implementation is that the range from min + to max must not exceed decimal.MaxVal. + + + + + Helper methods for inspecting a type by reflection. + + Many of these methods take ICustomAttributeProvider as an + argument to avoid duplication, even though certain attributes can + only appear on specific types of members, like MethodInfo or Type. + + In the case where a type is being examined for the presence of + an attribute, interface or named member, the Reflect methods + operate with the full name of the member being sought. This + removes the necessity of the caller having a reference to the + assembly that defines the item being sought and allows the + NUnit core to inspect assemblies that reference an older + version of the NUnit framework. + + + + + Examine a fixture type and return an array of methods having a + particular attribute. The array is order with base methods first. + + The type to examine + The attribute Type to look for + Specifies whether to search the fixture type inheritance chain + The array of methods found + + + + Examine a fixture type and return true if it has a method with + a particular attribute. + + The type to examine + The attribute Type to look for + True if found, otherwise false + + + + Invoke the default constructor on a Type + + The Type to be constructed + An instance of the Type + + + + Invoke a constructor on a Type with arguments + + The Type to be constructed + Arguments to the constructor + An instance of the Type + + + + Returns an array of types from an array of objects. + Used because the compact framework doesn't support + Type.GetTypeArray() + + An array of objects + An array of Types + + + + Invoke a parameterless method returning void on an object. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + + + + Invoke a method, converting any TargetInvocationException to an NUnitException. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Represents the result of running a single test case. + + + + + Construct a TestCaseResult based on a TestMethod + + A TestMethod to which the result applies. + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestResult class represents the result of a test. + + + + + Error message for when child tests have errors + + + + + Error message for when child tests are ignored + + + + + The minimum duration for tests + + + + + List of child results + + + + + Construct a test result given a Test + + The test to be used + + + + Gets the test with which this result is associated. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets or sets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Test HasChildren before accessing Children to avoid + the creation of an empty collection. + + + + + Gets the collection of child results. + + + + + Gets a TextWriter, which will write output to be included in the result. + + + + + Gets any text output written to this result. + + + + + Returns the Xml representation of the result. + + If true, descendant results are included + An XmlNode representing the result + + + + Adds the XML representation of the result as a child of the + supplied parent node.. + + The parent node. + If true, descendant results are included + + + + + Adds a child result to this result, setting this result's + ResultState to Failure if the child result failed. + + The result to be added + + + + Set the result of the test + + The ResultState to use in the result + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + Stack trace giving the location of the command + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + THe FailureSite to use in the result + + + + RecordTearDownException appends the message and stacktrace + from an exception arising during teardown of the test + to any previously recorded information, so that any + earlier failure information is not lost. Note that + calling Assert.Ignore, Assert.Inconclusive, etc. during + teardown is treated as an error. If the current result + represents a suite, it may show a teardown error even + though all contained tests passed. + + The Exception to be recorded + + + + Adds a reason element to a node and returns it. + + The target node. + The new reason element. + + + + Adds a failure element to a node and returns it. + + The target node. + The new failure element. + + + + Represents the result of running a test suite + + + + + Construct a TestSuiteResult base on a TestSuite + + The TestSuite to which the result applies + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Add a child result + + The child result to be added + + + + StackFilter class is used to remove internal NUnit + entries from a stack trace so that the resulting + trace provides better information about the test. + + + + + Filters a raw stack trace and returns the result. + + The original stack trace + A filtered stack trace + + + + Provides methods to support legacy string comparison methods. + + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + Zero if the strings are equivalent, a negative number if strA is sorted first, a positive number if + strB is sorted first + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + True if the strings are equivalent, false if not. + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + The expected result to be returned + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + The expected result of the test, which + must match the method return type. + + + + + Gets a value indicating whether an expected result was specified. + + + + + Helper class used to save and restore certain static or + singleton settings in the environment that affect tests + or which might be changed by the user tests. + + An internal class is used to hold settings and a stack + of these objects is pushed and popped as Save and Restore + are called. + + + + + Link to a prior saved context + + + + + Indicates that a stop has been requested + + + + + The event listener currently receiving notifications + + + + + The number of assertions for the current test + + + + + The current culture + + + + + The current UI culture + + + + + The current test result + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + An existing instance of TestExecutionContext. + + + + The current context, head of the list of saved contexts. + + + + + Gets the current context. + + The current context. + + + + Clear the current context. This is provided to + prevent "leakage" of the CallContext containing + the current context back to any runners. + + + + + Gets or sets the current test + + + + + The time the current test started execution + + + + + The time the current test started in Ticks + + + + + Gets or sets the current test result + + + + + Gets a TextWriter that will send output to the current test result. + + + + + The current test object - that is the user fixture + object on which tests are being executed. + + + + + Get or set the working directory + + + + + Get or set indicator that run should stop on the first error + + + + + Gets an enum indicating whether a stop has been requested. + + + + + The current test event listener + + + + + The current WorkItemDispatcher + + + + + The ParallelScope to be used by tests running in this context. + For builds with out the parallel feature, it has no effect. + + + + + Gets the RandomGenerator specific to this Test + + + + + Gets the assert count. + + The assert count. + + + + Gets or sets the test case timeout value + + + + + Gets a list of ITestActions set by upstream tests + + + + + Saves or restores the CurrentCulture + + + + + Saves or restores the CurrentUICulture + + + + + The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter + + + + + Record any changes in the environment made by + the test code in the execution context so it + will be passed on to lower level tests. + + + + + Set up the execution environment to match a context. + Note that we may be running on the same thread where the + context was initially created or on a different thread. + + + + + Increments the assert count by one. + + + + + Increments the assert count by a specified amount. + + + + + Adds a new ValueFormatterFactory to the chain of formatters + + The new factory + + + + Enumeration indicating whether the tests are + running normally or being cancelled. + + + + + Running normally with no stop requested + + + + + A graceful stop has been requested + + + + + A forced stop has been requested + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Indicates whether this is a top-level filter, + not contained in any other filter. + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. This is overridden by each + different type of filter to perform the necessary tests. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test matches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Create a TestFilter instance from an xml representation. + + + + + Create a TestFilter from it's TNode representation + + + + + Nested class provides an empty filter - one that always + returns true when called. It never matches explicitly. + + + + + Adds an XML node + + True if recursive + The added XML node + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + Type arguments used to create a generic fixture instance + + + + + TestListener provides an implementation of ITestListener that + does nothing. It is used only through its NULL property. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test case has finished + + The result of the test + + + + Construct a new TestListener - private so it may not be used. + + + + + Get a listener that does nothing + + + + + TestNameGenerator is able to create test names according to + a coded pattern. + + + + + Construct a TestNameGenerator + + The pattern used by this generator. + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + The display name + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + Arguments to be used + The display name + + + + Get the display name for a MethodInfo + + A MethodInfo + The display name + + + + Get the display name for a method with args + + A MethodInfo + Argument list for the method + The display name + + + + TestParameters is the abstract base class for all classes + that know how to provide data for constructing a test. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a ParameterSet from an object implementing ITestData + + + + + + The RunState for this set of parameters. + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets the property dictionary for this test + + + + + Applies ParameterSet _values to the test itself. + + A test. + + + + The original arguments provided by the user, + used for display purposes. + + + + + TestProgressReporter translates ITestListener events into + the async callbacks that are used to inform the client + software about the progress of a test run. + + + + + Initializes a new instance of the class. + + The callback handler to be used for reporting progress. + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished. Sends a result summary to the callback. + to + + The result of the test + + + + Returns the parent test item for the targer test item if it exists + + + parent test item + + + + Makes a string safe for use as an attribute, replacing + characters characters that can't be used with their + corresponding xml representations. + + The string to be used + A new string with the _values replaced + + + + ParameterizedFixtureSuite serves as a container for the set of test + fixtures created from a given Type using various parameters. + + + + + Initializes a new instance of the class. + + The ITypeInfo for the type that represents the suite. + + + + Gets a string representing the type of test + + + + + + ParameterizedMethodSuite holds a collection of individual + TestMethods with their arguments applied. + + + + + Construct from a MethodInfo + + + + + + Gets a string representing the type of test + + + + + + SetUpFixture extends TestSuite and supports + Setup and TearDown methods. + + + + + Initializes a new instance of the class. + + The type. + + + + The Test abstract class represents a test within the framework. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + The SetUp methods. + + + + + The teardown methods + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + TODO: Documentation needed for constructor + + + + + + Construct a test from a MethodInfo + + + + + + Gets or sets the id of the test + + + + + + Gets or sets the name of the test + + + + + Gets or sets the fully qualified name of the test + + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the TypeInfo of the fixture used in running this test + or null if no fixture type is associated with it. + + + + + Gets a MethodInfo for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Whether or not the test should be run + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Gets a string representing the type of test. Used as an attribute + value in the XML representation of a test and has no other + function in the framework. + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets the properties for this test + + + + + Returns true if this is a TestSuite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets or sets a fixture object for running this test. + + + + + Static prefix used for ids in this AppDomain. + Set by FrameworkController. + + + + + Gets or Sets the Int value representing the seed for the RandomGenerator + + + + + + Creates a TestResult for this test. + + A TestResult suitable for this type of test. + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object deriving from MemberInfo + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object deriving from MemberInfo + + + + Add standard attributes and members to a test node. + + + + + + + Returns the Xml representation of the test + + If true, include child tests recursively + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + TestAssembly is a TestSuite that represents the execution + of tests in a managed assembly. + + + + + Initializes a new instance of the class + specifying the Assembly and the path from which it was loaded. + + The assembly this test represents. + The path used to load the assembly. + + + + Initializes a new instance of the class + for a path which could not be loaded. + + The path used to load the assembly. + + + + Gets the Assembly represented by this instance. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + TestFixture is a surrogate for a user test fixture class, + containing one or more tests. + + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + The TestMethod class represents a Test implemented as a method. + + + + + The ParameterSet used to create this test method + + + + + Initializes a new instance of the class. + + The method to be used as a test. + + + + Initializes a new instance of the class. + + The method to be used as a test. + The suite or fixture to which the new test will be added + + + + Overridden to return a TestCaseResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Returns a TNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Gets this test's child tests + + A list of child tests + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns the name of the method + + + + + TestSuite represents a composite test, which contains other tests. + + + + + Our collection of child tests + + + + + Initializes a new instance of the class. + + The name of the suite. + + + + Initializes a new instance of the class. + + Name of the parent suite. + The name of the suite. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Sorts tests under this suite. + + + + + Adds a test to the suite. + + The test. + + + + Gets this test's child tests + + The list of child tests + + + + Gets a count of test cases represented by + or contained under this test. + + + + + + The arguments to use in creating the fixture + + + + + Set to true to suppress sorting this suite's contents + + + + + Overridden to return a TestSuiteResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Check that setup and teardown methods marked by certain attributes + meet NUnit's requirements and mark the tests not runnable otherwise. + + The attribute type to check for + + + + TypeHelper provides static methods that operate on Types. + + + + + A special value, which is used to indicate that BestCommonType() method + was unable to find a common type for the specified arguments. + + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The display name for the Type + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The arglist provided. + The display name for the Type + + + + Returns the best fit for a common type to be used in + matching actual arguments to a methods Type parameters. + + The first type. + The second type. + Either type1 or type2, depending on which is more general. + + + + Determines whether the specified type is numeric. + + The type to be examined. + + true if the specified type is numeric; otherwise, false. + + + + + Convert an argument list to the required parameter types. + Currently, only widening numeric conversions are performed. + + An array of args to be converted + A ParameterInfo[] whose types will be used as targets + + + + Determines whether this instance can deduce type args for a generic type from the supplied arguments. + + The type to be examined. + The arglist. + The type args to be used. + + true if this the provided args give sufficient information to determine the type args to be used; otherwise, false. + + + + + Gets the _values for an enumeration, using Enum.GetTypes + where available, otherwise through reflection. + + + + + + + Gets the ids of the _values for an enumeration, + using Enum.GetNames where available, otherwise + through reflection. + + + + + + + The TypeWrapper class wraps a Type so it may be used in + a platform-independent manner. + + + + + Construct a TypeWrapper for a specified Type. + + + + + Gets the underlying Type on which this TypeWrapper is based. + + + + + Gets the base type of this type as an ITypeInfo + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Returns true if the Type wrapped is T + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type represents a static class. + + + + + Get the display name for this type + + + + + Get the display name for an object of this type, constructed with the specified args. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns an array of custom attributes of the specified type applied to this type + + + + + Returns a value indicating whether the type has an attribute of the specified type. + + + + + + + + Returns a flag indicating whether this type has a method with an attribute of the specified type. + + + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Provides a platform-independent methods for getting attributes + for use by AttributeConstraint and AttributeExistsConstraint. + + + + + Gets the custom attributes from the given object. + + Portable libraries do not have an ICustomAttributeProvider, so we need to cast to each of + it's direct subtypes and try to get attributes off those instead. + The actual. + Type of the attribute. + if set to true [inherit]. + A list of the given attribute on the given object. + + + + Specifies flags that control binding and the way in which the search for members + and types is conducted by reflection. + + + + + Specifies no binding flag. + + + + + Specifies that only members declared at the level of the supplied type's hierarchy + should be considered. Inherited members are not considered. + + + + + Specifies that instance members are to be included in the search. + + + + + Specifies that static members are to be included in the search. + + + + + Specifies that public members are to be included in the search. + + + + + Specifies that non-public members are to be included in the search. + + + + + Specifies that public and protected static members up the hierarchy should be + returned. Private static members in inherited classes are not returned. Static + members include fields, methods, events, and properties. Nested types are not + returned. + + + + + A MarshalByRefObject that lives forever + + + + + Some path based methods that we need even in the Portable framework which + does not have the System.IO.Path class + + + + + Windows directory separator + + + + + Alternate directory separator + + + + + A volume separator character. + + + + + Get the file name and extension of the specified path string. + + The path string from which to obtain the file name and extension. + The filename as a . If the last character of is a directory or volume separator character, this method returns . If is null, this method returns null. + + + + Provides NUnit specific extensions to aid in Reflection + across multiple frameworks + + + This version of the class allows direct calls on Type on + those platforms that would normally require use of + GetTypeInfo(). + + + + + Returns an array of generic arguments for the give type + + + + + + + Gets the constructor with the given parameter types + + + + + + + + Gets the constructors for a type + + + + + + + + + + + + + + + + + + + + + + + Gets declared or inherited interfaces on this type + + + + + + + Gets the member on a given type by name. BindingFlags ARE IGNORED. + + + + + + + + + Gets all members on a given type. BindingFlags ARE IGNORED. + + + + + + + + Gets field of the given name on the type + + + + + + + + Gets property of the given name on the type + + + + + + + + Gets property of the given name on the type + + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + + Gets public methods on the given type + + + + + + + Gets methods on a type + + + + + + + + Determines if one type can be implicitly converted from another + + + + + + + + Extensions to the various MemberInfo derived classes + + + + + Returns the get method for the given property + + + + + + + + Returns an array of custom attributes of the specified type applied to this member + + Portable throws an argument exception if T does not + derive from Attribute. NUnit uses interfaces to find attributes, thus + this method + + + + Returns an array of custom attributes of the specified type applied to this parameter + + + + + Returns an array of custom attributes of the specified type applied to this assembly + + + + + Extensions for Assembly that are not available in portable + + + + + DNX does not have a version of GetCustomAttributes on Assembly that takes an inherit + parameter since it doesn't make sense on Assemblies. This version just ignores the + inherit parameter. + + The assembly + The type of attribute you are looking for + Ignored + + + + + Gets the types in a given assembly + + + + + + + This class is a System.Diagnostics.Stopwatch on operating systems that support it. On those that don't, + it replicates the functionality at the resolution supported. + + + + + Gets the total elapsed time measured by the current instance, in milliseconds. + + + + + Gets a value indicating whether the Stopwatch timer is running. + + + + + Gets the current number of ticks in the timer mechanism. + + + If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current + value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the current + DateTime.Ticks property of the DateTime.Now instance. + + A long integer representing the tick counter value of the underlying timer mechanism. + + + + Stops time interval measurement and resets the elapsed time to zero. + + + + + Starts, or resumes, measuring elapsed time for an interval. + + + + + Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring elapsed time. + + A Stopwatch that has just begun measuring elapsed time. + + + + Stops measuring elapsed time for an interval. + + + + + Returns a string that represents the current object. + + + A string that represents the current object. + + + + + Gets the frequency of the timer as the number of ticks per second. + + + + + Indicates whether the timer is based on a high-resolution performance counter. + + + + + Class used to guard against unexpected argument values + or operations by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Throws an ArgumentOutOfRangeException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an ArgumentException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an InvalidOperationException if the specified condition is not met. + + The condition that must be met + The exception message to be used + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + DefaultTestAssemblyBuilder loads a single assembly and builds a TestSuite + containing test fixtures present in the assembly. + + + + + The default suite builder used by the test assembly builder. + + + + + Initializes a new instance of the class. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + FrameworkController provides a facade for use in loading, browsing + and running tests without requiring a reference to the NUnit + framework. All calls are encapsulated in constructors for + this class and its nested classes, which only require the + types of the Common Type System as arguments. + + The controller supports four actions: Load, Explore, Count and Run. + They are intended to be called by a driver, which should allow for + proper sequencing of calls. Load must be called before any of the + other actions. The driver may support other actions, such as + reload on run, by combining these calls. + + + + + Construct a FrameworkController using the default builder and runner. + + The AssemblyName or path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController using the default builder and runner. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The full AssemblyName or the path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Gets the ITestAssemblyBuilder used by this controller instance. + + The builder. + + + + Gets the ITestAssemblyRunner used by this controller instance. + + The runner. + + + + Gets the AssemblyName or the path for which this FrameworkController was created + + + + + Gets the Assembly for which this + + + + + Gets a dictionary of settings for the FrameworkController + + + + + Loads the tests in the assembly + + + + + + Returns info about the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of exploring the tests + + + + Runs the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly syncronously reporting back the test results through the callback + or through the return value + + The callback that receives the test results + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly asyncronously reporting back the test results through the callback + + The callback that receives the test results + A string containing the XML representation of the filter to use + + + + Stops the test run + + True to force the stop, false for a cooperative stop + + + + Counts the number of test cases in the loaded TestSuite + + A string containing the XML representation of the filter to use + The number of tests + + + + Inserts settings element + + Target node + Settings dictionary + The new node + + + + FrameworkControllerAction is the base class for all actions + performed against a FrameworkController. + + + + + LoadTestsAction loads a test into the FrameworkController + + + + + LoadTestsAction loads the tests in an assembly. + + The controller. + The callback handler. + + + + ExploreTestsAction returns info about the tests in an assembly + + + + + Initializes a new instance of the class. + + The controller for which this action is being performed. + Filter used to control which tests are included (NYI) + The callback handler. + + + + CountTestsAction counts the number of test cases in the loaded TestSuite + held by the FrameworkController. + + + + + Construct a CountsTestAction and perform the count of test cases. + + A FrameworkController holding the TestSuite whose cases are to be counted + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunTestsAction runs the loaded TestSuite held by the FrameworkController. + + + + + Construct a RunTestsAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunAsyncAction initiates an asynchronous test run, returning immediately + + + + + Construct a RunAsyncAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + StopRunAction stops an ongoing run. + + + + + Construct a StopRunAction and stop any ongoing run. If no + run is in process, no error is raised. + + The FrameworkController for which a run is to be stopped. + True the stop should be forced, false for a cooperative stop. + >A callback handler used to report results + A forced stop will cause threads and processes to be killed as needed. + + + + The ITestAssemblyBuilder interface is implemented by a class + that is able to build a suite of tests given an assembly or + an assembly filename. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + The ITestAssemblyRunner interface is implemented by classes + that are able to execute a suite of tests loaded + from an assembly. + + + + + Gets the tree of loaded tests, or null if + no tests have been loaded. + + + + + Gets the tree of test results, if the test + run is completed, otherwise null. + + + + + Indicates whether a test has been loaded + + + + + Indicates whether a test is currently running + + + + + Indicates whether a test run is complete + + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + File name of the assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + The assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive ITestListener notifications. + A test filter used to select tests to be run + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any test-running threads + + + + Implementation of ITestAssemblyRunner + + + + + Initializes a new instance of the class. + + The builder. + + + + The tree of tests that was loaded by the builder + + + + + The test result, if a run has completed + + + + + Indicates whether a test is loaded + + + + + Indicates whether a test is running + + + + + Indicates whether a test run is complete + + + + + Our settings, specified when loading the assembly + + + + + The top level WorkItem created for the assembly as a whole + + + + + The TestExecutionContext for the top level WorkItem + + + + + Loads the tests found in an Assembly + + File name of the assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Loads the tests found in an Assembly + + The assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + RunAsync is a template method, calling various abstract and + virtual methods to be overridden by derived classes. + + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Initiate the test run. + + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any tests that are currently running + + + + Create the initial TestExecutionContext used to run tests + + The ITestListener specified in the RunAsync call + + + + Handle the the Completed event for the top level work item + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that an async delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate does not throw an exception. + + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + Delegate used by tests that execute async code and + capture any thrown exception. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter ids for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Provides the Author of a test or test fixture. + + + + + Initializes a new instance of the class. + + The name of the author. + + + + Initializes a new instance of the class. + + The name of the author. + The email address of the author. + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Modifies a test by adding a category to it. + + The test to modify + + + + Marks a test to use a combinatorial join of any argument + data provided. Since this is the default, the attribute is + optional. + + + + + Default constructor + + + + + Marks a test to use a particular CombiningStrategy to join + any parameter data provided. Since this is the default, the + attribute is optional. + + + + + Construct a CombiningStrategyAttribute incorporating an + ICombiningStrategy and an IParamterDataProvider. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct a CombiningStrategyAttribute incorporating an object + that implements ICombiningStrategy and an IParameterDataProvider. + This constructor is provided for CLS compliance. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Modify the test by adding the name of the combining strategy + to the properties. + + The test to modify + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Causes a test to be skipped if this CultureAttribute is not satisfied. + + The test to modify + + + + Tests to determine if the current culture is supported + based on the properties of this attribute. + + True, if the current culture is supported + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + The abstract base class for all data-providing attributes + defined by NUnit. Used to select all data sources for a + method, class or parameter. + + + + + Default constructor + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointSourceAttribute. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointsAttribute. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct a description Attribute + + The text of the description + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + Modifies a test by marking it as explicit. + + The test to modify + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The date in the future to stop ignoring the test as a string in UTC time. + For example for a date and time, "2014-12-25 08:10:00Z" or for just a date, + "2014-12-25". If just a date is given, the Ignore will expire at midnight UTC. + + + Once the ignore until date has passed, the test will be marked + as runnable. Tests with an ignore until date will have an IgnoreUntilDate + property set which will appear in the test results. + + The string does not contain a valid string representation of a date and time. + + + + Modifies a test by marking it as Ignored. + + The test to modify + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple items may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + TestAssemblyDirectoryResolveAttribute is used to mark a test assembly as needing a + special assembly resolution hook that will explicitly search the test assembly's + directory for dependent assemblies. This works around a conflict between mixed-mode + assembly initialization and tests running in their own AppDomain in some cases. + + + + + LevelOfParallelismAttribute is used to set the number of worker threads + that may be allocated by the framework for running tests. + + + + + Construct a LevelOfParallelismAttribute. + + The number of worker threads to be created by the framework. + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + The abstract base class for all custom attributes defined by NUnit. + + + + + Default constructor + + + + + Attribute used to identify a method that is called once + to perform setup before any child tests are run. + + + + + Attribute used to identify a method that is called once + after all the child tests have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + Marks a test to use a pairwise join of any argument + data provided. Arguments will be combined in such a + way that all possible pairs of arguments are used. + + + + + Default constructor + + + + + ParallelizableAttribute is used to mark tests that may be run in parallel. + + + + + Construct a ParallelizableAttribute using default ParallelScope.Self. + + + + + Construct a ParallelizableAttribute with a specified scope. + + The ParallelScope associated with this attribute. + + + + Modify the context to be used for child tests + + The current TestExecutionContext + + + + The ParallelScope enumeration permits specifying the degree to + which a test and its descendants may be run in parallel. + + + + + No Parallelism is permitted + + + + + The test itself may be run in parallel with others at the same level + + + + + Descendants of the test may be run in parallel with one another + + + + + Descendants of the test down to the level of TestFixtures may be run in parallel + + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Modifies a test by adding properties to it. + + The test to modify + + + + RandomAttribute is used to supply a set of random _values + to a single parameter of a parameterized test. + + + + + Construct a random set of values appropriate for the Type of the + parameter on which the attribute appears, specifying only the count. + + + + + + Construct a set of ints within a specified range + + + + + Construct a set of unsigned ints within a specified range + + + + + Construct a set of longs within a specified range + + + + + Construct a set of unsigned longs within a specified range + + + + + Construct a set of shorts within a specified range + + + + + Construct a set of unsigned shorts within a specified range + + + + + Construct a set of doubles within a specified range + + + + + Construct a set of floats within a specified range + + + + + Construct a set of bytes within a specified range + + + + + Construct a set of sbytes within a specified range + + + + + Get the collection of _values to be used as arguments. + + + + + RangeAttribute is used to supply a range of _values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of unsigned ints using default step of 1 + + + + + + + Construct a range of unsigned ints specifying the step size + + + + + + + + Construct a range of longs using a default step of 1 + + + + + + + Construct a range of longs + + + + + + + + Construct a range of unsigned longs using default step of 1 + + + + + + + Construct a range of unsigned longs specifying the step size + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RepeatAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RetryAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test to use a Sequential join of any argument + data provided. Arguments will be combined into test cases, + taking the next value of each argument until all are used. + + + + + Default constructor + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Build a SetUpFixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A SetUpFixture object as a TestSuite. + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + The author of this test + + + + + The type that this test is testing + + + + + Modifies a test by adding a description, if not already set. + + The test to modify + + + + Gets or sets the expected result. + + The result. + + + + Returns true if an expected result has been set + + + + + Construct a TestMethod from a given method. + + The method for which a test is to be constructed. + The suite to which the test will be added. + A TestMethod + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test case. + + + + + Gets the list of arguments to a test case + + + + + Gets the properties of the test case + + + + + Gets or sets the expected result. + + The result. + + + + Returns true if the expected result has been set + + + + + Gets or sets the description. + + The description. + + + + The author of this test + + + + + The type that this test is testing + + + + + Gets or sets the reason for ignoring the test + + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets or sets the reason for not running the test. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets and sets the category for this test case. + May be a comma-separated list of categories. + + + + + Performs several special conversions allowed by NUnit in order to + permit arguments with types that cannot be used in the constructor + of an Attribute such as TestCaseAttribute or to simplify their use. + + The arguments to be converted + The ParameterInfo array for the method + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + TestCaseSourceAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The IMethod for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Returns a set of ITestCaseDataItems for use as arguments + to a parameterized test method. + + The method for which data is needed. + + + + + TestFixtureAttribute is used to mark a class that represents a TestFixture. + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test fixture. + + + + + The arguments originally provided to the attribute + + + + + Properties pertaining to this fixture + + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Descriptive text for this fixture + + + + + The author of this fixture + + + + + The type that this fixture is testing + + + + + Gets or sets the ignore reason. May set RunState as a side effect. + + The ignore reason. + + + + Gets or sets the reason for not running the fixture. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Build a fixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A an IEnumerable holding one TestFixture object. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + TestCaseSourceAttribute indicates the source to be used to + provide test fixture instances for a test class. + + + + + Error message string is public so the tests can use it + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestFixtures from a given Type, + using available parameter data. + + The TypeInfo for which fixures are to be constructed. + One or more TestFixtures as TestSuite + + + + Returns a set of ITestFixtureData items for use as arguments + to a parameterized test fixture. + + The type for which data is needed. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Indicates which class the test or test fixture is testing + + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Construct the attribute, specifying a combining strategy and source of parameter data. + + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary + + + + + Constructs for use with an Enum parameter. Will pass every enum + value in to the test. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of _values to be used as arguments + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + + An enumeration containing individual data items + + + + + A set of Assert methods operating on one or more collections + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attribute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Gets the expected object + + + + + Test whether the expected item is contained in the collection + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionEquivalentConstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether two collections are equivalent + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + If used performs a reverse comparison + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the collection is ordered + + + + + + + Returns the string representation of the constraint. + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionSupersetConstraint is used to determine whether + one collection is a superset of another + + + + + Construct a CollectionSupersetConstraint + + The collection that the actual value is expected to be a superset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a superset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionTally counts (tallies) the number of + occurrences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + The number of objects remaining in the tally + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + ComparisonAdapter class centralizes all comparisons of + _values in NUnit, adapting to the use of any provided + , + or . + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps a + + + + + Compares two objects + + + + + Construct a default ComparisonAdapter + + + + + Construct a ComparisonAdapter for an + + + + + Compares two objects + + + + + + + + ComparerAdapter extends and + allows use of an or + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare _values to + determine if one is greater than, equal to or less than + the other. + + + + + The value against which a comparison is to be made + + + + + If true, less than returns success + + + + + if true, equal returns success + + + + + if true, greater than returns success + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + The value against which to make a comparison. + if set to true less succeeds. + if set to true equal succeeds. + if set to true greater succeeds. + String used in describing the constraint. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use a and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + Construct a constraint with optional arguments + + Arguments to be saved + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Retrieves the value to be tested from an ActualValueDelegate. + The default implementation simply evaluates the delegate but derived + classes may override it to provide for delayed processing. + + An ActualValueDelegate + Delegate evaluation result + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Resolves any pending operators and returns the resolved constraint. + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reorganized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + + + + Pushes the specified operator onto the stack. + + The operator to put onto the stack. + + + + Pops the topmost operator from the stack. + + The topmost operator on the stack + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Pushes the specified constraint. As a side effect, + the constraint's Builder field is set to the + ConstraintBuilder owning this stack. + + The constraint to put onto the stack + + + + Pops this topmost constraint from the stack. + As a side effect, the constraint's Builder + field is set to null. + + The topmost contraint on the stack + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expression by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the Builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reorganized. When a constraint is appended, it is returned as the + value of the operation so that modifiers may be applied. However, + any partially built expression is attached to the constraint for + later resolution. When an operator is appended, the partial + expression is returned. If it's a self-resolving operator, then + a ResolvableConstraintExpression is returned. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. Note that the constraint + is not reduced at this time. For example, if there + is a NotOperator on the stack we don't reduce and + return a NotConstraint. The original constraint must + be returned because it may support modifiers that + are yet to be applied. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests if item is equal to zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + ConstraintStatus represents the status of a ConstraintResult + returned by a Constraint being applied to an actual value. + + + + + The status has not yet been set + + + + + The constraint succeeded + + + + + The constraint failed + + + + + An error occured in applying the constraint (reserved for future use) + + + + + Contain the result of matching a against an actual value. + + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + The status of the new ConstraintResult. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + If true, applies a status of Success to the result, otherwise Failure. + + + + The actual value that was passed to the method. + + + + + Gets and sets the ResultStatus for this result. + + + + + True if actual value meets the Constraint criteria otherwise false. + + + + + Display friendly name of the constraint. + + + + + Description of the constraint may be affected by the state the constraint had + when was performed against the actual value. + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the result and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The _expected. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Flag the constraint to ignore case and return self. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + DictionaryContainsKeyConstraint is used to test whether a dictionary + contains an expected object as a key. + + + + + Construct a DictionaryContainsKeyConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected key is contained in the dictionary + + + + + DictionaryContainsValueConstraint is used to test whether a dictionary + contains an expected object as a value. + + + + + Construct a DictionaryContainsValueConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected value is contained in the dictionary + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that the collection is empty + + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyStringConstraint tests whether a string is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Gets the tolerance for this comparison. + + + The tolerance. + + + + + Gets a value indicating whether to compare case insensitive. + + + true if comparing case insensitive; otherwise, false. + + + + + Gets a value indicating whether or not to clip strings. + + + true if set to clip strings otherwise, false. + + + + + Gets the failure points. + + + The failure points. + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flags the constraint to include + property in comparison of two values. + + + Using this modifier does not allow to use the + constraint modifier. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable _values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point _values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual _values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + The EqualConstraintResult class is tailored for formatting + and displaying the result of an EqualConstraint. + + + + + Construct an EqualConstraintResult + + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual collections or arrays. If both are identical, the value is + only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both _values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + EqualityAdapter class handles all equality comparisons + that use an , + or a . + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps an . + + + + + Returns an EqualityAdapter that uses a predicate function for items comparison. + + + + + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + Returns an that wraps an . + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps a . + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the _values are + allowed to deviate by up to 2 adjacent floating point _values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + Compares two floating point _values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point _values that are allowed to + be between the left and the right floating point _values + + True if both numbers are equal or close to being equal + + + Floating point _values can only represent a finite subset of natural numbers. + For example, the _values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point _values are between + the left and the right number. If the number of possible _values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point _values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point _values that are + allowed to be between the left and the right double precision floating point _values + + True if both numbers are equal or close to being equal + + + Double precision floating point _values can only represent a limited series of + natural numbers. For example, the _values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + _values are between the left and the right number. If the number of possible + _values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Interface for all constraints + + + + + The display name of this Constraint for use by ToString(). + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The IResolveConstraint interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Tests whether a value is less than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Abstract method to get the max line length + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The failing constraint result + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Custom value formatter function + + The value + + + + + Custom value formatter factory function + + The next formatter function + ValueFormatter + If the given formatter is unable to handle a certain format, it must call the next formatter in the chain + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Formatting strings used for expected and actual _values + + + + + Current head of chain of value formatters. Public for testing. + + + + + Add a formatter to the chain of responsibility. + + + + + + Formats text to represent a generalized value. + + The value + The formatted text + + + + Formats text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a collection or + array corresponding to a single int index into the collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test that the actual value is an NaN + + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Numerics class contains common operations on numeric _values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric _values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the _values are equal + + + + Compare two numeric _values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the _values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Returns the default NUnitComparer. + + + + + Compares two objects + + + + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occurred. + + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + Flags the comparer to include + property in comparison of two values. + + + Using this modifier does not allow to use the + modifier. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + _values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + The syntax element preceding this operator + + + + + The syntax element following this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Gets the name of the property to which the operator applies + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifies the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Gets text describing a constraint + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Prefix used in forming the constraint description + + + + + Construct given a base constraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the value + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two _values are within a + specified range. + + + + + Initializes a new instance of the class. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + Resolve the current expression to a Constraint + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Return the top-level constraint for this expression + + + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Description of this constraint + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Constructs a StringConstraint without an expected value + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + Gets text describing a constraint + + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. This override only handles the special message + used when an exception is expected but none is thrown. + + The writer on which the actual value is displayed + + + + ThrowsExceptionConstraint tests that an exception has + been thrown, without any further tests. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Executes the code and returns success if an exception is thrown. + + A delegate representing the code to be tested + True if an exception is thrown, otherwise false + + + + Returns the ActualValueDelegate itself as the value to be tested. + + A delegate representing the code to be tested + The delegate itself + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Returns a default Tolerance object, equivalent to + specifying an exact match unless + is set, in which case, the + will be used. + + + + + Returns an empty Tolerance object, equivalent to + specifying an exact match even if + is set. + + + + + Constructs a linear tolerance of a specified amount + + + + + Constructs a tolerance given an amount and + + + + + Gets the for the current Tolerance + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance has not been set or is using the . + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared _values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared _values my deviate from each other. + + + + + Compares two _values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + The type of the actual argument to which the constraint was applied + + + + + Construct a TypeConstraint for a given Type + + The expected type for the constraint + Prefix used in forming the constraint description + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that all items are unique. + + + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new DictionaryContainsKeyConstraint checking for the + presence of a particular key in the dictionary. + + + + + Returns a new DictionaryContainsValueConstraint checking for the + presence of a particular value in the dictionary. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Abstract base for Exceptions that terminate a test and provide a ResultState. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. Anything set through + this class applies to the entire test run. It should not normally + be used from within a test, since it is not thread-safe. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + The IApplyToContext interface is implemented by attributes + that want to make changes to the execution context before + a test is run. + + + + + Apply changes to the execution context + + The execution context + + + + The IApplyToTest interface is implemented by self-applying + attributes that modify the state of a test in some way. + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + CombiningStrategy is the abstract base for classes that + know how to combine values provided for individual test + parameters to create a set of test cases. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ICommandWrapper is implemented by attributes and other + objects able to wrap a TestCommand with another command. + + + Attributes or other objects should implement one of the + derived interfaces, rather than this one, since they + indicate in which part of the command chain the wrapper + should be applied. + + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + Objects implementing this interface are used to wrap + the TestMethodCommand itself. They apply after SetUp + has been run and before TearDown. + + + + + Objects implementing this interface are used to wrap + the entire test, including SetUp and TearDown. + + + + + Any ITest that implements this interface is at a level that the implementing + class should be disposed at the end of the test run + + + + + The IFixtureBuilder interface is exposed by a class that knows how to + build a TestFixture from one or more Types. In general, it is exposed + by an attribute, but may be implemented in a helper class used by the + attribute in some cases. + + + + + Build one or more TestFixtures from type provided. At least one + non-null TestSuite must always be returned, since the method is + generally called because the user has marked the target class as + a fixture. If something prevents the fixture from being used, it + will be returned nonetheless, labelled as non-runnable. + + The type info of the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + IImplyFixture is an empty marker interface used by attributes like + TestAttribute that cause the class where they are used to be treated + as a TestFixture even without a TestFixtureAttribute. + + Marker interfaces are not usually considered a good practice, but + we use it here to avoid cluttering the attribute hierarchy with + classes that don't contain any extra implementation. + + + + + The IMethodInfo class is used to encapsulate information + about a method in a platform-independent manner. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IParameterDataSource interface is implemented by types + that can provide data for a test method parameter. + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + An enumeration containing individual data items + + + + The IParameterInfo interface is an abstraction of a .NET parameter. + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter + + + + + Gets the underlying .NET ParameterInfo + + + + + Gets the Type of the parameter + + + + + A PropertyBag represents a collection of name/value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + The entries in a PropertyBag are of two kinds: those that + take a single value and those that take multiple _values. + However, the PropertyBag has no knowledge of which entries + fall into each category and the distinction is entirely + up to the code using the PropertyBag. + + When working with multi-valued properties, client code + should use the Add method to add name/value pairs and + indexing to retrieve a list of all _values for a given + key. For example: + + bag.Add("Tag", "one"); + bag.Add("Tag", "two"); + Assert.That(bag["Tag"], + Is.EqualTo(new string[] { "one", "two" })); + + When working with single-valued propeties, client code + should use the Set method to set the value and Get to + retrieve the value. The GetSetting methods may also be + used to retrieve the value in a type-safe manner while + also providing default. For example: + + bag.Set("Priority", "low"); + bag.Set("Priority", "high"); // replaces value + Assert.That(bag.Get("Priority"), + Is.EqualTo("high")); + Assert.That(bag.GetSetting("Priority", "low"), + Is.EqualTo("high")); + + + + + Adds a key/value pair to the property bag + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + True if their are _values present, otherwise false + + + + Gets or sets the list of _values for a particular key + + The key for which the _values are to be retrieved or set + + + + Gets a collection containing all the keys in the property set + + + + + The IReflectionInfo interface is implemented by NUnit wrapper objects that perform reflection. + + + + + Returns an array of custom attributes of the specified type applied to this object + + + + + Returns a value indicating whether an attribute of the specified type is defined on this object. + + + + + The ISimpleTestBuilder interface is exposed by a class that knows how to + build a single TestMethod from a suitable MethodInfo Types. In general, + it is exposed by an attribute, but may be implemented in a helper class + used by the attribute in some cases. + + + + + Build a TestMethod from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the id of the test + + + + + Gets the name of the test + + + + + Gets the fully qualified name of the test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the Type of the test fixture, if applicable, or + null if no fixture type is associated with this test. + + + + + Gets an IMethod for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the RunState of the test, indicating whether it can be run. + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Gets the properties of the test + + + + + Gets the parent test, if any. + + The parent test or null if none exists. + + + + Returns true if this is a test suite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets a fixture object for running this test. + + + + + The ITestBuilder interface is exposed by a class that knows how to + build one or more TestMethods from a MethodInfo. In general, it is exposed + by an attribute, which has additional information available to provide + the necessary test parameters to distinguish the test cases built. + + + + + Build one or more TestMethods from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + This interface is not the same as the ITestCaseBuilder interface in NUnit 2.x. + We have reused the name because the two products don't interoperate at all. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + + + + Gets the expected result of the test case + + + + + Returns true if an expected result has been set + + + + + The ITestData interface is implemented by a class that + represents a single instance of a parameterized test. + + + + + Gets the name to be used for the test + + + + + Gets the RunState for this test case. + + + + + Gets the argument list to be provided to the test + + + + + Gets the property dictionary for the test case + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + The ITestCaseData interface is implemented by a class + that is able to return the data required to create an + instance of a parameterized test fixture. + + + + + Get the TypeArgs if separately set + + + + + The ITestListener interface is used internally to receive + notifications of significant events while a test is being + run. The events are propagated to clients by means of an + AsyncCallback. NUnit extensions may also monitor these events. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished + + The result of the test + + + + The ITestResult interface represents the result of a test. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. Not available in + the Compact Framework 1.0. + + + + + Gets the number of asserts executed + when running the test and all its children. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Accessing HasChildren should not force creation of the + Children collection in classes implementing this interface. + + + + + Gets the the collection of child results. + + + + + Gets the Test to which this result applies. + + + + + Gets any text output written to this result. + + + + + The ITypeInfo interface is an abstraction of a .NET Type + + + + + Gets the underlying Type on which this ITypeInfo is based + + + + + Gets the base type of this type as an ITypeInfo + + + + + Returns true if the Type wrapped is equal to the argument + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the Namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type is a static class. + + + + + Get the display name for this typeInfo. + + + + + Get the display name for an oject of this type, constructed with specific arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a value indicating whether this type has a method with a specified public attribute + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + An object implementing IXmlNodeBuilder is able to build + an XML representation of itself and any children. + + + + + Returns a TNode representing the current object. + + If true, children are included where applicable + A TNode representing the result + + + + Returns a TNode representing the current object after + adding it as a child of the supplied parent node. + + The parent node. + If true, children are included, where applicable + + + + + The ResultState class represents the outcome of running a test. + It contains two pieces of information. The Status of the test + is an enum indicating whether the test passed, failed, was + skipped or was inconclusive. The Label provides a more + detailed breakdown for use by client runners. + + + + + Initializes a new instance of the class. + + The TestStatus. + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + + + + Initializes a new instance of the class. + + The TestStatus. + The stage at which the result was produced + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + The stage at which the result was produced + + + + The result is inconclusive + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test was skipped because it is explicit + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The test was not runnable. + + + + + A suite failed because one or more child tests failed or had errors + + + + + A suite failed in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeDown + + + + + Gets the TestStatus for the test. + + The status. + + + + Gets the label under which this test result is + categorized, if any. + + + + + Gets the stage of test execution in which + the failure or other result took place. + + + + + Get a new ResultState, which is the same as the current + one but with the FailureSite set to the specified value. + + The FailureSite to use + A new ResultState + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occurred. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test can be executed. + + + + + The test is not runnable. + + + + + The test is runnable. + + + + + The test can only be run explicitly + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + TNode represents a single node in the XML representation + of a Test or TestResult. It replaces System.Xml.XmlNode and + System.Xml.Linq.XElement, providing a minimal set of methods + for operating on the XML in a platform-independent manner. + + + + + Constructs a new instance of TNode + + The name of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + Flag indicating whether to use CDATA when writing the text + + + + Gets the name of the node + + + + + Gets the value of the node + + + + + Gets a flag indicating whether the value should be output using CDATA. + + + + + Gets the dictionary of attributes + + + + + Gets a list of child nodes + + + + + Gets the first ChildNode + + + + + Gets the XML representation of this node. + + + + + Create a TNode from it's XML text representation + + The XML text to be parsed + A TNode + + + + Adds a new element as a child of the current node and returns it. + + The element name. + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + + The element name + The text content of the new element + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + The value will be output using a CDATA section. + + The element name + The text content of the new element + The newly created child element + + + + Adds an attribute with a specified name and value to the XmlNode. + + The name of the attribute. + The value of the attribute. + + + + Finds a single descendant of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + + + Finds all descendants of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + Writes the XML representation of the node to an XmlWriter + + + + + + Class used to represent a list of XmlResults + + + + + Class used to represent the attributes of a node + + + + + Gets or sets the value associated with the specified key. + Overridden to return null if attribute is not found. + + The key. + Value of the attribute or null + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + inclusively within a specified range. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the _values of a property + + The collection of property _values + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It is derived from TestCaseParameters and adds a + fluent syntax for use in initializing the test case. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Marks the test case as explicit. + + + + + Marks the test case as explicit, specifying the reason. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Provide the context information of the current test. + This is an adapter for the internal ExecutionContext + class, hiding the internals from the user test. + + + + + Construct a TestContext for an ExecutionContext + + The ExecutionContext to adapt + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TextWriter that will send output to the current test result. + + + + + Get a representation of the current test. + + + + + Gets a Representation of the TestResult for the current test. + + + + + Gets the directory to be used for outputting files created + by this test run. + + + + + Gets the random generator. + + + The random generator. + + + + Write the string representation of a boolean value to the current result + + + Write a char to the current result + + + Write a char array to the current result + + + Write the string representation of a double to the current result + + + Write the string representation of an Int32 value to the current result + + + Write the string representation of an Int64 value to the current result + + + Write the string representation of a decimal value to the current result + + + Write the string representation of an object to the current result + + + Write the string representation of a Single value to the current result + + + Write a string to the current result + + + Write the string representation of a UInt32 value to the current result + + + Write the string representation of a UInt64 value to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a line terminator to the current result + + + Write the string representation of a boolean value to the current result followed by a line terminator + + + Write a char to the current result followed by a line terminator + + + Write a char array to the current result followed by a line terminator + + + Write the string representation of a double to the current result followed by a line terminator + + + Write the string representation of an Int32 value to the current result followed by a line terminator + + + Write the string representation of an Int64 value to the current result followed by a line terminator + + + Write the string representation of a decimal value to the current result followed by a line terminator + + + Write the string representation of an object to the current result followed by a line terminator + + + Write the string representation of a Single value to the current result followed by a line terminator + + + Write a string to the current result followed by a line terminator + + + Write the string representation of a UInt32 value to the current result followed by a line terminator + + + Write the string representation of a UInt64 value to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + + This method adds the a new ValueFormatterFactory to the + chain of responsibility used for fomatting values in messages. + The scope of the change is the current TestContext. + + The factory delegate + + + + This method provides a simplified way to add a ValueFormatter + delegate to the chain of responsibility, creating the factory + delegate internally. It is useful when the Type of the object + is the only criterion for selection of the formatter, since + it can be used without getting involved with a compould function. + + The type supported by this formatter + The ValueFormatter delegate + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Construct a TestAdapter for a Test + + The Test to be adapted + + + + Gets the unique Id of a test + + + + + The name of the test, which may or may not be + the same as the method name. + + + + + The name of the method representing the test. + + + + + The FullName of the test + + + + + The ClassName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a TestResult + + The TestResult to be adapted + + + + Gets a ResultState representing the outcome of the test. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestFixtureData class represents a set of arguments + and other parameter info to be used for a parameterized + fixture. It is derived from TestFixtureParameters and adds a + fluent syntax for use in initializing the fixture. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Marks the test fixture as explicit. + + + + + Marks the test fixture as explicit, specifying the reason. + + + + + Ignores this TestFixture, specifying the reason. + + The reason. + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected ArgumentException + + + + + Creates a constraint specifying an expected ArgumentNUllException + + + + + Creates a constraint specifying an expected InvalidOperationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Env is a static class that provides some of the features of + System.Environment that are not available under all runtimes + + + + + The newline sequence in the current environment. + + + + + Path to the 'My Documents' folder + + + + + Directory used for file output if not specified on commandline. + + + + + PackageSettings is a static class containing constant values that + are used as keys in setting up a TestPackage. These values are used in + the engine and framework. Setting values may be a string, int or bool. + + + + + Flag (bool) indicating whether tests are being debugged. + + + + + Flag (bool) indicating whether to pause execution of tests to allow + the user to attache a debugger. + + + + + The InternalTraceLevel for this run. Values are: "Default", + "Off", "Error", "Warning", "Info", "Debug", "Verbose". + Default is "Off". "Debug" and "Verbose" are synonyms. + + + + + Full path of the directory to be used for work and result files. + This path is provided to tests by the frameowrk TestContext. + + + + + The name of the config to use in loading a project. + If not specified, the first config found is used. + + + + + Bool indicating whether the engine should determine the private + bin path by examining the paths to all the tests. Defaults to + true unless PrivateBinPath is specified. + + + + + The ApplicationBase to use in loading the tests. If not + specified, and each assembly has its own process, then the + location of the assembly is used. For multiple assemblies + in a single process, the closest common root directory is used. + + + + + Path to the config file to use in running the tests. + + + + + Bool flag indicating whether a debugger should be launched at agent + startup. Used only for debugging NUnit itself. + + + + + Indicates how to load tests across AppDomains. Values are: + "Default", "None", "Single", "Multiple". Default is "Multiple" + if more than one assembly is loaded in a process. Otherwise, + it is "Single". + + + + + The private binpath used to locate assemblies. Directory paths + is separated by a semicolon. It's an error to specify this and + also set AutoBinPath to true. + + + + + The maximum number of test agents permitted to run simultneously. + Ignored if the ProcessModel is not set or defaulted to Multiple. + + + + + Indicates how to allocate assemblies to processes. Values are: + "Default", "Single", "Separate", "Multiple". Default is "Multiple" + for more than one assembly, "Separate" for a single assembly. + + + + + Indicates the desired runtime to use for the tests. Values + are strings like "net-4.5", "mono-4.0", etc. Default is to + use the target framework for which an assembly was built. + + + + + Bool flag indicating that the test should be run in a 32-bit process + on a 64-bit system. By default, NUNit runs in a 64-bit process on + a 64-bit system. Ignored if set on a 32-bit system. + + + + + Indicates that test runners should be disposed after the tests are executed + + + + + Bool flag indicating that the test assemblies should be shadow copied. + Defaults to false. + + + + + Integer value in milliseconds for the default timeout value + for test cases. If not specified, there is no timeout except + as specified by attributes on the tests themselves. + + + + + A TextWriter to which the internal trace will be sent. + + + + + A list of tests to be loaded. + + + + + The number of test threads to run for the assembly. If set to + 1, a single queue is used. If set to 0, tests are executed + directly, without queuing. + + + + + The random seed to be used for this assembly. If specified + as the value reported from a prior run, the framework should + generate identical random values for tests as were used for + that run, provided that no change has been made to the test + assembly. Default is a random value itself. + + + + + If true, execution stops after the first error or failure. + + + + + If true, use of the event queue is suppressed and test events are synchronous. + + + + + If the package represents an assembly, then this is the CLR version + stored in the assembly image. If it represents a project or other + group of assemblies, it is the maximum version for all the assemblies. + + + + + True if any assembly in the package requires running as a 32-bit + process when on a 64-bit system. + + + + + True if any assembly in the package requires a special assembly resolution hook + in the default AppDomain in order to find dependent assemblies. + + + + + The FrameworkName specified on a TargetFrameworkAttribute for the assembly + + + + + A shim of the .NET interface for platforms that do not support it. + Used to indicate that a control can be the target of a callback event on the server. + + + + + Processes a callback event that targets a control. + + + + + + Returns the results of a callback event that targets a control. + + + + + + A shim of the .NET attribute for platforms that do not support it. + + + + diff --git a/packages/NUnit.3.2.0/lib/net20/nunit.framework.dll b/packages/NUnit.3.2.0/lib/net20/nunit.framework.dll new file mode 100644 index 00000000..8fab2097 Binary files /dev/null and b/packages/NUnit.3.2.0/lib/net20/nunit.framework.dll differ diff --git a/packages/NUnit.3.2.0/lib/net20/nunit.framework.xml b/packages/NUnit.3.2.0/lib/net20/nunit.framework.xml new file mode 100644 index 00000000..983282a2 --- /dev/null +++ b/packages/NUnit.3.2.0/lib/net20/nunit.framework.xml @@ -0,0 +1,17212 @@ + + + + nunit.framework + + + + + AssemblyHelper provides static methods for working + with assemblies. + + + + + Gets the path from which the assembly defining a type was loaded. + + The Type. + The path. + + + + Gets the path from which an assembly was loaded. + For builds where this is not possible, returns + the name of the assembly. + + The assembly. + The path. + + + + Gets the path to the directory from which an assembly was loaded. + + The assembly. + The path. + + + + Gets the AssemblyName of an assembly. + + The assembly + An AssemblyName + + + + Loads an assembly given a string, which may be the + path to the assembly or the AssemblyName + + + + + + + Gets the assembly path from code base. + + Public for testing purposes + The code base. + + + + + Interface for logging within the engine + + + + + Logs the specified message at the error level. + + The message. + + + + Logs the specified message at the error level. + + The message. + The arguments. + + + + Logs the specified message at the warning level. + + The message. + + + + Logs the specified message at the warning level. + + The message. + The arguments. + + + + Logs the specified message at the info level. + + The message. + + + + Logs the specified message at the info level. + + The message. + The arguments. + + + + Logs the specified message at the debug level. + + The message. + + + + Logs the specified message at the debug level. + + The message. + The arguments. + + + + InternalTrace provides facilities for tracing the execution + of the NUnit framework. Tests and classes under test may make use + of Console writes, System.Diagnostics.Trace or various loggers and + NUnit itself traps and processes each of them. For that reason, a + separate internal trace is needed. + + Note: + InternalTrace uses a global lock to allow multiple threads to write + trace messages. This can easily make it a bottleneck so it must be + used sparingly. Keep the trace Level as low as possible and only + insert InternalTrace writes where they are needed. + TODO: add some buffering and a separate writer thread as an option. + TODO: figure out a way to turn on trace in specific classes only. + + + + + Gets a flag indicating whether the InternalTrace is initialized + + + + + Initialize the internal trace facility using the name of the log + to be written to and the trace level. + + The log name + The trace level + + + + Initialize the internal trace using a provided TextWriter and level + + A TextWriter + The InternalTraceLevel + + + + Get a named Logger + + + + + + Get a logger named for a particular Type. + + + + + InternalTraceLevel is an enumeration controlling the + level of detailed presented in the internal log. + + + + + Use the default settings as specified by the user. + + + + + Do not display any trace messages + + + + + Display Error messages only + + + + + Display Warning level and higher messages + + + + + Display informational and higher messages + + + + + Display debug messages and higher - i.e. all messages + + + + + Display debug messages and higher - i.e. all messages + + + + + A trace listener that writes to a separate file per domain + and process using it. + + + + + Construct an InternalTraceWriter that writes to a file. + + Path to the file to use + + + + Construct an InternalTraceWriter that writes to a + TextWriter provided by the caller. + + + + + + Returns the character encoding in which the output is written. + + The character encoding in which the output is written. + + + + Writes a character to the text string or stream. + + The character to write to the text stream. + + + + Writes a string to the text string or stream. + + The string to write. + + + + Writes a string followed by a line terminator to the text string or stream. + + The string to write. If is null, only the line terminator is written. + + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. + + + + + Provides internal logging to the NUnit framework + + + + + Initializes a new instance of the class. + + The name. + The log level. + The writer where logs are sent. + + + + Logs the message at error level. + + The message. + + + + Logs the message at error level. + + The message. + The message arguments. + + + + Logs the message at warm level. + + The message. + + + + Logs the message at warning level. + + The message. + The message arguments. + + + + Logs the message at info level. + + The message. + + + + Logs the message at info level. + + The message. + The message arguments. + + + + Logs the message at debug level. + + The message. + + + + Logs the message at debug level. + + The message. + The message arguments. + + + + The ParameterDataProvider class implements IParameterDataProvider + and hosts one or more individual providers. + + + + + Construct with a collection of individual providers + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + Built-in SuiteBuilder for all types of test classes. + + + + + Checks to see if the provided Type is a fixture. + To be considered a fixture, it must be a non-abstract + class with one or more attributes implementing the + IFixtureBuilder interface or one or more methods + marked as tests. + + The fixture type to check + True if the fixture can be built, false if not + + + + Build a TestSuite from TypeInfo provided. + + The fixture type to build + A TestSuite built from that type + + + + We look for attributes implementing IFixtureBuilder at one level + of inheritance at a time. Attributes on base classes are not used + unless there are no fixture builder attributes at all on the derived + class. This is by design. + + The type being examined for attributes + A list of the attributes found. + + + + NUnitTestCaseBuilder is a utility class used by attributes + that build test cases. + + + + + Constructs an + + + + + Builds a single NUnitTestMethod, either as a child of the fixture + or as one of a set of test cases under a ParameterizedTestMethodSuite. + + The MethodInfo from which to construct the TestMethod + The suite or fixture to which the new test will be added + The ParameterSet to be used, or null + + + + + Helper method that checks the signature of a TestMethod and + any supplied parameters to determine if the test is valid. + + Currently, NUnitTestMethods are required to be public, + non-abstract methods, either static or instance, + returning void. They may take arguments but the _values must + be provided or the TestMethod is not considered runnable. + + Methods not meeting these criteria will be marked as + non-runnable and the method will return false in that case. + + The TestMethod to be checked. If it + is found to be non-runnable, it will be modified. + Parameters to be used for this test, or null + True if the method signature is valid, false if not + + The return value is no longer used internally, but is retained + for testing purposes. + + + + + Class that can build a tree of automatic namespace + suites from a group of fixtures. + + + + + NamespaceDictionary of all test suites we have created to represent + namespaces. Used to locate namespace parent suites for fixtures. + + + + + The root of the test suite being created by this builder. + + + + + Initializes a new instance of the class. + + The root suite. + + + + Gets the root entry in the tree created by the NamespaceTreeBuilder. + + The root suite. + + + + Adds the specified fixtures to the tree. + + The fixtures to be added. + + + + Adds the specified fixture to the tree. + + The fixture to be added. + + + + CombinatorialStrategy creates test cases by using all possible + combinations of the parameter data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Provides data from fields marked with the DatapointAttribute or the + DatapointsAttribute. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + Class to build ether a parameterized or a normal NUnitTestMethod. + There are four cases that the builder must deal with: + 1. The method needs no params and none are provided + 2. The method needs params and they are provided + 3. The method needs no params but they are provided in error + 4. The method needs params but they are not provided + This could have been done using two different builders, but it + turned out to be simpler to have just one. The BuildFrom method + takes a different branch depending on whether any parameters are + provided, but all four cases are dealt with in lower-level methods + + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + A Test representing one or more method invocations + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + The test suite being built, to which the new test would be added + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + The test fixture being populated, or null + A Test representing one or more method invocations + + + + Builds a ParameterizedMethodSuite containing individual test cases. + + The method for which a test is to be built. + The list of test cases to include. + A ParameterizedMethodSuite populated with test cases + + + + Build a simple, non-parameterized TestMethod for this method. + + The MethodInfo for which a test is to be built + The test suite for which the method is being built + A TestMethod. + + + + NUnitTestFixtureBuilder is able to build a fixture given + a class marked with a TestFixtureAttribute or an unmarked + class containing test methods. In the first case, it is + called by the attribute and in the second directly by + NUnitSuiteBuilder. + + + + + Build a TestFixture from type provided. A non-null TestSuite + must always be returned, since the method is generally called + because the user has marked the target class as a fixture. + If something prevents the fixture from being used, it should + be returned nonetheless, labelled as non-runnable. + + An ITypeInfo for the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + Overload of BuildFrom called by tests that have arguments. + Builds a fixture using the provided type and information + in the ITestFixtureData object. + + The TypeInfo for which to construct a fixture. + An object implementing ITestFixtureData or null. + + + + + Method to add test cases to the newly constructed fixture. + + The fixture to which cases should be added + + + + Method to create a test case from a MethodInfo and add + it to the fixture being built. It first checks to see if + any global TestCaseBuilder addin wants to build the + test case. If not, it uses the internal builder + collection maintained by this fixture builder. + + The default implementation has no test case builders. + Derived classes should add builders to the collection + in their constructor. + + The method for which a test is to be created + The test suite being built. + A newly constructed Test + + + + PairwiseStrategy creates test cases by combining the parameter + data so that all possible pairs of data items are used. + + + + The number of test cases that cover all possible pairs of test function + parameters values is significantly less than the number of test cases + that cover all possible combination of test function parameters values. + And because different studies show that most of software failures are + caused by combination of no more than two parameters, pairwise testing + can be an effective ways to test the system when it's impossible to test + all combinations of parameters. + + + The PairwiseStrategy code is based on "jenny" tool by Bob Jenkins: + http://burtleburtle.net/bob/math/jenny.html + + + + + + FleaRand is a pseudo-random number generator developed by Bob Jenkins: + http://burtleburtle.net/bob/rand/talksmall.html#flea + + + + + Initializes a new instance of the FleaRand class. + + The seed. + + + + FeatureInfo represents coverage of a single value of test function + parameter, represented as a pair of indices, Dimension and Feature. In + terms of unit testing, Dimension is the index of the test parameter and + Feature is the index of the supplied value in that parameter's list of + sources. + + + + + Initializes a new instance of FeatureInfo class. + + Index of a dimension. + Index of a feature. + + + + A FeatureTuple represents a combination of features, one per test + parameter, which should be covered by a test case. In the + PairwiseStrategy, we are only trying to cover pairs of features, so the + tuples actually may contain only single feature or pair of features, but + the algorithm itself works with triplets, quadruples and so on. + + + + + Initializes a new instance of FeatureTuple class for a single feature. + + Single feature. + + + + Initializes a new instance of FeatureTuple class for a pair of features. + + First feature. + Second feature. + + + + TestCase represents a single test case covering a list of features. + + + + + Initializes a new instance of TestCaseInfo class. + + A number of features in the test case. + + + + PairwiseTestCaseGenerator class implements an algorithm which generates + a set of test cases which covers all pairs of possible values of test + function. + + + + The algorithm starts with creating a set of all feature tuples which we + will try to cover (see method). This set + includes every single feature and all possible pairs of features. We + store feature tuples in the 3-D collection (where axes are "dimension", + "feature", and "all combinations which includes this feature"), and for + every two feature (e.g. "A" and "B") we generate both ("A", "B") and + ("B", "A") pairs. This data structure extremely reduces the amount of + time needed to calculate coverage for a single test case (this + calculation is the most time-consuming part of the algorithm). + + + Then the algorithm picks one tuple from the uncovered tuple, creates a + test case that covers this tuple, and then removes this tuple and all + other tuples covered by this test case from the collection of uncovered + tuples. + + + Picking a tuple to cover + + + There are no any special rules defined for picking tuples to cover. We + just pick them one by one, in the order they were generated. + + + Test generation + + + Test generation starts from creating a completely random test case which + covers, nevertheless, previously selected tuple. Then the algorithm + tries to maximize number of tuples which this test covers. + + + Test generation and maximization process repeats seven times for every + selected tuple and then the algorithm picks the best test case ("seven" + is a magic number which provides good results in acceptable time). + + Maximizing test coverage + + To maximize tests coverage, the algorithm walks thru the list of mutable + dimensions (mutable dimension is a dimension that are not included in + the previously selected tuple). Then for every dimension, the algorithm + walks thru the list of features and checks if this feature provides + better coverage than randomly selected feature, and if yes keeps this + feature. + + + This process repeats while it shows progress. If the last iteration + doesn't improve coverage, the process ends. + + + In addition, for better results, before start every iteration, the + algorithm "scrambles" dimensions - so for every iteration dimension + probes in a different order. + + + + + + Creates a set of test cases for specified dimensions. + + + An array which contains information about dimensions. Each element of + this array represents a number of features in the specific dimension. + + + A set of test cases. + + + + + Gets the test cases generated by this strategy instance. + + A set of test cases. + + + + ParameterDataSourceProvider supplies individual argument _values for + single parameters using attributes implementing IParameterDataSource. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + SequentialStrategy creates test cases by using all of the + parameter data sources in parallel, substituting null + when any of them run out of data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + A base class for multi-part filters + + + + + Constructs an empty CompositeFilter + + + + + Constructs a CompositeFilter from an array of filters + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return a list of the composing filters. + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + PropertyFilter is able to select or exclude tests + based on their properties. + + + + + + Construct a PropertyFilter using a property name and expected value + + A property name + The expected value of the property + + + + Check whether the filter matches a test + + The test to be matched + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + TestName filter selects tests based on their Name + + + + + Construct a TestNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + ClassName filter selects tests based on the class FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a MethodNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + IdFilter selects tests based on their id + + + + + Construct an IdFilter for a single value + + The id the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + ValueMatchFilter selects tests based on some value, which + is expected to be contained in the test. + + + + + Returns the value matched by the filter - used for testing + + + + + Indicates whether the value is a regular expression + + + + + Construct a ValueMatchFilter for a single value. + + The value to be included. + + + + Match the input provided by the derived class + + The value to be matchedT + True for a match, false otherwise. + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + Gets the element name + + Element name + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter + + The filter to be negated + + + + Gets the base filter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + The MethodWrapper class wraps a MethodInfo so that it may + be used in a platform-independent manner. + + + + + Construct a MethodWrapper for a Type and a MethodInfo. + + + + + Construct a MethodInfo for a given Type and method name. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the spcified type are defined on the method. + + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + The ParameterWrapper class wraps a ParameterInfo so that it may + be used in a platform-independent manner. + + + + + Construct a ParameterWrapper for a given method and parameter + + + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter. + + + + + Gets the underlying ParameterInfo + + + + + Gets the Type of the parameter + + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the specified type are defined on the parameter. + + + + + TestNameGenerator is able to create test names according to + a coded pattern. + + + + + Construct a TestNameGenerator + + The pattern used by this generator. + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + The display name + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + Arguments to be used + The display name + + + + Get the display name for a MethodInfo + + A MethodInfo + The display name + + + + Get the display name for a method with args + + A MethodInfo + Argument list for the method + The display name + + + + The TypeWrapper class wraps a Type so it may be used in + a platform-independent manner. + + + + + Construct a TypeWrapper for a specified Type. + + + + + Gets the underlying Type on which this TypeWrapper is based. + + + + + Gets the base type of this type as an ITypeInfo + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Returns true if the Type wrapped is T + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type represents a static class. + + + + + Get the display name for this type + + + + + Get the display name for an object of this type, constructed with the specified args. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns an array of custom attributes of the specified type applied to this type + + + + + Returns a value indicating whether the type has an attribute of the specified type. + + + + + + + + Returns a flag indicating whether this type has a method with an attribute of the specified type. + + + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + SetUpTearDownItem holds the setup and teardown methods + for a single level of the inheritance hierarchy. + + + + + Construct a SetUpTearDownNode + + A list of setup methods for this level + A list teardown methods for this level + + + + Returns true if this level has any methods at all. + This flag is used to discard levels that do nothing. + + + + + Run SetUp on this level. + + The execution context to use for running. + + + + Run TearDown for this level. + + + + + + TestActionCommand runs the BeforeTest actions for a test, + then runs the test and finally runs the AfterTestActions. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TestActionItem represents a single execution of an + ITestAction. It is used to track whether the BeforeTest + method has been called and suppress calling the + AfterTest method if it has not. + + + + + Construct a TestActionItem + + The ITestAction to be included + + + + Run the BeforeTest method of the action and remember that it has been run. + + The test to which the action applies + + + + Run the AfterTest action, but only if the BeforeTest + action was actually run. + + The test to which the action applies + + + + ContextSettingsCommand applies specified changes to the + TestExecutionContext prior to running a test. No special + action is needed after the test runs, since the prior + context will be restored automatically. + + + + + TODO: Documentation needed for class + + + + TODO: Documentation needed for field + + + + TODO: Documentation needed for constructor + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The inner command. + The max time allowed in milliseconds + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext + + The context in which the test should run. + A TestResult + + + + OneTimeSetUpCommand runs any one-time setup methods for a suite, + constructing the user test object if necessary. + + + + + Constructs a OneTimeSetUpCommand for a suite + + The suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run after Setup + + + + Overridden to run the one-time setup for a suite. + + The TestExecutionContext to be used. + A TestResult + + + + OneTimeTearDownCommand performs any teardown actions + specified for a suite and calls Dispose on the user + test object, if any. + + + + + Construct a OneTimeTearDownCommand + + The test suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run before teardown. + + + + Overridden to run the teardown methods specified on the test. + + The TestExecutionContext to be used. + A TestResult + + + + SetUpTearDownCommand runs any SetUp methods for a suite, + runs the test and then runs any TearDown methods. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The test being skipped. + + + + Overridden to simply set the CurrentResult to the + appropriate Skipped state. + + The execution context for the test + A TestResult + + + + TestCommand is the abstract base class for all test commands + in the framework. A TestCommand represents a single stage in + the execution of a test, e.g.: SetUp/TearDown, checking for + Timeout, verifying the returned result from a method, etc. + + TestCommands may decorate other test commands so that the + execution of a lower-level command is nested within that + of a higher level command. All nested commands are executed + synchronously, as a single unit. Scheduling test execution + on separate threads is handled at a higher level, using the + task dispatcher. + + + + + Construct a TestCommand for a test. + + The test to be executed + + + + Gets the test associated with this command. + + + + + Runs the test in a specified context, returning a TestResult. + + The TestExecutionContext to be used for running the test. + A TestResult + + + + TestMethodCommand is the lowest level concrete command + used to run actual test cases. + + + + + Initializes a new instance of the class. + + The test. + + + + Runs the test, saving a TestResult in the execution context, as + well as returning it. If the test has an expected result, it + is asserts on that value. Since failed tests and errors throw + an exception, this command must be wrapped in an outer command, + will handle that exception and records the failure. This role + is usually played by the SetUpTearDown command. + + The execution context + + + + TheoryResultCommand adjusts the result of a Theory so that + it fails if all the results were inconclusive. + + + + + Constructs a TheoryResultCommand + + The command to be wrapped by this one + + + + Overridden to call the inner command and adjust the result + in case all chlid results were inconclusive. + + + + + + + The CommandStage enumeration represents the defined stages + of execution for a series of TestCommands. The int _values + of the enum are used to apply decorators in the proper + order. Lower _values are applied first and are therefore + "closer" to the actual test execution. + + + No CommandStage is defined for actual invocation of the test or + for creation of the context. Execution may be imagined as + proceeding from the bottom of the list upwards, with cleanup + after the test running in the opposite order. + + + + + Use an application-defined default value. + + + + + Make adjustments needed before and after running + the raw test - that is, after any SetUp has run + and before TearDown. + + + + + Run SetUp and TearDown for the test. This stage is used + internally by NUnit and should not normally appear + in user-defined decorators. + + + + + Make adjustments needed before and after running + the entire test - including SetUp and TearDown. + + + + + A utility class to create TestCommands + + + + + Gets the command to be executed before any of + the child tests are run. + + A TestCommand + + + + Gets the command to be executed after all of the + child tests are run. + + A TestCommand + + + + Creates a test command for use in running this test. + + + + + + Creates a command for skipping a test. The result returned will + depend on the test RunState. + + + + + Builds the set up tear down list. + + Type of the fixture. + Type of the set up attribute. + Type of the tear down attribute. + A list of SetUpTearDownItems + + + + An IWorkItemDispatcher handles execution of work items. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + true if the IWorkItemDispatcher should abort all currently running WorkItems, false if it should allow all currently running WorkItems to complete + + + + SimpleWorkItemDispatcher handles execution of WorkItems by + directly executing them. It is provided so that a dispatcher + is always available in the context, thereby simplifying the + code needed to run child tests. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and a thread is created on which to + run it. Subsequent calls come from the top level + item or its descendants on the proper thread. + + The item to dispatch + + + + Cancel (abort or stop) the ongoing run. + If no run is in process, the call has no effect. + + true if the run should be aborted, false if it should allow its currently running test to complete + + + + The TextCapture class intercepts console output and writes it + to the current execution context, if one is present on the thread. + If no execution context is found, the output is written to a + default destination, normally the original destination of the + intercepted output. + + + + + Construct a TextCapture object + + The default destination for non-intercepted output + + + + Gets the Encoding in use by this TextWriter + + + + + Writes a single character + + The char to write + + + + Writes a string + + The string to write + + + + Writes a string followed by a line terminator + + The string to write + + + + The dispatcher needs to do different things at different, + non-overlapped times. For example, non-parallel tests may + not be run at the same time as parallel tests. We model + this using the metaphor of a working shift. The WorkShift + class associates one or more WorkItemQueues with one or + more TestWorkers. + + Work in the queues is processed until all queues are empty + and all workers are idle. Both tests are needed because a + worker that is busy may end up adding more work to one of + the queues. At that point, the shift is over and another + shift may begin. This cycle continues until all the tests + have been run. + + + + + Construct a WorkShift + + + + + Event that fires when the shift has ended + + + + + Gets a flag indicating whether the shift is currently active + + + + + Gets a list of the queues associated with this shift. + + Used for testing + + + + Gets the list of workers associated with this shift. + + + + + Gets a bool indicating whether this shift has any work to do + + + + + Add a WorkItemQueue to the shift, starting it if the + shift is currently active. + + + + + Assign a worker to the shift. + + + + + + Start or restart processing for the shift + + + + + End the shift, pausing all queues and raising + the EndOfShift event. + + + + + Shut down the shift. + + + + + Cancel (abort or stop) the shift without completing all work + + true if the WorkShift should be aborted, false if it should allow its currently running tests to complete + + + + A CompositeWorkItem represents a test suite and + encapsulates the execution of the suite as well + as all its child tests. + + + + + List of Child WorkItems + + + + + A count of how many tests in the work item have a value for the Order Property + + + + + Construct a CompositeWorkItem for executing a test suite + using a filter to select child tests. + + The TestSuite to be executed + A filter used to select child tests + + + + Method that actually performs the work. Overridden + in CompositeWorkItem to do setup, run all child + items and then do teardown. + + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + A signed integer that indicates the relative values of and , as shown in the following table.Value Meaning Less than zero is less than .Zero equals .Greater than zero is greater than . + + The first object to compare.The second object to compare. + + + + Sorts tests under this suite. + + + + + Cancel (abort or stop) a CompositeWorkItem and all of its children + + true if the CompositeWorkItem and all of its children should be aborted, false if it should allow all currently running tests to complete + + + + A simplified implementation of .NET 4 CountdownEvent + for use in earlier versions of .NET. Only the methods + used by NUnit are implemented. + + + + + Construct a CountdownEvent + + The initial count + + + + Gets the initial count established for the CountdownEvent + + + + + Gets the current count remaining for the CountdownEvent + + + + + Decrement the count by one + + + + + Block the thread until the count reaches zero + + + + + The EventPumpState enum represents the state of an + EventPump. + + + + + The pump is stopped + + + + + The pump is pumping events with no stop requested + + + + + The pump is pumping events but a stop has been requested + + + + + EventPump pulls events out of an EventQueue and sends + them to a listener. It is used to send events back to + the client without using the CallContext of the test + runner thread. + + + + + The handle on which a thread enqueuing an event with == true + waits, until the EventPump has sent the event to its listeners. + + + + + The downstream listener to which we send events + + + + + The queue that holds our events + + + + + Thread to do the pumping + + + + + The current state of the eventpump + + + + + Constructor + + The EventListener to receive events + The event queue to pull events from + + + + Gets or sets the current state of the pump + + + On volatile and , see + "http://www.albahari.com/threading/part4.aspx". + + + + + Gets or sets the name of this EventPump + (used only internally and for testing). + + + + + Dispose stops the pump + Disposes the used WaitHandle, too. + + + + + Start the pump + + + + + Tell the pump to stop after emptying the queue. + + + + + Our thread proc for removing items from the event + queue and sending them on. Note that this would + need to do more locking if any other thread were + removing events from the queue. + + + + + NUnit.Core.Event is the abstract base for all stored events. + An Event is the stored representation of a call to the + ITestListener interface and is used to record such calls + or to queue them for forwarding on another thread or at + a later time. + + + + + The Send method is implemented by derived classes to send the event to the specified listener. + + The listener. + + + + Gets a value indicating whether this event is delivered synchronously by the NUnit . + + If true, and if has been used to + set a WaitHandle, blocks its calling thread until the + thread has delivered the event and sets the WaitHandle. + + + + + + TestStartedEvent holds information needed to call the TestStarted method. + + + + + Initializes a new instance of the class. + + The test. + + + + Calls TestStarted on the specified listener. + + The listener. + + + + TestFinishedEvent holds information needed to call the TestFinished method. + + + + + Initializes a new instance of the class. + + The result. + + + + Calls TestFinished on the specified listener. + + The listener. + + + + Implements a queue of work items each of which + is queued as a WaitCallback. + + + + + Construct a new EventQueue + + + + + WaitHandle for synchronous event delivery in . + + Having just one handle for the whole implies that + there may be only one producer (the test thread) for synchronous events. + If there can be multiple producers for synchronous events, one would have + to introduce one WaitHandle per event. + + + + + + Gets the count of items in the queue. + + + + + Sets a handle on which to wait, when is called + for an with == true. + + + The wait handle on which to wait, when is called + for an with == true. + The caller is responsible for disposing this wait handle. + + + + + Enqueues the specified event + + The event to enqueue. + + + + Removes the first element from the queue and returns it (or null). + + + If true and the queue is empty, the calling thread is blocked until + either an element is enqueued, or is called. + + + + + If the queue not empty + the first element. + + + otherwise, if ==false + or has been called + null. + + + + + + + Stop processing of the queue + + + + + QueuingEventListener uses an EventQueue to store any + events received on its EventListener interface. + + + + + The EvenQueue created and filled by this listener + + + + + A test has started + + The test that is starting + + + + A test case finished + + Result of the test case + + + + A SimpleWorkItem represents a single test case and is + marked as completed immediately upon execution. This + class is also used for skipped or ignored test suites. + + + + + Construct a simple work item for a test. + + The test to be executed + The filter used to select this test + + + + Method that performs actually performs the work. + + + + + A TestWorker pulls work items from a queue + and executes them. + + + + + Event signaled immediately before executing a WorkItem + + + + + Event signaled immediately after executing a WorkItem + + + + + Construct a new TestWorker. + + The queue from which to pull work items + The name of this worker + The apartment state to use for running tests + + + + The name of this worker - also used for the thread + + + + + Indicates whether the worker thread is running + + + + + Our ThreadProc, which pulls and runs tests in a loop + + + + + Start processing work items. + + + + + Stop the thread, either immediately or after finishing the current WorkItem + + true if the thread should be aborted, false if it should allow the currently running test to complete + + + + A WorkItem may be an individual test case, a fixture or + a higher level grouping of tests. All WorkItems inherit + from the abstract WorkItem class, which uses the template + pattern to allow derived classes to perform work in + whatever way is needed. + + A WorkItem is created with a particular TestExecutionContext + and is responsible for re-establishing that context in the + current thread before it begins or resumes execution. + + + + + Creates a work item. + + The test for which this WorkItem is being created. + The filter to be used in selecting any child Tests. + + + + + Construct a WorkItem for a particular test. + + The test that the WorkItem will run + + + + Initialize the TestExecutionContext. This must be done + before executing the WorkItem. + + + Originally, the context was provided in the constructor + but delaying initialization of the context until the item + is about to be dispatched allows changes in the parent + context during OneTimeSetUp to be reflected in the child. + + The TestExecutionContext to use + + + + Event triggered when the item is complete + + + + + Gets the current state of the WorkItem + + + + + The test being executed by the work item + + + + + The execution context + + + + + The test actions to be performed before and after this test + + + + + Indicates whether this WorkItem may be run in parallel + + + + + The test result + + + + + Execute the current work item, including any + child work items. + + + + + Cancel (abort or stop) a WorkItem + + true if the WorkItem should be aborted, false if it should run to completion + + + + Method that performs actually performs the work. It should + set the State to WorkItemState.Complete when done. + + + + + Method called by the derived class when all work is complete + + + + + ParallelWorkItemDispatcher handles execution of work items by + queuing them for worker threads to process. + + + + + Construct a ParallelWorkItemDispatcher + + Number of workers to use + + + + Enumerates all the shifts supported by the dispatcher + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + + + + WorkItemQueueState indicates the current state of a WorkItemQueue + + + + + The queue is paused + + + + + The queue is running + + + + + The queue is stopped + + + + + A WorkItemQueue holds work items that are ready to + be run, either initially or after some dependency + has been satisfied. + + + + + Initializes a new instance of the class. + + The name of the queue. + + + + Gets the name of the work item queue. + + + + + Gets the total number of items processed so far + + + + + Gets the maximum number of work items. + + + + + Gets the current state of the queue + + + + + Get a bool indicating whether the queue is empty. + + + + + Enqueue a WorkItem to be processed + + The WorkItem to process + + + + Dequeue a WorkItem for processing + + A WorkItem or null if the queue has stopped + + + + Start or restart processing of items from the queue + + + + + Signal the queue to stop + + + + + Pause the queue for restarting later + + + + + The current state of a work item + + + + + Ready to run or continue + + + + + Work Item is executing + + + + + Complete + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Gets or sets the maximum line length for this writer + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a given + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The result of the constraint that failed + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The ConstraintResult for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + GenericMethodHelper is able to deduce the Type arguments for + a generic method from the actual arguments provided. + + + + + Construct a GenericMethodHelper for a method + + MethodInfo for the method to examine + + + + Return the type argments for the method, deducing them + from the arguments actually provided. + + The arguments to the method + An array of type arguments. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + Randomizer returns a set of random _values in a repeatable + way, to allow re-running of tests if necessary. It extends + the .NET Random class, providing random values for a much + wider range of types. + + The class is used internally by the framework to generate + test case data and is also exposed for use by users through + the TestContext.Random property. + + + For consistency with the underlying Random Type, methods + returning a single value use the prefix "Next..." Those + without an argument return a non-negative value up to + the full positive range of the Type. Overloads are provided + for specifying a maximum or a range. Methods that return + arrays or strings use the prefix "Get..." to avoid + confusion with the single-value methods. + + + + + Initial seed used to create randomizers for this run + + + + + Get a Randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same _values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Create a new Randomizer using the next seed + available to ensure that each randomizer gives + a unique sequence of values. + + + + + + Default constructor + + + + + Construct based on seed value + + + + + + Returns a random unsigned int. + + + + + Returns a random unsigned int less than the specified maximum. + + + + + Returns a random unsigned int within a specified range. + + + + + Returns a non-negative random short. + + + + + Returns a non-negative random short less than the specified maximum. + + + + + Returns a non-negative random short within a specified range. + + + + + Returns a random unsigned short. + + + + + Returns a random unsigned short less than the specified maximum. + + + + + Returns a random unsigned short within a specified range. + + + + + Returns a random long. + + + + + Returns a random long less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random ulong. + + + + + Returns a random ulong less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random Byte + + + + + Returns a random Byte less than the specified maximum. + + + + + Returns a random Byte within a specified range + + + + + Returns a random SByte + + + + + Returns a random sbyte less than the specified maximum. + + + + + Returns a random sbyte within a specified range + + + + + Returns a random bool + + + + + Returns a random bool based on the probablility a true result + + + + + Returns a random double between 0.0 and the specified maximum. + + + + + Returns a random double within a specified range. + + + + + Returns a random float. + + + + + Returns a random float between 0.0 and the specified maximum. + + + + + Returns a random float within a specified range. + + + + + Returns a random enum value of the specified Type as an object. + + + + + Returns a random enum value of the specified Type. + + + + + Default characters for random functions. + + Default characters are the English alphabet (uppercase & lowercase), arabic numerals, and underscore + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + string representing the set of characters from which to construct the resulting string + A random string of arbitrary length + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + A random string of arbitrary length + Uses DefaultStringChars as the input character set + + + + Generate a random string based on the characters from the input string. + + A random string of the default length + Uses DefaultStringChars as the input character set + + + + Returns a random decimal. + + + + + Returns a random decimal between positive zero and the specified maximum. + + + + + Returns a random decimal within a specified range, which is not + permitted to exceed decimal.MaxVal in the current implementation. + + + A limitation of this implementation is that the range from min + to max must not exceed decimal.MaxVal. + + + + + StackFilter class is used to remove internal NUnit + entries from a stack trace so that the resulting + trace provides better information about the test. + + + + + Filters a raw stack trace and returns the result. + + The original stack trace + A filtered stack trace + + + + Provides methods to support legacy string comparison methods. + + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + Zero if the strings are equivalent, a negative number if strA is sorted first, a positive number if + strB is sorted first + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + True if the strings are equivalent, false if not. + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + Type arguments used to create a generic fixture instance + + + + + TestParameters is the abstract base class for all classes + that know how to provide data for constructing a test. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a ParameterSet from an object implementing ITestData + + + + + + The RunState for this set of parameters. + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets the property dictionary for this test + + + + + Applies ParameterSet _values to the test itself. + + A test. + + + + The original arguments provided by the user, + used for display purposes. + + + + + Enumeration indicating whether the tests are + running normally or being cancelled. + + + + + Running normally with no stop requested + + + + + A graceful stop has been requested + + + + + A forced stop has been requested + + + + + The PropertyNames class provides static constants for the + standard property ids that NUnit uses on tests. + + + + + The FriendlyName of the AppDomain in which the assembly is running + + + + + The selected strategy for joining parameter data into test cases + + + + + The process ID of the executing assembly + + + + + The stack trace from any data provider that threw + an exception. + + + + + The reason a test was not run + + + + + The author of the tests + + + + + The ApartmentState required for running the test + + + + + The categories applying to a test + + + + + The Description of a test + + + + + The number of threads to be used in running tests + + + + + The maximum time in ms, above which the test is considered to have failed + + + + + The ParallelScope associated with a test + + + + + The number of times the test should be repeated + + + + + Indicates that the test should be run on a separate thread + + + + + The culture to be set for a test + + + + + The UI culture to be set for a test + + + + + The type that is under test + + + + + The timeout value for the test + + + + + The test will be ignored until the given date + + + + + The optional Order the test will run in + + + + + CultureDetector is a helper class used by NUnit to determine + whether a test should be run based on the current culture. + + + + + Default constructor uses the current culture. + + + + + Construct a CultureDetector for a particular culture for testing. + + The culture to be used + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + Tests to determine if the current culture is supported + based on a culture attribute. + + The attribute to examine + + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + ExceptionHelper provides static methods for working with exceptions + + + + + Rethrows an exception, preserving its stack trace + + The exception to rethrow + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined message string. + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined stack trace. + + + + Gets the stack trace of the exception. + + The exception. + A string representation of the stack trace. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + Thrown when an assertion failed. Here to preserve the inner + exception and hence its stack trace. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + OSPlatform represents a particular operating system platform + + + + + Platform ID for Unix as defined by Microsoft .NET 2.0 and greater + + + + + Platform ID for Unix as defined by Mono + + + + + Platform ID for XBox as defined by .NET and Mono, but not CF + + + + + Platform ID for MacOSX as defined by .NET and Mono, but not CF + + + + + Get the OSPlatform under which we are currently running + + + + + Gets the actual OS Version, not the incorrect value that might be + returned for Win 8.1 and Win 10 + + + If an application is not manifested as Windows 8.1 or Windows 10, + the version returned from Environment.OSVersion will not be 6.3 and 10.0 + respectively, but will be 6.2 and 6.3. The correct value can be found in + the registry. + + The original version + The correct OS version + + + + Product Type Enumeration used for Windows + + + + + Product type is unknown or unspecified + + + + + Product type is Workstation + + + + + Product type is Domain Controller + + + + + Product type is Server + + + + + Construct from a platform ID and version + + + + + Construct from a platform ID, version and product type + + + + + Get the platform ID of this instance + + + + + Get the Version of this instance + + + + + Get the Product Type of this instance + + + + + Return true if this is a windows platform + + + + + Return true if this is a Unix or Linux platform + + + + + Return true if the platform is Win32S + + + + + Return true if the platform is Win32Windows + + + + + Return true if the platform is Win32NT + + + + + Return true if the platform is Windows CE + + + + + Return true if the platform is Xbox + + + + + Return true if the platform is MacOSX + + + + + Return true if the platform is Windows 95 + + + + + Return true if the platform is Windows 98 + + + + + Return true if the platform is Windows ME + + + + + Return true if the platform is NT 3 + + + + + Return true if the platform is NT 4 + + + + + Return true if the platform is NT 5 + + + + + Return true if the platform is Windows 2000 + + + + + Return true if the platform is Windows XP + + + + + Return true if the platform is Windows 2003 Server + + + + + Return true if the platform is NT 6 + + + + + Return true if the platform is NT 6.0 + + + + + Return true if the platform is NT 6.1 + + + + + Return true if the platform is NT 6.2 + + + + + Return true if the platform is NT 6.3 + + + + + Return true if the platform is Vista + + + + + Return true if the platform is Windows 2008 Server (original or R2) + + + + + Return true if the platform is Windows 2008 Server (original) + + + + + Return true if the platform is Windows 2008 Server R2 + + + + + Return true if the platform is Windows 2012 Server (original or R2) + + + + + Return true if the platform is Windows 2012 Server (original) + + + + + Return true if the platform is Windows 2012 Server R2 + + + + + Return true if the platform is Windows 7 + + + + + Return true if the platform is Windows 8 + + + + + Return true if the platform is Windows 8.1 + + + + + Return true if the platform is Windows 10 + + + + + Return true if the platform is Windows Server. This is named Windows + Server 10 to distinguish it from previous versions of Windows Server. + + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + The expected result to be returned + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + The expected result of the test, which + must match the method return type. + + + + + Gets a value indicating whether an expected result was specified. + + + + + PlatformHelper class is used by the PlatformAttribute class to + determine whether a platform is supported. + + + + + Comma-delimited list of all supported OS platform constants + + + + + Comma-delimited list of all supported Runtime platform constants + + + + + Default constructor uses the operating system and + common language runtime of the system. + + + + + Construct a PlatformHelper for a particular operating + system and common language runtime. Used in testing. + + OperatingSystem to be used + RuntimeFramework to be used + + + + Test to determine if one of a collection of platforms + is being used currently. + + + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Test to determine if the a particular platform or comma- + delimited set of platforms is in use. + + Name of the platform or comma-separated list of platform ids + True if the platform is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + A PropertyBag represents a collection of name value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + + + + Adds a key/value pair to the property set + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + + True if their are _values present, otherwise false + + + + + Gets a collection containing all the keys in the property set + + + + + + Gets or sets the list of _values for a particular key + + + + + Returns an XmlNode representating the current PropertyBag. + + Not used + An XmlNode representing the PropertyBag + + + + Returns an XmlNode representing the PropertyBag after + adding it as a child of the supplied parent node. + + The parent node. + Not used + + + + + Helper methods for inspecting a type by reflection. + + Many of these methods take ICustomAttributeProvider as an + argument to avoid duplication, even though certain attributes can + only appear on specific types of members, like MethodInfo or Type. + + In the case where a type is being examined for the presence of + an attribute, interface or named member, the Reflect methods + operate with the full name of the member being sought. This + removes the necessity of the caller having a reference to the + assembly that defines the item being sought and allows the + NUnit core to inspect assemblies that reference an older + version of the NUnit framework. + + + + + Examine a fixture type and return an array of methods having a + particular attribute. The array is order with base methods first. + + The type to examine + The attribute Type to look for + Specifies whether to search the fixture type inheritance chain + The array of methods found + + + + Examine a fixture type and return true if it has a method with + a particular attribute. + + The type to examine + The attribute Type to look for + True if found, otherwise false + + + + Invoke the default constructor on a Type + + The Type to be constructed + An instance of the Type + + + + Invoke a constructor on a Type with arguments + + The Type to be constructed + Arguments to the constructor + An instance of the Type + + + + Returns an array of types from an array of objects. + Used because the compact framework doesn't support + Type.GetTypeArray() + + An array of objects + An array of Types + + + + Invoke a parameterless method returning void on an object. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + + + + Invoke a method, converting any TargetInvocationException to an NUnitException. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The TestResult class represents the result of a test. + + + + + Error message for when child tests have errors + + + + + Error message for when child tests are ignored + + + + + The minimum duration for tests + + + + + List of child results + + + + + Construct a test result given a Test + + The test to be used + + + + Gets the test with which this result is associated. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets or sets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Test HasChildren before accessing Children to avoid + the creation of an empty collection. + + + + + Gets the collection of child results. + + + + + Gets a TextWriter, which will write output to be included in the result. + + + + + Gets any text output written to this result. + + + + + Returns the Xml representation of the result. + + If true, descendant results are included + An XmlNode representing the result + + + + Adds the XML representation of the result as a child of the + supplied parent node.. + + The parent node. + If true, descendant results are included + + + + + Adds a child result to this result, setting this result's + ResultState to Failure if the child result failed. + + The result to be added + + + + Set the result of the test + + The ResultState to use in the result + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + Stack trace giving the location of the command + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + THe FailureSite to use in the result + + + + RecordTearDownException appends the message and stacktrace + from an exception arising during teardown of the test + to any previously recorded information, so that any + earlier failure information is not lost. Note that + calling Assert.Ignore, Assert.Inconclusive, etc. during + teardown is treated as an error. If the current result + represents a suite, it may show a teardown error even + though all contained tests passed. + + The Exception to be recorded + + + + Adds a reason element to a node and returns it. + + The target node. + The new reason element. + + + + Adds a failure element to a node and returns it. + + The target node. + The new failure element. + + + + Enumeration identifying a common language + runtime implementation. + + + + Any supported runtime framework + + + Microsoft .NET Framework + + + Microsoft .NET Compact Framework + + + Microsoft Shared Source CLI + + + Mono + + + Silverlight + + + MonoTouch + + + + RuntimeFramework represents a particular version + of a common language runtime implementation. + + + + + DefaultVersion is an empty Version, used to indicate that + NUnit should select the CLR version to use for the test. + + + + + Construct from a runtime type and version. If the version has + two parts, it is taken as a framework version. If it has three + or more, it is taken as a CLR version. In either case, the other + version is deduced based on the runtime type and provided version. + + The runtime type of the framework + The version of the framework + + + + Static method to return a RuntimeFramework object + for the framework that is currently in use. + + + + + The type of this runtime framework + + + + + The framework version for this runtime framework + + + + + The CLR version for this runtime framework + + + + + Return true if any CLR version may be used in + matching this RuntimeFramework object. + + + + + Returns the Display name for this framework + + + + + Parses a string representing a RuntimeFramework. + The string may be just a RuntimeType name or just + a Version or a hyphenated RuntimeType-Version or + a Version prefixed by 'versionString'. + + + + + + + Overridden to return the short name of the framework + + + + + + Returns true if the current framework matches the + one supplied as an argument. Two frameworks match + if their runtime types are the same or either one + is RuntimeType.Any and all specified version components + are equal. Negative (i.e. unspecified) version + components are ignored. + + The RuntimeFramework to be matched. + True on match, otherwise false + + + + Helper class used to save and restore certain static or + singleton settings in the environment that affect tests + or which might be changed by the user tests. + + An internal class is used to hold settings and a stack + of these objects is pushed and popped as Save and Restore + are called. + + + + + Link to a prior saved context + + + + + Indicates that a stop has been requested + + + + + The event listener currently receiving notifications + + + + + The number of assertions for the current test + + + + + The current culture + + + + + The current UI culture + + + + + The current test result + + + + + The current Principal. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + An existing instance of TestExecutionContext. + + + + The current context, head of the list of saved contexts. + + + + + Gets the current context. + + The current context. + + + + Get the current context or return null if none is found. + + + + + Clear the current context. This is provided to + prevent "leakage" of the CallContext containing + the current context back to any runners. + + + + + Gets or sets the current test + + + + + The time the current test started execution + + + + + The time the current test started in Ticks + + + + + Gets or sets the current test result + + + + + Gets a TextWriter that will send output to the current test result. + + + + + The current test object - that is the user fixture + object on which tests are being executed. + + + + + Get or set the working directory + + + + + Get or set indicator that run should stop on the first error + + + + + Gets an enum indicating whether a stop has been requested. + + + + + The current test event listener + + + + + The current WorkItemDispatcher + + + + + The ParallelScope to be used by tests running in this context. + For builds with out the parallel feature, it has no effect. + + + + + Gets the RandomGenerator specific to this Test + + + + + Gets the assert count. + + The assert count. + + + + Gets or sets the test case timeout value + + + + + Gets a list of ITestActions set by upstream tests + + + + + Saves or restores the CurrentCulture + + + + + Saves or restores the CurrentUICulture + + + + + Gets or sets the current for the Thread. + + + + + The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter + + + + + Record any changes in the environment made by + the test code in the execution context so it + will be passed on to lower level tests. + + + + + Set up the execution environment to match a context. + Note that we may be running on the same thread where the + context was initially created or on a different thread. + + + + + Increments the assert count by one. + + + + + Increments the assert count by a specified amount. + + + + + Adds a new ValueFormatterFactory to the chain of formatters + + The new factory + + + + Obtain lifetime service object + + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Indicates whether this is a top-level filter, + not contained in any other filter. + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. This is overridden by each + different type of filter to perform the necessary tests. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test matches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Create a TestFilter instance from an xml representation. + + + + + Create a TestFilter from it's TNode representation + + + + + Nested class provides an empty filter - one that always + returns true when called. It never matches explicitly. + + + + + Adds an XML node + + True if recursive + The added XML node + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + TestListener provides an implementation of ITestListener that + does nothing. It is used only through its NULL property. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test case has finished + + The result of the test + + + + Construct a new TestListener - private so it may not be used. + + + + + Get a listener that does nothing + + + + + TestProgressReporter translates ITestListener events into + the async callbacks that are used to inform the client + software about the progress of a test run. + + + + + Initializes a new instance of the class. + + The callback handler to be used for reporting progress. + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished. Sends a result summary to the callback. + to + + The result of the test + + + + Returns the parent test item for the targer test item if it exists + + + parent test item + + + + Makes a string safe for use as an attribute, replacing + characters characters that can't be used with their + corresponding xml representations. + + The string to be used + A new string with the _values replaced + + + + ParameterizedFixtureSuite serves as a container for the set of test + fixtures created from a given Type using various parameters. + + + + + Initializes a new instance of the class. + + The ITypeInfo for the type that represents the suite. + + + + Gets a string representing the type of test + + + + + + ParameterizedMethodSuite holds a collection of individual + TestMethods with their arguments applied. + + + + + Construct from a MethodInfo + + + + + + Gets a string representing the type of test + + + + + + SetUpFixture extends TestSuite and supports + Setup and TearDown methods. + + + + + Initializes a new instance of the class. + + The type. + + + + The Test abstract class represents a test within the framework. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + The SetUp methods. + + + + + The teardown methods + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + TODO: Documentation needed for constructor + + + + + + Construct a test from a MethodInfo + + + + + + Gets or sets the id of the test + + + + + + Gets or sets the name of the test + + + + + Gets or sets the fully qualified name of the test + + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the TypeInfo of the fixture used in running this test + or null if no fixture type is associated with it. + + + + + Gets a MethodInfo for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Whether or not the test should be run + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Gets a string representing the type of test. Used as an attribute + value in the XML representation of a test and has no other + function in the framework. + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets the properties for this test + + + + + Returns true if this is a TestSuite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets or sets a fixture object for running this test. + + + + + Static prefix used for ids in this AppDomain. + Set by FrameworkController. + + + + + Gets or Sets the Int value representing the seed for the RandomGenerator + + + + + + Creates a TestResult for this test. + + A TestResult suitable for this type of test. + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object implementing ICustomAttributeProvider + + + + Add standard attributes and members to a test node. + + + + + + + Returns the Xml representation of the test + + If true, include child tests recursively + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + TestAssembly is a TestSuite that represents the execution + of tests in a managed assembly. + + + + + Initializes a new instance of the class + specifying the Assembly and the path from which it was loaded. + + The assembly this test represents. + The path used to load the assembly. + + + + Initializes a new instance of the class + for a path which could not be loaded. + + The path used to load the assembly. + + + + Gets the Assembly represented by this instance. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + TestFixture is a surrogate for a user test fixture class, + containing one or more tests. + + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + The TestMethod class represents a Test implemented as a method. + + + + + The ParameterSet used to create this test method + + + + + Initializes a new instance of the class. + + The method to be used as a test. + + + + Initializes a new instance of the class. + + The method to be used as a test. + The suite or fixture to which the new test will be added + + + + Overridden to return a TestCaseResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Returns a TNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Gets this test's child tests + + A list of child tests + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns the name of the method + + + + + TestSuite represents a composite test, which contains other tests. + + + + + Our collection of child tests + + + + + Initializes a new instance of the class. + + The name of the suite. + + + + Initializes a new instance of the class. + + Name of the parent suite. + The name of the suite. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Sorts tests under this suite. + + + + + Adds a test to the suite. + + The test. + + + + Gets this test's child tests + + The list of child tests + + + + Gets a count of test cases represented by + or contained under this test. + + + + + + The arguments to use in creating the fixture + + + + + Set to true to suppress sorting this suite's contents + + + + + Overridden to return a TestSuiteResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Check that setup and teardown methods marked by certain attributes + meet NUnit's requirements and mark the tests not runnable otherwise. + + The attribute type to check for + + + + ThreadUtility provides a set of static methods convenient + for working with threads. + + + + + Do our best to Kill a thread + + The thread to kill + + + + Do our best to kill a thread, passing state info + + The thread to kill + Info for the ThreadAbortException handler + + + + TypeHelper provides static methods that operate on Types. + + + + + A special value, which is used to indicate that BestCommonType() method + was unable to find a common type for the specified arguments. + + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The display name for the Type + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The arglist provided. + The display name for the Type + + + + Returns the best fit for a common type to be used in + matching actual arguments to a methods Type parameters. + + The first type. + The second type. + Either type1 or type2, depending on which is more general. + + + + Determines whether the specified type is numeric. + + The type to be examined. + + true if the specified type is numeric; otherwise, false. + + + + + Convert an argument list to the required parameter types. + Currently, only widening numeric conversions are performed. + + An array of args to be converted + A ParameterInfo[] whose types will be used as targets + + + + Determines whether this instance can deduce type args for a generic type from the supplied arguments. + + The type to be examined. + The arglist. + The type args to be used. + + true if this the provided args give sufficient information to determine the type args to be used; otherwise, false. + + + + + Gets the _values for an enumeration, using Enum.GetTypes + where available, otherwise through reflection. + + + + + + + Gets the ids of the _values for an enumeration, + using Enum.GetNames where available, otherwise + through reflection. + + + + + + + Represents the result of running a single test case. + + + + + Construct a TestCaseResult based on a TestMethod + + A TestMethod to which the result applies. + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Represents the result of running a test suite + + + + + Construct a TestSuiteResult base on a TestSuite + + The TestSuite to which the result applies + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Add a child result + + The child result to be added + + + + Provides a platform-independent methods for getting attributes + for use by AttributeConstraint and AttributeExistsConstraint. + + + + + Gets the custom attributes from the given object. + + Portable libraries do not have an ICustomAttributeProvider, so we need to cast to each of + it's direct subtypes and try to get attributes off those instead. + The actual. + Type of the attribute. + if set to true [inherit]. + A list of the given attribute on the given object. + + + + A MarshalByRefObject that lives forever + + + + + Obtains a lifetime service object to control the lifetime policy for this instance. + + + + + Provides NUnit specific extensions to aid in Reflection + across multiple frameworks + + + This version of the class supplies GetTypeInfo() on platforms + that don't support it. + + + + + GetTypeInfo gives access to most of the Type information we take for granted + on .NET Core and Windows Runtime. Rather than #ifdef different code for different + platforms, it is easiest to just code all platforms as if they worked this way, + thus the simple passthrough. + + + + + + + Extensions for Assembly that are not available in pre-4.5 .NET releases + + + + + An easy way to get a single custom attribute from an assembly + + The attribute Type + The assembly + An attribute of Type T + + + + This class is a System.Diagnostics.Stopwatch on operating systems that support it. On those that don't, + it replicates the functionality at the resolution supported. + + + + + Class used to guard against unexpected argument values + or operations by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Throws an ArgumentOutOfRangeException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an ArgumentException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an InvalidOperationException if the specified condition is not met. + + The condition that must be met + The exception message to be used + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + FrameworkController provides a facade for use in loading, browsing + and running tests without requiring a reference to the NUnit + framework. All calls are encapsulated in constructors for + this class and its nested classes, which only require the + types of the Common Type System as arguments. + + The controller supports four actions: Load, Explore, Count and Run. + They are intended to be called by a driver, which should allow for + proper sequencing of calls. Load must be called before any of the + other actions. The driver may support other actions, such as + reload on run, by combining these calls. + + + + + Construct a FrameworkController using the default builder and runner. + + The AssemblyName or path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController using the default builder and runner. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The full AssemblyName or the path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Gets the ITestAssemblyBuilder used by this controller instance. + + The builder. + + + + Gets the ITestAssemblyRunner used by this controller instance. + + The runner. + + + + Gets the AssemblyName or the path for which this FrameworkController was created + + + + + Gets the Assembly for which this + + + + + Gets a dictionary of settings for the FrameworkController + + + + + Loads the tests in the assembly + + + + + + Returns info about the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of exploring the tests + + + + Runs the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Stops the test run + + True to force the stop, false for a cooperative stop + + + + Counts the number of test cases in the loaded TestSuite + + A string containing the XML representation of the filter to use + The number of tests + + + + Inserts environment element + + Target node + The new node + + + + Inserts settings element + + Target node + Settings dictionary + The new node + + + + FrameworkControllerAction is the base class for all actions + performed against a FrameworkController. + + + + + LoadTestsAction loads a test into the FrameworkController + + + + + LoadTestsAction loads the tests in an assembly. + + The controller. + The callback handler. + + + + ExploreTestsAction returns info about the tests in an assembly + + + + + Initializes a new instance of the class. + + The controller for which this action is being performed. + Filter used to control which tests are included (NYI) + The callback handler. + + + + CountTestsAction counts the number of test cases in the loaded TestSuite + held by the FrameworkController. + + + + + Construct a CountsTestAction and perform the count of test cases. + + A FrameworkController holding the TestSuite whose cases are to be counted + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunTestsAction runs the loaded TestSuite held by the FrameworkController. + + + + + Construct a RunTestsAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunAsyncAction initiates an asynchronous test run, returning immediately + + + + + Construct a RunAsyncAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + StopRunAction stops an ongoing run. + + + + + Construct a StopRunAction and stop any ongoing run. If no + run is in process, no error is raised. + + The FrameworkController for which a run is to be stopped. + True the stop should be forced, false for a cooperative stop. + >A callback handler used to report results + A forced stop will cause threads and processes to be killed as needed. + + + + Implementation of ITestAssemblyRunner + + + + + Initializes a new instance of the class. + + The builder. + + + + Gets the default level of parallel execution (worker threads) + + + + + The tree of tests that was loaded by the builder + + + + + The test result, if a run has completed + + + + + Indicates whether a test is loaded + + + + + Indicates whether a test is running + + + + + Indicates whether a test run is complete + + + + + Our settings, specified when loading the assembly + + + + + The top level WorkItem created for the assembly as a whole + + + + + The TestExecutionContext for the top level WorkItem + + + + + Loads the tests found in an Assembly + + File name of the assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Loads the tests found in an Assembly + + The assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + RunAsync is a template method, calling various abstract and + virtual methods to be overridden by derived classes. + + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Initiate the test run. + + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any tests that are currently running + + + + Create the initial TestExecutionContext used to run tests + + The ITestListener specified in the RunAsync call + + + + Handle the the Completed event for the top level work item + + + + + The ITestAssemblyBuilder interface is implemented by a class + that is able to build a suite of tests given an assembly or + an assembly filename. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + The ITestAssemblyRunner interface is implemented by classes + that are able to execute a suite of tests loaded + from an assembly. + + + + + Gets the tree of loaded tests, or null if + no tests have been loaded. + + + + + Gets the tree of test results, if the test + run is completed, otherwise null. + + + + + Indicates whether a test has been loaded + + + + + Indicates whether a test is currently running + + + + + Indicates whether a test run is complete + + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + File name of the assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + The assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive ITestListener notifications. + A test filter used to select tests to be run + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any test-running threads + + + + DefaultTestAssemblyBuilder loads a single assembly and builds a TestSuite + containing test fixtures present in the assembly. + + + + + The default suite builder used by the test assembly builder. + + + + + Initializes a new instance of the class. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Marks a test that must run in a particular threading apartment state, causing it + to run in a separate thread if necessary. + + + + + Construct an ApartmentAttribute + + The apartment state that this test must be run under. You must pass in a valid apartment state. + + + + Provides the Author of a test or test fixture. + + + + + Initializes a new instance of the class. + + The name of the author. + + + + Initializes a new instance of the class. + + The name of the author. + The email address of the author. + + + + Marks a test to use a particular CombiningStrategy to join + any parameter data provided. Since this is the default, the + attribute is optional. + + + + + Construct a CombiningStrategyAttribute incorporating an + ICombiningStrategy and an IParamterDataProvider. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct a CombiningStrategyAttribute incorporating an object + that implements ICombiningStrategy and an IParameterDataProvider. + This constructor is provided for CLS compliance. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Modify the test by adding the name of the combining strategy + to the properties. + + The test to modify + + + + TestAssemblyDirectoryResolveAttribute is used to mark a test assembly as needing a + special assembly resolution hook that will explicitly search the test assembly's + directory for dependent assemblies. This works around a conflict between mixed-mode + assembly initialization and tests running in their own AppDomain in some cases. + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RetryAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Attribute used to identify a method that is called once + after all the child tests have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Attribute used to identify a method that is called once + to perform setup before any child tests are run. + + + + + LevelOfParallelismAttribute is used to set the number of worker threads + that may be allocated by the framework for running tests. + + + + + Construct a LevelOfParallelismAttribute. + + The number of worker threads to be created by the framework. + + + + ParallelizableAttribute is used to mark tests that may be run in parallel. + + + + + Construct a ParallelizableAttribute using default ParallelScope.Self. + + + + + Construct a ParallelizableAttribute with a specified scope. + + The ParallelScope associated with this attribute. + + + + Modify the context to be used for child tests + + The current TestExecutionContext + + + + The ParallelScope enumeration permits specifying the degree to + which a test and its descendants may be run in parallel. + + + + + No Parallelism is permitted + + + + + The test itself may be run in parallel with others at the same level + + + + + Descendants of the test may be run in parallel with one another + + + + + Descendants of the test down to the level of TestFixtures may be run in parallel + + + + + Provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + + + + TestCaseSourceAttribute indicates the source to be used to + provide test fixture instances for a test class. + + + + + Error message string is public so the tests can use it + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestFixtures from a given Type, + using available parameter data. + + The TypeInfo for which fixures are to be constructed. + One or more TestFixtures as TestSuite + + + + Returns a set of ITestFixtureData items for use as arguments + to a parameterized test fixture. + + The type for which data is needed. + + + + + Indicates which class the test or test fixture is testing + + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + CollectionSupersetConstraint is used to determine whether + one collection is a superset of another + + + + + Construct a CollectionSupersetConstraint + + The collection that the actual value is expected to be a superset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a superset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + DictionaryContainsValueConstraint is used to test whether a dictionary + contains an expected object as a value. + + + + + Construct a DictionaryContainsValueConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected value is contained in the dictionary + + + + + The EqualConstraintResult class is tailored for formatting + and displaying the result of an EqualConstraint. + + + + + Construct an EqualConstraintResult + + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual collections or arrays. If both are identical, the value is + only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both _values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + FileExistsConstraint is used to determine if a file exists + + + + + Initializes a new instance of the class. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + FileOrDirectoryExistsConstraint is used to determine if a file or directory exists + + + + + If true, the constraint will only check if files exist, not directories + + + + + If true, the constraint will only check if directories exist, not files + + + + + Initializes a new instance of the class that + will check files and directories. + + + + + Initializes a new instance of the class that + will only check files if ignoreDirectories is true. + + if set to true [ignore directories]. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Interface for all constraints + + + + + The display name of this Constraint for use by ToString(). + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsExceptionConstraint tests that an exception has + been thrown, without any further tests. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Executes the code and returns success if an exception is thrown. + + A delegate representing the code to be tested + True if an exception is thrown, otherwise false + + + + Returns the ActualValueDelegate itself as the value to be tested. + + A delegate representing the code to be tested + The delegate itself + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attribute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation + + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Gets the expected object + + + + + Test whether the expected item is contained in the collection + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionEquivalentConstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether two collections are equivalent + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + If used performs a reverse comparison + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the collection is ordered + + + + + + + Returns the string representation of the constraint. + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionTally counts (tallies) the number of + occurrences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + The number of objects remaining in the tally + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + ComparisonAdapter class centralizes all comparisons of + _values in NUnit, adapting to the use of any provided + , + or . + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps a + + + + + Compares two objects + + + + + Construct a default ComparisonAdapter + + + + + Construct a ComparisonAdapter for an + + + + + Compares two objects + + + + + + + + ComparerAdapter extends and + allows use of an or + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare _values to + determine if one is greater than, equal to or less than + the other. + + + + + The value against which a comparison is to be made + + + + + If true, less than returns success + + + + + if true, equal returns success + + + + + if true, greater than returns success + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + The value against which to make a comparison. + if set to true less succeeds. + if set to true equal succeeds. + if set to true greater succeeds. + String used in describing the constraint. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use a and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + Construct a constraint with optional arguments + + Arguments to be saved + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Retrieves the value to be tested from an ActualValueDelegate. + The default implementation simply evaluates the delegate but derived + classes may override it to provide for delayed processing. + + An ActualValueDelegate + Delegate evaluation result + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + Resolves any pending operators and returns the resolved constraint. + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reorganized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + + + + Pushes the specified operator onto the stack. + + The operator to put onto the stack. + + + + Pops the topmost operator from the stack. + + The topmost operator on the stack + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Pushes the specified constraint. As a side effect, + the constraint's Builder field is set to the + ConstraintBuilder owning this stack. + + The constraint to put onto the stack + + + + Pops this topmost constraint from the stack. + As a side effect, the constraint's Builder + field is set to null. + + The topmost contraint on the stack + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expression by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the Builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reorganized. When a constraint is appended, it is returned as the + value of the operation so that modifiers may be applied. However, + any partially built expression is attached to the constraint for + later resolution. When an operator is appended, the partial + expression is returned. If it's a self-resolving operator, then + a ResolvableConstraintExpression is returned. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. Note that the constraint + is not reduced at this time. For example, if there + is a NotOperator on the stack we don't reduce and + return a NotConstraint. The original constraint must + be returned because it may support modifiers that + are yet to be applied. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests if item is equal to zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The _expected. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Flag the constraint to ignore case and return self. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed, in milliseconds + The time interval used for polling, in milliseconds + If the value of is less than 0 + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + Adjusts a Timestamp by a given TimeSpan + + + + + + + + Returns the difference between two Timestamps as a TimeSpan + + + + + + + + DictionaryContainsKeyConstraint is used to test whether a dictionary + contains an expected object as a key. + + + + + Construct a DictionaryContainsKeyConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected key is contained in the dictionary + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that the collection is empty + + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyStringConstraint tests whether a string is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Gets the tolerance for this comparison. + + + The tolerance. + + + + + Gets a value indicating whether to compare case insensitive. + + + true if comparing case insensitive; otherwise, false. + + + + + Gets a value indicating whether or not to clip strings. + + + true if set to clip strings otherwise, false. + + + + + Gets the failure points. + + + The failure points. + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flags the constraint to include + property in comparison of two values. + + + Using this modifier does not allow to use the + constraint modifier. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable _values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point _values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual _values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + EqualityAdapter class handles all equality comparisons + that use an , + or a . + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps an . + + + + + Returns an EqualityAdapter that uses a predicate function for items comparison. + + + + + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + Returns an that wraps an . + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps a . + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the _values are + allowed to deviate by up to 2 adjacent floating point _values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + Compares two floating point _values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point _values that are allowed to + be between the left and the right floating point _values + + True if both numbers are equal or close to being equal + + + Floating point _values can only represent a finite subset of natural numbers. + For example, the _values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point _values are between + the left and the right number. If the number of possible _values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point _values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point _values that are + allowed to be between the left and the right double precision floating point _values + + True if both numbers are equal or close to being equal + + + Double precision floating point _values can only represent a limited series of + natural numbers. For example, the _values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + _values are between the left and the right number. If the number of possible + _values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + ConstraintStatus represents the status of a ConstraintResult + returned by a Constraint being applied to an actual value. + + + + + The status has not yet been set + + + + + The constraint succeeded + + + + + The constraint failed + + + + + An error occured in applying the constraint (reserved for future use) + + + + + Contain the result of matching a against an actual value. + + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + The status of the new ConstraintResult. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + If true, applies a status of Success to the result, otherwise Failure. + + + + The actual value that was passed to the method. + + + + + Gets and sets the ResultStatus for this result. + + + + + True if actual value meets the Constraint criteria otherwise false. + + + + + Display friendly name of the constraint. + + + + + Description of the constraint may be affected by the state the constraint had + when was performed against the actual value. + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the result and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The IResolveConstraint interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Tests whether a value is less than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Abstract method to get the max line length + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The failing constraint result + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Custom value formatter function + + The value + + + + + Custom value formatter factory function + + The next formatter function + ValueFormatter + If the given formatter is unable to handle a certain format, it must call the next formatter in the chain + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Formatting strings used for expected and actual _values + + + + + Current head of chain of value formatters. Public for testing. + + + + + Add a formatter to the chain of responsibility. + + + + + + Formats text to represent a generalized value. + + The value + The formatted text + + + + Formats text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a collection or + array corresponding to a single int index into the collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test that the actual value is an NaN + + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Numerics class contains common operations on numeric _values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric _values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the _values are equal + + + + Compare two numeric _values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the _values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Returns the default NUnitComparer. + + + + + Compares two objects + + + + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occurred. + + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + Flags the comparer to include + property in comparison of two values. + + + Using this modifier does not allow to use the + modifier. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + _values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + The syntax element preceding this operator + + + + + The syntax element following this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Gets the name of the property to which the operator applies + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifies the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Modifies the current instance to be case-sensitive + and returns it. + + + + + Returns the string representation of this constraint + + + + + Canonicalize the provided path + + + The path in standardized form + + + + Test whether one path in canonical form is a subpath of another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Gets text describing a constraint + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Prefix used in forming the constraint description + + + + + Construct given a base constraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the value + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two _values are within a + specified range. + + + + + Initializes a new instance of the class. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + Resolve the current expression to a Constraint + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Return the top-level constraint for this expression + + + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Description of this constraint + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Constructs a StringConstraint without an expected value + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + Gets text describing a constraint + + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. This override only handles the special message + used when an exception is expected but none is thrown. + + The writer on which the actual value is displayed + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Returns a default Tolerance object, equivalent to + specifying an exact match unless + is set, in which case, the + will be used. + + + + + Returns an empty Tolerance object, equivalent to + specifying an exact match even if + is set. + + + + + Constructs a linear tolerance of a specified amount + + + + + Constructs a tolerance given an amount and + + + + + Gets the for the current Tolerance + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance has not been set or is using the . + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared _values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared _values my deviate from each other. + + + + + Compares two _values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + The type of the actual argument to which the constraint was applied + + + + + Construct a TypeConstraint for a given Type + + The expected type for the constraint + Prefix used in forming the constraint description + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that all items are unique. + + + + + + + XmlSerializableConstraint tests whether + an object is serializable in xml format. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of this constraint + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Any ITest that implements this interface is at a level that the implementing + class should be disposed at the end of the test run + + + + + The IMethodInfo class is used to encapsulate information + about a method in a platform-independent manner. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The IParameterInfo interface is an abstraction of a .NET parameter. + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter + + + + + Gets the underlying .NET ParameterInfo + + + + + Gets the Type of the parameter + + + + + The IReflectionInfo interface is implemented by NUnit wrapper objects that perform reflection. + + + + + Returns an array of custom attributes of the specified type applied to this object + + + + + Returns a value indicating whether an attribute of the specified type is defined on this object. + + + + + The ITypeInfo interface is an abstraction of a .NET Type + + + + + Gets the underlying Type on which this ITypeInfo is based + + + + + Gets the base type of this type as an ITypeInfo + + + + + Returns true if the Type wrapped is equal to the argument + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the Namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type is a static class. + + + + + Get the display name for this typeInfo. + + + + + Get the display name for an oject of this type, constructed with specific arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a value indicating whether this type has a method with a specified public attribute + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + CombiningStrategy is the abstract base for classes that + know how to combine values provided for individual test + parameters to create a set of test cases. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + The ISimpleTestBuilder interface is exposed by a class that knows how to + build a single TestMethod from a suitable MethodInfo Types. In general, + it is exposed by an attribute, but may be implemented in a helper class + used by the attribute in some cases. + + + + + Build a TestMethod from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ITestBuilder interface is exposed by a class that knows how to + build one or more TestMethods from a MethodInfo. In general, it is exposed + by an attribute, which has additional information available to provide + the necessary test parameters to distinguish the test cases built. + + + + + Build one or more TestMethods from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IParameterDataSource interface is implemented by types + that can provide data for a test method parameter. + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + An enumeration containing individual data items + + + + A PropertyBag represents a collection of name/value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + The entries in a PropertyBag are of two kinds: those that + take a single value and those that take multiple _values. + However, the PropertyBag has no knowledge of which entries + fall into each category and the distinction is entirely + up to the code using the PropertyBag. + + When working with multi-valued properties, client code + should use the Add method to add name/value pairs and + indexing to retrieve a list of all _values for a given + key. For example: + + bag.Add("Tag", "one"); + bag.Add("Tag", "two"); + Assert.That(bag["Tag"], + Is.EqualTo(new string[] { "one", "two" })); + + When working with single-valued propeties, client code + should use the Set method to set the value and Get to + retrieve the value. The GetSetting methods may also be + used to retrieve the value in a type-safe manner while + also providing default. For example: + + bag.Set("Priority", "low"); + bag.Set("Priority", "high"); // replaces value + Assert.That(bag.Get("Priority"), + Is.EqualTo("high")); + Assert.That(bag.GetSetting("Priority", "low"), + Is.EqualTo("high")); + + + + + Adds a key/value pair to the property bag + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + True if their are _values present, otherwise false + + + + Gets or sets the list of _values for a particular key + + The key for which the _values are to be retrieved or set + + + + Gets a collection containing all the keys in the property set + + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the id of the test + + + + + Gets the name of the test + + + + + Gets the fully qualified name of the test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the Type of the test fixture, if applicable, or + null if no fixture type is associated with this test. + + + + + Gets an IMethod for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the RunState of the test, indicating whether it can be run. + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Gets the properties of the test + + + + + Gets the parent test, if any. + + The parent test or null if none exists. + + + + Returns true if this is a test suite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets a fixture object for running this test. + + + + + The ITestData interface is implemented by a class that + represents a single instance of a parameterized test. + + + + + Gets the name to be used for the test + + + + + Gets the RunState for this test case. + + + + + Gets the argument list to be provided to the test + + + + + Gets the property dictionary for the test case + + + + + The ITestCaseData interface is implemented by a class + that is able to return the data required to create an + instance of a parameterized test fixture. + + + + + Get the TypeArgs if separately set + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + + + + Gets the expected result of the test case + + + + + Returns true if an expected result has been set + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + The ITestListener interface is used internally to receive + notifications of significant events while a test is being + run. The events are propagated to clients by means of an + AsyncCallback. NUnit extensions may also monitor these events. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished + + The result of the test + + + + The ITestResult interface represents the result of a test. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. Not available in + the Compact Framework 1.0. + + + + + Gets the number of asserts executed + when running the test and all its children. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Accessing HasChildren should not force creation of the + Children collection in classes implementing this interface. + + + + + Gets the the collection of child results. + + + + + Gets the Test to which this result applies. + + + + + Gets any text output written to this result. + + + + + An object implementing IXmlNodeBuilder is able to build + an XML representation of itself and any children. + + + + + Returns a TNode representing the current object. + + If true, children are included where applicable + A TNode representing the result + + + + Returns a TNode representing the current object after + adding it as a child of the supplied parent node. + + The parent node. + If true, children are included, where applicable + + + + + The ResultState class represents the outcome of running a test. + It contains two pieces of information. The Status of the test + is an enum indicating whether the test passed, failed, was + skipped or was inconclusive. The Label provides a more + detailed breakdown for use by client runners. + + + + + Initializes a new instance of the class. + + The TestStatus. + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + + + + Initializes a new instance of the class. + + The TestStatus. + The stage at which the result was produced + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + The stage at which the result was produced + + + + The result is inconclusive + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test was skipped because it is explicit + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The test was not runnable. + + + + + A suite failed because one or more child tests failed or had errors + + + + + A suite failed in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeDown + + + + + Gets the TestStatus for the test. + + The status. + + + + Gets the label under which this test result is + categorized, if any. + + + + + Gets the stage of test execution in which + the failure or other result took place. + + + + + Get a new ResultState, which is the same as the current + one but with the FailureSite set to the specified value. + + The FailureSite to use + A new ResultState + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occurred. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test can be executed. + + + + + The test is not runnable. + + + + + The test is runnable. + + + + + The test can only be run explicitly + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + TNode represents a single node in the XML representation + of a Test or TestResult. It replaces System.Xml.XmlNode and + System.Xml.Linq.XElement, providing a minimal set of methods + for operating on the XML in a platform-independent manner. + + + + + Constructs a new instance of TNode + + The name of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + Flag indicating whether to use CDATA when writing the text + + + + Gets the name of the node + + + + + Gets the value of the node + + + + + Gets a flag indicating whether the value should be output using CDATA. + + + + + Gets the dictionary of attributes + + + + + Gets a list of child nodes + + + + + Gets the first ChildNode + + + + + Gets the XML representation of this node. + + + + + Create a TNode from it's XML text representation + + The XML text to be parsed + A TNode + + + + Adds a new element as a child of the current node and returns it. + + The element name. + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + + The element name + The text content of the new element + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + The value will be output using a CDATA section. + + The element name + The text content of the new element + The newly created child element + + + + Adds an attribute with a specified name and value to the XmlNode. + + The name of the attribute. + The value of the attribute. + + + + Finds a single descendant of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + + + Finds all descendants of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + Writes the XML representation of the node to an XmlWriter + + + + + + Class used to represent a list of XmlResults + + + + + Class used to represent the attributes of a node + + + + + Gets or sets the value associated with the specified key. + Overridden to return null if attribute is not found. + + The key. + Value of the attribute or null + + + + The IFixtureBuilder interface is exposed by a class that knows how to + build a TestFixture from one or more Types. In general, it is exposed + by an attribute, but may be implemented in a helper class used by the + attribute in some cases. + + + + + Build one or more TestFixtures from type provided. At least one + non-null TestSuite must always be returned, since the method is + generally called because the user has marked the target class as + a fixture. If something prevents the fixture from being used, it + will be returned nonetheless, labelled as non-runnable. + + The type info of the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + IImplyFixture is an empty marker interface used by attributes like + TestAttribute that cause the class where they are used to be treated + as a TestFixture even without a TestFixtureAttribute. + + Marker interfaces are not usually considered a good practice, but + we use it here to avoid cluttering the attribute hierarchy with + classes that don't contain any extra implementation. + + + + + The IApplyToContext interface is implemented by attributes + that want to make changes to the execution context before + a test is run. + + + + + Apply changes to the execution context + + The execution context + + + + The IApplyToTest interface is implemented by self-applying + attributes that modify the state of a test in some way. + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + This interface is not the same as the ITestCaseBuilder interface in NUnit 2.x. + We have reused the name because the two products don't interoperate at all. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + ICommandWrapper is implemented by attributes and other + objects able to wrap a TestCommand with another command. + + + Attributes or other objects should implement one of the + derived interfaces, rather than this one, since they + indicate in which part of the command chain the wrapper + should be applied. + + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + Objects implementing this interface are used to wrap + the TestMethodCommand itself. They apply after SetUp + has been run and before TearDown. + + + + + Objects implementing this interface are used to wrap + the entire test, including SetUp and TearDown. + + + + + The TestFixtureData class represents a set of arguments + and other parameter info to be used for a parameterized + fixture. It is derived from TestFixtureParameters and adds a + fluent syntax for use in initializing the fixture. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Marks the test fixture as explicit. + + + + + Marks the test fixture as explicit, specifying the reason. + + + + + Ignores this TestFixture, specifying the reason. + + The reason. + + + + + Asserts on Directories + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if the directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Abstract base for Exceptions that terminate a test and provide a ResultState. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter ids for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Modifies a test by adding a category to it. + + The test to modify + + + + Marks a test to use a combinatorial join of any argument + data provided. Since this is the default, the attribute is + optional. + + + + + Default constructor + + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Causes a test to be skipped if this CultureAttribute is not satisfied. + + The test to modify + + + + Tests to determine if the current culture is supported + based on the properties of this attribute. + + True, if the current culture is supported + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + The abstract base class for all data-providing attributes + defined by NUnit. Used to select all data sources for a + method, class or parameter. + + + + + Default constructor + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointSourceAttribute. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointsAttribute. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct a description Attribute + + The text of the description + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + Modifies a test by marking it as explicit. + + The test to modify + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The date in the future to stop ignoring the test as a string in UTC time. + For example for a date and time, "2014-12-25 08:10:00Z" or for just a date, + "2014-12-25". If just a date is given, the Ignore will expire at midnight UTC. + + + Once the ignore until date has passed, the test will be marked + as runnable. Tests with an ignore until date will have an IgnoreUntilDate + property set which will appear in the test results. + + The string does not contain a valid string representation of a date and time. + + + + Modifies a test by marking it as Ignored. + + The test to modify + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple items may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + The abstract base class for all custom attributes defined by NUnit. + + + + + Default constructor + + + + + Marks a test to use a pairwise join of any argument + data provided. Arguments will be combined in such a + way that all possible pairs of arguments are used. + + + + + Default constructor + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-delimited list of platforms + + + + Causes a test to be skipped if this PlatformAttribute is not satisfied. + + The test to modify + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Modifies a test by adding properties to it. + + The test to modify + + + + RandomAttribute is used to supply a set of random _values + to a single parameter of a parameterized test. + + + + + Construct a random set of values appropriate for the Type of the + parameter on which the attribute appears, specifying only the count. + + + + + + Construct a set of ints within a specified range + + + + + Construct a set of unsigned ints within a specified range + + + + + Construct a set of longs within a specified range + + + + + Construct a set of unsigned longs within a specified range + + + + + Construct a set of shorts within a specified range + + + + + Construct a set of unsigned shorts within a specified range + + + + + Construct a set of doubles within a specified range + + + + + Construct a set of floats within a specified range + + + + + Construct a set of bytes within a specified range + + + + + Construct a set of sbytes within a specified range + + + + + Get the collection of _values to be used as arguments. + + + + + RangeAttribute is used to supply a range of _values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of unsigned ints using default step of 1 + + + + + + + Construct a range of unsigned ints specifying the step size + + + + + + + + Construct a range of longs using a default step of 1 + + + + + + + Construct a range of longs + + + + + + + + Construct a range of unsigned longs using default step of 1 + + + + + + + Construct a range of unsigned longs specifying the step size + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RepeatAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + Marks a test to use a Sequential join of any argument + data provided. Arguments will be combined into test cases, + taking the next value of each argument until all are used. + + + + + Default constructor + + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Build a SetUpFixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A SetUpFixture object as a TestSuite. + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + The author of this test + + + + + The type that this test is testing + + + + + Modifies a test by adding a description, if not already set. + + The test to modify + + + + Gets or sets the expected result. + + The result. + + + + Returns true if an expected result has been set + + + + + Construct a TestMethod from a given method. + + The method for which a test is to be constructed. + The suite to which the test will be added. + A TestMethod + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test case. + + + + + Gets the list of arguments to a test case + + + + + Gets the properties of the test case + + + + + Gets or sets the expected result. + + The result. + + + + Returns true if the expected result has been set + + + + + Gets or sets the description. + + The description. + + + + The author of this test + + + + + The type that this test is testing + + + + + Gets or sets the reason for ignoring the test + + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets or sets the reason for not running the test. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Comma-delimited list of platforms to run the test for + + + + + Comma-delimited list of platforms to not run the test for + + + + + Gets and sets the category for this test case. + May be a comma-separated list of categories. + + + + + Performs several special conversions allowed by NUnit in order to + permit arguments with types that cannot be used in the constructor + of an Attribute such as TestCaseAttribute or to simplify their use. + + The arguments to be converted + The ParameterInfo array for the method + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + TestCaseSourceAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The IMethod for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Returns a set of ITestCaseDataItems for use as arguments + to a parameterized test method. + + The method for which data is needed. + + + + + TestFixtureAttribute is used to mark a class that represents a TestFixture. + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test fixture. + + + + + The arguments originally provided to the attribute + + + + + Properties pertaining to this fixture + + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Descriptive text for this fixture + + + + + The author of this fixture + + + + + The type that this fixture is testing + + + + + Gets or sets the ignore reason. May set RunState as a side effect. + + The ignore reason. + + + + Gets or sets the reason for not running the fixture. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Build a fixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A an IEnumerable holding one TestFixture object. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Construct the attribute, specifying a combining strategy and source of parameter data. + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a class or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary + + + + + Constructs for use with an Enum parameter. Will pass every enum + value in to the test. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of _values to be used as arguments + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + + An enumeration containing individual data items + + + + + A set of Assert methods operating on one or more collections + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new DictionaryContainsKeyConstraint checking for the + presence of a particular key in the dictionary. + + + + + Returns a new DictionaryContainsValueConstraint checking for the + presence of a particular value in the dictionary. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Asserts on Files + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. Anything set through + this class applies to the entire test run. It should not normally + be used from within a test, since it is not thread-safe. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + inclusively within a specified range. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the _values of a property + + The collection of property _values + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It is derived from TestCaseParameters and adds a + fluent syntax for use in initializing the test case. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Marks the test case as explicit. + + + + + Marks the test case as explicit, specifying the reason. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Provide the context information of the current test. + This is an adapter for the internal ExecutionContext + class, hiding the internals from the user test. + + + + + Construct a TestContext for an ExecutionContext + + The ExecutionContext to adapt + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TextWriter that will send output to the current test result. + + + + + Get a representation of the current test. + + + + + Gets a Representation of the TestResult for the current test. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputting files created + by this test run. + + + + + Gets the random generator. + + + The random generator. + + + + Write the string representation of a boolean value to the current result + + + Write a char to the current result + + + Write a char array to the current result + + + Write the string representation of a double to the current result + + + Write the string representation of an Int32 value to the current result + + + Write the string representation of an Int64 value to the current result + + + Write the string representation of a decimal value to the current result + + + Write the string representation of an object to the current result + + + Write the string representation of a Single value to the current result + + + Write a string to the current result + + + Write the string representation of a UInt32 value to the current result + + + Write the string representation of a UInt64 value to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a line terminator to the current result + + + Write the string representation of a boolean value to the current result followed by a line terminator + + + Write a char to the current result followed by a line terminator + + + Write a char array to the current result followed by a line terminator + + + Write the string representation of a double to the current result followed by a line terminator + + + Write the string representation of an Int32 value to the current result followed by a line terminator + + + Write the string representation of an Int64 value to the current result followed by a line terminator + + + Write the string representation of a decimal value to the current result followed by a line terminator + + + Write the string representation of an object to the current result followed by a line terminator + + + Write the string representation of a Single value to the current result followed by a line terminator + + + Write a string to the current result followed by a line terminator + + + Write the string representation of a UInt32 value to the current result followed by a line terminator + + + Write the string representation of a UInt64 value to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + + This method adds the a new ValueFormatterFactory to the + chain of responsibility used for fomatting values in messages. + The scope of the change is the current TestContext. + + The factory delegate + + + + This method provides a simplified way to add a ValueFormatter + delegate to the chain of responsibility, creating the factory + delegate internally. It is useful when the Type of the object + is the only criterion for selection of the formatter, since + it can be used without getting involved with a compould function. + + The type supported by this formatter + The ValueFormatter delegate + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Construct a TestAdapter for a Test + + The Test to be adapted + + + + Gets the unique Id of a test + + + + + The name of the test, which may or may not be + the same as the method name. + + + + + The name of the method representing the test. + + + + + The FullName of the test + + + + + The ClassName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a TestResult + + The TestResult to be adapted + + + + Gets a ResultState representing the outcome of the test. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected ArgumentException + + + + + Creates a constraint specifying an expected ArgumentNUllException + + + + + Creates a constraint specifying an expected InvalidOperationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Env is a static class that provides some of the features of + System.Environment that are not available under all runtimes + + + + + The newline sequence in the current environment. + + + + + Path to the 'My Documents' folder + + + + + Directory used for file output if not specified on commandline. + + + + + PackageSettings is a static class containing constant values that + are used as keys in setting up a TestPackage. These values are used in + the engine and framework. Setting values may be a string, int or bool. + + + + + Flag (bool) indicating whether tests are being debugged. + + + + + Flag (bool) indicating whether to pause execution of tests to allow + the user to attache a debugger. + + + + + The InternalTraceLevel for this run. Values are: "Default", + "Off", "Error", "Warning", "Info", "Debug", "Verbose". + Default is "Off". "Debug" and "Verbose" are synonyms. + + + + + Full path of the directory to be used for work and result files. + This path is provided to tests by the frameowrk TestContext. + + + + + The name of the config to use in loading a project. + If not specified, the first config found is used. + + + + + Bool indicating whether the engine should determine the private + bin path by examining the paths to all the tests. Defaults to + true unless PrivateBinPath is specified. + + + + + The ApplicationBase to use in loading the tests. If not + specified, and each assembly has its own process, then the + location of the assembly is used. For multiple assemblies + in a single process, the closest common root directory is used. + + + + + Path to the config file to use in running the tests. + + + + + Bool flag indicating whether a debugger should be launched at agent + startup. Used only for debugging NUnit itself. + + + + + Indicates how to load tests across AppDomains. Values are: + "Default", "None", "Single", "Multiple". Default is "Multiple" + if more than one assembly is loaded in a process. Otherwise, + it is "Single". + + + + + The private binpath used to locate assemblies. Directory paths + is separated by a semicolon. It's an error to specify this and + also set AutoBinPath to true. + + + + + The maximum number of test agents permitted to run simultneously. + Ignored if the ProcessModel is not set or defaulted to Multiple. + + + + + Indicates how to allocate assemblies to processes. Values are: + "Default", "Single", "Separate", "Multiple". Default is "Multiple" + for more than one assembly, "Separate" for a single assembly. + + + + + Indicates the desired runtime to use for the tests. Values + are strings like "net-4.5", "mono-4.0", etc. Default is to + use the target framework for which an assembly was built. + + + + + Bool flag indicating that the test should be run in a 32-bit process + on a 64-bit system. By default, NUNit runs in a 64-bit process on + a 64-bit system. Ignored if set on a 32-bit system. + + + + + Indicates that test runners should be disposed after the tests are executed + + + + + Bool flag indicating that the test assemblies should be shadow copied. + Defaults to false. + + + + + Integer value in milliseconds for the default timeout value + for test cases. If not specified, there is no timeout except + as specified by attributes on the tests themselves. + + + + + A TextWriter to which the internal trace will be sent. + + + + + A list of tests to be loaded. + + + + + The number of test threads to run for the assembly. If set to + 1, a single queue is used. If set to 0, tests are executed + directly, without queuing. + + + + + The random seed to be used for this assembly. If specified + as the value reported from a prior run, the framework should + generate identical random values for tests as were used for + that run, provided that no change has been made to the test + assembly. Default is a random value itself. + + + + + If true, execution stops after the first error or failure. + + + + + If true, use of the event queue is suppressed and test events are synchronous. + + + + + If the package represents an assembly, then this is the CLR version + stored in the assembly image. If it represents a project or other + group of assemblies, it is the maximum version for all the assemblies. + + + + + True if any assembly in the package requires running as a 32-bit + process when on a 64-bit system. + + + + + True if any assembly in the package requires a special assembly resolution hook + in the default AppDomain in order to find dependent assemblies. + + + + + The FrameworkName specified on a TargetFrameworkAttribute for the assembly + + + + + Allows us to use Func when compiling against .NET 2.0 + + + + + + + + + + + Enables compiling extension methods in .NET 2.0 + + + + diff --git a/packages/NUnit.3.2.0/lib/net40/nunit.framework.dll b/packages/NUnit.3.2.0/lib/net40/nunit.framework.dll new file mode 100644 index 00000000..ce04dc46 Binary files /dev/null and b/packages/NUnit.3.2.0/lib/net40/nunit.framework.dll differ diff --git a/packages/NUnit.3.2.0/lib/net40/nunit.framework.xml b/packages/NUnit.3.2.0/lib/net40/nunit.framework.xml new file mode 100644 index 00000000..33edb784 --- /dev/null +++ b/packages/NUnit.3.2.0/lib/net40/nunit.framework.xml @@ -0,0 +1,17337 @@ + + + + nunit.framework + + + + + AssemblyHelper provides static methods for working + with assemblies. + + + + + Gets the path from which the assembly defining a type was loaded. + + The Type. + The path. + + + + Gets the path from which an assembly was loaded. + For builds where this is not possible, returns + the name of the assembly. + + The assembly. + The path. + + + + Gets the path to the directory from which an assembly was loaded. + + The assembly. + The path. + + + + Gets the AssemblyName of an assembly. + + The assembly + An AssemblyName + + + + Loads an assembly given a string, which may be the + path to the assembly or the AssemblyName + + + + + + + Gets the assembly path from code base. + + Public for testing purposes + The code base. + + + + + Interface for logging within the engine + + + + + Logs the specified message at the error level. + + The message. + + + + Logs the specified message at the error level. + + The message. + The arguments. + + + + Logs the specified message at the warning level. + + The message. + + + + Logs the specified message at the warning level. + + The message. + The arguments. + + + + Logs the specified message at the info level. + + The message. + + + + Logs the specified message at the info level. + + The message. + The arguments. + + + + Logs the specified message at the debug level. + + The message. + + + + Logs the specified message at the debug level. + + The message. + The arguments. + + + + InternalTrace provides facilities for tracing the execution + of the NUnit framework. Tests and classes under test may make use + of Console writes, System.Diagnostics.Trace or various loggers and + NUnit itself traps and processes each of them. For that reason, a + separate internal trace is needed. + + Note: + InternalTrace uses a global lock to allow multiple threads to write + trace messages. This can easily make it a bottleneck so it must be + used sparingly. Keep the trace Level as low as possible and only + insert InternalTrace writes where they are needed. + TODO: add some buffering and a separate writer thread as an option. + TODO: figure out a way to turn on trace in specific classes only. + + + + + Gets a flag indicating whether the InternalTrace is initialized + + + + + Initialize the internal trace facility using the name of the log + to be written to and the trace level. + + The log name + The trace level + + + + Initialize the internal trace using a provided TextWriter and level + + A TextWriter + The InternalTraceLevel + + + + Get a named Logger + + + + + + Get a logger named for a particular Type. + + + + + InternalTraceLevel is an enumeration controlling the + level of detailed presented in the internal log. + + + + + Use the default settings as specified by the user. + + + + + Do not display any trace messages + + + + + Display Error messages only + + + + + Display Warning level and higher messages + + + + + Display informational and higher messages + + + + + Display debug messages and higher - i.e. all messages + + + + + Display debug messages and higher - i.e. all messages + + + + + A trace listener that writes to a separate file per domain + and process using it. + + + + + Construct an InternalTraceWriter that writes to a file. + + Path to the file to use + + + + Construct an InternalTraceWriter that writes to a + TextWriter provided by the caller. + + + + + + Returns the character encoding in which the output is written. + + The character encoding in which the output is written. + + + + Writes a character to the text string or stream. + + The character to write to the text stream. + + + + Writes a string to the text string or stream. + + The string to write. + + + + Writes a string followed by a line terminator to the text string or stream. + + The string to write. If is null, only the line terminator is written. + + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. + + + + + Provides internal logging to the NUnit framework + + + + + Initializes a new instance of the class. + + The name. + The log level. + The writer where logs are sent. + + + + Logs the message at error level. + + The message. + + + + Logs the message at error level. + + The message. + The message arguments. + + + + Logs the message at warm level. + + The message. + + + + Logs the message at warning level. + + The message. + The message arguments. + + + + Logs the message at info level. + + The message. + + + + Logs the message at info level. + + The message. + The message arguments. + + + + Logs the message at debug level. + + The message. + + + + Logs the message at debug level. + + The message. + The message arguments. + + + + Waits for pending asynchronous operations to complete, if appropriate, + and returns a proper result of the invocation by unwrapping task results + + The raw result of the method invocation + The unwrapped result, if necessary + + + + CombinatorialStrategy creates test cases by using all possible + combinations of the parameter data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Provides data from fields marked with the DatapointAttribute or the + DatapointsAttribute. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + Class to build ether a parameterized or a normal NUnitTestMethod. + There are four cases that the builder must deal with: + 1. The method needs no params and none are provided + 2. The method needs params and they are provided + 3. The method needs no params but they are provided in error + 4. The method needs params but they are not provided + This could have been done using two different builders, but it + turned out to be simpler to have just one. The BuildFrom method + takes a different branch depending on whether any parameters are + provided, but all four cases are dealt with in lower-level methods + + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + A Test representing one or more method invocations + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + The test suite being built, to which the new test would be added + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + The test fixture being populated, or null + A Test representing one or more method invocations + + + + Builds a ParameterizedMethodSuite containing individual test cases. + + The method for which a test is to be built. + The list of test cases to include. + A ParameterizedMethodSuite populated with test cases + + + + Build a simple, non-parameterized TestMethod for this method. + + The MethodInfo for which a test is to be built + The test suite for which the method is being built + A TestMethod. + + + + Class that can build a tree of automatic namespace + suites from a group of fixtures. + + + + + NamespaceDictionary of all test suites we have created to represent + namespaces. Used to locate namespace parent suites for fixtures. + + + + + The root of the test suite being created by this builder. + + + + + Initializes a new instance of the class. + + The root suite. + + + + Gets the root entry in the tree created by the NamespaceTreeBuilder. + + The root suite. + + + + Adds the specified fixtures to the tree. + + The fixtures to be added. + + + + Adds the specified fixture to the tree. + + The fixture to be added. + + + + NUnitTestCaseBuilder is a utility class used by attributes + that build test cases. + + + + + Constructs an + + + + + Builds a single NUnitTestMethod, either as a child of the fixture + or as one of a set of test cases under a ParameterizedTestMethodSuite. + + The MethodInfo from which to construct the TestMethod + The suite or fixture to which the new test will be added + The ParameterSet to be used, or null + + + + + Helper method that checks the signature of a TestMethod and + any supplied parameters to determine if the test is valid. + + Currently, NUnitTestMethods are required to be public, + non-abstract methods, either static or instance, + returning void. They may take arguments but the _values must + be provided or the TestMethod is not considered runnable. + + Methods not meeting these criteria will be marked as + non-runnable and the method will return false in that case. + + The TestMethod to be checked. If it + is found to be non-runnable, it will be modified. + Parameters to be used for this test, or null + True if the method signature is valid, false if not + + The return value is no longer used internally, but is retained + for testing purposes. + + + + + NUnitTestFixtureBuilder is able to build a fixture given + a class marked with a TestFixtureAttribute or an unmarked + class containing test methods. In the first case, it is + called by the attribute and in the second directly by + NUnitSuiteBuilder. + + + + + Build a TestFixture from type provided. A non-null TestSuite + must always be returned, since the method is generally called + because the user has marked the target class as a fixture. + If something prevents the fixture from being used, it should + be returned nonetheless, labelled as non-runnable. + + An ITypeInfo for the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + Overload of BuildFrom called by tests that have arguments. + Builds a fixture using the provided type and information + in the ITestFixtureData object. + + The TypeInfo for which to construct a fixture. + An object implementing ITestFixtureData or null. + + + + + Method to add test cases to the newly constructed fixture. + + The fixture to which cases should be added + + + + Method to create a test case from a MethodInfo and add + it to the fixture being built. It first checks to see if + any global TestCaseBuilder addin wants to build the + test case. If not, it uses the internal builder + collection maintained by this fixture builder. + + The default implementation has no test case builders. + Derived classes should add builders to the collection + in their constructor. + + The method for which a test is to be created + The test suite being built. + A newly constructed Test + + + + Built-in SuiteBuilder for all types of test classes. + + + + + Checks to see if the provided Type is a fixture. + To be considered a fixture, it must be a non-abstract + class with one or more attributes implementing the + IFixtureBuilder interface or one or more methods + marked as tests. + + The fixture type to check + True if the fixture can be built, false if not + + + + Build a TestSuite from TypeInfo provided. + + The fixture type to build + A TestSuite built from that type + + + + We look for attributes implementing IFixtureBuilder at one level + of inheritance at a time. Attributes on base classes are not used + unless there are no fixture builder attributes at all on the derived + class. This is by design. + + The type being examined for attributes + A list of the attributes found. + + + + PairwiseStrategy creates test cases by combining the parameter + data so that all possible pairs of data items are used. + + + + The number of test cases that cover all possible pairs of test function + parameters values is significantly less than the number of test cases + that cover all possible combination of test function parameters values. + And because different studies show that most of software failures are + caused by combination of no more than two parameters, pairwise testing + can be an effective ways to test the system when it's impossible to test + all combinations of parameters. + + + The PairwiseStrategy code is based on "jenny" tool by Bob Jenkins: + http://burtleburtle.net/bob/math/jenny.html + + + + + + FleaRand is a pseudo-random number generator developed by Bob Jenkins: + http://burtleburtle.net/bob/rand/talksmall.html#flea + + + + + Initializes a new instance of the FleaRand class. + + The seed. + + + + FeatureInfo represents coverage of a single value of test function + parameter, represented as a pair of indices, Dimension and Feature. In + terms of unit testing, Dimension is the index of the test parameter and + Feature is the index of the supplied value in that parameter's list of + sources. + + + + + Initializes a new instance of FeatureInfo class. + + Index of a dimension. + Index of a feature. + + + + A FeatureTuple represents a combination of features, one per test + parameter, which should be covered by a test case. In the + PairwiseStrategy, we are only trying to cover pairs of features, so the + tuples actually may contain only single feature or pair of features, but + the algorithm itself works with triplets, quadruples and so on. + + + + + Initializes a new instance of FeatureTuple class for a single feature. + + Single feature. + + + + Initializes a new instance of FeatureTuple class for a pair of features. + + First feature. + Second feature. + + + + TestCase represents a single test case covering a list of features. + + + + + Initializes a new instance of TestCaseInfo class. + + A number of features in the test case. + + + + PairwiseTestCaseGenerator class implements an algorithm which generates + a set of test cases which covers all pairs of possible values of test + function. + + + + The algorithm starts with creating a set of all feature tuples which we + will try to cover (see method). This set + includes every single feature and all possible pairs of features. We + store feature tuples in the 3-D collection (where axes are "dimension", + "feature", and "all combinations which includes this feature"), and for + every two feature (e.g. "A" and "B") we generate both ("A", "B") and + ("B", "A") pairs. This data structure extremely reduces the amount of + time needed to calculate coverage for a single test case (this + calculation is the most time-consuming part of the algorithm). + + + Then the algorithm picks one tuple from the uncovered tuple, creates a + test case that covers this tuple, and then removes this tuple and all + other tuples covered by this test case from the collection of uncovered + tuples. + + + Picking a tuple to cover + + + There are no any special rules defined for picking tuples to cover. We + just pick them one by one, in the order they were generated. + + + Test generation + + + Test generation starts from creating a completely random test case which + covers, nevertheless, previously selected tuple. Then the algorithm + tries to maximize number of tuples which this test covers. + + + Test generation and maximization process repeats seven times for every + selected tuple and then the algorithm picks the best test case ("seven" + is a magic number which provides good results in acceptable time). + + Maximizing test coverage + + To maximize tests coverage, the algorithm walks thru the list of mutable + dimensions (mutable dimension is a dimension that are not included in + the previously selected tuple). Then for every dimension, the algorithm + walks thru the list of features and checks if this feature provides + better coverage than randomly selected feature, and if yes keeps this + feature. + + + This process repeats while it shows progress. If the last iteration + doesn't improve coverage, the process ends. + + + In addition, for better results, before start every iteration, the + algorithm "scrambles" dimensions - so for every iteration dimension + probes in a different order. + + + + + + Creates a set of test cases for specified dimensions. + + + An array which contains information about dimensions. Each element of + this array represents a number of features in the specific dimension. + + + A set of test cases. + + + + + Gets the test cases generated by this strategy instance. + + A set of test cases. + + + + The ParameterDataProvider class implements IParameterDataProvider + and hosts one or more individual providers. + + + + + Construct with a collection of individual providers + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + ParameterDataSourceProvider supplies individual argument _values for + single parameters using attributes implementing IParameterDataSource. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + SequentialStrategy creates test cases by using all of the + parameter data sources in parallel, substituting null + when any of them run out of data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ContextSettingsCommand applies specified changes to the + TestExecutionContext prior to running a test. No special + action is needed after the test runs, since the prior + context will be restored automatically. + + + + + The CommandStage enumeration represents the defined stages + of execution for a series of TestCommands. The int _values + of the enum are used to apply decorators in the proper + order. Lower _values are applied first and are therefore + "closer" to the actual test execution. + + + No CommandStage is defined for actual invocation of the test or + for creation of the context. Execution may be imagined as + proceeding from the bottom of the list upwards, with cleanup + after the test running in the opposite order. + + + + + Use an application-defined default value. + + + + + Make adjustments needed before and after running + the raw test - that is, after any SetUp has run + and before TearDown. + + + + + Run SetUp and TearDown for the test. This stage is used + internally by NUnit and should not normally appear + in user-defined decorators. + + + + + Make adjustments needed before and after running + the entire test - including SetUp and TearDown. + + + + + TODO: Documentation needed for class + + + + TODO: Documentation needed for field + + + + TODO: Documentation needed for constructor + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The inner command. + The max time allowed in milliseconds + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext + + The context in which the test should run. + A TestResult + + + + OneTimeSetUpCommand runs any one-time setup methods for a suite, + constructing the user test object if necessary. + + + + + Constructs a OneTimeSetUpCommand for a suite + + The suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run after Setup + + + + Overridden to run the one-time setup for a suite. + + The TestExecutionContext to be used. + A TestResult + + + + OneTimeTearDownCommand performs any teardown actions + specified for a suite and calls Dispose on the user + test object, if any. + + + + + Construct a OneTimeTearDownCommand + + The test suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run before teardown. + + + + Overridden to run the teardown methods specified on the test. + + The TestExecutionContext to be used. + A TestResult + + + + SetUpTearDownCommand runs any SetUp methods for a suite, + runs the test and then runs any TearDown methods. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + SetUpTearDownItem holds the setup and teardown methods + for a single level of the inheritance hierarchy. + + + + + Construct a SetUpTearDownNode + + A list of setup methods for this level + A list teardown methods for this level + + + + Returns true if this level has any methods at all. + This flag is used to discard levels that do nothing. + + + + + Run SetUp on this level. + + The execution context to use for running. + + + + Run TearDown for this level. + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The test being skipped. + + + + Overridden to simply set the CurrentResult to the + appropriate Skipped state. + + The execution context for the test + A TestResult + + + + TestActionCommand runs the BeforeTest actions for a test, + then runs the test and finally runs the AfterTestActions. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TestActionItem represents a single execution of an + ITestAction. It is used to track whether the BeforeTest + method has been called and suppress calling the + AfterTest method if it has not. + + + + + Construct a TestActionItem + + The ITestAction to be included + + + + Run the BeforeTest method of the action and remember that it has been run. + + The test to which the action applies + + + + Run the AfterTest action, but only if the BeforeTest + action was actually run. + + The test to which the action applies + + + + TestCommand is the abstract base class for all test commands + in the framework. A TestCommand represents a single stage in + the execution of a test, e.g.: SetUp/TearDown, checking for + Timeout, verifying the returned result from a method, etc. + + TestCommands may decorate other test commands so that the + execution of a lower-level command is nested within that + of a higher level command. All nested commands are executed + synchronously, as a single unit. Scheduling test execution + on separate threads is handled at a higher level, using the + task dispatcher. + + + + + Construct a TestCommand for a test. + + The test to be executed + + + + Gets the test associated with this command. + + + + + Runs the test in a specified context, returning a TestResult. + + The TestExecutionContext to be used for running the test. + A TestResult + + + + TestMethodCommand is the lowest level concrete command + used to run actual test cases. + + + + + Initializes a new instance of the class. + + The test. + + + + Runs the test, saving a TestResult in the execution context, as + well as returning it. If the test has an expected result, it + is asserts on that value. Since failed tests and errors throw + an exception, this command must be wrapped in an outer command, + will handle that exception and records the failure. This role + is usually played by the SetUpTearDown command. + + The execution context + + + + TheoryResultCommand adjusts the result of a Theory so that + it fails if all the results were inconclusive. + + + + + Constructs a TheoryResultCommand + + The command to be wrapped by this one + + + + Overridden to call the inner command and adjust the result + in case all chlid results were inconclusive. + + + + + + + CultureDetector is a helper class used by NUnit to determine + whether a test should be run based on the current culture. + + + + + Default constructor uses the current culture. + + + + + Construct a CultureDetector for a particular culture for testing. + + The culture to be used + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + Tests to determine if the current culture is supported + based on a culture attribute. + + The attribute to examine + + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + ExceptionHelper provides static methods for working with exceptions + + + + + Rethrows an exception, preserving its stack trace + + The exception to rethrow + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined message string. + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined stack trace. + + + + Gets the stack trace of the exception. + + The exception. + A string representation of the stack trace. + + + + A utility class to create TestCommands + + + + + Gets the command to be executed before any of + the child tests are run. + + A TestCommand + + + + Gets the command to be executed after all of the + child tests are run. + + A TestCommand + + + + Creates a test command for use in running this test. + + + + + + Creates a command for skipping a test. The result returned will + depend on the test RunState. + + + + + Builds the set up tear down list. + + Type of the fixture. + Type of the set up attribute. + Type of the tear down attribute. + A list of SetUpTearDownItems + + + + A CompositeWorkItem represents a test suite and + encapsulates the execution of the suite as well + as all its child tests. + + + + + List of Child WorkItems + + + + + A count of how many tests in the work item have a value for the Order Property + + + + + Construct a CompositeWorkItem for executing a test suite + using a filter to select child tests. + + The TestSuite to be executed + A filter used to select child tests + + + + Method that actually performs the work. Overridden + in CompositeWorkItem to do setup, run all child + items and then do teardown. + + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + A signed integer that indicates the relative values of and , as shown in the following table.Value Meaning Less than zero is less than .Zero equals .Greater than zero is greater than . + + The first object to compare.The second object to compare. + + + + Sorts tests under this suite. + + + + + Cancel (abort or stop) a CompositeWorkItem and all of its children + + true if the CompositeWorkItem and all of its children should be aborted, false if it should allow all currently running tests to complete + + + + The EventPumpState enum represents the state of an + EventPump. + + + + + The pump is stopped + + + + + The pump is pumping events with no stop requested + + + + + The pump is pumping events but a stop has been requested + + + + + EventPump pulls events out of an EventQueue and sends + them to a listener. It is used to send events back to + the client without using the CallContext of the test + runner thread. + + + + + The handle on which a thread enqueuing an event with == true + waits, until the EventPump has sent the event to its listeners. + + + + + The downstream listener to which we send events + + + + + The queue that holds our events + + + + + Thread to do the pumping + + + + + The current state of the eventpump + + + + + Constructor + + The EventListener to receive events + The event queue to pull events from + + + + Gets or sets the current state of the pump + + + On volatile and , see + "http://www.albahari.com/threading/part4.aspx". + + + + + Gets or sets the name of this EventPump + (used only internally and for testing). + + + + + Dispose stops the pump + Disposes the used WaitHandle, too. + + + + + Start the pump + + + + + Tell the pump to stop after emptying the queue. + + + + + Our thread proc for removing items from the event + queue and sending them on. Note that this would + need to do more locking if any other thread were + removing events from the queue. + + + + + NUnit.Core.Event is the abstract base for all stored events. + An Event is the stored representation of a call to the + ITestListener interface and is used to record such calls + or to queue them for forwarding on another thread or at + a later time. + + + + + The Send method is implemented by derived classes to send the event to the specified listener. + + The listener. + + + + Gets a value indicating whether this event is delivered synchronously by the NUnit . + + If true, and if has been used to + set a WaitHandle, blocks its calling thread until the + thread has delivered the event and sets the WaitHandle. + + + + + + TestStartedEvent holds information needed to call the TestStarted method. + + + + + Initializes a new instance of the class. + + The test. + + + + Calls TestStarted on the specified listener. + + The listener. + + + + TestFinishedEvent holds information needed to call the TestFinished method. + + + + + Initializes a new instance of the class. + + The result. + + + + Calls TestFinished on the specified listener. + + The listener. + + + + Implements a queue of work items each of which + is queued as a WaitCallback. + + + + + Construct a new EventQueue + + + + + WaitHandle for synchronous event delivery in . + + Having just one handle for the whole implies that + there may be only one producer (the test thread) for synchronous events. + If there can be multiple producers for synchronous events, one would have + to introduce one WaitHandle per event. + + + + + + Gets the count of items in the queue. + + + + + Sets a handle on which to wait, when is called + for an with == true. + + + The wait handle on which to wait, when is called + for an with == true. + The caller is responsible for disposing this wait handle. + + + + + Enqueues the specified event + + The event to enqueue. + + + + Removes the first element from the queue and returns it (or null). + + + If true and the queue is empty, the calling thread is blocked until + either an element is enqueued, or is called. + + + + + If the queue not empty + the first element. + + + otherwise, if ==false + or has been called + null. + + + + + + + Stop processing of the queue + + + + + An IWorkItemDispatcher handles execution of work items. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + true if the IWorkItemDispatcher should abort all currently running WorkItems, false if it should allow all currently running WorkItems to complete + + + + ParallelWorkItemDispatcher handles execution of work items by + queuing them for worker threads to process. + + + + + Construct a ParallelWorkItemDispatcher + + Number of workers to use + + + + Enumerates all the shifts supported by the dispatcher + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + + + + QueuingEventListener uses an EventQueue to store any + events received on its EventListener interface. + + + + + The EvenQueue created and filled by this listener + + + + + A test has started + + The test that is starting + + + + A test case finished + + Result of the test case + + + + A SimpleWorkItem represents a single test case and is + marked as completed immediately upon execution. This + class is also used for skipped or ignored test suites. + + + + + Construct a simple work item for a test. + + The test to be executed + The filter used to select this test + + + + Method that performs actually performs the work. + + + + + SimpleWorkItemDispatcher handles execution of WorkItems by + directly executing them. It is provided so that a dispatcher + is always available in the context, thereby simplifying the + code needed to run child tests. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and a thread is created on which to + run it. Subsequent calls come from the top level + item or its descendants on the proper thread. + + The item to dispatch + + + + Cancel (abort or stop) the ongoing run. + If no run is in process, the call has no effect. + + true if the run should be aborted, false if it should allow its currently running test to complete + + + + A TestWorker pulls work items from a queue + and executes them. + + + + + Event signaled immediately before executing a WorkItem + + + + + Event signaled immediately after executing a WorkItem + + + + + Construct a new TestWorker. + + The queue from which to pull work items + The name of this worker + The apartment state to use for running tests + + + + The name of this worker - also used for the thread + + + + + Indicates whether the worker thread is running + + + + + Our ThreadProc, which pulls and runs tests in a loop + + + + + Start processing work items. + + + + + Stop the thread, either immediately or after finishing the current WorkItem + + true if the thread should be aborted, false if it should allow the currently running test to complete + + + + The TextCapture class intercepts console output and writes it + to the current execution context, if one is present on the thread. + If no execution context is found, the output is written to a + default destination, normally the original destination of the + intercepted output. + + + + + Construct a TextCapture object + + The default destination for non-intercepted output + + + + Gets the Encoding in use by this TextWriter + + + + + Writes a single character + + The char to write + + + + Writes a string + + The string to write + + + + Writes a string followed by a line terminator + + The string to write + + + + A WorkItem may be an individual test case, a fixture or + a higher level grouping of tests. All WorkItems inherit + from the abstract WorkItem class, which uses the template + pattern to allow derived classes to perform work in + whatever way is needed. + + A WorkItem is created with a particular TestExecutionContext + and is responsible for re-establishing that context in the + current thread before it begins or resumes execution. + + + + + Creates a work item. + + The test for which this WorkItem is being created. + The filter to be used in selecting any child Tests. + + + + + Construct a WorkItem for a particular test. + + The test that the WorkItem will run + + + + Initialize the TestExecutionContext. This must be done + before executing the WorkItem. + + + Originally, the context was provided in the constructor + but delaying initialization of the context until the item + is about to be dispatched allows changes in the parent + context during OneTimeSetUp to be reflected in the child. + + The TestExecutionContext to use + + + + Event triggered when the item is complete + + + + + Gets the current state of the WorkItem + + + + + The test being executed by the work item + + + + + The execution context + + + + + The test actions to be performed before and after this test + + + + + Indicates whether this WorkItem may be run in parallel + + + + + The test result + + + + + Execute the current work item, including any + child work items. + + + + + Cancel (abort or stop) a WorkItem + + true if the WorkItem should be aborted, false if it should run to completion + + + + Method that performs actually performs the work. It should + set the State to WorkItemState.Complete when done. + + + + + Method called by the derived class when all work is complete + + + + + WorkItemQueueState indicates the current state of a WorkItemQueue + + + + + The queue is paused + + + + + The queue is running + + + + + The queue is stopped + + + + + A WorkItemQueue holds work items that are ready to + be run, either initially or after some dependency + has been satisfied. + + + + + Initializes a new instance of the class. + + The name of the queue. + + + + Gets the name of the work item queue. + + + + + Gets the total number of items processed so far + + + + + Gets the maximum number of work items. + + + + + Gets the current state of the queue + + + + + Get a bool indicating whether the queue is empty. + + + + + Enqueue a WorkItem to be processed + + The WorkItem to process + + + + Dequeue a WorkItem for processing + + A WorkItem or null if the queue has stopped + + + + Start or restart processing of items from the queue + + + + + Signal the queue to stop + + + + + Pause the queue for restarting later + + + + + The current state of a work item + + + + + Ready to run or continue + + + + + Work Item is executing + + + + + Complete + + + + + The dispatcher needs to do different things at different, + non-overlapped times. For example, non-parallel tests may + not be run at the same time as parallel tests. We model + this using the metaphor of a working shift. The WorkShift + class associates one or more WorkItemQueues with one or + more TestWorkers. + + Work in the queues is processed until all queues are empty + and all workers are idle. Both tests are needed because a + worker that is busy may end up adding more work to one of + the queues. At that point, the shift is over and another + shift may begin. This cycle continues until all the tests + have been run. + + + + + Construct a WorkShift + + + + + Event that fires when the shift has ended + + + + + Gets a flag indicating whether the shift is currently active + + + + + Gets a list of the queues associated with this shift. + + Used for testing + + + + Gets the list of workers associated with this shift. + + + + + Gets a bool indicating whether this shift has any work to do + + + + + Add a WorkItemQueue to the shift, starting it if the + shift is currently active. + + + + + Assign a worker to the shift. + + + + + + Start or restart processing for the shift + + + + + End the shift, pausing all queues and raising + the EndOfShift event. + + + + + Shut down the shift. + + + + + Cancel (abort or stop) the shift without completing all work + + true if the WorkShift should be aborted, false if it should allow its currently running tests to complete + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Gets or sets the maximum line length for this writer + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a given + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The result of the constraint that failed + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The ConstraintResult for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + Gets the element name + + Element name + + + + ClassName filter selects tests based on the class FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + A base class for multi-part filters + + + + + Constructs an empty CompositeFilter + + + + + Constructs a CompositeFilter from an array of filters + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return a list of the composing filters. + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + IdFilter selects tests based on their id + + + + + Construct an IdFilter for a single value + + The id the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a MethodNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter + + The filter to be negated + + + + Gets the base filter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + PropertyFilter is able to select or exclude tests + based on their properties. + + + + + + Construct a PropertyFilter using a property name and expected value + + A property name + The expected value of the property + + + + Check whether the filter matches a test + + The test to be matched + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + TestName filter selects tests based on their Name + + + + + Construct a TestNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + ValueMatchFilter selects tests based on some value, which + is expected to be contained in the test. + + + + + Returns the value matched by the filter - used for testing + + + + + Indicates whether the value is a regular expression + + + + + Construct a ValueMatchFilter for a single value. + + The value to be included. + + + + Match the input provided by the derived class + + The value to be matchedT + True for a match, false otherwise. + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + GenericMethodHelper is able to deduce the Type arguments for + a generic method from the actual arguments provided. + + + + + Construct a GenericMethodHelper for a method + + MethodInfo for the method to examine + + + + Return the type argments for the method, deducing them + from the arguments actually provided. + + The arguments to the method + An array of type arguments. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + The MethodWrapper class wraps a MethodInfo so that it may + be used in a platform-independent manner. + + + + + Construct a MethodWrapper for a Type and a MethodInfo. + + + + + Construct a MethodInfo for a given Type and method name. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the spcified type are defined on the method. + + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Thrown when an assertion failed. Here to preserve the inner + exception and hence its stack trace. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + OSPlatform represents a particular operating system platform + + + + + Platform ID for Unix as defined by Microsoft .NET 2.0 and greater + + + + + Platform ID for Unix as defined by Mono + + + + + Platform ID for XBox as defined by .NET and Mono, but not CF + + + + + Platform ID for MacOSX as defined by .NET and Mono, but not CF + + + + + Get the OSPlatform under which we are currently running + + + + + Gets the actual OS Version, not the incorrect value that might be + returned for Win 8.1 and Win 10 + + + If an application is not manifested as Windows 8.1 or Windows 10, + the version returned from Environment.OSVersion will not be 6.3 and 10.0 + respectively, but will be 6.2 and 6.3. The correct value can be found in + the registry. + + The original version + The correct OS version + + + + Product Type Enumeration used for Windows + + + + + Product type is unknown or unspecified + + + + + Product type is Workstation + + + + + Product type is Domain Controller + + + + + Product type is Server + + + + + Construct from a platform ID and version + + + + + Construct from a platform ID, version and product type + + + + + Get the platform ID of this instance + + + + + Get the Version of this instance + + + + + Get the Product Type of this instance + + + + + Return true if this is a windows platform + + + + + Return true if this is a Unix or Linux platform + + + + + Return true if the platform is Win32S + + + + + Return true if the platform is Win32Windows + + + + + Return true if the platform is Win32NT + + + + + Return true if the platform is Windows CE + + + + + Return true if the platform is Xbox + + + + + Return true if the platform is MacOSX + + + + + Return true if the platform is Windows 95 + + + + + Return true if the platform is Windows 98 + + + + + Return true if the platform is Windows ME + + + + + Return true if the platform is NT 3 + + + + + Return true if the platform is NT 4 + + + + + Return true if the platform is NT 5 + + + + + Return true if the platform is Windows 2000 + + + + + Return true if the platform is Windows XP + + + + + Return true if the platform is Windows 2003 Server + + + + + Return true if the platform is NT 6 + + + + + Return true if the platform is NT 6.0 + + + + + Return true if the platform is NT 6.1 + + + + + Return true if the platform is NT 6.2 + + + + + Return true if the platform is NT 6.3 + + + + + Return true if the platform is Vista + + + + + Return true if the platform is Windows 2008 Server (original or R2) + + + + + Return true if the platform is Windows 2008 Server (original) + + + + + Return true if the platform is Windows 2008 Server R2 + + + + + Return true if the platform is Windows 2012 Server (original or R2) + + + + + Return true if the platform is Windows 2012 Server (original) + + + + + Return true if the platform is Windows 2012 Server R2 + + + + + Return true if the platform is Windows 7 + + + + + Return true if the platform is Windows 8 + + + + + Return true if the platform is Windows 8.1 + + + + + Return true if the platform is Windows 10 + + + + + Return true if the platform is Windows Server. This is named Windows + Server 10 to distinguish it from previous versions of Windows Server. + + + + + The ParameterWrapper class wraps a ParameterInfo so that it may + be used in a platform-independent manner. + + + + + Construct a ParameterWrapper for a given method and parameter + + + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter. + + + + + Gets the underlying ParameterInfo + + + + + Gets the Type of the parameter + + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the specified type are defined on the parameter. + + + + + PlatformHelper class is used by the PlatformAttribute class to + determine whether a platform is supported. + + + + + Comma-delimited list of all supported OS platform constants + + + + + Comma-delimited list of all supported Runtime platform constants + + + + + Default constructor uses the operating system and + common language runtime of the system. + + + + + Construct a PlatformHelper for a particular operating + system and common language runtime. Used in testing. + + OperatingSystem to be used + RuntimeFramework to be used + + + + Test to determine if one of a collection of platforms + is being used currently. + + + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Test to determine if the a particular platform or comma- + delimited set of platforms is in use. + + Name of the platform or comma-separated list of platform ids + True if the platform is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + A PropertyBag represents a collection of name value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + + + + Adds a key/value pair to the property set + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + + True if their are _values present, otherwise false + + + + + Gets a collection containing all the keys in the property set + + + + + + Gets or sets the list of _values for a particular key + + + + + Returns an XmlNode representating the current PropertyBag. + + Not used + An XmlNode representing the PropertyBag + + + + Returns an XmlNode representing the PropertyBag after + adding it as a child of the supplied parent node. + + The parent node. + Not used + + + + + The PropertyNames class provides static constants for the + standard property ids that NUnit uses on tests. + + + + + The FriendlyName of the AppDomain in which the assembly is running + + + + + The selected strategy for joining parameter data into test cases + + + + + The process ID of the executing assembly + + + + + The stack trace from any data provider that threw + an exception. + + + + + The reason a test was not run + + + + + The author of the tests + + + + + The ApartmentState required for running the test + + + + + The categories applying to a test + + + + + The Description of a test + + + + + The number of threads to be used in running tests + + + + + The maximum time in ms, above which the test is considered to have failed + + + + + The ParallelScope associated with a test + + + + + The number of times the test should be repeated + + + + + Indicates that the test should be run on a separate thread + + + + + The culture to be set for a test + + + + + The UI culture to be set for a test + + + + + The type that is under test + + + + + The timeout value for the test + + + + + The test will be ignored until the given date + + + + + The optional Order the test will run in + + + + + Randomizer returns a set of random _values in a repeatable + way, to allow re-running of tests if necessary. It extends + the .NET Random class, providing random values for a much + wider range of types. + + The class is used internally by the framework to generate + test case data and is also exposed for use by users through + the TestContext.Random property. + + + For consistency with the underlying Random Type, methods + returning a single value use the prefix "Next..." Those + without an argument return a non-negative value up to + the full positive range of the Type. Overloads are provided + for specifying a maximum or a range. Methods that return + arrays or strings use the prefix "Get..." to avoid + confusion with the single-value methods. + + + + + Initial seed used to create randomizers for this run + + + + + Get a Randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same _values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Create a new Randomizer using the next seed + available to ensure that each randomizer gives + a unique sequence of values. + + + + + + Default constructor + + + + + Construct based on seed value + + + + + + Returns a random unsigned int. + + + + + Returns a random unsigned int less than the specified maximum. + + + + + Returns a random unsigned int within a specified range. + + + + + Returns a non-negative random short. + + + + + Returns a non-negative random short less than the specified maximum. + + + + + Returns a non-negative random short within a specified range. + + + + + Returns a random unsigned short. + + + + + Returns a random unsigned short less than the specified maximum. + + + + + Returns a random unsigned short within a specified range. + + + + + Returns a random long. + + + + + Returns a random long less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random ulong. + + + + + Returns a random ulong less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random Byte + + + + + Returns a random Byte less than the specified maximum. + + + + + Returns a random Byte within a specified range + + + + + Returns a random SByte + + + + + Returns a random sbyte less than the specified maximum. + + + + + Returns a random sbyte within a specified range + + + + + Returns a random bool + + + + + Returns a random bool based on the probablility a true result + + + + + Returns a random double between 0.0 and the specified maximum. + + + + + Returns a random double within a specified range. + + + + + Returns a random float. + + + + + Returns a random float between 0.0 and the specified maximum. + + + + + Returns a random float within a specified range. + + + + + Returns a random enum value of the specified Type as an object. + + + + + Returns a random enum value of the specified Type. + + + + + Default characters for random functions. + + Default characters are the English alphabet (uppercase & lowercase), arabic numerals, and underscore + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + string representing the set of characters from which to construct the resulting string + A random string of arbitrary length + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + A random string of arbitrary length + Uses DefaultStringChars as the input character set + + + + Generate a random string based on the characters from the input string. + + A random string of the default length + Uses DefaultStringChars as the input character set + + + + Returns a random decimal. + + + + + Returns a random decimal between positive zero and the specified maximum. + + + + + Returns a random decimal within a specified range, which is not + permitted to exceed decimal.MaxVal in the current implementation. + + + A limitation of this implementation is that the range from min + to max must not exceed decimal.MaxVal. + + + + + Helper methods for inspecting a type by reflection. + + Many of these methods take ICustomAttributeProvider as an + argument to avoid duplication, even though certain attributes can + only appear on specific types of members, like MethodInfo or Type. + + In the case where a type is being examined for the presence of + an attribute, interface or named member, the Reflect methods + operate with the full name of the member being sought. This + removes the necessity of the caller having a reference to the + assembly that defines the item being sought and allows the + NUnit core to inspect assemblies that reference an older + version of the NUnit framework. + + + + + Examine a fixture type and return an array of methods having a + particular attribute. The array is order with base methods first. + + The type to examine + The attribute Type to look for + Specifies whether to search the fixture type inheritance chain + The array of methods found + + + + Examine a fixture type and return true if it has a method with + a particular attribute. + + The type to examine + The attribute Type to look for + True if found, otherwise false + + + + Invoke the default constructor on a Type + + The Type to be constructed + An instance of the Type + + + + Invoke a constructor on a Type with arguments + + The Type to be constructed + Arguments to the constructor + An instance of the Type + + + + Returns an array of types from an array of objects. + Used because the compact framework doesn't support + Type.GetTypeArray() + + An array of objects + An array of Types + + + + Invoke a parameterless method returning void on an object. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + + + + Invoke a method, converting any TargetInvocationException to an NUnitException. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The TestResult class represents the result of a test. + + + + + Error message for when child tests have errors + + + + + Error message for when child tests are ignored + + + + + The minimum duration for tests + + + + + List of child results + + + + + Construct a test result given a Test + + The test to be used + + + + Gets the test with which this result is associated. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets or sets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Test HasChildren before accessing Children to avoid + the creation of an empty collection. + + + + + Gets the collection of child results. + + + + + Gets a TextWriter, which will write output to be included in the result. + + + + + Gets any text output written to this result. + + + + + Returns the Xml representation of the result. + + If true, descendant results are included + An XmlNode representing the result + + + + Adds the XML representation of the result as a child of the + supplied parent node.. + + The parent node. + If true, descendant results are included + + + + + Adds a child result to this result, setting this result's + ResultState to Failure if the child result failed. + + The result to be added + + + + Set the result of the test + + The ResultState to use in the result + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + Stack trace giving the location of the command + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + THe FailureSite to use in the result + + + + RecordTearDownException appends the message and stacktrace + from an exception arising during teardown of the test + to any previously recorded information, so that any + earlier failure information is not lost. Note that + calling Assert.Ignore, Assert.Inconclusive, etc. during + teardown is treated as an error. If the current result + represents a suite, it may show a teardown error even + though all contained tests passed. + + The Exception to be recorded + + + + Adds a reason element to a node and returns it. + + The target node. + The new reason element. + + + + Adds a failure element to a node and returns it. + + The target node. + The new failure element. + + + + Enumeration identifying a common language + runtime implementation. + + + + Any supported runtime framework + + + Microsoft .NET Framework + + + Microsoft .NET Compact Framework + + + Microsoft Shared Source CLI + + + Mono + + + Silverlight + + + MonoTouch + + + + RuntimeFramework represents a particular version + of a common language runtime implementation. + + + + + DefaultVersion is an empty Version, used to indicate that + NUnit should select the CLR version to use for the test. + + + + + Construct from a runtime type and version. If the version has + two parts, it is taken as a framework version. If it has three + or more, it is taken as a CLR version. In either case, the other + version is deduced based on the runtime type and provided version. + + The runtime type of the framework + The version of the framework + + + + Static method to return a RuntimeFramework object + for the framework that is currently in use. + + + + + The type of this runtime framework + + + + + The framework version for this runtime framework + + + + + The CLR version for this runtime framework + + + + + Return true if any CLR version may be used in + matching this RuntimeFramework object. + + + + + Returns the Display name for this framework + + + + + Parses a string representing a RuntimeFramework. + The string may be just a RuntimeType name or just + a Version or a hyphenated RuntimeType-Version or + a Version prefixed by 'versionString'. + + + + + + + Overridden to return the short name of the framework + + + + + + Returns true if the current framework matches the + one supplied as an argument. Two frameworks match + if their runtime types are the same or either one + is RuntimeType.Any and all specified version components + are equal. Negative (i.e. unspecified) version + components are ignored. + + The RuntimeFramework to be matched. + True on match, otherwise false + + + + StackFilter class is used to remove internal NUnit + entries from a stack trace so that the resulting + trace provides better information about the test. + + + + + Filters a raw stack trace and returns the result. + + The original stack trace + A filtered stack trace + + + + Provides methods to support legacy string comparison methods. + + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + Zero if the strings are equivalent, a negative number if strA is sorted first, a positive number if + strB is sorted first + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + True if the strings are equivalent, false if not. + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + The expected result to be returned + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + The expected result of the test, which + must match the method return type. + + + + + Gets a value indicating whether an expected result was specified. + + + + + Helper class used to save and restore certain static or + singleton settings in the environment that affect tests + or which might be changed by the user tests. + + An internal class is used to hold settings and a stack + of these objects is pushed and popped as Save and Restore + are called. + + + + + Link to a prior saved context + + + + + Indicates that a stop has been requested + + + + + The event listener currently receiving notifications + + + + + The number of assertions for the current test + + + + + The current culture + + + + + The current UI culture + + + + + The current test result + + + + + The current Principal. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + An existing instance of TestExecutionContext. + + + + The current context, head of the list of saved contexts. + + + + + Gets the current context. + + The current context. + + + + Get the current context or return null if none is found. + + + + + Clear the current context. This is provided to + prevent "leakage" of the CallContext containing + the current context back to any runners. + + + + + Gets or sets the current test + + + + + The time the current test started execution + + + + + The time the current test started in Ticks + + + + + Gets or sets the current test result + + + + + Gets a TextWriter that will send output to the current test result. + + + + + The current test object - that is the user fixture + object on which tests are being executed. + + + + + Get or set the working directory + + + + + Get or set indicator that run should stop on the first error + + + + + Gets an enum indicating whether a stop has been requested. + + + + + The current test event listener + + + + + The current WorkItemDispatcher + + + + + The ParallelScope to be used by tests running in this context. + For builds with out the parallel feature, it has no effect. + + + + + Gets the RandomGenerator specific to this Test + + + + + Gets the assert count. + + The assert count. + + + + Gets or sets the test case timeout value + + + + + Gets a list of ITestActions set by upstream tests + + + + + Saves or restores the CurrentCulture + + + + + Saves or restores the CurrentUICulture + + + + + Gets or sets the current for the Thread. + + + + + The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter + + + + + Record any changes in the environment made by + the test code in the execution context so it + will be passed on to lower level tests. + + + + + Set up the execution environment to match a context. + Note that we may be running on the same thread where the + context was initially created or on a different thread. + + + + + Increments the assert count by one. + + + + + Increments the assert count by a specified amount. + + + + + Adds a new ValueFormatterFactory to the chain of formatters + + The new factory + + + + Obtain lifetime service object + + + + + + Enumeration indicating whether the tests are + running normally or being cancelled. + + + + + Running normally with no stop requested + + + + + A graceful stop has been requested + + + + + A forced stop has been requested + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Indicates whether this is a top-level filter, + not contained in any other filter. + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. This is overridden by each + different type of filter to perform the necessary tests. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test matches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Create a TestFilter instance from an xml representation. + + + + + Create a TestFilter from it's TNode representation + + + + + Nested class provides an empty filter - one that always + returns true when called. It never matches explicitly. + + + + + Adds an XML node + + True if recursive + The added XML node + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + Type arguments used to create a generic fixture instance + + + + + TestListener provides an implementation of ITestListener that + does nothing. It is used only through its NULL property. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test case has finished + + The result of the test + + + + Construct a new TestListener - private so it may not be used. + + + + + Get a listener that does nothing + + + + + TestNameGenerator is able to create test names according to + a coded pattern. + + + + + Construct a TestNameGenerator + + The pattern used by this generator. + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + The display name + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + Arguments to be used + The display name + + + + Get the display name for a MethodInfo + + A MethodInfo + The display name + + + + Get the display name for a method with args + + A MethodInfo + Argument list for the method + The display name + + + + TestParameters is the abstract base class for all classes + that know how to provide data for constructing a test. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a ParameterSet from an object implementing ITestData + + + + + + The RunState for this set of parameters. + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets the property dictionary for this test + + + + + Applies ParameterSet _values to the test itself. + + A test. + + + + The original arguments provided by the user, + used for display purposes. + + + + + TestProgressReporter translates ITestListener events into + the async callbacks that are used to inform the client + software about the progress of a test run. + + + + + Initializes a new instance of the class. + + The callback handler to be used for reporting progress. + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished. Sends a result summary to the callback. + to + + The result of the test + + + + Returns the parent test item for the targer test item if it exists + + + parent test item + + + + Makes a string safe for use as an attribute, replacing + characters characters that can't be used with their + corresponding xml representations. + + The string to be used + A new string with the _values replaced + + + + ParameterizedFixtureSuite serves as a container for the set of test + fixtures created from a given Type using various parameters. + + + + + Initializes a new instance of the class. + + The ITypeInfo for the type that represents the suite. + + + + Gets a string representing the type of test + + + + + + ParameterizedMethodSuite holds a collection of individual + TestMethods with their arguments applied. + + + + + Construct from a MethodInfo + + + + + + Gets a string representing the type of test + + + + + + SetUpFixture extends TestSuite and supports + Setup and TearDown methods. + + + + + Initializes a new instance of the class. + + The type. + + + + The Test abstract class represents a test within the framework. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + The SetUp methods. + + + + + The teardown methods + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + TODO: Documentation needed for constructor + + + + + + Construct a test from a MethodInfo + + + + + + Gets or sets the id of the test + + + + + + Gets or sets the name of the test + + + + + Gets or sets the fully qualified name of the test + + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the TypeInfo of the fixture used in running this test + or null if no fixture type is associated with it. + + + + + Gets a MethodInfo for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Whether or not the test should be run + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Gets a string representing the type of test. Used as an attribute + value in the XML representation of a test and has no other + function in the framework. + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets the properties for this test + + + + + Returns true if this is a TestSuite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets or sets a fixture object for running this test. + + + + + Static prefix used for ids in this AppDomain. + Set by FrameworkController. + + + + + Gets or Sets the Int value representing the seed for the RandomGenerator + + + + + + Creates a TestResult for this test. + + A TestResult suitable for this type of test. + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object implementing ICustomAttributeProvider + + + + Add standard attributes and members to a test node. + + + + + + + Returns the Xml representation of the test + + If true, include child tests recursively + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + TestAssembly is a TestSuite that represents the execution + of tests in a managed assembly. + + + + + Initializes a new instance of the class + specifying the Assembly and the path from which it was loaded. + + The assembly this test represents. + The path used to load the assembly. + + + + Initializes a new instance of the class + for a path which could not be loaded. + + The path used to load the assembly. + + + + Gets the Assembly represented by this instance. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + TestFixture is a surrogate for a user test fixture class, + containing one or more tests. + + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + The TestMethod class represents a Test implemented as a method. + + + + + The ParameterSet used to create this test method + + + + + Initializes a new instance of the class. + + The method to be used as a test. + + + + Initializes a new instance of the class. + + The method to be used as a test. + The suite or fixture to which the new test will be added + + + + Overridden to return a TestCaseResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Returns a TNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Gets this test's child tests + + A list of child tests + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns the name of the method + + + + + TestSuite represents a composite test, which contains other tests. + + + + + Our collection of child tests + + + + + Initializes a new instance of the class. + + The name of the suite. + + + + Initializes a new instance of the class. + + Name of the parent suite. + The name of the suite. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Sorts tests under this suite. + + + + + Adds a test to the suite. + + The test. + + + + Gets this test's child tests + + The list of child tests + + + + Gets a count of test cases represented by + or contained under this test. + + + + + + The arguments to use in creating the fixture + + + + + Set to true to suppress sorting this suite's contents + + + + + Overridden to return a TestSuiteResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Check that setup and teardown methods marked by certain attributes + meet NUnit's requirements and mark the tests not runnable otherwise. + + The attribute type to check for + + + + ThreadUtility provides a set of static methods convenient + for working with threads. + + + + + Do our best to Kill a thread + + The thread to kill + + + + Do our best to kill a thread, passing state info + + The thread to kill + Info for the ThreadAbortException handler + + + + TypeHelper provides static methods that operate on Types. + + + + + A special value, which is used to indicate that BestCommonType() method + was unable to find a common type for the specified arguments. + + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The display name for the Type + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The arglist provided. + The display name for the Type + + + + Returns the best fit for a common type to be used in + matching actual arguments to a methods Type parameters. + + The first type. + The second type. + Either type1 or type2, depending on which is more general. + + + + Determines whether the specified type is numeric. + + The type to be examined. + + true if the specified type is numeric; otherwise, false. + + + + + Convert an argument list to the required parameter types. + Currently, only widening numeric conversions are performed. + + An array of args to be converted + A ParameterInfo[] whose types will be used as targets + + + + Determines whether this instance can deduce type args for a generic type from the supplied arguments. + + The type to be examined. + The arglist. + The type args to be used. + + true if this the provided args give sufficient information to determine the type args to be used; otherwise, false. + + + + + Gets the _values for an enumeration, using Enum.GetTypes + where available, otherwise through reflection. + + + + + + + Gets the ids of the _values for an enumeration, + using Enum.GetNames where available, otherwise + through reflection. + + + + + + + The TypeWrapper class wraps a Type so it may be used in + a platform-independent manner. + + + + + Construct a TypeWrapper for a specified Type. + + + + + Gets the underlying Type on which this TypeWrapper is based. + + + + + Gets the base type of this type as an ITypeInfo + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Returns true if the Type wrapped is T + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type represents a static class. + + + + + Get the display name for this type + + + + + Get the display name for an object of this type, constructed with the specified args. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns an array of custom attributes of the specified type applied to this type + + + + + Returns a value indicating whether the type has an attribute of the specified type. + + + + + + + + Returns a flag indicating whether this type has a method with an attribute of the specified type. + + + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Represents the result of running a single test case. + + + + + Construct a TestCaseResult based on a TestMethod + + A TestMethod to which the result applies. + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Represents the result of running a test suite + + + + + Construct a TestSuiteResult base on a TestSuite + + The TestSuite to which the result applies + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Add a child result + + The child result to be added + + + + Provides a platform-independent methods for getting attributes + for use by AttributeConstraint and AttributeExistsConstraint. + + + + + Gets the custom attributes from the given object. + + Portable libraries do not have an ICustomAttributeProvider, so we need to cast to each of + it's direct subtypes and try to get attributes off those instead. + The actual. + Type of the attribute. + if set to true [inherit]. + A list of the given attribute on the given object. + + + + A MarshalByRefObject that lives forever + + + + + Obtains a lifetime service object to control the lifetime policy for this instance. + + + + + Provides NUnit specific extensions to aid in Reflection + across multiple frameworks + + + This version of the class supplies GetTypeInfo() on platforms + that don't support it. + + + + + GetTypeInfo gives access to most of the Type information we take for granted + on .NET Core and Windows Runtime. Rather than #ifdef different code for different + platforms, it is easiest to just code all platforms as if they worked this way, + thus the simple passthrough. + + + + + + + Extensions for Assembly that are not available in pre-4.5 .NET releases + + + + + An easy way to get a single custom attribute from an assembly + + The attribute Type + The assembly + An attribute of Type T + + + + This class is a System.Diagnostics.Stopwatch on operating systems that support it. On those that don't, + it replicates the functionality at the resolution supported. + + + + + Class used to guard against unexpected argument values + or operations by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Throws an ArgumentOutOfRangeException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an ArgumentException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an InvalidOperationException if the specified condition is not met. + + The condition that must be met + The exception message to be used + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + DefaultTestAssemblyBuilder loads a single assembly and builds a TestSuite + containing test fixtures present in the assembly. + + + + + The default suite builder used by the test assembly builder. + + + + + Initializes a new instance of the class. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + FrameworkController provides a facade for use in loading, browsing + and running tests without requiring a reference to the NUnit + framework. All calls are encapsulated in constructors for + this class and its nested classes, which only require the + types of the Common Type System as arguments. + + The controller supports four actions: Load, Explore, Count and Run. + They are intended to be called by a driver, which should allow for + proper sequencing of calls. Load must be called before any of the + other actions. The driver may support other actions, such as + reload on run, by combining these calls. + + + + + Construct a FrameworkController using the default builder and runner. + + The AssemblyName or path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController using the default builder and runner. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The full AssemblyName or the path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Gets the ITestAssemblyBuilder used by this controller instance. + + The builder. + + + + Gets the ITestAssemblyRunner used by this controller instance. + + The runner. + + + + Gets the AssemblyName or the path for which this FrameworkController was created + + + + + Gets the Assembly for which this + + + + + Gets a dictionary of settings for the FrameworkController + + + + + Loads the tests in the assembly + + + + + + Returns info about the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of exploring the tests + + + + Runs the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly syncronously reporting back the test results through the callback + or through the return value + + The callback that receives the test results + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly asyncronously reporting back the test results through the callback + + The callback that receives the test results + A string containing the XML representation of the filter to use + + + + Stops the test run + + True to force the stop, false for a cooperative stop + + + + Counts the number of test cases in the loaded TestSuite + + A string containing the XML representation of the filter to use + The number of tests + + + + Inserts environment element + + Target node + The new node + + + + Inserts settings element + + Target node + Settings dictionary + The new node + + + + FrameworkControllerAction is the base class for all actions + performed against a FrameworkController. + + + + + LoadTestsAction loads a test into the FrameworkController + + + + + LoadTestsAction loads the tests in an assembly. + + The controller. + The callback handler. + + + + ExploreTestsAction returns info about the tests in an assembly + + + + + Initializes a new instance of the class. + + The controller for which this action is being performed. + Filter used to control which tests are included (NYI) + The callback handler. + + + + CountTestsAction counts the number of test cases in the loaded TestSuite + held by the FrameworkController. + + + + + Construct a CountsTestAction and perform the count of test cases. + + A FrameworkController holding the TestSuite whose cases are to be counted + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunTestsAction runs the loaded TestSuite held by the FrameworkController. + + + + + Construct a RunTestsAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunAsyncAction initiates an asynchronous test run, returning immediately + + + + + Construct a RunAsyncAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + StopRunAction stops an ongoing run. + + + + + Construct a StopRunAction and stop any ongoing run. If no + run is in process, no error is raised. + + The FrameworkController for which a run is to be stopped. + True the stop should be forced, false for a cooperative stop. + >A callback handler used to report results + A forced stop will cause threads and processes to be killed as needed. + + + + The ITestAssemblyBuilder interface is implemented by a class + that is able to build a suite of tests given an assembly or + an assembly filename. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + The ITestAssemblyRunner interface is implemented by classes + that are able to execute a suite of tests loaded + from an assembly. + + + + + Gets the tree of loaded tests, or null if + no tests have been loaded. + + + + + Gets the tree of test results, if the test + run is completed, otherwise null. + + + + + Indicates whether a test has been loaded + + + + + Indicates whether a test is currently running + + + + + Indicates whether a test run is complete + + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + File name of the assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + The assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive ITestListener notifications. + A test filter used to select tests to be run + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any test-running threads + + + + Implementation of ITestAssemblyRunner + + + + + Initializes a new instance of the class. + + The builder. + + + + Gets the default level of parallel execution (worker threads) + + + + + The tree of tests that was loaded by the builder + + + + + The test result, if a run has completed + + + + + Indicates whether a test is loaded + + + + + Indicates whether a test is running + + + + + Indicates whether a test run is complete + + + + + Our settings, specified when loading the assembly + + + + + The top level WorkItem created for the assembly as a whole + + + + + The TestExecutionContext for the top level WorkItem + + + + + Loads the tests found in an Assembly + + File name of the assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Loads the tests found in an Assembly + + The assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + RunAsync is a template method, calling various abstract and + virtual methods to be overridden by derived classes. + + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Initiate the test run. + + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any tests that are currently running + + + + Create the initial TestExecutionContext used to run tests + + The ITestListener specified in the RunAsync call + + + + Handle the the Completed event for the top level work item + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that an async delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate does not throw an exception. + + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + Delegate used by tests that execute async code and + capture any thrown exception. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter ids for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Marks a test that must run in a particular threading apartment state, causing it + to run in a separate thread if necessary. + + + + + Construct an ApartmentAttribute + + The apartment state that this test must be run under. You must pass in a valid apartment state. + + + + Provides the Author of a test or test fixture. + + + + + Initializes a new instance of the class. + + The name of the author. + + + + Initializes a new instance of the class. + + The name of the author. + The email address of the author. + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Modifies a test by adding a category to it. + + The test to modify + + + + Marks a test to use a combinatorial join of any argument + data provided. Since this is the default, the attribute is + optional. + + + + + Default constructor + + + + + Marks a test to use a particular CombiningStrategy to join + any parameter data provided. Since this is the default, the + attribute is optional. + + + + + Construct a CombiningStrategyAttribute incorporating an + ICombiningStrategy and an IParamterDataProvider. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct a CombiningStrategyAttribute incorporating an object + that implements ICombiningStrategy and an IParameterDataProvider. + This constructor is provided for CLS compliance. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Modify the test by adding the name of the combining strategy + to the properties. + + The test to modify + + + + TestAssemblyDirectoryResolveAttribute is used to mark a test assembly as needing a + special assembly resolution hook that will explicitly search the test assembly's + directory for dependent assemblies. This works around a conflict between mixed-mode + assembly initialization and tests running in their own AppDomain in some cases. + + + + + LevelOfParallelismAttribute is used to set the number of worker threads + that may be allocated by the framework for running tests. + + + + + Construct a LevelOfParallelismAttribute. + + The number of worker threads to be created by the framework. + + + + Attribute used to identify a method that is called once + to perform setup before any child tests are run. + + + + + Attribute used to identify a method that is called once + after all the child tests have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RetryAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + + + + ParallelizableAttribute is used to mark tests that may be run in parallel. + + + + + Construct a ParallelizableAttribute using default ParallelScope.Self. + + + + + Construct a ParallelizableAttribute with a specified scope. + + The ParallelScope associated with this attribute. + + + + Modify the context to be used for child tests + + The current TestExecutionContext + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Causes a test to be skipped if this CultureAttribute is not satisfied. + + The test to modify + + + + Tests to determine if the current culture is supported + based on the properties of this attribute. + + True, if the current culture is supported + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + The abstract base class for all data-providing attributes + defined by NUnit. Used to select all data sources for a + method, class or parameter. + + + + + Default constructor + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointSourceAttribute. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointsAttribute. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct a description Attribute + + The text of the description + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + Modifies a test by marking it as explicit. + + The test to modify + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The date in the future to stop ignoring the test as a string in UTC time. + For example for a date and time, "2014-12-25 08:10:00Z" or for just a date, + "2014-12-25". If just a date is given, the Ignore will expire at midnight UTC. + + + Once the ignore until date has passed, the test will be marked + as runnable. Tests with an ignore until date will have an IgnoreUntilDate + property set which will appear in the test results. + + The string does not contain a valid string representation of a date and time. + + + + Modifies a test by marking it as Ignored. + + The test to modify + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple items may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + The abstract base class for all custom attributes defined by NUnit. + + + + + Default constructor + + + + + Marks a test to use a pairwise join of any argument + data provided. Arguments will be combined in such a + way that all possible pairs of arguments are used. + + + + + Default constructor + + + + + The ParallelScope enumeration permits specifying the degree to + which a test and its descendants may be run in parallel. + + + + + No Parallelism is permitted + + + + + The test itself may be run in parallel with others at the same level + + + + + Descendants of the test may be run in parallel with one another + + + + + Descendants of the test down to the level of TestFixtures may be run in parallel + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-delimited list of platforms + + + + Causes a test to be skipped if this PlatformAttribute is not satisfied. + + The test to modify + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Modifies a test by adding properties to it. + + The test to modify + + + + RandomAttribute is used to supply a set of random _values + to a single parameter of a parameterized test. + + + + + Construct a random set of values appropriate for the Type of the + parameter on which the attribute appears, specifying only the count. + + + + + + Construct a set of ints within a specified range + + + + + Construct a set of unsigned ints within a specified range + + + + + Construct a set of longs within a specified range + + + + + Construct a set of unsigned longs within a specified range + + + + + Construct a set of shorts within a specified range + + + + + Construct a set of unsigned shorts within a specified range + + + + + Construct a set of doubles within a specified range + + + + + Construct a set of floats within a specified range + + + + + Construct a set of bytes within a specified range + + + + + Construct a set of sbytes within a specified range + + + + + Get the collection of _values to be used as arguments. + + + + + RangeAttribute is used to supply a range of _values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of unsigned ints using default step of 1 + + + + + + + Construct a range of unsigned ints specifying the step size + + + + + + + + Construct a range of longs using a default step of 1 + + + + + + + Construct a range of longs + + + + + + + + Construct a range of unsigned longs using default step of 1 + + + + + + + Construct a range of unsigned longs specifying the step size + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RepeatAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + Marks a test to use a Sequential join of any argument + data provided. Arguments will be combined into test cases, + taking the next value of each argument until all are used. + + + + + Default constructor + + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Build a SetUpFixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A SetUpFixture object as a TestSuite. + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + The author of this test + + + + + The type that this test is testing + + + + + Modifies a test by adding a description, if not already set. + + The test to modify + + + + Gets or sets the expected result. + + The result. + + + + Returns true if an expected result has been set + + + + + Construct a TestMethod from a given method. + + The method for which a test is to be constructed. + The suite to which the test will be added. + A TestMethod + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test case. + + + + + Gets the list of arguments to a test case + + + + + Gets the properties of the test case + + + + + Gets or sets the expected result. + + The result. + + + + Returns true if the expected result has been set + + + + + Gets or sets the description. + + The description. + + + + The author of this test + + + + + The type that this test is testing + + + + + Gets or sets the reason for ignoring the test + + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets or sets the reason for not running the test. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Comma-delimited list of platforms to run the test for + + + + + Comma-delimited list of platforms to not run the test for + + + + + Gets and sets the category for this test case. + May be a comma-separated list of categories. + + + + + Performs several special conversions allowed by NUnit in order to + permit arguments with types that cannot be used in the constructor + of an Attribute such as TestCaseAttribute or to simplify their use. + + The arguments to be converted + The ParameterInfo array for the method + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + TestCaseSourceAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The IMethod for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Returns a set of ITestCaseDataItems for use as arguments + to a parameterized test method. + + The method for which data is needed. + + + + + TestFixtureAttribute is used to mark a class that represents a TestFixture. + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test fixture. + + + + + The arguments originally provided to the attribute + + + + + Properties pertaining to this fixture + + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Descriptive text for this fixture + + + + + The author of this fixture + + + + + The type that this fixture is testing + + + + + Gets or sets the ignore reason. May set RunState as a side effect. + + The ignore reason. + + + + Gets or sets the reason for not running the fixture. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Build a fixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A an IEnumerable holding one TestFixture object. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + TestCaseSourceAttribute indicates the source to be used to + provide test fixture instances for a test class. + + + + + Error message string is public so the tests can use it + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestFixtures from a given Type, + using available parameter data. + + The TypeInfo for which fixures are to be constructed. + One or more TestFixtures as TestSuite + + + + Returns a set of ITestFixtureData items for use as arguments + to a parameterized test fixture. + + The type for which data is needed. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Indicates which class the test or test fixture is testing + + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Construct the attribute, specifying a combining strategy and source of parameter data. + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a class or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary + + + + + Constructs for use with an Enum parameter. Will pass every enum + value in to the test. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of _values to be used as arguments + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + + An enumeration containing individual data items + + + + + A set of Assert methods operating on one or more collections + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attribute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation + + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Gets the expected object + + + + + Test whether the expected item is contained in the collection + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionEquivalentConstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether two collections are equivalent + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + If used performs a reverse comparison + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the collection is ordered + + + + + + + Returns the string representation of the constraint. + + + + + + CollectionSupersetConstraint is used to determine whether + one collection is a superset of another + + + + + Construct a CollectionSupersetConstraint + + The collection that the actual value is expected to be a superset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a superset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionTally counts (tallies) the number of + occurrences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + The number of objects remaining in the tally + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + ComparisonAdapter class centralizes all comparisons of + _values in NUnit, adapting to the use of any provided + , + or . + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps a + + + + + Compares two objects + + + + + Construct a default ComparisonAdapter + + + + + Construct a ComparisonAdapter for an + + + + + Compares two objects + + + + + + + + ComparerAdapter extends and + allows use of an or + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare _values to + determine if one is greater than, equal to or less than + the other. + + + + + The value against which a comparison is to be made + + + + + If true, less than returns success + + + + + if true, equal returns success + + + + + if true, greater than returns success + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + The value against which to make a comparison. + if set to true less succeeds. + if set to true equal succeeds. + if set to true greater succeeds. + String used in describing the constraint. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use a and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + Construct a constraint with optional arguments + + Arguments to be saved + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Retrieves the value to be tested from an ActualValueDelegate. + The default implementation simply evaluates the delegate but derived + classes may override it to provide for delayed processing. + + An ActualValueDelegate + Delegate evaluation result + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + Resolves any pending operators and returns the resolved constraint. + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reorganized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + + + + Pushes the specified operator onto the stack. + + The operator to put onto the stack. + + + + Pops the topmost operator from the stack. + + The topmost operator on the stack + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Pushes the specified constraint. As a side effect, + the constraint's Builder field is set to the + ConstraintBuilder owning this stack. + + The constraint to put onto the stack + + + + Pops this topmost constraint from the stack. + As a side effect, the constraint's Builder + field is set to null. + + The topmost contraint on the stack + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expression by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the Builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reorganized. When a constraint is appended, it is returned as the + value of the operation so that modifiers may be applied. However, + any partially built expression is attached to the constraint for + later resolution. When an operator is appended, the partial + expression is returned. If it's a self-resolving operator, then + a ResolvableConstraintExpression is returned. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. Note that the constraint + is not reduced at this time. For example, if there + is a NotOperator on the stack we don't reduce and + return a NotConstraint. The original constraint must + be returned because it may support modifiers that + are yet to be applied. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests if item is equal to zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + ConstraintStatus represents the status of a ConstraintResult + returned by a Constraint being applied to an actual value. + + + + + The status has not yet been set + + + + + The constraint succeeded + + + + + The constraint failed + + + + + An error occured in applying the constraint (reserved for future use) + + + + + Contain the result of matching a against an actual value. + + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + The status of the new ConstraintResult. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + If true, applies a status of Success to the result, otherwise Failure. + + + + The actual value that was passed to the method. + + + + + Gets and sets the ResultStatus for this result. + + + + + True if actual value meets the Constraint criteria otherwise false. + + + + + Display friendly name of the constraint. + + + + + Description of the constraint may be affected by the state the constraint had + when was performed against the actual value. + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the result and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The _expected. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Flag the constraint to ignore case and return self. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed, in milliseconds + The time interval used for polling, in milliseconds + If the value of is less than 0 + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + Adjusts a Timestamp by a given TimeSpan + + + + + + + + Returns the difference between two Timestamps as a TimeSpan + + + + + + + + DictionaryContainsKeyConstraint is used to test whether a dictionary + contains an expected object as a key. + + + + + Construct a DictionaryContainsKeyConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected key is contained in the dictionary + + + + + DictionaryContainsValueConstraint is used to test whether a dictionary + contains an expected object as a value. + + + + + Construct a DictionaryContainsValueConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected value is contained in the dictionary + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that the collection is empty + + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyStringConstraint tests whether a string is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Gets the tolerance for this comparison. + + + The tolerance. + + + + + Gets a value indicating whether to compare case insensitive. + + + true if comparing case insensitive; otherwise, false. + + + + + Gets a value indicating whether or not to clip strings. + + + true if set to clip strings otherwise, false. + + + + + Gets the failure points. + + + The failure points. + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flags the constraint to include + property in comparison of two values. + + + Using this modifier does not allow to use the + constraint modifier. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable _values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point _values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual _values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + EqualityAdapter class handles all equality comparisons + that use an , + or a . + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps an . + + + + + Returns an EqualityAdapter that uses a predicate function for items comparison. + + + + + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + Returns an that wraps an . + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps a . + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + FileExistsConstraint is used to determine if a file exists + + + + + Initializes a new instance of the class. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + FileOrDirectoryExistsConstraint is used to determine if a file or directory exists + + + + + If true, the constraint will only check if files exist, not directories + + + + + If true, the constraint will only check if directories exist, not files + + + + + Initializes a new instance of the class that + will check files and directories. + + + + + Initializes a new instance of the class that + will only check files if ignoreDirectories is true. + + if set to true [ignore directories]. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the _values are + allowed to deviate by up to 2 adjacent floating point _values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + Compares two floating point _values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point _values that are allowed to + be between the left and the right floating point _values + + True if both numbers are equal or close to being equal + + + Floating point _values can only represent a finite subset of natural numbers. + For example, the _values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point _values are between + the left and the right number. If the number of possible _values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point _values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point _values that are + allowed to be between the left and the right double precision floating point _values + + True if both numbers are equal or close to being equal + + + Double precision floating point _values can only represent a limited series of + natural numbers. For example, the _values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + _values are between the left and the right number. If the number of possible + _values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Interface for all constraints + + + + + The display name of this Constraint for use by ToString(). + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The IResolveConstraint interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Tests whether a value is less than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Abstract method to get the max line length + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The failing constraint result + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Custom value formatter function + + The value + + + + + Custom value formatter factory function + + The next formatter function + ValueFormatter + If the given formatter is unable to handle a certain format, it must call the next formatter in the chain + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Formatting strings used for expected and actual _values + + + + + Current head of chain of value formatters. Public for testing. + + + + + Add a formatter to the chain of responsibility. + + + + + + Formats text to represent a generalized value. + + The value + The formatted text + + + + Formats text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a collection or + array corresponding to a single int index into the collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test that the actual value is an NaN + + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Numerics class contains common operations on numeric _values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric _values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the _values are equal + + + + Compare two numeric _values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the _values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Returns the default NUnitComparer. + + + + + Compares two objects + + + + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occurred. + + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + Flags the comparer to include + property in comparison of two values. + + + Using this modifier does not allow to use the + modifier. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + _values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + The syntax element preceding this operator + + + + + The syntax element following this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Gets the name of the property to which the operator applies + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifies the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Modifies the current instance to be case-sensitive + and returns it. + + + + + Returns the string representation of this constraint + + + + + Canonicalize the provided path + + + The path in standardized form + + + + Test whether one path in canonical form is a subpath of another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Gets text describing a constraint + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Prefix used in forming the constraint description + + + + + Construct given a base constraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the value + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two _values are within a + specified range. + + + + + Initializes a new instance of the class. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + Resolve the current expression to a Constraint + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Return the top-level constraint for this expression + + + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + The EqualConstraintResult class is tailored for formatting + and displaying the result of an EqualConstraint. + + + + + Construct an EqualConstraintResult + + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual collections or arrays. If both are identical, the value is + only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both _values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Description of this constraint + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Constructs a StringConstraint without an expected value + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + Gets text describing a constraint + + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. This override only handles the special message + used when an exception is expected but none is thrown. + + The writer on which the actual value is displayed + + + + ThrowsExceptionConstraint tests that an exception has + been thrown, without any further tests. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Executes the code and returns success if an exception is thrown. + + A delegate representing the code to be tested + True if an exception is thrown, otherwise false + + + + Returns the ActualValueDelegate itself as the value to be tested. + + A delegate representing the code to be tested + The delegate itself + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Returns a default Tolerance object, equivalent to + specifying an exact match unless + is set, in which case, the + will be used. + + + + + Returns an empty Tolerance object, equivalent to + specifying an exact match even if + is set. + + + + + Constructs a linear tolerance of a specified amount + + + + + Constructs a tolerance given an amount and + + + + + Gets the for the current Tolerance + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance has not been set or is using the . + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared _values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared _values my deviate from each other. + + + + + Compares two _values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + The type of the actual argument to which the constraint was applied + + + + + Construct a TypeConstraint for a given Type + + The expected type for the constraint + Prefix used in forming the constraint description + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that all items are unique. + + + + + + + XmlSerializableConstraint tests whether + an object is serializable in xml format. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of this constraint + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new DictionaryContainsKeyConstraint checking for the + presence of a particular key in the dictionary. + + + + + Returns a new DictionaryContainsValueConstraint checking for the + presence of a particular value in the dictionary. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Asserts on Directories + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if the directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Abstract base for Exceptions that terminate a test and provide a ResultState. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + The IApplyToContext interface is implemented by attributes + that want to make changes to the execution context before + a test is run. + + + + + Apply changes to the execution context + + The execution context + + + + The IApplyToTest interface is implemented by self-applying + attributes that modify the state of a test in some way. + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + CombiningStrategy is the abstract base for classes that + know how to combine values provided for individual test + parameters to create a set of test cases. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ICommandWrapper is implemented by attributes and other + objects able to wrap a TestCommand with another command. + + + Attributes or other objects should implement one of the + derived interfaces, rather than this one, since they + indicate in which part of the command chain the wrapper + should be applied. + + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + Objects implementing this interface are used to wrap + the TestMethodCommand itself. They apply after SetUp + has been run and before TearDown. + + + + + Objects implementing this interface are used to wrap + the entire test, including SetUp and TearDown. + + + + + Any ITest that implements this interface is at a level that the implementing + class should be disposed at the end of the test run + + + + + The IFixtureBuilder interface is exposed by a class that knows how to + build a TestFixture from one or more Types. In general, it is exposed + by an attribute, but may be implemented in a helper class used by the + attribute in some cases. + + + + + Build one or more TestFixtures from type provided. At least one + non-null TestSuite must always be returned, since the method is + generally called because the user has marked the target class as + a fixture. If something prevents the fixture from being used, it + will be returned nonetheless, labelled as non-runnable. + + The type info of the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + IImplyFixture is an empty marker interface used by attributes like + TestAttribute that cause the class where they are used to be treated + as a TestFixture even without a TestFixtureAttribute. + + Marker interfaces are not usually considered a good practice, but + we use it here to avoid cluttering the attribute hierarchy with + classes that don't contain any extra implementation. + + + + + The IMethodInfo class is used to encapsulate information + about a method in a platform-independent manner. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IParameterDataSource interface is implemented by types + that can provide data for a test method parameter. + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + An enumeration containing individual data items + + + + The IParameterInfo interface is an abstraction of a .NET parameter. + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter + + + + + Gets the underlying .NET ParameterInfo + + + + + Gets the Type of the parameter + + + + + A PropertyBag represents a collection of name/value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + The entries in a PropertyBag are of two kinds: those that + take a single value and those that take multiple _values. + However, the PropertyBag has no knowledge of which entries + fall into each category and the distinction is entirely + up to the code using the PropertyBag. + + When working with multi-valued properties, client code + should use the Add method to add name/value pairs and + indexing to retrieve a list of all _values for a given + key. For example: + + bag.Add("Tag", "one"); + bag.Add("Tag", "two"); + Assert.That(bag["Tag"], + Is.EqualTo(new string[] { "one", "two" })); + + When working with single-valued propeties, client code + should use the Set method to set the value and Get to + retrieve the value. The GetSetting methods may also be + used to retrieve the value in a type-safe manner while + also providing default. For example: + + bag.Set("Priority", "low"); + bag.Set("Priority", "high"); // replaces value + Assert.That(bag.Get("Priority"), + Is.EqualTo("high")); + Assert.That(bag.GetSetting("Priority", "low"), + Is.EqualTo("high")); + + + + + Adds a key/value pair to the property bag + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + True if their are _values present, otherwise false + + + + Gets or sets the list of _values for a particular key + + The key for which the _values are to be retrieved or set + + + + Gets a collection containing all the keys in the property set + + + + + The IReflectionInfo interface is implemented by NUnit wrapper objects that perform reflection. + + + + + Returns an array of custom attributes of the specified type applied to this object + + + + + Returns a value indicating whether an attribute of the specified type is defined on this object. + + + + + The ISimpleTestBuilder interface is exposed by a class that knows how to + build a single TestMethod from a suitable MethodInfo Types. In general, + it is exposed by an attribute, but may be implemented in a helper class + used by the attribute in some cases. + + + + + Build a TestMethod from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the id of the test + + + + + Gets the name of the test + + + + + Gets the fully qualified name of the test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the Type of the test fixture, if applicable, or + null if no fixture type is associated with this test. + + + + + Gets an IMethod for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the RunState of the test, indicating whether it can be run. + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Gets the properties of the test + + + + + Gets the parent test, if any. + + The parent test or null if none exists. + + + + Returns true if this is a test suite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets a fixture object for running this test. + + + + + The ITestBuilder interface is exposed by a class that knows how to + build one or more TestMethods from a MethodInfo. In general, it is exposed + by an attribute, which has additional information available to provide + the necessary test parameters to distinguish the test cases built. + + + + + Build one or more TestMethods from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + This interface is not the same as the ITestCaseBuilder interface in NUnit 2.x. + We have reused the name because the two products don't interoperate at all. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + + + + Gets the expected result of the test case + + + + + Returns true if an expected result has been set + + + + + The ITestData interface is implemented by a class that + represents a single instance of a parameterized test. + + + + + Gets the name to be used for the test + + + + + Gets the RunState for this test case. + + + + + Gets the argument list to be provided to the test + + + + + Gets the property dictionary for the test case + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + The ITestCaseData interface is implemented by a class + that is able to return the data required to create an + instance of a parameterized test fixture. + + + + + Get the TypeArgs if separately set + + + + + The ITestListener interface is used internally to receive + notifications of significant events while a test is being + run. The events are propagated to clients by means of an + AsyncCallback. NUnit extensions may also monitor these events. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished + + The result of the test + + + + The ITestResult interface represents the result of a test. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. Not available in + the Compact Framework 1.0. + + + + + Gets the number of asserts executed + when running the test and all its children. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Accessing HasChildren should not force creation of the + Children collection in classes implementing this interface. + + + + + Gets the the collection of child results. + + + + + Gets the Test to which this result applies. + + + + + Gets any text output written to this result. + + + + + The ITypeInfo interface is an abstraction of a .NET Type + + + + + Gets the underlying Type on which this ITypeInfo is based + + + + + Gets the base type of this type as an ITypeInfo + + + + + Returns true if the Type wrapped is equal to the argument + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the Namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type is a static class. + + + + + Get the display name for this typeInfo. + + + + + Get the display name for an oject of this type, constructed with specific arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a value indicating whether this type has a method with a specified public attribute + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + An object implementing IXmlNodeBuilder is able to build + an XML representation of itself and any children. + + + + + Returns a TNode representing the current object. + + If true, children are included where applicable + A TNode representing the result + + + + Returns a TNode representing the current object after + adding it as a child of the supplied parent node. + + The parent node. + If true, children are included, where applicable + + + + + The ResultState class represents the outcome of running a test. + It contains two pieces of information. The Status of the test + is an enum indicating whether the test passed, failed, was + skipped or was inconclusive. The Label provides a more + detailed breakdown for use by client runners. + + + + + Initializes a new instance of the class. + + The TestStatus. + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + + + + Initializes a new instance of the class. + + The TestStatus. + The stage at which the result was produced + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + The stage at which the result was produced + + + + The result is inconclusive + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test was skipped because it is explicit + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The test was not runnable. + + + + + A suite failed because one or more child tests failed or had errors + + + + + A suite failed in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeDown + + + + + Gets the TestStatus for the test. + + The status. + + + + Gets the label under which this test result is + categorized, if any. + + + + + Gets the stage of test execution in which + the failure or other result took place. + + + + + Get a new ResultState, which is the same as the current + one but with the FailureSite set to the specified value. + + The FailureSite to use + A new ResultState + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occurred. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test can be executed. + + + + + The test is not runnable. + + + + + The test is runnable. + + + + + The test can only be run explicitly + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + TNode represents a single node in the XML representation + of a Test or TestResult. It replaces System.Xml.XmlNode and + System.Xml.Linq.XElement, providing a minimal set of methods + for operating on the XML in a platform-independent manner. + + + + + Constructs a new instance of TNode + + The name of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + Flag indicating whether to use CDATA when writing the text + + + + Gets the name of the node + + + + + Gets the value of the node + + + + + Gets a flag indicating whether the value should be output using CDATA. + + + + + Gets the dictionary of attributes + + + + + Gets a list of child nodes + + + + + Gets the first ChildNode + + + + + Gets the XML representation of this node. + + + + + Create a TNode from it's XML text representation + + The XML text to be parsed + A TNode + + + + Adds a new element as a child of the current node and returns it. + + The element name. + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + + The element name + The text content of the new element + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + The value will be output using a CDATA section. + + The element name + The text content of the new element + The newly created child element + + + + Adds an attribute with a specified name and value to the XmlNode. + + The name of the attribute. + The value of the attribute. + + + + Finds a single descendant of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + + + Finds all descendants of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + Writes the XML representation of the node to an XmlWriter + + + + + + Class used to represent a list of XmlResults + + + + + Class used to represent the attributes of a node + + + + + Gets or sets the value associated with the specified key. + Overridden to return null if attribute is not found. + + The key. + Value of the attribute or null + + + + Asserts on Files + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. Anything set through + this class applies to the entire test run. It should not normally + be used from within a test, since it is not thread-safe. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + inclusively within a specified range. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the _values of a property + + The collection of property _values + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It is derived from TestCaseParameters and adds a + fluent syntax for use in initializing the test case. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Marks the test case as explicit. + + + + + Marks the test case as explicit, specifying the reason. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Provide the context information of the current test. + This is an adapter for the internal ExecutionContext + class, hiding the internals from the user test. + + + + + Construct a TestContext for an ExecutionContext + + The ExecutionContext to adapt + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TextWriter that will send output to the current test result. + + + + + Get a representation of the current test. + + + + + Gets a Representation of the TestResult for the current test. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputting files created + by this test run. + + + + + Gets the random generator. + + + The random generator. + + + + Write the string representation of a boolean value to the current result + + + Write a char to the current result + + + Write a char array to the current result + + + Write the string representation of a double to the current result + + + Write the string representation of an Int32 value to the current result + + + Write the string representation of an Int64 value to the current result + + + Write the string representation of a decimal value to the current result + + + Write the string representation of an object to the current result + + + Write the string representation of a Single value to the current result + + + Write a string to the current result + + + Write the string representation of a UInt32 value to the current result + + + Write the string representation of a UInt64 value to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a line terminator to the current result + + + Write the string representation of a boolean value to the current result followed by a line terminator + + + Write a char to the current result followed by a line terminator + + + Write a char array to the current result followed by a line terminator + + + Write the string representation of a double to the current result followed by a line terminator + + + Write the string representation of an Int32 value to the current result followed by a line terminator + + + Write the string representation of an Int64 value to the current result followed by a line terminator + + + Write the string representation of a decimal value to the current result followed by a line terminator + + + Write the string representation of an object to the current result followed by a line terminator + + + Write the string representation of a Single value to the current result followed by a line terminator + + + Write a string to the current result followed by a line terminator + + + Write the string representation of a UInt32 value to the current result followed by a line terminator + + + Write the string representation of a UInt64 value to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + + This method adds the a new ValueFormatterFactory to the + chain of responsibility used for fomatting values in messages. + The scope of the change is the current TestContext. + + The factory delegate + + + + This method provides a simplified way to add a ValueFormatter + delegate to the chain of responsibility, creating the factory + delegate internally. It is useful when the Type of the object + is the only criterion for selection of the formatter, since + it can be used without getting involved with a compould function. + + The type supported by this formatter + The ValueFormatter delegate + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Construct a TestAdapter for a Test + + The Test to be adapted + + + + Gets the unique Id of a test + + + + + The name of the test, which may or may not be + the same as the method name. + + + + + The name of the method representing the test. + + + + + The FullName of the test + + + + + The ClassName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a TestResult + + The TestResult to be adapted + + + + Gets a ResultState representing the outcome of the test. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestFixtureData class represents a set of arguments + and other parameter info to be used for a parameterized + fixture. It is derived from TestFixtureParameters and adds a + fluent syntax for use in initializing the fixture. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Marks the test fixture as explicit. + + + + + Marks the test fixture as explicit, specifying the reason. + + + + + Ignores this TestFixture, specifying the reason. + + The reason. + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected ArgumentException + + + + + Creates a constraint specifying an expected ArgumentNUllException + + + + + Creates a constraint specifying an expected InvalidOperationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Env is a static class that provides some of the features of + System.Environment that are not available under all runtimes + + + + + The newline sequence in the current environment. + + + + + Path to the 'My Documents' folder + + + + + Directory used for file output if not specified on commandline. + + + + + PackageSettings is a static class containing constant values that + are used as keys in setting up a TestPackage. These values are used in + the engine and framework. Setting values may be a string, int or bool. + + + + + Flag (bool) indicating whether tests are being debugged. + + + + + Flag (bool) indicating whether to pause execution of tests to allow + the user to attache a debugger. + + + + + The InternalTraceLevel for this run. Values are: "Default", + "Off", "Error", "Warning", "Info", "Debug", "Verbose". + Default is "Off". "Debug" and "Verbose" are synonyms. + + + + + Full path of the directory to be used for work and result files. + This path is provided to tests by the frameowrk TestContext. + + + + + The name of the config to use in loading a project. + If not specified, the first config found is used. + + + + + Bool indicating whether the engine should determine the private + bin path by examining the paths to all the tests. Defaults to + true unless PrivateBinPath is specified. + + + + + The ApplicationBase to use in loading the tests. If not + specified, and each assembly has its own process, then the + location of the assembly is used. For multiple assemblies + in a single process, the closest common root directory is used. + + + + + Path to the config file to use in running the tests. + + + + + Bool flag indicating whether a debugger should be launched at agent + startup. Used only for debugging NUnit itself. + + + + + Indicates how to load tests across AppDomains. Values are: + "Default", "None", "Single", "Multiple". Default is "Multiple" + if more than one assembly is loaded in a process. Otherwise, + it is "Single". + + + + + The private binpath used to locate assemblies. Directory paths + is separated by a semicolon. It's an error to specify this and + also set AutoBinPath to true. + + + + + The maximum number of test agents permitted to run simultneously. + Ignored if the ProcessModel is not set or defaulted to Multiple. + + + + + Indicates how to allocate assemblies to processes. Values are: + "Default", "Single", "Separate", "Multiple". Default is "Multiple" + for more than one assembly, "Separate" for a single assembly. + + + + + Indicates the desired runtime to use for the tests. Values + are strings like "net-4.5", "mono-4.0", etc. Default is to + use the target framework for which an assembly was built. + + + + + Bool flag indicating that the test should be run in a 32-bit process + on a 64-bit system. By default, NUNit runs in a 64-bit process on + a 64-bit system. Ignored if set on a 32-bit system. + + + + + Indicates that test runners should be disposed after the tests are executed + + + + + Bool flag indicating that the test assemblies should be shadow copied. + Defaults to false. + + + + + Integer value in milliseconds for the default timeout value + for test cases. If not specified, there is no timeout except + as specified by attributes on the tests themselves. + + + + + A TextWriter to which the internal trace will be sent. + + + + + A list of tests to be loaded. + + + + + The number of test threads to run for the assembly. If set to + 1, a single queue is used. If set to 0, tests are executed + directly, without queuing. + + + + + The random seed to be used for this assembly. If specified + as the value reported from a prior run, the framework should + generate identical random values for tests as were used for + that run, provided that no change has been made to the test + assembly. Default is a random value itself. + + + + + If true, execution stops after the first error or failure. + + + + + If true, use of the event queue is suppressed and test events are synchronous. + + + + + If the package represents an assembly, then this is the CLR version + stored in the assembly image. If it represents a project or other + group of assemblies, it is the maximum version for all the assemblies. + + + + + True if any assembly in the package requires running as a 32-bit + process when on a 64-bit system. + + + + + True if any assembly in the package requires a special assembly resolution hook + in the default AppDomain in order to find dependent assemblies. + + + + + The FrameworkName specified on a TargetFrameworkAttribute for the assembly + + + + diff --git a/packages/NUnit.3.2.0/lib/net45/nunit.framework.dll b/packages/NUnit.3.2.0/lib/net45/nunit.framework.dll new file mode 100644 index 00000000..e04b959d Binary files /dev/null and b/packages/NUnit.3.2.0/lib/net45/nunit.framework.dll differ diff --git a/packages/NUnit.3.2.0/lib/net45/nunit.framework.xml b/packages/NUnit.3.2.0/lib/net45/nunit.framework.xml new file mode 100644 index 00000000..f483f514 --- /dev/null +++ b/packages/NUnit.3.2.0/lib/net45/nunit.framework.xml @@ -0,0 +1,17304 @@ + + + + nunit.framework + + + + + AssemblyHelper provides static methods for working + with assemblies. + + + + + Gets the path from which the assembly defining a type was loaded. + + The Type. + The path. + + + + Gets the path from which an assembly was loaded. + For builds where this is not possible, returns + the name of the assembly. + + The assembly. + The path. + + + + Gets the path to the directory from which an assembly was loaded. + + The assembly. + The path. + + + + Gets the AssemblyName of an assembly. + + The assembly + An AssemblyName + + + + Loads an assembly given a string, which may be the + path to the assembly or the AssemblyName + + + + + + + Gets the assembly path from code base. + + Public for testing purposes + The code base. + + + + + Interface for logging within the engine + + + + + Logs the specified message at the error level. + + The message. + + + + Logs the specified message at the error level. + + The message. + The arguments. + + + + Logs the specified message at the warning level. + + The message. + + + + Logs the specified message at the warning level. + + The message. + The arguments. + + + + Logs the specified message at the info level. + + The message. + + + + Logs the specified message at the info level. + + The message. + The arguments. + + + + Logs the specified message at the debug level. + + The message. + + + + Logs the specified message at the debug level. + + The message. + The arguments. + + + + InternalTrace provides facilities for tracing the execution + of the NUnit framework. Tests and classes under test may make use + of Console writes, System.Diagnostics.Trace or various loggers and + NUnit itself traps and processes each of them. For that reason, a + separate internal trace is needed. + + Note: + InternalTrace uses a global lock to allow multiple threads to write + trace messages. This can easily make it a bottleneck so it must be + used sparingly. Keep the trace Level as low as possible and only + insert InternalTrace writes where they are needed. + TODO: add some buffering and a separate writer thread as an option. + TODO: figure out a way to turn on trace in specific classes only. + + + + + Gets a flag indicating whether the InternalTrace is initialized + + + + + Initialize the internal trace facility using the name of the log + to be written to and the trace level. + + The log name + The trace level + + + + Initialize the internal trace using a provided TextWriter and level + + A TextWriter + The InternalTraceLevel + + + + Get a named Logger + + + + + + Get a logger named for a particular Type. + + + + + InternalTraceLevel is an enumeration controlling the + level of detailed presented in the internal log. + + + + + Use the default settings as specified by the user. + + + + + Do not display any trace messages + + + + + Display Error messages only + + + + + Display Warning level and higher messages + + + + + Display informational and higher messages + + + + + Display debug messages and higher - i.e. all messages + + + + + Display debug messages and higher - i.e. all messages + + + + + A trace listener that writes to a separate file per domain + and process using it. + + + + + Construct an InternalTraceWriter that writes to a file. + + Path to the file to use + + + + Construct an InternalTraceWriter that writes to a + TextWriter provided by the caller. + + + + + + Returns the character encoding in which the output is written. + + The character encoding in which the output is written. + + + + Writes a character to the text string or stream. + + The character to write to the text stream. + + + + Writes a string to the text string or stream. + + The string to write. + + + + Writes a string followed by a line terminator to the text string or stream. + + The string to write. If is null, only the line terminator is written. + + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. + + + + + Provides internal logging to the NUnit framework + + + + + Initializes a new instance of the class. + + The name. + The log level. + The writer where logs are sent. + + + + Logs the message at error level. + + The message. + + + + Logs the message at error level. + + The message. + The message arguments. + + + + Logs the message at warm level. + + The message. + + + + Logs the message at warning level. + + The message. + The message arguments. + + + + Logs the message at info level. + + The message. + + + + Logs the message at info level. + + The message. + The message arguments. + + + + Logs the message at debug level. + + The message. + + + + Logs the message at debug level. + + The message. + The message arguments. + + + + CombinatorialStrategy creates test cases by using all possible + combinations of the parameter data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Provides data from fields marked with the DatapointAttribute or the + DatapointsAttribute. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + Built-in SuiteBuilder for all types of test classes. + + + + + Checks to see if the provided Type is a fixture. + To be considered a fixture, it must be a non-abstract + class with one or more attributes implementing the + IFixtureBuilder interface or one or more methods + marked as tests. + + The fixture type to check + True if the fixture can be built, false if not + + + + Build a TestSuite from TypeInfo provided. + + The fixture type to build + A TestSuite built from that type + + + + We look for attributes implementing IFixtureBuilder at one level + of inheritance at a time. Attributes on base classes are not used + unless there are no fixture builder attributes at all on the derived + class. This is by design. + + The type being examined for attributes + A list of the attributes found. + + + + Class to build ether a parameterized or a normal NUnitTestMethod. + There are four cases that the builder must deal with: + 1. The method needs no params and none are provided + 2. The method needs params and they are provided + 3. The method needs no params but they are provided in error + 4. The method needs params but they are not provided + This could have been done using two different builders, but it + turned out to be simpler to have just one. The BuildFrom method + takes a different branch depending on whether any parameters are + provided, but all four cases are dealt with in lower-level methods + + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + A Test representing one or more method invocations + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + The test suite being built, to which the new test would be added + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + The test fixture being populated, or null + A Test representing one or more method invocations + + + + Builds a ParameterizedMethodSuite containing individual test cases. + + The method for which a test is to be built. + The list of test cases to include. + A ParameterizedMethodSuite populated with test cases + + + + Build a simple, non-parameterized TestMethod for this method. + + The MethodInfo for which a test is to be built + The test suite for which the method is being built + A TestMethod. + + + + Class that can build a tree of automatic namespace + suites from a group of fixtures. + + + + + NamespaceDictionary of all test suites we have created to represent + namespaces. Used to locate namespace parent suites for fixtures. + + + + + The root of the test suite being created by this builder. + + + + + Initializes a new instance of the class. + + The root suite. + + + + Gets the root entry in the tree created by the NamespaceTreeBuilder. + + The root suite. + + + + Adds the specified fixtures to the tree. + + The fixtures to be added. + + + + Adds the specified fixture to the tree. + + The fixture to be added. + + + + NUnitTestCaseBuilder is a utility class used by attributes + that build test cases. + + + + + Constructs an + + + + + Builds a single NUnitTestMethod, either as a child of the fixture + or as one of a set of test cases under a ParameterizedTestMethodSuite. + + The MethodInfo from which to construct the TestMethod + The suite or fixture to which the new test will be added + The ParameterSet to be used, or null + + + + + Helper method that checks the signature of a TestMethod and + any supplied parameters to determine if the test is valid. + + Currently, NUnitTestMethods are required to be public, + non-abstract methods, either static or instance, + returning void. They may take arguments but the _values must + be provided or the TestMethod is not considered runnable. + + Methods not meeting these criteria will be marked as + non-runnable and the method will return false in that case. + + The TestMethod to be checked. If it + is found to be non-runnable, it will be modified. + Parameters to be used for this test, or null + True if the method signature is valid, false if not + + The return value is no longer used internally, but is retained + for testing purposes. + + + + + NUnitTestFixtureBuilder is able to build a fixture given + a class marked with a TestFixtureAttribute or an unmarked + class containing test methods. In the first case, it is + called by the attribute and in the second directly by + NUnitSuiteBuilder. + + + + + Build a TestFixture from type provided. A non-null TestSuite + must always be returned, since the method is generally called + because the user has marked the target class as a fixture. + If something prevents the fixture from being used, it should + be returned nonetheless, labelled as non-runnable. + + An ITypeInfo for the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + Overload of BuildFrom called by tests that have arguments. + Builds a fixture using the provided type and information + in the ITestFixtureData object. + + The TypeInfo for which to construct a fixture. + An object implementing ITestFixtureData or null. + + + + + Method to add test cases to the newly constructed fixture. + + The fixture to which cases should be added + + + + Method to create a test case from a MethodInfo and add + it to the fixture being built. It first checks to see if + any global TestCaseBuilder addin wants to build the + test case. If not, it uses the internal builder + collection maintained by this fixture builder. + + The default implementation has no test case builders. + Derived classes should add builders to the collection + in their constructor. + + The method for which a test is to be created + The test suite being built. + A newly constructed Test + + + + PairwiseStrategy creates test cases by combining the parameter + data so that all possible pairs of data items are used. + + + + The number of test cases that cover all possible pairs of test function + parameters values is significantly less than the number of test cases + that cover all possible combination of test function parameters values. + And because different studies show that most of software failures are + caused by combination of no more than two parameters, pairwise testing + can be an effective ways to test the system when it's impossible to test + all combinations of parameters. + + + The PairwiseStrategy code is based on "jenny" tool by Bob Jenkins: + http://burtleburtle.net/bob/math/jenny.html + + + + + + FleaRand is a pseudo-random number generator developed by Bob Jenkins: + http://burtleburtle.net/bob/rand/talksmall.html#flea + + + + + Initializes a new instance of the FleaRand class. + + The seed. + + + + FeatureInfo represents coverage of a single value of test function + parameter, represented as a pair of indices, Dimension and Feature. In + terms of unit testing, Dimension is the index of the test parameter and + Feature is the index of the supplied value in that parameter's list of + sources. + + + + + Initializes a new instance of FeatureInfo class. + + Index of a dimension. + Index of a feature. + + + + A FeatureTuple represents a combination of features, one per test + parameter, which should be covered by a test case. In the + PairwiseStrategy, we are only trying to cover pairs of features, so the + tuples actually may contain only single feature or pair of features, but + the algorithm itself works with triplets, quadruples and so on. + + + + + Initializes a new instance of FeatureTuple class for a single feature. + + Single feature. + + + + Initializes a new instance of FeatureTuple class for a pair of features. + + First feature. + Second feature. + + + + TestCase represents a single test case covering a list of features. + + + + + Initializes a new instance of TestCaseInfo class. + + A number of features in the test case. + + + + PairwiseTestCaseGenerator class implements an algorithm which generates + a set of test cases which covers all pairs of possible values of test + function. + + + + The algorithm starts with creating a set of all feature tuples which we + will try to cover (see method). This set + includes every single feature and all possible pairs of features. We + store feature tuples in the 3-D collection (where axes are "dimension", + "feature", and "all combinations which includes this feature"), and for + every two feature (e.g. "A" and "B") we generate both ("A", "B") and + ("B", "A") pairs. This data structure extremely reduces the amount of + time needed to calculate coverage for a single test case (this + calculation is the most time-consuming part of the algorithm). + + + Then the algorithm picks one tuple from the uncovered tuple, creates a + test case that covers this tuple, and then removes this tuple and all + other tuples covered by this test case from the collection of uncovered + tuples. + + + Picking a tuple to cover + + + There are no any special rules defined for picking tuples to cover. We + just pick them one by one, in the order they were generated. + + + Test generation + + + Test generation starts from creating a completely random test case which + covers, nevertheless, previously selected tuple. Then the algorithm + tries to maximize number of tuples which this test covers. + + + Test generation and maximization process repeats seven times for every + selected tuple and then the algorithm picks the best test case ("seven" + is a magic number which provides good results in acceptable time). + + Maximizing test coverage + + To maximize tests coverage, the algorithm walks thru the list of mutable + dimensions (mutable dimension is a dimension that are not included in + the previously selected tuple). Then for every dimension, the algorithm + walks thru the list of features and checks if this feature provides + better coverage than randomly selected feature, and if yes keeps this + feature. + + + This process repeats while it shows progress. If the last iteration + doesn't improve coverage, the process ends. + + + In addition, for better results, before start every iteration, the + algorithm "scrambles" dimensions - so for every iteration dimension + probes in a different order. + + + + + + Creates a set of test cases for specified dimensions. + + + An array which contains information about dimensions. Each element of + this array represents a number of features in the specific dimension. + + + A set of test cases. + + + + + Gets the test cases generated by this strategy instance. + + A set of test cases. + + + + The ParameterDataProvider class implements IParameterDataProvider + and hosts one or more individual providers. + + + + + Construct with a collection of individual providers + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + ParameterDataSourceProvider supplies individual argument _values for + single parameters using attributes implementing IParameterDataSource. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + SequentialStrategy creates test cases by using all of the + parameter data sources in parallel, substituting null + when any of them run out of data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Waits for pending asynchronous operations to complete, if appropriate, + and returns a proper result of the invocation by unwrapping task results + + The raw result of the method invocation + The unwrapped result, if necessary + + + + OneTimeSetUpCommand runs any one-time setup methods for a suite, + constructing the user test object if necessary. + + + + + Constructs a OneTimeSetUpCommand for a suite + + The suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run after Setup + + + + Overridden to run the one-time setup for a suite. + + The TestExecutionContext to be used. + A TestResult + + + + OneTimeTearDownCommand performs any teardown actions + specified for a suite and calls Dispose on the user + test object, if any. + + + + + Construct a OneTimeTearDownCommand + + The test suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run before teardown. + + + + Overridden to run the teardown methods specified on the test. + + The TestExecutionContext to be used. + A TestResult + + + + ContextSettingsCommand applies specified changes to the + TestExecutionContext prior to running a test. No special + action is needed after the test runs, since the prior + context will be restored automatically. + + + + + The CommandStage enumeration represents the defined stages + of execution for a series of TestCommands. The int _values + of the enum are used to apply decorators in the proper + order. Lower _values are applied first and are therefore + "closer" to the actual test execution. + + + No CommandStage is defined for actual invocation of the test or + for creation of the context. Execution may be imagined as + proceeding from the bottom of the list upwards, with cleanup + after the test running in the opposite order. + + + + + Use an application-defined default value. + + + + + Make adjustments needed before and after running + the raw test - that is, after any SetUp has run + and before TearDown. + + + + + Run SetUp and TearDown for the test. This stage is used + internally by NUnit and should not normally appear + in user-defined decorators. + + + + + Make adjustments needed before and after running + the entire test - including SetUp and TearDown. + + + + + TODO: Documentation needed for class + + + + TODO: Documentation needed for field + + + + TODO: Documentation needed for constructor + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The inner command. + The max time allowed in milliseconds + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext + + The context in which the test should run. + A TestResult + + + + SetUpTearDownCommand runs any SetUp methods for a suite, + runs the test and then runs any TearDown methods. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + SetUpTearDownItem holds the setup and teardown methods + for a single level of the inheritance hierarchy. + + + + + Construct a SetUpTearDownNode + + A list of setup methods for this level + A list teardown methods for this level + + + + Returns true if this level has any methods at all. + This flag is used to discard levels that do nothing. + + + + + Run SetUp on this level. + + The execution context to use for running. + + + + Run TearDown for this level. + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The test being skipped. + + + + Overridden to simply set the CurrentResult to the + appropriate Skipped state. + + The execution context for the test + A TestResult + + + + TestActionCommand runs the BeforeTest actions for a test, + then runs the test and finally runs the AfterTestActions. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TestActionItem represents a single execution of an + ITestAction. It is used to track whether the BeforeTest + method has been called and suppress calling the + AfterTest method if it has not. + + + + + Construct a TestActionItem + + The ITestAction to be included + + + + Run the BeforeTest method of the action and remember that it has been run. + + The test to which the action applies + + + + Run the AfterTest action, but only if the BeforeTest + action was actually run. + + The test to which the action applies + + + + TestCommand is the abstract base class for all test commands + in the framework. A TestCommand represents a single stage in + the execution of a test, e.g.: SetUp/TearDown, checking for + Timeout, verifying the returned result from a method, etc. + + TestCommands may decorate other test commands so that the + execution of a lower-level command is nested within that + of a higher level command. All nested commands are executed + synchronously, as a single unit. Scheduling test execution + on separate threads is handled at a higher level, using the + task dispatcher. + + + + + Construct a TestCommand for a test. + + The test to be executed + + + + Gets the test associated with this command. + + + + + Runs the test in a specified context, returning a TestResult. + + The TestExecutionContext to be used for running the test. + A TestResult + + + + TestMethodCommand is the lowest level concrete command + used to run actual test cases. + + + + + Initializes a new instance of the class. + + The test. + + + + Runs the test, saving a TestResult in the execution context, as + well as returning it. If the test has an expected result, it + is asserts on that value. Since failed tests and errors throw + an exception, this command must be wrapped in an outer command, + will handle that exception and records the failure. This role + is usually played by the SetUpTearDown command. + + The execution context + + + + TheoryResultCommand adjusts the result of a Theory so that + it fails if all the results were inconclusive. + + + + + Constructs a TheoryResultCommand + + The command to be wrapped by this one + + + + Overridden to call the inner command and adjust the result + in case all chlid results were inconclusive. + + + + + + + ClassName filter selects tests based on the class FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + A base class for multi-part filters + + + + + Constructs an empty CompositeFilter + + + + + Constructs a CompositeFilter from an array of filters + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return a list of the composing filters. + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a MethodNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + PropertyFilter is able to select or exclude tests + based on their properties. + + + + + + Construct a PropertyFilter using a property name and expected value + + A property name + The expected value of the property + + + + Check whether the filter matches a test + + The test to be matched + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + TestName filter selects tests based on their Name + + + + + Construct a TestNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + Gets the element name + + Element name + + + + IdFilter selects tests based on their id + + + + + Construct an IdFilter for a single value + + The id the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter + + The filter to be negated + + + + Gets the base filter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + ValueMatchFilter selects tests based on some value, which + is expected to be contained in the test. + + + + + Returns the value matched by the filter - used for testing + + + + + Indicates whether the value is a regular expression + + + + + Construct a ValueMatchFilter for a single value. + + The value to be included. + + + + Match the input provided by the derived class + + The value to be matchedT + True for a match, false otherwise. + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + GenericMethodHelper is able to deduce the Type arguments for + a generic method from the actual arguments provided. + + + + + Construct a GenericMethodHelper for a method + + MethodInfo for the method to examine + + + + Return the type argments for the method, deducing them + from the arguments actually provided. + + The arguments to the method + An array of type arguments. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + CultureDetector is a helper class used by NUnit to determine + whether a test should be run based on the current culture. + + + + + Default constructor uses the current culture. + + + + + Construct a CultureDetector for a particular culture for testing. + + The culture to be used + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + Tests to determine if the current culture is supported + based on a culture attribute. + + The attribute to examine + + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + ExceptionHelper provides static methods for working with exceptions + + + + + Rethrows an exception, preserving its stack trace + + The exception to rethrow + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined message string. + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined stack trace. + + + + Gets the stack trace of the exception. + + The exception. + A string representation of the stack trace. + + + + A utility class to create TestCommands + + + + + Gets the command to be executed before any of + the child tests are run. + + A TestCommand + + + + Gets the command to be executed after all of the + child tests are run. + + A TestCommand + + + + Creates a test command for use in running this test. + + + + + + Creates a command for skipping a test. The result returned will + depend on the test RunState. + + + + + Builds the set up tear down list. + + Type of the fixture. + Type of the set up attribute. + Type of the tear down attribute. + A list of SetUpTearDownItems + + + + A CompositeWorkItem represents a test suite and + encapsulates the execution of the suite as well + as all its child tests. + + + + + List of Child WorkItems + + + + + A count of how many tests in the work item have a value for the Order Property + + + + + Construct a CompositeWorkItem for executing a test suite + using a filter to select child tests. + + The TestSuite to be executed + A filter used to select child tests + + + + Method that actually performs the work. Overridden + in CompositeWorkItem to do setup, run all child + items and then do teardown. + + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + A signed integer that indicates the relative values of and , as shown in the following table.Value Meaning Less than zero is less than .Zero equals .Greater than zero is greater than . + + The first object to compare.The second object to compare. + + + + Sorts tests under this suite. + + + + + Cancel (abort or stop) a CompositeWorkItem and all of its children + + true if the CompositeWorkItem and all of its children should be aborted, false if it should allow all currently running tests to complete + + + + The EventPumpState enum represents the state of an + EventPump. + + + + + The pump is stopped + + + + + The pump is pumping events with no stop requested + + + + + The pump is pumping events but a stop has been requested + + + + + EventPump pulls events out of an EventQueue and sends + them to a listener. It is used to send events back to + the client without using the CallContext of the test + runner thread. + + + + + The handle on which a thread enqueuing an event with == true + waits, until the EventPump has sent the event to its listeners. + + + + + The downstream listener to which we send events + + + + + The queue that holds our events + + + + + Thread to do the pumping + + + + + The current state of the eventpump + + + + + Constructor + + The EventListener to receive events + The event queue to pull events from + + + + Gets or sets the current state of the pump + + + On volatile and , see + "http://www.albahari.com/threading/part4.aspx". + + + + + Gets or sets the name of this EventPump + (used only internally and for testing). + + + + + Dispose stops the pump + Disposes the used WaitHandle, too. + + + + + Start the pump + + + + + Tell the pump to stop after emptying the queue. + + + + + Our thread proc for removing items from the event + queue and sending them on. Note that this would + need to do more locking if any other thread were + removing events from the queue. + + + + + NUnit.Core.Event is the abstract base for all stored events. + An Event is the stored representation of a call to the + ITestListener interface and is used to record such calls + or to queue them for forwarding on another thread or at + a later time. + + + + + The Send method is implemented by derived classes to send the event to the specified listener. + + The listener. + + + + Gets a value indicating whether this event is delivered synchronously by the NUnit . + + If true, and if has been used to + set a WaitHandle, blocks its calling thread until the + thread has delivered the event and sets the WaitHandle. + + + + + + TestStartedEvent holds information needed to call the TestStarted method. + + + + + Initializes a new instance of the class. + + The test. + + + + Calls TestStarted on the specified listener. + + The listener. + + + + TestFinishedEvent holds information needed to call the TestFinished method. + + + + + Initializes a new instance of the class. + + The result. + + + + Calls TestFinished on the specified listener. + + The listener. + + + + Implements a queue of work items each of which + is queued as a WaitCallback. + + + + + Construct a new EventQueue + + + + + WaitHandle for synchronous event delivery in . + + Having just one handle for the whole implies that + there may be only one producer (the test thread) for synchronous events. + If there can be multiple producers for synchronous events, one would have + to introduce one WaitHandle per event. + + + + + + Gets the count of items in the queue. + + + + + Sets a handle on which to wait, when is called + for an with == true. + + + The wait handle on which to wait, when is called + for an with == true. + The caller is responsible for disposing this wait handle. + + + + + Enqueues the specified event + + The event to enqueue. + + + + Removes the first element from the queue and returns it (or null). + + + If true and the queue is empty, the calling thread is blocked until + either an element is enqueued, or is called. + + + + + If the queue not empty + the first element. + + + otherwise, if ==false + or has been called + null. + + + + + + + Stop processing of the queue + + + + + An IWorkItemDispatcher handles execution of work items. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + true if the IWorkItemDispatcher should abort all currently running WorkItems, false if it should allow all currently running WorkItems to complete + + + + ParallelWorkItemDispatcher handles execution of work items by + queuing them for worker threads to process. + + + + + Construct a ParallelWorkItemDispatcher + + Number of workers to use + + + + Enumerates all the shifts supported by the dispatcher + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + + + + QueuingEventListener uses an EventQueue to store any + events received on its EventListener interface. + + + + + The EvenQueue created and filled by this listener + + + + + A test has started + + The test that is starting + + + + A test case finished + + Result of the test case + + + + A SimpleWorkItem represents a single test case and is + marked as completed immediately upon execution. This + class is also used for skipped or ignored test suites. + + + + + Construct a simple work item for a test. + + The test to be executed + The filter used to select this test + + + + Method that performs actually performs the work. + + + + + SimpleWorkItemDispatcher handles execution of WorkItems by + directly executing them. It is provided so that a dispatcher + is always available in the context, thereby simplifying the + code needed to run child tests. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and a thread is created on which to + run it. Subsequent calls come from the top level + item or its descendants on the proper thread. + + The item to dispatch + + + + Cancel (abort or stop) the ongoing run. + If no run is in process, the call has no effect. + + true if the run should be aborted, false if it should allow its currently running test to complete + + + + A TestWorker pulls work items from a queue + and executes them. + + + + + Event signaled immediately before executing a WorkItem + + + + + Event signaled immediately after executing a WorkItem + + + + + Construct a new TestWorker. + + The queue from which to pull work items + The name of this worker + The apartment state to use for running tests + + + + The name of this worker - also used for the thread + + + + + Indicates whether the worker thread is running + + + + + Our ThreadProc, which pulls and runs tests in a loop + + + + + Start processing work items. + + + + + Stop the thread, either immediately or after finishing the current WorkItem + + true if the thread should be aborted, false if it should allow the currently running test to complete + + + + The TextCapture class intercepts console output and writes it + to the current execution context, if one is present on the thread. + If no execution context is found, the output is written to a + default destination, normally the original destination of the + intercepted output. + + + + + Construct a TextCapture object + + The default destination for non-intercepted output + + + + Gets the Encoding in use by this TextWriter + + + + + Writes a single character + + The char to write + + + + Writes a string + + The string to write + + + + Writes a string followed by a line terminator + + The string to write + + + + A WorkItem may be an individual test case, a fixture or + a higher level grouping of tests. All WorkItems inherit + from the abstract WorkItem class, which uses the template + pattern to allow derived classes to perform work in + whatever way is needed. + + A WorkItem is created with a particular TestExecutionContext + and is responsible for re-establishing that context in the + current thread before it begins or resumes execution. + + + + + Creates a work item. + + The test for which this WorkItem is being created. + The filter to be used in selecting any child Tests. + + + + + Construct a WorkItem for a particular test. + + The test that the WorkItem will run + + + + Initialize the TestExecutionContext. This must be done + before executing the WorkItem. + + + Originally, the context was provided in the constructor + but delaying initialization of the context until the item + is about to be dispatched allows changes in the parent + context during OneTimeSetUp to be reflected in the child. + + The TestExecutionContext to use + + + + Event triggered when the item is complete + + + + + Gets the current state of the WorkItem + + + + + The test being executed by the work item + + + + + The execution context + + + + + The test actions to be performed before and after this test + + + + + Indicates whether this WorkItem may be run in parallel + + + + + The test result + + + + + Execute the current work item, including any + child work items. + + + + + Cancel (abort or stop) a WorkItem + + true if the WorkItem should be aborted, false if it should run to completion + + + + Method that performs actually performs the work. It should + set the State to WorkItemState.Complete when done. + + + + + Method called by the derived class when all work is complete + + + + + WorkItemQueueState indicates the current state of a WorkItemQueue + + + + + The queue is paused + + + + + The queue is running + + + + + The queue is stopped + + + + + A WorkItemQueue holds work items that are ready to + be run, either initially or after some dependency + has been satisfied. + + + + + Initializes a new instance of the class. + + The name of the queue. + + + + Gets the name of the work item queue. + + + + + Gets the total number of items processed so far + + + + + Gets the maximum number of work items. + + + + + Gets the current state of the queue + + + + + Get a bool indicating whether the queue is empty. + + + + + Enqueue a WorkItem to be processed + + The WorkItem to process + + + + Dequeue a WorkItem for processing + + A WorkItem or null if the queue has stopped + + + + Start or restart processing of items from the queue + + + + + Signal the queue to stop + + + + + Pause the queue for restarting later + + + + + The current state of a work item + + + + + Ready to run or continue + + + + + Work Item is executing + + + + + Complete + + + + + The dispatcher needs to do different things at different, + non-overlapped times. For example, non-parallel tests may + not be run at the same time as parallel tests. We model + this using the metaphor of a working shift. The WorkShift + class associates one or more WorkItemQueues with one or + more TestWorkers. + + Work in the queues is processed until all queues are empty + and all workers are idle. Both tests are needed because a + worker that is busy may end up adding more work to one of + the queues. At that point, the shift is over and another + shift may begin. This cycle continues until all the tests + have been run. + + + + + Construct a WorkShift + + + + + Event that fires when the shift has ended + + + + + Gets a flag indicating whether the shift is currently active + + + + + Gets a list of the queues associated with this shift. + + Used for testing + + + + Gets the list of workers associated with this shift. + + + + + Gets a bool indicating whether this shift has any work to do + + + + + Add a WorkItemQueue to the shift, starting it if the + shift is currently active. + + + + + Assign a worker to the shift. + + + + + + Start or restart processing for the shift + + + + + End the shift, pausing all queues and raising + the EndOfShift event. + + + + + Shut down the shift. + + + + + Cancel (abort or stop) the shift without completing all work + + true if the WorkShift should be aborted, false if it should allow its currently running tests to complete + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Gets or sets the maximum line length for this writer + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a given + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The result of the constraint that failed + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The ConstraintResult for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + Serialization Constructor + + + + + The MethodWrapper class wraps a MethodInfo so that it may + be used in a platform-independent manner. + + + + + Construct a MethodWrapper for a Type and a MethodInfo. + + + + + Construct a MethodInfo for a given Type and method name. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the spcified type are defined on the method. + + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Thrown when an assertion failed. Here to preserve the inner + exception and hence its stack trace. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + OSPlatform represents a particular operating system platform + + + + + Platform ID for Unix as defined by Microsoft .NET 2.0 and greater + + + + + Platform ID for Unix as defined by Mono + + + + + Platform ID for XBox as defined by .NET and Mono, but not CF + + + + + Platform ID for MacOSX as defined by .NET and Mono, but not CF + + + + + Get the OSPlatform under which we are currently running + + + + + Gets the actual OS Version, not the incorrect value that might be + returned for Win 8.1 and Win 10 + + + If an application is not manifested as Windows 8.1 or Windows 10, + the version returned from Environment.OSVersion will not be 6.3 and 10.0 + respectively, but will be 6.2 and 6.3. The correct value can be found in + the registry. + + The original version + The correct OS version + + + + Product Type Enumeration used for Windows + + + + + Product type is unknown or unspecified + + + + + Product type is Workstation + + + + + Product type is Domain Controller + + + + + Product type is Server + + + + + Construct from a platform ID and version + + + + + Construct from a platform ID, version and product type + + + + + Get the platform ID of this instance + + + + + Get the Version of this instance + + + + + Get the Product Type of this instance + + + + + Return true if this is a windows platform + + + + + Return true if this is a Unix or Linux platform + + + + + Return true if the platform is Win32S + + + + + Return true if the platform is Win32Windows + + + + + Return true if the platform is Win32NT + + + + + Return true if the platform is Windows CE + + + + + Return true if the platform is Xbox + + + + + Return true if the platform is MacOSX + + + + + Return true if the platform is Windows 95 + + + + + Return true if the platform is Windows 98 + + + + + Return true if the platform is Windows ME + + + + + Return true if the platform is NT 3 + + + + + Return true if the platform is NT 4 + + + + + Return true if the platform is NT 5 + + + + + Return true if the platform is Windows 2000 + + + + + Return true if the platform is Windows XP + + + + + Return true if the platform is Windows 2003 Server + + + + + Return true if the platform is NT 6 + + + + + Return true if the platform is NT 6.0 + + + + + Return true if the platform is NT 6.1 + + + + + Return true if the platform is NT 6.2 + + + + + Return true if the platform is NT 6.3 + + + + + Return true if the platform is Vista + + + + + Return true if the platform is Windows 2008 Server (original or R2) + + + + + Return true if the platform is Windows 2008 Server (original) + + + + + Return true if the platform is Windows 2008 Server R2 + + + + + Return true if the platform is Windows 2012 Server (original or R2) + + + + + Return true if the platform is Windows 2012 Server (original) + + + + + Return true if the platform is Windows 2012 Server R2 + + + + + Return true if the platform is Windows 7 + + + + + Return true if the platform is Windows 8 + + + + + Return true if the platform is Windows 8.1 + + + + + Return true if the platform is Windows 10 + + + + + Return true if the platform is Windows Server. This is named Windows + Server 10 to distinguish it from previous versions of Windows Server. + + + + + The ParameterWrapper class wraps a ParameterInfo so that it may + be used in a platform-independent manner. + + + + + Construct a ParameterWrapper for a given method and parameter + + + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter. + + + + + Gets the underlying ParameterInfo + + + + + Gets the Type of the parameter + + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the specified type are defined on the parameter. + + + + + PlatformHelper class is used by the PlatformAttribute class to + determine whether a platform is supported. + + + + + Comma-delimited list of all supported OS platform constants + + + + + Comma-delimited list of all supported Runtime platform constants + + + + + Default constructor uses the operating system and + common language runtime of the system. + + + + + Construct a PlatformHelper for a particular operating + system and common language runtime. Used in testing. + + OperatingSystem to be used + RuntimeFramework to be used + + + + Test to determine if one of a collection of platforms + is being used currently. + + + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Tests to determine if the current platform is supported + based on a platform attribute. + + The attribute to examine + + + + + Test to determine if the a particular platform or comma- + delimited set of platforms is in use. + + Name of the platform or comma-separated list of platform ids + True if the platform is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + A PropertyBag represents a collection of name value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + + + + Adds a key/value pair to the property set + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + + True if their are _values present, otherwise false + + + + + Gets a collection containing all the keys in the property set + + + + + + Gets or sets the list of _values for a particular key + + + + + Returns an XmlNode representating the current PropertyBag. + + Not used + An XmlNode representing the PropertyBag + + + + Returns an XmlNode representing the PropertyBag after + adding it as a child of the supplied parent node. + + The parent node. + Not used + + + + + The PropertyNames class provides static constants for the + standard property ids that NUnit uses on tests. + + + + + The FriendlyName of the AppDomain in which the assembly is running + + + + + The selected strategy for joining parameter data into test cases + + + + + The process ID of the executing assembly + + + + + The stack trace from any data provider that threw + an exception. + + + + + The reason a test was not run + + + + + The author of the tests + + + + + The ApartmentState required for running the test + + + + + The categories applying to a test + + + + + The Description of a test + + + + + The number of threads to be used in running tests + + + + + The maximum time in ms, above which the test is considered to have failed + + + + + The ParallelScope associated with a test + + + + + The number of times the test should be repeated + + + + + Indicates that the test should be run on a separate thread + + + + + The culture to be set for a test + + + + + The UI culture to be set for a test + + + + + The type that is under test + + + + + The timeout value for the test + + + + + The test will be ignored until the given date + + + + + The optional Order the test will run in + + + + + Randomizer returns a set of random _values in a repeatable + way, to allow re-running of tests if necessary. It extends + the .NET Random class, providing random values for a much + wider range of types. + + The class is used internally by the framework to generate + test case data and is also exposed for use by users through + the TestContext.Random property. + + + For consistency with the underlying Random Type, methods + returning a single value use the prefix "Next..." Those + without an argument return a non-negative value up to + the full positive range of the Type. Overloads are provided + for specifying a maximum or a range. Methods that return + arrays or strings use the prefix "Get..." to avoid + confusion with the single-value methods. + + + + + Initial seed used to create randomizers for this run + + + + + Get a Randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same _values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Create a new Randomizer using the next seed + available to ensure that each randomizer gives + a unique sequence of values. + + + + + + Default constructor + + + + + Construct based on seed value + + + + + + Returns a random unsigned int. + + + + + Returns a random unsigned int less than the specified maximum. + + + + + Returns a random unsigned int within a specified range. + + + + + Returns a non-negative random short. + + + + + Returns a non-negative random short less than the specified maximum. + + + + + Returns a non-negative random short within a specified range. + + + + + Returns a random unsigned short. + + + + + Returns a random unsigned short less than the specified maximum. + + + + + Returns a random unsigned short within a specified range. + + + + + Returns a random long. + + + + + Returns a random long less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random ulong. + + + + + Returns a random ulong less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random Byte + + + + + Returns a random Byte less than the specified maximum. + + + + + Returns a random Byte within a specified range + + + + + Returns a random SByte + + + + + Returns a random sbyte less than the specified maximum. + + + + + Returns a random sbyte within a specified range + + + + + Returns a random bool + + + + + Returns a random bool based on the probablility a true result + + + + + Returns a random double between 0.0 and the specified maximum. + + + + + Returns a random double within a specified range. + + + + + Returns a random float. + + + + + Returns a random float between 0.0 and the specified maximum. + + + + + Returns a random float within a specified range. + + + + + Returns a random enum value of the specified Type as an object. + + + + + Returns a random enum value of the specified Type. + + + + + Default characters for random functions. + + Default characters are the English alphabet (uppercase & lowercase), arabic numerals, and underscore + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + string representing the set of characters from which to construct the resulting string + A random string of arbitrary length + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + A random string of arbitrary length + Uses DefaultStringChars as the input character set + + + + Generate a random string based on the characters from the input string. + + A random string of the default length + Uses DefaultStringChars as the input character set + + + + Returns a random decimal. + + + + + Returns a random decimal between positive zero and the specified maximum. + + + + + Returns a random decimal within a specified range, which is not + permitted to exceed decimal.MaxVal in the current implementation. + + + A limitation of this implementation is that the range from min + to max must not exceed decimal.MaxVal. + + + + + Helper methods for inspecting a type by reflection. + + Many of these methods take ICustomAttributeProvider as an + argument to avoid duplication, even though certain attributes can + only appear on specific types of members, like MethodInfo or Type. + + In the case where a type is being examined for the presence of + an attribute, interface or named member, the Reflect methods + operate with the full name of the member being sought. This + removes the necessity of the caller having a reference to the + assembly that defines the item being sought and allows the + NUnit core to inspect assemblies that reference an older + version of the NUnit framework. + + + + + Examine a fixture type and return an array of methods having a + particular attribute. The array is order with base methods first. + + The type to examine + The attribute Type to look for + Specifies whether to search the fixture type inheritance chain + The array of methods found + + + + Examine a fixture type and return true if it has a method with + a particular attribute. + + The type to examine + The attribute Type to look for + True if found, otherwise false + + + + Invoke the default constructor on a Type + + The Type to be constructed + An instance of the Type + + + + Invoke a constructor on a Type with arguments + + The Type to be constructed + Arguments to the constructor + An instance of the Type + + + + Returns an array of types from an array of objects. + Used because the compact framework doesn't support + Type.GetTypeArray() + + An array of objects + An array of Types + + + + Invoke a parameterless method returning void on an object. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + + + + Invoke a method, converting any TargetInvocationException to an NUnitException. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The TestResult class represents the result of a test. + + + + + Error message for when child tests have errors + + + + + Error message for when child tests are ignored + + + + + The minimum duration for tests + + + + + List of child results + + + + + Construct a test result given a Test + + The test to be used + + + + Gets the test with which this result is associated. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets or sets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Test HasChildren before accessing Children to avoid + the creation of an empty collection. + + + + + Gets the collection of child results. + + + + + Gets a TextWriter, which will write output to be included in the result. + + + + + Gets any text output written to this result. + + + + + Returns the Xml representation of the result. + + If true, descendant results are included + An XmlNode representing the result + + + + Adds the XML representation of the result as a child of the + supplied parent node.. + + The parent node. + If true, descendant results are included + + + + + Adds a child result to this result, setting this result's + ResultState to Failure if the child result failed. + + The result to be added + + + + Set the result of the test + + The ResultState to use in the result + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + Stack trace giving the location of the command + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + THe FailureSite to use in the result + + + + RecordTearDownException appends the message and stacktrace + from an exception arising during teardown of the test + to any previously recorded information, so that any + earlier failure information is not lost. Note that + calling Assert.Ignore, Assert.Inconclusive, etc. during + teardown is treated as an error. If the current result + represents a suite, it may show a teardown error even + though all contained tests passed. + + The Exception to be recorded + + + + Adds a reason element to a node and returns it. + + The target node. + The new reason element. + + + + Adds a failure element to a node and returns it. + + The target node. + The new failure element. + + + + Enumeration identifying a common language + runtime implementation. + + + + Any supported runtime framework + + + Microsoft .NET Framework + + + Microsoft .NET Compact Framework + + + Microsoft Shared Source CLI + + + Mono + + + Silverlight + + + MonoTouch + + + + RuntimeFramework represents a particular version + of a common language runtime implementation. + + + + + DefaultVersion is an empty Version, used to indicate that + NUnit should select the CLR version to use for the test. + + + + + Construct from a runtime type and version. If the version has + two parts, it is taken as a framework version. If it has three + or more, it is taken as a CLR version. In either case, the other + version is deduced based on the runtime type and provided version. + + The runtime type of the framework + The version of the framework + + + + Static method to return a RuntimeFramework object + for the framework that is currently in use. + + + + + The type of this runtime framework + + + + + The framework version for this runtime framework + + + + + The CLR version for this runtime framework + + + + + Return true if any CLR version may be used in + matching this RuntimeFramework object. + + + + + Returns the Display name for this framework + + + + + Parses a string representing a RuntimeFramework. + The string may be just a RuntimeType name or just + a Version or a hyphenated RuntimeType-Version or + a Version prefixed by 'versionString'. + + + + + + + Overridden to return the short name of the framework + + + + + + Returns true if the current framework matches the + one supplied as an argument. Two frameworks match + if their runtime types are the same or either one + is RuntimeType.Any and all specified version components + are equal. Negative (i.e. unspecified) version + components are ignored. + + The RuntimeFramework to be matched. + True on match, otherwise false + + + + StackFilter class is used to remove internal NUnit + entries from a stack trace so that the resulting + trace provides better information about the test. + + + + + Filters a raw stack trace and returns the result. + + The original stack trace + A filtered stack trace + + + + Provides methods to support legacy string comparison methods. + + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + Zero if the strings are equivalent, a negative number if strA is sorted first, a positive number if + strB is sorted first + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + True if the strings are equivalent, false if not. + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + The expected result to be returned + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + The expected result of the test, which + must match the method return type. + + + + + Gets a value indicating whether an expected result was specified. + + + + + Helper class used to save and restore certain static or + singleton settings in the environment that affect tests + or which might be changed by the user tests. + + An internal class is used to hold settings and a stack + of these objects is pushed and popped as Save and Restore + are called. + + + + + Link to a prior saved context + + + + + Indicates that a stop has been requested + + + + + The event listener currently receiving notifications + + + + + The number of assertions for the current test + + + + + The current culture + + + + + The current UI culture + + + + + The current test result + + + + + The current Principal. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + An existing instance of TestExecutionContext. + + + + The current context, head of the list of saved contexts. + + + + + Gets the current context. + + The current context. + + + + Get the current context or return null if none is found. + + + + + Clear the current context. This is provided to + prevent "leakage" of the CallContext containing + the current context back to any runners. + + + + + Gets or sets the current test + + + + + The time the current test started execution + + + + + The time the current test started in Ticks + + + + + Gets or sets the current test result + + + + + Gets a TextWriter that will send output to the current test result. + + + + + The current test object - that is the user fixture + object on which tests are being executed. + + + + + Get or set the working directory + + + + + Get or set indicator that run should stop on the first error + + + + + Gets an enum indicating whether a stop has been requested. + + + + + The current test event listener + + + + + The current WorkItemDispatcher + + + + + The ParallelScope to be used by tests running in this context. + For builds with out the parallel feature, it has no effect. + + + + + Gets the RandomGenerator specific to this Test + + + + + Gets the assert count. + + The assert count. + + + + Gets or sets the test case timeout value + + + + + Gets a list of ITestActions set by upstream tests + + + + + Saves or restores the CurrentCulture + + + + + Saves or restores the CurrentUICulture + + + + + Gets or sets the current for the Thread. + + + + + The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter + + + + + Record any changes in the environment made by + the test code in the execution context so it + will be passed on to lower level tests. + + + + + Set up the execution environment to match a context. + Note that we may be running on the same thread where the + context was initially created or on a different thread. + + + + + Increments the assert count by one. + + + + + Increments the assert count by a specified amount. + + + + + Adds a new ValueFormatterFactory to the chain of formatters + + The new factory + + + + Obtain lifetime service object + + + + + + Enumeration indicating whether the tests are + running normally or being cancelled. + + + + + Running normally with no stop requested + + + + + A graceful stop has been requested + + + + + A forced stop has been requested + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Indicates whether this is a top-level filter, + not contained in any other filter. + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. This is overridden by each + different type of filter to perform the necessary tests. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test matches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Create a TestFilter instance from an xml representation. + + + + + Create a TestFilter from it's TNode representation + + + + + Nested class provides an empty filter - one that always + returns true when called. It never matches explicitly. + + + + + Adds an XML node + + True if recursive + The added XML node + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + Type arguments used to create a generic fixture instance + + + + + TestListener provides an implementation of ITestListener that + does nothing. It is used only through its NULL property. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test case has finished + + The result of the test + + + + Construct a new TestListener - private so it may not be used. + + + + + Get a listener that does nothing + + + + + TestNameGenerator is able to create test names according to + a coded pattern. + + + + + Construct a TestNameGenerator + + The pattern used by this generator. + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + The display name + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + Arguments to be used + The display name + + + + Get the display name for a MethodInfo + + A MethodInfo + The display name + + + + Get the display name for a method with args + + A MethodInfo + Argument list for the method + The display name + + + + TestParameters is the abstract base class for all classes + that know how to provide data for constructing a test. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a ParameterSet from an object implementing ITestData + + + + + + The RunState for this set of parameters. + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets the property dictionary for this test + + + + + Applies ParameterSet _values to the test itself. + + A test. + + + + The original arguments provided by the user, + used for display purposes. + + + + + TestProgressReporter translates ITestListener events into + the async callbacks that are used to inform the client + software about the progress of a test run. + + + + + Initializes a new instance of the class. + + The callback handler to be used for reporting progress. + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished. Sends a result summary to the callback. + to + + The result of the test + + + + Returns the parent test item for the targer test item if it exists + + + parent test item + + + + Makes a string safe for use as an attribute, replacing + characters characters that can't be used with their + corresponding xml representations. + + The string to be used + A new string with the _values replaced + + + + ParameterizedFixtureSuite serves as a container for the set of test + fixtures created from a given Type using various parameters. + + + + + Initializes a new instance of the class. + + The ITypeInfo for the type that represents the suite. + + + + Gets a string representing the type of test + + + + + + ParameterizedMethodSuite holds a collection of individual + TestMethods with their arguments applied. + + + + + Construct from a MethodInfo + + + + + + Gets a string representing the type of test + + + + + + SetUpFixture extends TestSuite and supports + Setup and TearDown methods. + + + + + Initializes a new instance of the class. + + The type. + + + + The Test abstract class represents a test within the framework. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + The SetUp methods. + + + + + The teardown methods + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + TODO: Documentation needed for constructor + + + + + + Construct a test from a MethodInfo + + + + + + Gets or sets the id of the test + + + + + + Gets or sets the name of the test + + + + + Gets or sets the fully qualified name of the test + + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the TypeInfo of the fixture used in running this test + or null if no fixture type is associated with it. + + + + + Gets a MethodInfo for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Whether or not the test should be run + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Gets a string representing the type of test. Used as an attribute + value in the XML representation of a test and has no other + function in the framework. + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets the properties for this test + + + + + Returns true if this is a TestSuite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets or sets a fixture object for running this test. + + + + + Static prefix used for ids in this AppDomain. + Set by FrameworkController. + + + + + Gets or Sets the Int value representing the seed for the RandomGenerator + + + + + + Creates a TestResult for this test. + + A TestResult suitable for this type of test. + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object implementing ICustomAttributeProvider + + + + Add standard attributes and members to a test node. + + + + + + + Returns the Xml representation of the test + + If true, include child tests recursively + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + TestAssembly is a TestSuite that represents the execution + of tests in a managed assembly. + + + + + Initializes a new instance of the class + specifying the Assembly and the path from which it was loaded. + + The assembly this test represents. + The path used to load the assembly. + + + + Initializes a new instance of the class + for a path which could not be loaded. + + The path used to load the assembly. + + + + Gets the Assembly represented by this instance. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + TestFixture is a surrogate for a user test fixture class, + containing one or more tests. + + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + The TestMethod class represents a Test implemented as a method. + + + + + The ParameterSet used to create this test method + + + + + Initializes a new instance of the class. + + The method to be used as a test. + + + + Initializes a new instance of the class. + + The method to be used as a test. + The suite or fixture to which the new test will be added + + + + Overridden to return a TestCaseResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Returns a TNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Gets this test's child tests + + A list of child tests + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns the name of the method + + + + + TestSuite represents a composite test, which contains other tests. + + + + + Our collection of child tests + + + + + Initializes a new instance of the class. + + The name of the suite. + + + + Initializes a new instance of the class. + + Name of the parent suite. + The name of the suite. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Sorts tests under this suite. + + + + + Adds a test to the suite. + + The test. + + + + Gets this test's child tests + + The list of child tests + + + + Gets a count of test cases represented by + or contained under this test. + + + + + + The arguments to use in creating the fixture + + + + + Set to true to suppress sorting this suite's contents + + + + + Overridden to return a TestSuiteResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Check that setup and teardown methods marked by certain attributes + meet NUnit's requirements and mark the tests not runnable otherwise. + + The attribute type to check for + + + + ThreadUtility provides a set of static methods convenient + for working with threads. + + + + + Do our best to Kill a thread + + The thread to kill + + + + Do our best to kill a thread, passing state info + + The thread to kill + Info for the ThreadAbortException handler + + + + TypeHelper provides static methods that operate on Types. + + + + + A special value, which is used to indicate that BestCommonType() method + was unable to find a common type for the specified arguments. + + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The display name for the Type + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The arglist provided. + The display name for the Type + + + + Returns the best fit for a common type to be used in + matching actual arguments to a methods Type parameters. + + The first type. + The second type. + Either type1 or type2, depending on which is more general. + + + + Determines whether the specified type is numeric. + + The type to be examined. + + true if the specified type is numeric; otherwise, false. + + + + + Convert an argument list to the required parameter types. + Currently, only widening numeric conversions are performed. + + An array of args to be converted + A ParameterInfo[] whose types will be used as targets + + + + Determines whether this instance can deduce type args for a generic type from the supplied arguments. + + The type to be examined. + The arglist. + The type args to be used. + + true if this the provided args give sufficient information to determine the type args to be used; otherwise, false. + + + + + Gets the _values for an enumeration, using Enum.GetTypes + where available, otherwise through reflection. + + + + + + + Gets the ids of the _values for an enumeration, + using Enum.GetNames where available, otherwise + through reflection. + + + + + + + The TypeWrapper class wraps a Type so it may be used in + a platform-independent manner. + + + + + Construct a TypeWrapper for a specified Type. + + + + + Gets the underlying Type on which this TypeWrapper is based. + + + + + Gets the base type of this type as an ITypeInfo + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Returns true if the Type wrapped is T + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type represents a static class. + + + + + Get the display name for this type + + + + + Get the display name for an object of this type, constructed with the specified args. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns an array of custom attributes of the specified type applied to this type + + + + + Returns a value indicating whether the type has an attribute of the specified type. + + + + + + + + Returns a flag indicating whether this type has a method with an attribute of the specified type. + + + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Represents the result of running a single test case. + + + + + Construct a TestCaseResult based on a TestMethod + + A TestMethod to which the result applies. + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Represents the result of running a test suite + + + + + Construct a TestSuiteResult base on a TestSuite + + The TestSuite to which the result applies + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Add a child result + + The child result to be added + + + + Provides a platform-independent methods for getting attributes + for use by AttributeConstraint and AttributeExistsConstraint. + + + + + Gets the custom attributes from the given object. + + Portable libraries do not have an ICustomAttributeProvider, so we need to cast to each of + it's direct subtypes and try to get attributes off those instead. + The actual. + Type of the attribute. + if set to true [inherit]. + A list of the given attribute on the given object. + + + + A MarshalByRefObject that lives forever + + + + + Obtains a lifetime service object to control the lifetime policy for this instance. + + + + + This class is a System.Diagnostics.Stopwatch on operating systems that support it. On those that don't, + it replicates the functionality at the resolution supported. + + + + + Class used to guard against unexpected argument values + or operations by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Throws an ArgumentOutOfRangeException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an ArgumentException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an InvalidOperationException if the specified condition is not met. + + The condition that must be met + The exception message to be used + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + DefaultTestAssemblyBuilder loads a single assembly and builds a TestSuite + containing test fixtures present in the assembly. + + + + + The default suite builder used by the test assembly builder. + + + + + Initializes a new instance of the class. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + FrameworkController provides a facade for use in loading, browsing + and running tests without requiring a reference to the NUnit + framework. All calls are encapsulated in constructors for + this class and its nested classes, which only require the + types of the Common Type System as arguments. + + The controller supports four actions: Load, Explore, Count and Run. + They are intended to be called by a driver, which should allow for + proper sequencing of calls. Load must be called before any of the + other actions. The driver may support other actions, such as + reload on run, by combining these calls. + + + + + Construct a FrameworkController using the default builder and runner. + + The AssemblyName or path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController using the default builder and runner. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The full AssemblyName or the path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Gets the ITestAssemblyBuilder used by this controller instance. + + The builder. + + + + Gets the ITestAssemblyRunner used by this controller instance. + + The runner. + + + + Gets the AssemblyName or the path for which this FrameworkController was created + + + + + Gets the Assembly for which this + + + + + Gets a dictionary of settings for the FrameworkController + + + + + Loads the tests in the assembly + + + + + + Returns info about the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of exploring the tests + + + + Runs the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly syncronously reporting back the test results through the callback + or through the return value + + The callback that receives the test results + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly asyncronously reporting back the test results through the callback + + The callback that receives the test results + A string containing the XML representation of the filter to use + + + + Stops the test run + + True to force the stop, false for a cooperative stop + + + + Counts the number of test cases in the loaded TestSuite + + A string containing the XML representation of the filter to use + The number of tests + + + + Inserts environment element + + Target node + The new node + + + + Inserts settings element + + Target node + Settings dictionary + The new node + + + + FrameworkControllerAction is the base class for all actions + performed against a FrameworkController. + + + + + LoadTestsAction loads a test into the FrameworkController + + + + + LoadTestsAction loads the tests in an assembly. + + The controller. + The callback handler. + + + + ExploreTestsAction returns info about the tests in an assembly + + + + + Initializes a new instance of the class. + + The controller for which this action is being performed. + Filter used to control which tests are included (NYI) + The callback handler. + + + + CountTestsAction counts the number of test cases in the loaded TestSuite + held by the FrameworkController. + + + + + Construct a CountsTestAction and perform the count of test cases. + + A FrameworkController holding the TestSuite whose cases are to be counted + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunTestsAction runs the loaded TestSuite held by the FrameworkController. + + + + + Construct a RunTestsAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunAsyncAction initiates an asynchronous test run, returning immediately + + + + + Construct a RunAsyncAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + StopRunAction stops an ongoing run. + + + + + Construct a StopRunAction and stop any ongoing run. If no + run is in process, no error is raised. + + The FrameworkController for which a run is to be stopped. + True the stop should be forced, false for a cooperative stop. + >A callback handler used to report results + A forced stop will cause threads and processes to be killed as needed. + + + + The ITestAssemblyBuilder interface is implemented by a class + that is able to build a suite of tests given an assembly or + an assembly filename. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + The ITestAssemblyRunner interface is implemented by classes + that are able to execute a suite of tests loaded + from an assembly. + + + + + Gets the tree of loaded tests, or null if + no tests have been loaded. + + + + + Gets the tree of test results, if the test + run is completed, otherwise null. + + + + + Indicates whether a test has been loaded + + + + + Indicates whether a test is currently running + + + + + Indicates whether a test run is complete + + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + File name of the assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + The assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive ITestListener notifications. + A test filter used to select tests to be run + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any test-running threads + + + + Implementation of ITestAssemblyRunner + + + + + Initializes a new instance of the class. + + The builder. + + + + Gets the default level of parallel execution (worker threads) + + + + + The tree of tests that was loaded by the builder + + + + + The test result, if a run has completed + + + + + Indicates whether a test is loaded + + + + + Indicates whether a test is running + + + + + Indicates whether a test run is complete + + + + + Our settings, specified when loading the assembly + + + + + The top level WorkItem created for the assembly as a whole + + + + + The TestExecutionContext for the top level WorkItem + + + + + Loads the tests found in an Assembly + + File name of the assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Loads the tests found in an Assembly + + The assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + RunAsync is a template method, calling various abstract and + virtual methods to be overridden by derived classes. + + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Initiate the test run. + + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any tests that are currently running + + + + Create the initial TestExecutionContext used to run tests + + The ITestListener specified in the RunAsync call + + + + Handle the the Completed event for the top level work item + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that an async delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate does not throw an exception. + + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + Delegate used by tests that execute async code and + capture any thrown exception. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter ids for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Marks a test that must run in a particular threading apartment state, causing it + to run in a separate thread if necessary. + + + + + Construct an ApartmentAttribute + + The apartment state that this test must be run under. You must pass in a valid apartment state. + + + + Provides the Author of a test or test fixture. + + + + + Initializes a new instance of the class. + + The name of the author. + + + + Initializes a new instance of the class. + + The name of the author. + The email address of the author. + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Modifies a test by adding a category to it. + + The test to modify + + + + Marks a test to use a combinatorial join of any argument + data provided. Since this is the default, the attribute is + optional. + + + + + Default constructor + + + + + Marks a test to use a particular CombiningStrategy to join + any parameter data provided. Since this is the default, the + attribute is optional. + + + + + Construct a CombiningStrategyAttribute incorporating an + ICombiningStrategy and an IParamterDataProvider. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct a CombiningStrategyAttribute incorporating an object + that implements ICombiningStrategy and an IParameterDataProvider. + This constructor is provided for CLS compliance. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Modify the test by adding the name of the combining strategy + to the properties. + + The test to modify + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Causes a test to be skipped if this CultureAttribute is not satisfied. + + The test to modify + + + + Tests to determine if the current culture is supported + based on the properties of this attribute. + + True, if the current culture is supported + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + The abstract base class for all data-providing attributes + defined by NUnit. Used to select all data sources for a + method, class or parameter. + + + + + Default constructor + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointSourceAttribute. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointsAttribute. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct a description Attribute + + The text of the description + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + Modifies a test by marking it as explicit. + + The test to modify + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The date in the future to stop ignoring the test as a string in UTC time. + For example for a date and time, "2014-12-25 08:10:00Z" or for just a date, + "2014-12-25". If just a date is given, the Ignore will expire at midnight UTC. + + + Once the ignore until date has passed, the test will be marked + as runnable. Tests with an ignore until date will have an IgnoreUntilDate + property set which will appear in the test results. + + The string does not contain a valid string representation of a date and time. + + + + Modifies a test by marking it as Ignored. + + The test to modify + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple items may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + TestAssemblyDirectoryResolveAttribute is used to mark a test assembly as needing a + special assembly resolution hook that will explicitly search the test assembly's + directory for dependent assemblies. This works around a conflict between mixed-mode + assembly initialization and tests running in their own AppDomain in some cases. + + + + + LevelOfParallelismAttribute is used to set the number of worker threads + that may be allocated by the framework for running tests. + + + + + Construct a LevelOfParallelismAttribute. + + The number of worker threads to be created by the framework. + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + The abstract base class for all custom attributes defined by NUnit. + + + + + Default constructor + + + + + Attribute used to identify a method that is called once + to perform setup before any child tests are run. + + + + + Attribute used to identify a method that is called once + after all the child tests have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + Marks a test to use a pairwise join of any argument + data provided. Arguments will be combined in such a + way that all possible pairs of arguments are used. + + + + + Default constructor + + + + + ParallelizableAttribute is used to mark tests that may be run in parallel. + + + + + Construct a ParallelizableAttribute using default ParallelScope.Self. + + + + + Construct a ParallelizableAttribute with a specified scope. + + The ParallelScope associated with this attribute. + + + + Modify the context to be used for child tests + + The current TestExecutionContext + + + + The ParallelScope enumeration permits specifying the degree to + which a test and its descendants may be run in parallel. + + + + + No Parallelism is permitted + + + + + The test itself may be run in parallel with others at the same level + + + + + Descendants of the test may be run in parallel with one another + + + + + Descendants of the test down to the level of TestFixtures may be run in parallel + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-delimited list of platforms + + + + Causes a test to be skipped if this PlatformAttribute is not satisfied. + + The test to modify + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Modifies a test by adding properties to it. + + The test to modify + + + + RandomAttribute is used to supply a set of random _values + to a single parameter of a parameterized test. + + + + + Construct a random set of values appropriate for the Type of the + parameter on which the attribute appears, specifying only the count. + + + + + + Construct a set of ints within a specified range + + + + + Construct a set of unsigned ints within a specified range + + + + + Construct a set of longs within a specified range + + + + + Construct a set of unsigned longs within a specified range + + + + + Construct a set of shorts within a specified range + + + + + Construct a set of unsigned shorts within a specified range + + + + + Construct a set of doubles within a specified range + + + + + Construct a set of floats within a specified range + + + + + Construct a set of bytes within a specified range + + + + + Construct a set of sbytes within a specified range + + + + + Get the collection of _values to be used as arguments. + + + + + RangeAttribute is used to supply a range of _values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of unsigned ints using default step of 1 + + + + + + + Construct a range of unsigned ints specifying the step size + + + + + + + + Construct a range of longs using a default step of 1 + + + + + + + Construct a range of longs + + + + + + + + Construct a range of unsigned longs using default step of 1 + + + + + + + Construct a range of unsigned longs specifying the step size + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RepeatAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RetryAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test to use a Sequential join of any argument + data provided. Arguments will be combined into test cases, + taking the next value of each argument until all are used. + + + + + Default constructor + + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Build a SetUpFixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A SetUpFixture object as a TestSuite. + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + The author of this test + + + + + The type that this test is testing + + + + + Modifies a test by adding a description, if not already set. + + The test to modify + + + + Gets or sets the expected result. + + The result. + + + + Returns true if an expected result has been set + + + + + Construct a TestMethod from a given method. + + The method for which a test is to be constructed. + The suite to which the test will be added. + A TestMethod + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test case. + + + + + Gets the list of arguments to a test case + + + + + Gets the properties of the test case + + + + + Gets or sets the expected result. + + The result. + + + + Returns true if the expected result has been set + + + + + Gets or sets the description. + + The description. + + + + The author of this test + + + + + The type that this test is testing + + + + + Gets or sets the reason for ignoring the test + + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets or sets the reason for not running the test. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Comma-delimited list of platforms to run the test for + + + + + Comma-delimited list of platforms to not run the test for + + + + + Gets and sets the category for this test case. + May be a comma-separated list of categories. + + + + + Performs several special conversions allowed by NUnit in order to + permit arguments with types that cannot be used in the constructor + of an Attribute such as TestCaseAttribute or to simplify their use. + + The arguments to be converted + The ParameterInfo array for the method + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + TestCaseSourceAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The IMethod for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Returns a set of ITestCaseDataItems for use as arguments + to a parameterized test method. + + The method for which data is needed. + + + + + TestFixtureAttribute is used to mark a class that represents a TestFixture. + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test fixture. + + + + + The arguments originally provided to the attribute + + + + + Properties pertaining to this fixture + + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Descriptive text for this fixture + + + + + The author of this fixture + + + + + The type that this fixture is testing + + + + + Gets or sets the ignore reason. May set RunState as a side effect. + + The ignore reason. + + + + Gets or sets the reason for not running the fixture. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Build a fixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A an IEnumerable holding one TestFixture object. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + TestCaseSourceAttribute indicates the source to be used to + provide test fixture instances for a test class. + + + + + Error message string is public so the tests can use it + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestFixtures from a given Type, + using available parameter data. + + The TypeInfo for which fixures are to be constructed. + One or more TestFixtures as TestSuite + + + + Returns a set of ITestFixtureData items for use as arguments + to a parameterized test fixture. + + The type for which data is needed. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Indicates which class the test or test fixture is testing + + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Construct the attribute, specifying a combining strategy and source of parameter data. + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a class or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary + + + + + Constructs for use with an Enum parameter. Will pass every enum + value in to the test. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of _values to be used as arguments + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + + An enumeration containing individual data items + + + + + A set of Assert methods operating on one or more collections + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attribute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation + + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Gets the expected object + + + + + Test whether the expected item is contained in the collection + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionEquivalentConstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether two collections are equivalent + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + If used performs a reverse comparison + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the collection is ordered + + + + + + + Returns the string representation of the constraint. + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionSupersetConstraint is used to determine whether + one collection is a superset of another + + + + + Construct a CollectionSupersetConstraint + + The collection that the actual value is expected to be a superset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a superset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionTally counts (tallies) the number of + occurrences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + The number of objects remaining in the tally + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + ComparisonAdapter class centralizes all comparisons of + _values in NUnit, adapting to the use of any provided + , + or . + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps a + + + + + Compares two objects + + + + + Construct a default ComparisonAdapter + + + + + Construct a ComparisonAdapter for an + + + + + Compares two objects + + + + + + + + ComparerAdapter extends and + allows use of an or + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare _values to + determine if one is greater than, equal to or less than + the other. + + + + + The value against which a comparison is to be made + + + + + If true, less than returns success + + + + + if true, equal returns success + + + + + if true, greater than returns success + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + The value against which to make a comparison. + if set to true less succeeds. + if set to true equal succeeds. + if set to true greater succeeds. + String used in describing the constraint. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use a and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + Construct a constraint with optional arguments + + Arguments to be saved + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Retrieves the value to be tested from an ActualValueDelegate. + The default implementation simply evaluates the delegate but derived + classes may override it to provide for delayed processing. + + An ActualValueDelegate + Delegate evaluation result + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + Resolves any pending operators and returns the resolved constraint. + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reorganized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + + + + Pushes the specified operator onto the stack. + + The operator to put onto the stack. + + + + Pops the topmost operator from the stack. + + The topmost operator on the stack + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Pushes the specified constraint. As a side effect, + the constraint's Builder field is set to the + ConstraintBuilder owning this stack. + + The constraint to put onto the stack + + + + Pops this topmost constraint from the stack. + As a side effect, the constraint's Builder + field is set to null. + + The topmost contraint on the stack + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expression by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the Builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reorganized. When a constraint is appended, it is returned as the + value of the operation so that modifiers may be applied. However, + any partially built expression is attached to the constraint for + later resolution. When an operator is appended, the partial + expression is returned. If it's a self-resolving operator, then + a ResolvableConstraintExpression is returned. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. Note that the constraint + is not reduced at this time. For example, if there + is a NotOperator on the stack we don't reduce and + return a NotConstraint. The original constraint must + be returned because it may support modifiers that + are yet to be applied. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests if item is equal to zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + ConstraintStatus represents the status of a ConstraintResult + returned by a Constraint being applied to an actual value. + + + + + The status has not yet been set + + + + + The constraint succeeded + + + + + The constraint failed + + + + + An error occured in applying the constraint (reserved for future use) + + + + + Contain the result of matching a against an actual value. + + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + The status of the new ConstraintResult. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + If true, applies a status of Success to the result, otherwise Failure. + + + + The actual value that was passed to the method. + + + + + Gets and sets the ResultStatus for this result. + + + + + True if actual value meets the Constraint criteria otherwise false. + + + + + Display friendly name of the constraint. + + + + + Description of the constraint may be affected by the state the constraint had + when was performed against the actual value. + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the result and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The _expected. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Flag the constraint to ignore case and return self. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint to decorate + The time interval after which the match is performed, in milliseconds + The time interval used for polling, in milliseconds + If the value of is less than 0 + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + Adjusts a Timestamp by a given TimeSpan + + + + + + + + Returns the difference between two Timestamps as a TimeSpan + + + + + + + + DictionaryContainsKeyConstraint is used to test whether a dictionary + contains an expected object as a key. + + + + + Construct a DictionaryContainsKeyConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected key is contained in the dictionary + + + + + DictionaryContainsValueConstraint is used to test whether a dictionary + contains an expected object as a value. + + + + + Construct a DictionaryContainsValueConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected value is contained in the dictionary + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that the collection is empty + + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyStringConstraint tests whether a string is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Gets the tolerance for this comparison. + + + The tolerance. + + + + + Gets a value indicating whether to compare case insensitive. + + + true if comparing case insensitive; otherwise, false. + + + + + Gets a value indicating whether or not to clip strings. + + + true if set to clip strings otherwise, false. + + + + + Gets the failure points. + + + The failure points. + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flags the constraint to include + property in comparison of two values. + + + Using this modifier does not allow to use the + constraint modifier. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable _values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point _values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual _values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + EqualityAdapter class handles all equality comparisons + that use an , + or a . + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps an . + + + + + Returns an EqualityAdapter that uses a predicate function for items comparison. + + + + + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + Returns an that wraps an . + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps a . + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + FileExistsConstraint is used to determine if a file exists + + + + + Initializes a new instance of the class. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + FileOrDirectoryExistsConstraint is used to determine if a file or directory exists + + + + + If true, the constraint will only check if files exist, not directories + + + + + If true, the constraint will only check if directories exist, not files + + + + + Initializes a new instance of the class that + will check files and directories. + + + + + Initializes a new instance of the class that + will only check files if ignoreDirectories is true. + + if set to true [ignore directories]. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the _values are + allowed to deviate by up to 2 adjacent floating point _values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + Compares two floating point _values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point _values that are allowed to + be between the left and the right floating point _values + + True if both numbers are equal or close to being equal + + + Floating point _values can only represent a finite subset of natural numbers. + For example, the _values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point _values are between + the left and the right number. If the number of possible _values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point _values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point _values that are + allowed to be between the left and the right double precision floating point _values + + True if both numbers are equal or close to being equal + + + Double precision floating point _values can only represent a limited series of + natural numbers. For example, the _values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + _values are between the left and the right number. If the number of possible + _values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Interface for all constraints + + + + + The display name of this Constraint for use by ToString(). + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The IResolveConstraint interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Tests whether a value is less than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Abstract method to get the max line length + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The failing constraint result + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Custom value formatter function + + The value + + + + + Custom value formatter factory function + + The next formatter function + ValueFormatter + If the given formatter is unable to handle a certain format, it must call the next formatter in the chain + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Formatting strings used for expected and actual _values + + + + + Current head of chain of value formatters. Public for testing. + + + + + Add a formatter to the chain of responsibility. + + + + + + Formats text to represent a generalized value. + + The value + The formatted text + + + + Formats text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a collection or + array corresponding to a single int index into the collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test that the actual value is an NaN + + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Numerics class contains common operations on numeric _values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric _values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the _values are equal + + + + Compare two numeric _values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the _values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Returns the default NUnitComparer. + + + + + Compares two objects + + + + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occurred. + + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + Flags the comparer to include + property in comparison of two values. + + + Using this modifier does not allow to use the + modifier. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + _values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + The syntax element preceding this operator + + + + + The syntax element following this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Gets the name of the property to which the operator applies + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifies the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Modifies the current instance to be case-sensitive + and returns it. + + + + + Returns the string representation of this constraint + + + + + Canonicalize the provided path + + + The path in standardized form + + + + Test whether one path in canonical form is a subpath of another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Gets text describing a constraint + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Prefix used in forming the constraint description + + + + + Construct given a base constraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the value + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two _values are within a + specified range. + + + + + Initializes a new instance of the class. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + Resolve the current expression to a Constraint + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Return the top-level constraint for this expression + + + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + The EqualConstraintResult class is tailored for formatting + and displaying the result of an EqualConstraint. + + + + + Construct an EqualConstraintResult + + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual collections or arrays. If both are identical, the value is + only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both _values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Description of this constraint + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Constructs a StringConstraint without an expected value + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + Gets text describing a constraint + + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. This override only handles the special message + used when an exception is expected but none is thrown. + + The writer on which the actual value is displayed + + + + ThrowsExceptionConstraint tests that an exception has + been thrown, without any further tests. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Executes the code and returns success if an exception is thrown. + + A delegate representing the code to be tested + True if an exception is thrown, otherwise false + + + + Returns the ActualValueDelegate itself as the value to be tested. + + A delegate representing the code to be tested + The delegate itself + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Returns a default Tolerance object, equivalent to + specifying an exact match unless + is set, in which case, the + will be used. + + + + + Returns an empty Tolerance object, equivalent to + specifying an exact match even if + is set. + + + + + Constructs a linear tolerance of a specified amount + + + + + Constructs a tolerance given an amount and + + + + + Gets the for the current Tolerance + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance has not been set or is using the . + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared _values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared _values my deviate from each other. + + + + + Compares two _values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + The type of the actual argument to which the constraint was applied + + + + + Construct a TypeConstraint for a given Type + + The expected type for the constraint + Prefix used in forming the constraint description + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that all items are unique. + + + + + + + XmlSerializableConstraint tests whether + an object is serializable in xml format. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of this constraint + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new DictionaryContainsKeyConstraint checking for the + presence of a particular key in the dictionary. + + + + + Returns a new DictionaryContainsValueConstraint checking for the + presence of a particular value in the dictionary. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Asserts on Directories + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if the directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both point to the same directory. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory exists. If it does not exist + an is thrown. + + The path to a directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + A directory containing the actual value + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory does not exist. If it does exist + an is thrown. + + The path to a directory containing the actual value + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a constraint that succeeds if the value + is a file or directory and it exists. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Abstract base for Exceptions that terminate a test and provide a ResultState. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Gets the ResultState provided by this exception + + + + + Asserts on Files + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file exists. If it does not exist + an is thrown. + + The path to a file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + A file containing the actual value + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that the file does not exist. If it does exist + an is thrown. + + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. Anything set through + this class applies to the entire test run. It should not normally + be used from within a test, since it is not thread-safe. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + The IApplyToContext interface is implemented by attributes + that want to make changes to the execution context before + a test is run. + + + + + Apply changes to the execution context + + The execution context + + + + The IApplyToTest interface is implemented by self-applying + attributes that modify the state of a test in some way. + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + ICommandWrapper is implemented by attributes and other + objects able to wrap a TestCommand with another command. + + + Attributes or other objects should implement one of the + derived interfaces, rather than this one, since they + indicate in which part of the command chain the wrapper + should be applied. + + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + Objects implementing this interface are used to wrap + the TestMethodCommand itself. They apply after SetUp + has been run and before TearDown. + + + + + Objects implementing this interface are used to wrap + the entire test, including SetUp and TearDown. + + + + + Any ITest that implements this interface is at a level that the implementing + class should be disposed at the end of the test run + + + + + The IFixtureBuilder interface is exposed by a class that knows how to + build a TestFixture from one or more Types. In general, it is exposed + by an attribute, but may be implemented in a helper class used by the + attribute in some cases. + + + + + Build one or more TestFixtures from type provided. At least one + non-null TestSuite must always be returned, since the method is + generally called because the user has marked the target class as + a fixture. If something prevents the fixture from being used, it + will be returned nonetheless, labelled as non-runnable. + + The type info of the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + IImplyFixture is an empty marker interface used by attributes like + TestAttribute that cause the class where they are used to be treated + as a TestFixture even without a TestFixtureAttribute. + + Marker interfaces are not usually considered a good practice, but + we use it here to avoid cluttering the attribute hierarchy with + classes that don't contain any extra implementation. + + + + + The IMethodInfo class is used to encapsulate information + about a method in a platform-independent manner. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IParameterDataSource interface is implemented by types + that can provide data for a test method parameter. + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + An enumeration containing individual data items + + + + The IParameterInfo interface is an abstraction of a .NET parameter. + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter + + + + + Gets the underlying .NET ParameterInfo + + + + + Gets the Type of the parameter + + + + + A PropertyBag represents a collection of name/value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + The entries in a PropertyBag are of two kinds: those that + take a single value and those that take multiple _values. + However, the PropertyBag has no knowledge of which entries + fall into each category and the distinction is entirely + up to the code using the PropertyBag. + + When working with multi-valued properties, client code + should use the Add method to add name/value pairs and + indexing to retrieve a list of all _values for a given + key. For example: + + bag.Add("Tag", "one"); + bag.Add("Tag", "two"); + Assert.That(bag["Tag"], + Is.EqualTo(new string[] { "one", "two" })); + + When working with single-valued propeties, client code + should use the Set method to set the value and Get to + retrieve the value. The GetSetting methods may also be + used to retrieve the value in a type-safe manner while + also providing default. For example: + + bag.Set("Priority", "low"); + bag.Set("Priority", "high"); // replaces value + Assert.That(bag.Get("Priority"), + Is.EqualTo("high")); + Assert.That(bag.GetSetting("Priority", "low"), + Is.EqualTo("high")); + + + + + Adds a key/value pair to the property bag + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + True if their are _values present, otherwise false + + + + Gets or sets the list of _values for a particular key + + The key for which the _values are to be retrieved or set + + + + Gets a collection containing all the keys in the property set + + + + + The IReflectionInfo interface is implemented by NUnit wrapper objects that perform reflection. + + + + + Returns an array of custom attributes of the specified type applied to this object + + + + + Returns a value indicating whether an attribute of the specified type is defined on this object. + + + + + The ISimpleTestBuilder interface is exposed by a class that knows how to + build a single TestMethod from a suitable MethodInfo Types. In general, + it is exposed by an attribute, but may be implemented in a helper class + used by the attribute in some cases. + + + + + Build a TestMethod from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the id of the test + + + + + Gets the name of the test + + + + + Gets the fully qualified name of the test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the Type of the test fixture, if applicable, or + null if no fixture type is associated with this test. + + + + + Gets an IMethod for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the RunState of the test, indicating whether it can be run. + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Gets the properties of the test + + + + + Gets the parent test, if any. + + The parent test or null if none exists. + + + + Returns true if this is a test suite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets a fixture object for running this test. + + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + This interface is not the same as the ITestCaseBuilder interface in NUnit 2.x. + We have reused the name because the two products don't interoperate at all. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + + + + Gets the expected result of the test case + + + + + Returns true if an expected result has been set + + + + + The ITestData interface is implemented by a class that + represents a single instance of a parameterized test. + + + + + Gets the name to be used for the test + + + + + Gets the RunState for this test case. + + + + + Gets the argument list to be provided to the test + + + + + Gets the property dictionary for the test case + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + The ITestCaseData interface is implemented by a class + that is able to return the data required to create an + instance of a parameterized test fixture. + + + + + Get the TypeArgs if separately set + + + + + The ITestListener interface is used internally to receive + notifications of significant events while a test is being + run. The events are propagated to clients by means of an + AsyncCallback. NUnit extensions may also monitor these events. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished + + The result of the test + + + + The ITestBuilder interface is exposed by a class that knows how to + build one or more TestMethods from a MethodInfo. In general, it is exposed + by an attribute, which has additional information available to provide + the necessary test parameters to distinguish the test cases built. + + + + + Build one or more TestMethods from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ITestResult interface represents the result of a test. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. Not available in + the Compact Framework 1.0. + + + + + Gets the number of asserts executed + when running the test and all its children. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Accessing HasChildren should not force creation of the + Children collection in classes implementing this interface. + + + + + Gets the the collection of child results. + + + + + Gets the Test to which this result applies. + + + + + Gets any text output written to this result. + + + + + The ITypeInfo interface is an abstraction of a .NET Type + + + + + Gets the underlying Type on which this ITypeInfo is based + + + + + Gets the base type of this type as an ITypeInfo + + + + + Returns true if the Type wrapped is equal to the argument + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the Namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type is a static class. + + + + + Get the display name for this typeInfo. + + + + + Get the display name for an oject of this type, constructed with specific arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a value indicating whether this type has a method with a specified public attribute + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + An object implementing IXmlNodeBuilder is able to build + an XML representation of itself and any children. + + + + + Returns a TNode representing the current object. + + If true, children are included where applicable + A TNode representing the result + + + + Returns a TNode representing the current object after + adding it as a child of the supplied parent node. + + The parent node. + If true, children are included, where applicable + + + + + The ResultState class represents the outcome of running a test. + It contains two pieces of information. The Status of the test + is an enum indicating whether the test passed, failed, was + skipped or was inconclusive. The Label provides a more + detailed breakdown for use by client runners. + + + + + Initializes a new instance of the class. + + The TestStatus. + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + + + + Initializes a new instance of the class. + + The TestStatus. + The stage at which the result was produced + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + The stage at which the result was produced + + + + The result is inconclusive + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test was skipped because it is explicit + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The test was not runnable. + + + + + A suite failed because one or more child tests failed or had errors + + + + + A suite failed in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeDown + + + + + Gets the TestStatus for the test. + + The status. + + + + Gets the label under which this test result is + categorized, if any. + + + + + Gets the stage of test execution in which + the failure or other result took place. + + + + + Get a new ResultState, which is the same as the current + one but with the FailureSite set to the specified value. + + The FailureSite to use + A new ResultState + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occurred. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test can be executed. + + + + + The test is not runnable. + + + + + The test is runnable. + + + + + The test can only be run explicitly + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + TNode represents a single node in the XML representation + of a Test or TestResult. It replaces System.Xml.XmlNode and + System.Xml.Linq.XElement, providing a minimal set of methods + for operating on the XML in a platform-independent manner. + + + + + Constructs a new instance of TNode + + The name of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + Flag indicating whether to use CDATA when writing the text + + + + Gets the name of the node + + + + + Gets the value of the node + + + + + Gets a flag indicating whether the value should be output using CDATA. + + + + + Gets the dictionary of attributes + + + + + Gets a list of child nodes + + + + + Gets the first ChildNode + + + + + Gets the XML representation of this node. + + + + + Create a TNode from it's XML text representation + + The XML text to be parsed + A TNode + + + + Adds a new element as a child of the current node and returns it. + + The element name. + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + + The element name + The text content of the new element + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + The value will be output using a CDATA section. + + The element name + The text content of the new element + The newly created child element + + + + Adds an attribute with a specified name and value to the XmlNode. + + The name of the attribute. + The value of the attribute. + + + + Finds a single descendant of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + + + Finds all descendants of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + Writes the XML representation of the node to an XmlWriter + + + + + + Class used to represent a list of XmlResults + + + + + Class used to represent the attributes of a node + + + + + Gets or sets the value associated with the specified key. + Overridden to return null if attribute is not found. + + The key. + Value of the attribute or null + + + + CombiningStrategy is the abstract base for classes that + know how to combine values provided for individual test + parameters to create a set of test cases. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is a subpath of the expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + inclusively within a specified range. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the _values of a property + + The collection of property _values + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It is derived from TestCaseParameters and adds a + fluent syntax for use in initializing the test case. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Marks the test case as explicit. + + + + + Marks the test case as explicit, specifying the reason. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Provide the context information of the current test. + This is an adapter for the internal ExecutionContext + class, hiding the internals from the user test. + + + + + Construct a TestContext for an ExecutionContext + + The ExecutionContext to adapt + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TextWriter that will send output to the current test result. + + + + + Get a representation of the current test. + + + + + Gets a Representation of the TestResult for the current test. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputting files created + by this test run. + + + + + Gets the random generator. + + + The random generator. + + + + Write the string representation of a boolean value to the current result + + + Write a char to the current result + + + Write a char array to the current result + + + Write the string representation of a double to the current result + + + Write the string representation of an Int32 value to the current result + + + Write the string representation of an Int64 value to the current result + + + Write the string representation of a decimal value to the current result + + + Write the string representation of an object to the current result + + + Write the string representation of a Single value to the current result + + + Write a string to the current result + + + Write the string representation of a UInt32 value to the current result + + + Write the string representation of a UInt64 value to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a line terminator to the current result + + + Write the string representation of a boolean value to the current result followed by a line terminator + + + Write a char to the current result followed by a line terminator + + + Write a char array to the current result followed by a line terminator + + + Write the string representation of a double to the current result followed by a line terminator + + + Write the string representation of an Int32 value to the current result followed by a line terminator + + + Write the string representation of an Int64 value to the current result followed by a line terminator + + + Write the string representation of a decimal value to the current result followed by a line terminator + + + Write the string representation of an object to the current result followed by a line terminator + + + Write the string representation of a Single value to the current result followed by a line terminator + + + Write a string to the current result followed by a line terminator + + + Write the string representation of a UInt32 value to the current result followed by a line terminator + + + Write the string representation of a UInt64 value to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + + This method adds the a new ValueFormatterFactory to the + chain of responsibility used for fomatting values in messages. + The scope of the change is the current TestContext. + + The factory delegate + + + + This method provides a simplified way to add a ValueFormatter + delegate to the chain of responsibility, creating the factory + delegate internally. It is useful when the Type of the object + is the only criterion for selection of the formatter, since + it can be used without getting involved with a compould function. + + The type supported by this formatter + The ValueFormatter delegate + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Construct a TestAdapter for a Test + + The Test to be adapted + + + + Gets the unique Id of a test + + + + + The name of the test, which may or may not be + the same as the method name. + + + + + The name of the method representing the test. + + + + + The FullName of the test + + + + + The ClassName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a TestResult + + The TestResult to be adapted + + + + Gets a ResultState representing the outcome of the test. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestFixtureData class represents a set of arguments + and other parameter info to be used for a parameterized + fixture. It is derived from TestFixtureParameters and adds a + fluent syntax for use in initializing the fixture. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Marks the test fixture as explicit. + + + + + Marks the test fixture as explicit, specifying the reason. + + + + + Ignores this TestFixture, specifying the reason. + + The reason. + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected ArgumentException + + + + + Creates a constraint specifying an expected ArgumentNUllException + + + + + Creates a constraint specifying an expected InvalidOperationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Env is a static class that provides some of the features of + System.Environment that are not available under all runtimes + + + + + The newline sequence in the current environment. + + + + + Path to the 'My Documents' folder + + + + + Directory used for file output if not specified on commandline. + + + + + PackageSettings is a static class containing constant values that + are used as keys in setting up a TestPackage. These values are used in + the engine and framework. Setting values may be a string, int or bool. + + + + + Flag (bool) indicating whether tests are being debugged. + + + + + Flag (bool) indicating whether to pause execution of tests to allow + the user to attache a debugger. + + + + + The InternalTraceLevel for this run. Values are: "Default", + "Off", "Error", "Warning", "Info", "Debug", "Verbose". + Default is "Off". "Debug" and "Verbose" are synonyms. + + + + + Full path of the directory to be used for work and result files. + This path is provided to tests by the frameowrk TestContext. + + + + + The name of the config to use in loading a project. + If not specified, the first config found is used. + + + + + Bool indicating whether the engine should determine the private + bin path by examining the paths to all the tests. Defaults to + true unless PrivateBinPath is specified. + + + + + The ApplicationBase to use in loading the tests. If not + specified, and each assembly has its own process, then the + location of the assembly is used. For multiple assemblies + in a single process, the closest common root directory is used. + + + + + Path to the config file to use in running the tests. + + + + + Bool flag indicating whether a debugger should be launched at agent + startup. Used only for debugging NUnit itself. + + + + + Indicates how to load tests across AppDomains. Values are: + "Default", "None", "Single", "Multiple". Default is "Multiple" + if more than one assembly is loaded in a process. Otherwise, + it is "Single". + + + + + The private binpath used to locate assemblies. Directory paths + is separated by a semicolon. It's an error to specify this and + also set AutoBinPath to true. + + + + + The maximum number of test agents permitted to run simultneously. + Ignored if the ProcessModel is not set or defaulted to Multiple. + + + + + Indicates how to allocate assemblies to processes. Values are: + "Default", "Single", "Separate", "Multiple". Default is "Multiple" + for more than one assembly, "Separate" for a single assembly. + + + + + Indicates the desired runtime to use for the tests. Values + are strings like "net-4.5", "mono-4.0", etc. Default is to + use the target framework for which an assembly was built. + + + + + Bool flag indicating that the test should be run in a 32-bit process + on a 64-bit system. By default, NUNit runs in a 64-bit process on + a 64-bit system. Ignored if set on a 32-bit system. + + + + + Indicates that test runners should be disposed after the tests are executed + + + + + Bool flag indicating that the test assemblies should be shadow copied. + Defaults to false. + + + + + Integer value in milliseconds for the default timeout value + for test cases. If not specified, there is no timeout except + as specified by attributes on the tests themselves. + + + + + A TextWriter to which the internal trace will be sent. + + + + + A list of tests to be loaded. + + + + + The number of test threads to run for the assembly. If set to + 1, a single queue is used. If set to 0, tests are executed + directly, without queuing. + + + + + The random seed to be used for this assembly. If specified + as the value reported from a prior run, the framework should + generate identical random values for tests as were used for + that run, provided that no change has been made to the test + assembly. Default is a random value itself. + + + + + If true, execution stops after the first error or failure. + + + + + If true, use of the event queue is suppressed and test events are synchronous. + + + + + If the package represents an assembly, then this is the CLR version + stored in the assembly image. If it represents a project or other + group of assemblies, it is the maximum version for all the assemblies. + + + + + True if any assembly in the package requires running as a 32-bit + process when on a 64-bit system. + + + + + True if any assembly in the package requires a special assembly resolution hook + in the default AppDomain in order to find dependent assemblies. + + + + + The FrameworkName specified on a TargetFrameworkAttribute for the assembly + + + + diff --git a/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.dll b/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.dll new file mode 100644 index 00000000..682227ca Binary files /dev/null and b/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.dll differ diff --git a/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.xml b/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.xml new file mode 100644 index 00000000..acd4bd7c --- /dev/null +++ b/packages/NUnit.3.2.0/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.xml @@ -0,0 +1,15715 @@ + + + + nunit.framework + + + + + AssemblyHelper provides static methods for working + with assemblies. + + + + + Gets the path from which the assembly defining a type was loaded. + + The Type. + The path. + + + + Gets the path from which an assembly was loaded. + For builds where this is not possible, returns + the name of the assembly. + + The assembly. + The path. + + + + Gets the AssemblyName of an assembly. + + The assembly + An AssemblyName + + + + Loads an assembly given a string, which is the AssemblyName + + + + + + + Interface for logging within the engine + + + + + Logs the specified message at the error level. + + The message. + + + + Logs the specified message at the error level. + + The message. + The arguments. + + + + Logs the specified message at the warning level. + + The message. + + + + Logs the specified message at the warning level. + + The message. + The arguments. + + + + Logs the specified message at the info level. + + The message. + + + + Logs the specified message at the info level. + + The message. + The arguments. + + + + Logs the specified message at the debug level. + + The message. + + + + Logs the specified message at the debug level. + + The message. + The arguments. + + + + InternalTrace provides facilities for tracing the execution + of the NUnit framework. Tests and classes under test may make use + of Console writes, System.Diagnostics.Trace or various loggers and + NUnit itself traps and processes each of them. For that reason, a + separate internal trace is needed. + + Note: + InternalTrace uses a global lock to allow multiple threads to write + trace messages. This can easily make it a bottleneck so it must be + used sparingly. Keep the trace Level as low as possible and only + insert InternalTrace writes where they are needed. + TODO: add some buffering and a separate writer thread as an option. + TODO: figure out a way to turn on trace in specific classes only. + + + + + Gets a flag indicating whether the InternalTrace is initialized + + + + + Initialize the internal trace using a provided TextWriter and level + + A TextWriter + The InternalTraceLevel + + + + Get a named Logger + + + + + + Get a logger named for a particular Type. + + + + + InternalTraceLevel is an enumeration controlling the + level of detailed presented in the internal log. + + + + + Use the default settings as specified by the user. + + + + + Do not display any trace messages + + + + + Display Error messages only + + + + + Display Warning level and higher messages + + + + + Display informational and higher messages + + + + + Display debug messages and higher - i.e. all messages + + + + + Display debug messages and higher - i.e. all messages + + + + + A trace listener that writes to a separate file per domain + and process using it. + + + + + Construct an InternalTraceWriter that writes to a + TextWriter provided by the caller. + + + + + + Returns the character encoding in which the output is written. + + The character encoding in which the output is written. + + + + Writes a character to the text string or stream. + + The character to write to the text stream. + + + + Writes a string to the text string or stream. + + The string to write. + + + + Writes a string followed by a line terminator to the text string or stream. + + The string to write. If is null, only the line terminator is written. + + + + Releases the unmanaged resources used by the and optionally releases the managed resources. + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. + + + + + Provides internal logging to the NUnit framework + + + + + Initializes a new instance of the class. + + The name. + The log level. + The writer where logs are sent. + + + + Logs the message at error level. + + The message. + + + + Logs the message at error level. + + The message. + The message arguments. + + + + Logs the message at warm level. + + The message. + + + + Logs the message at warning level. + + The message. + The message arguments. + + + + Logs the message at info level. + + The message. + + + + Logs the message at info level. + + The message. + The message arguments. + + + + Logs the message at debug level. + + The message. + + + + Logs the message at debug level. + + The message. + The message arguments. + + + + Waits for pending asynchronous operations to complete, if appropriate, + and returns a proper result of the invocation by unwrapping task results + + The raw result of the method invocation + The unwrapped result, if necessary + + + + CombinatorialStrategy creates test cases by using all possible + combinations of the parameter data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + Provides data from fields marked with the DatapointAttribute or the + DatapointsAttribute. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + Built-in SuiteBuilder for all types of test classes. + + + + + Checks to see if the provided Type is a fixture. + To be considered a fixture, it must be a non-abstract + class with one or more attributes implementing the + IFixtureBuilder interface or one or more methods + marked as tests. + + The fixture type to check + True if the fixture can be built, false if not + + + + Build a TestSuite from TypeInfo provided. + + The fixture type to build + A TestSuite built from that type + + + + We look for attributes implementing IFixtureBuilder at one level + of inheritance at a time. Attributes on base classes are not used + unless there are no fixture builder attributes at all on the derived + class. This is by design. + + The type being examined for attributes + A list of the attributes found. + + + + Class to build ether a parameterized or a normal NUnitTestMethod. + There are four cases that the builder must deal with: + 1. The method needs no params and none are provided + 2. The method needs params and they are provided + 3. The method needs no params but they are provided in error + 4. The method needs params but they are not provided + This could have been done using two different builders, but it + turned out to be simpler to have just one. The BuildFrom method + takes a different branch depending on whether any parameters are + provided, but all four cases are dealt with in lower-level methods + + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + A Test representing one or more method invocations + + + + Determines if the method can be used to build an NUnit test + test method of some kind. The method must normally be marked + with an identifying attribute for this to be true. + + Note that this method does not check that the signature + of the method for validity. If we did that here, any + test methods with invalid signatures would be passed + over in silence in the test run. Since we want such + methods to be reported, the check for validity is made + in BuildFrom rather than here. + + An IMethodInfo for the method being used as a test method + The test suite being built, to which the new test would be added + True if the builder can create a test case from this method + + + + Build a Test from the provided MethodInfo. Depending on + whether the method takes arguments and on the availability + of test case data, this method may return a single test + or a group of tests contained in a ParameterizedMethodSuite. + + The method for which a test is to be built + The test fixture being populated, or null + A Test representing one or more method invocations + + + + Builds a ParameterizedMethodSuite containing individual test cases. + + The method for which a test is to be built. + The list of test cases to include. + A ParameterizedMethodSuite populated with test cases + + + + Build a simple, non-parameterized TestMethod for this method. + + The MethodInfo for which a test is to be built + The test suite for which the method is being built + A TestMethod. + + + + Class that can build a tree of automatic namespace + suites from a group of fixtures. + + + + + NamespaceDictionary of all test suites we have created to represent + namespaces. Used to locate namespace parent suites for fixtures. + + + + + The root of the test suite being created by this builder. + + + + + Initializes a new instance of the class. + + The root suite. + + + + Gets the root entry in the tree created by the NamespaceTreeBuilder. + + The root suite. + + + + Adds the specified fixtures to the tree. + + The fixtures to be added. + + + + Adds the specified fixture to the tree. + + The fixture to be added. + + + + NUnitTestCaseBuilder is a utility class used by attributes + that build test cases. + + + + + Constructs an + + + + + Builds a single NUnitTestMethod, either as a child of the fixture + or as one of a set of test cases under a ParameterizedTestMethodSuite. + + The MethodInfo from which to construct the TestMethod + The suite or fixture to which the new test will be added + The ParameterSet to be used, or null + + + + + Helper method that checks the signature of a TestMethod and + any supplied parameters to determine if the test is valid. + + Currently, NUnitTestMethods are required to be public, + non-abstract methods, either static or instance, + returning void. They may take arguments but the _values must + be provided or the TestMethod is not considered runnable. + + Methods not meeting these criteria will be marked as + non-runnable and the method will return false in that case. + + The TestMethod to be checked. If it + is found to be non-runnable, it will be modified. + Parameters to be used for this test, or null + True if the method signature is valid, false if not + + The return value is no longer used internally, but is retained + for testing purposes. + + + + + NUnitTestFixtureBuilder is able to build a fixture given + a class marked with a TestFixtureAttribute or an unmarked + class containing test methods. In the first case, it is + called by the attribute and in the second directly by + NUnitSuiteBuilder. + + + + + Build a TestFixture from type provided. A non-null TestSuite + must always be returned, since the method is generally called + because the user has marked the target class as a fixture. + If something prevents the fixture from being used, it should + be returned nonetheless, labelled as non-runnable. + + An ITypeInfo for the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + Overload of BuildFrom called by tests that have arguments. + Builds a fixture using the provided type and information + in the ITestFixtureData object. + + The TypeInfo for which to construct a fixture. + An object implementing ITestFixtureData or null. + + + + + Method to add test cases to the newly constructed fixture. + + The fixture to which cases should be added + + + + Method to create a test case from a MethodInfo and add + it to the fixture being built. It first checks to see if + any global TestCaseBuilder addin wants to build the + test case. If not, it uses the internal builder + collection maintained by this fixture builder. + + The default implementation has no test case builders. + Derived classes should add builders to the collection + in their constructor. + + The method for which a test is to be created + The test suite being built. + A newly constructed Test + + + + PairwiseStrategy creates test cases by combining the parameter + data so that all possible pairs of data items are used. + + + + The number of test cases that cover all possible pairs of test function + parameters values is significantly less than the number of test cases + that cover all possible combination of test function parameters values. + And because different studies show that most of software failures are + caused by combination of no more than two parameters, pairwise testing + can be an effective ways to test the system when it's impossible to test + all combinations of parameters. + + + The PairwiseStrategy code is based on "jenny" tool by Bob Jenkins: + http://burtleburtle.net/bob/math/jenny.html + + + + + + FleaRand is a pseudo-random number generator developed by Bob Jenkins: + http://burtleburtle.net/bob/rand/talksmall.html#flea + + + + + Initializes a new instance of the FleaRand class. + + The seed. + + + + FeatureInfo represents coverage of a single value of test function + parameter, represented as a pair of indices, Dimension and Feature. In + terms of unit testing, Dimension is the index of the test parameter and + Feature is the index of the supplied value in that parameter's list of + sources. + + + + + Initializes a new instance of FeatureInfo class. + + Index of a dimension. + Index of a feature. + + + + A FeatureTuple represents a combination of features, one per test + parameter, which should be covered by a test case. In the + PairwiseStrategy, we are only trying to cover pairs of features, so the + tuples actually may contain only single feature or pair of features, but + the algorithm itself works with triplets, quadruples and so on. + + + + + Initializes a new instance of FeatureTuple class for a single feature. + + Single feature. + + + + Initializes a new instance of FeatureTuple class for a pair of features. + + First feature. + Second feature. + + + + TestCase represents a single test case covering a list of features. + + + + + Initializes a new instance of TestCaseInfo class. + + A number of features in the test case. + + + + PairwiseTestCaseGenerator class implements an algorithm which generates + a set of test cases which covers all pairs of possible values of test + function. + + + + The algorithm starts with creating a set of all feature tuples which we + will try to cover (see method). This set + includes every single feature and all possible pairs of features. We + store feature tuples in the 3-D collection (where axes are "dimension", + "feature", and "all combinations which includes this feature"), and for + every two feature (e.g. "A" and "B") we generate both ("A", "B") and + ("B", "A") pairs. This data structure extremely reduces the amount of + time needed to calculate coverage for a single test case (this + calculation is the most time-consuming part of the algorithm). + + + Then the algorithm picks one tuple from the uncovered tuple, creates a + test case that covers this tuple, and then removes this tuple and all + other tuples covered by this test case from the collection of uncovered + tuples. + + + Picking a tuple to cover + + + There are no any special rules defined for picking tuples to cover. We + just pick them one by one, in the order they were generated. + + + Test generation + + + Test generation starts from creating a completely random test case which + covers, nevertheless, previously selected tuple. Then the algorithm + tries to maximize number of tuples which this test covers. + + + Test generation and maximization process repeats seven times for every + selected tuple and then the algorithm picks the best test case ("seven" + is a magic number which provides good results in acceptable time). + + Maximizing test coverage + + To maximize tests coverage, the algorithm walks thru the list of mutable + dimensions (mutable dimension is a dimension that are not included in + the previously selected tuple). Then for every dimension, the algorithm + walks thru the list of features and checks if this feature provides + better coverage than randomly selected feature, and if yes keeps this + feature. + + + This process repeats while it shows progress. If the last iteration + doesn't improve coverage, the process ends. + + + In addition, for better results, before start every iteration, the + algorithm "scrambles" dimensions - so for every iteration dimension + probes in a different order. + + + + + + Creates a set of test cases for specified dimensions. + + + An array which contains information about dimensions. Each element of + this array represents a number of features in the specific dimension. + + + A set of test cases. + + + + + Gets the test cases generated by this strategy instance. + + A set of test cases. + + + + The ParameterDataProvider class implements IParameterDataProvider + and hosts one or more individual providers. + + + + + Construct with a collection of individual providers + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + ParameterDataSourceProvider supplies individual argument _values for + single parameters using attributes implementing IParameterDataSource. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + + True if any data is available, otherwise false. + + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + + An IEnumerable providing the required data + + + + + SequentialStrategy creates test cases by using all of the + parameter data sources in parallel, substituting null + when any of them run out of data. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ContextSettingsCommand applies specified changes to the + TestExecutionContext prior to running a test. No special + action is needed after the test runs, since the prior + context will be restored automatically. + + + + + The CommandStage enumeration represents the defined stages + of execution for a series of TestCommands. The int _values + of the enum are used to apply decorators in the proper + order. Lower _values are applied first and are therefore + "closer" to the actual test execution. + + + No CommandStage is defined for actual invocation of the test or + for creation of the context. Execution may be imagined as + proceeding from the bottom of the list upwards, with cleanup + after the test running in the opposite order. + + + + + Use an application-defined default value. + + + + + Make adjustments needed before and after running + the raw test - that is, after any SetUp has run + and before TearDown. + + + + + Run SetUp and TearDown for the test. This stage is used + internally by NUnit and should not normally appear + in user-defined decorators. + + + + + Make adjustments needed before and after running + the entire test - including SetUp and TearDown. + + + + + TODO: Documentation needed for class + + + + TODO: Documentation needed for field + + + + TODO: Documentation needed for constructor + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The inner command. + The max time allowed in milliseconds + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext + + The context in which the test should run. + A TestResult + + + + OneTimeSetUpCommand runs any one-time setup methods for a suite, + constructing the user test object if necessary. + + + + + Constructs a OneTimeSetUpCommand for a suite + + The suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run after Setup + + + + Overridden to run the one-time setup for a suite. + + The TestExecutionContext to be used. + A TestResult + + + + OneTimeTearDownCommand performs any teardown actions + specified for a suite and calls Dispose on the user + test object, if any. + + + + + Construct a OneTimeTearDownCommand + + The test suite to which the command applies + A SetUpTearDownList for use by the command + A List of TestActionItems to be run before teardown. + + + + Overridden to run the teardown methods specified on the test. + + The TestExecutionContext to be used. + A TestResult + + + + SetUpTearDownCommand runs any SetUp methods for a suite, + runs the test and then runs any TearDown methods. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + SetUpTearDownItem holds the setup and teardown methods + for a single level of the inheritance hierarchy. + + + + + Construct a SetUpTearDownNode + + A list of setup methods for this level + A list teardown methods for this level + + + + Returns true if this level has any methods at all. + This flag is used to discard levels that do nothing. + + + + + Run SetUp on this level. + + The execution context to use for running. + + + + Run TearDown for this level. + + + + + + TODO: Documentation needed for class + + + + + Initializes a new instance of the class. + + The test being skipped. + + + + Overridden to simply set the CurrentResult to the + appropriate Skipped state. + + The execution context for the test + A TestResult + + + + TestActionCommand runs the BeforeTest actions for a test, + then runs the test and finally runs the AfterTestActions. + + + + + Initializes a new instance of the class. + + The inner command. + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + TestActionItem represents a single execution of an + ITestAction. It is used to track whether the BeforeTest + method has been called and suppress calling the + AfterTest method if it has not. + + + + + Construct a TestActionItem + + The ITestAction to be included + + + + Run the BeforeTest method of the action and remember that it has been run. + + The test to which the action applies + + + + Run the AfterTest action, but only if the BeforeTest + action was actually run. + + The test to which the action applies + + + + TestCommand is the abstract base class for all test commands + in the framework. A TestCommand represents a single stage in + the execution of a test, e.g.: SetUp/TearDown, checking for + Timeout, verifying the returned result from a method, etc. + + TestCommands may decorate other test commands so that the + execution of a lower-level command is nested within that + of a higher level command. All nested commands are executed + synchronously, as a single unit. Scheduling test execution + on separate threads is handled at a higher level, using the + task dispatcher. + + + + + Construct a TestCommand for a test. + + The test to be executed + + + + Gets the test associated with this command. + + + + + Runs the test in a specified context, returning a TestResult. + + The TestExecutionContext to be used for running the test. + A TestResult + + + + TestMethodCommand is the lowest level concrete command + used to run actual test cases. + + + + + Initializes a new instance of the class. + + The test. + + + + Runs the test, saving a TestResult in the execution context, as + well as returning it. If the test has an expected result, it + is asserts on that value. Since failed tests and errors throw + an exception, this command must be wrapped in an outer command, + will handle that exception and records the failure. This role + is usually played by the SetUpTearDown command. + + The execution context + + + + TheoryResultCommand adjusts the result of a Theory so that + it fails if all the results were inconclusive. + + + + + Constructs a TheoryResultCommand + + The command to be wrapped by this one + + + + Overridden to call the inner command and adjust the result + in case all chlid results were inconclusive. + + + + + + + CultureDetector is a helper class used by NUnit to determine + whether a test should be run based on the current culture. + + + + + Default constructor uses the current culture. + + + + + Construct a CultureDetector for a particular culture for testing. + + The culture to be used + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + Tests to determine if the current culture is supported + based on a culture attribute. + + The attribute to examine + + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Return the last failure reason. Results are not + defined if called before IsSupported( Attribute ) + is called. + + + + + ExceptionHelper provides static methods for working with exceptions + + + + + Rethrows an exception, preserving its stack trace + + The exception to rethrow + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined message string. + + + + Builds up a message, using the Message field of the specified exception + as well as any InnerExceptions. + + The exception. + A combined stack trace. + + + + Gets the stack trace of the exception. + + The exception. + A string representation of the stack trace. + + + + A utility class to create TestCommands + + + + + Gets the command to be executed before any of + the child tests are run. + + A TestCommand + + + + Gets the command to be executed after all of the + child tests are run. + + A TestCommand + + + + Creates a test command for use in running this test. + + + + + + Creates a command for skipping a test. The result returned will + depend on the test RunState. + + + + + Builds the set up tear down list. + + Type of the fixture. + Type of the set up attribute. + Type of the tear down attribute. + A list of SetUpTearDownItems + + + + A CompositeWorkItem represents a test suite and + encapsulates the execution of the suite as well + as all its child tests. + + + + + List of Child WorkItems + + + + + A count of how many tests in the work item have a value for the Order Property + + + + + Construct a CompositeWorkItem for executing a test suite + using a filter to select child tests. + + The TestSuite to be executed + A filter used to select child tests + + + + Method that actually performs the work. Overridden + in CompositeWorkItem to do setup, run all child + items and then do teardown. + + + + + Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + + + A signed integer that indicates the relative values of and , as shown in the following table.Value Meaning Less than zero is less than .Zero equals .Greater than zero is greater than . + + The first object to compare.The second object to compare. + + + + Sorts tests under this suite. + + + + + Cancel (abort or stop) a CompositeWorkItem and all of its children + + true if the CompositeWorkItem and all of its children should be aborted, false if it should allow all currently running tests to complete + + + + A simplified implementation of .NET 4 CountdownEvent + for use in earlier versions of .NET. Only the methods + used by NUnit are implemented. + + + + + Construct a CountdownEvent + + The initial count + + + + Gets the initial count established for the CountdownEvent + + + + + Gets the current count remaining for the CountdownEvent + + + + + Decrement the count by one + + + + + Block the thread until the count reaches zero + + + + + An IWorkItemDispatcher handles execution of work items. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and used when stopping the run. + + The item to dispatch + + + + Cancel the ongoing run completely. + If no run is in process, the call has no effect. + + true if the IWorkItemDispatcher should abort all currently running WorkItems, false if it should allow all currently running WorkItems to complete + + + + A SimpleWorkItem represents a single test case and is + marked as completed immediately upon execution. This + class is also used for skipped or ignored test suites. + + + + + Construct a simple work item for a test. + + The test to be executed + The filter used to select this test + + + + Method that performs actually performs the work. + + + + + SimpleWorkItemDispatcher handles execution of WorkItems by + directly executing them. It is provided so that a dispatcher + is always available in the context, thereby simplifying the + code needed to run child tests. + + + + + Dispatch a single work item for execution. The first + work item dispatched is saved as the top-level + work item and a thread is created on which to + run it. Subsequent calls come from the top level + item or its descendants on the proper thread. + + The item to dispatch + + + + Cancel (abort or stop) the ongoing run. + If no run is in process, the call has no effect. + + true if the run should be aborted, false if it should allow its currently running test to complete + + + + A WorkItem may be an individual test case, a fixture or + a higher level grouping of tests. All WorkItems inherit + from the abstract WorkItem class, which uses the template + pattern to allow derived classes to perform work in + whatever way is needed. + + A WorkItem is created with a particular TestExecutionContext + and is responsible for re-establishing that context in the + current thread before it begins or resumes execution. + + + + + Creates a work item. + + The test for which this WorkItem is being created. + The filter to be used in selecting any child Tests. + + + + + Construct a WorkItem for a particular test. + + The test that the WorkItem will run + + + + Initialize the TestExecutionContext. This must be done + before executing the WorkItem. + + + Originally, the context was provided in the constructor + but delaying initialization of the context until the item + is about to be dispatched allows changes in the parent + context during OneTimeSetUp to be reflected in the child. + + The TestExecutionContext to use + + + + Event triggered when the item is complete + + + + + Gets the current state of the WorkItem + + + + + The test being executed by the work item + + + + + The execution context + + + + + The test actions to be performed before and after this test + + + + + The test result + + + + + Execute the current work item, including any + child work items. + + + + + Cancel (abort or stop) a WorkItem + + true if the WorkItem should be aborted, false if it should run to completion + + + + Method that performs actually performs the work. It should + set the State to WorkItemState.Complete when done. + + + + + Method called by the derived class when all work is complete + + + + + The current state of a work item + + + + + Ready to run or continue + + + + + Work Item is executing + + + + + Complete + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Gets or sets the maximum line length for this writer + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a given + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The result of the constraint that failed + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The ConstraintResult for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + Gets the element name + + Element name + + + + ClassName filter selects tests based on the class FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + A base class for multi-part filters + + + + + Constructs an empty CompositeFilter + + + + + Constructs a CompositeFilter from an array of filters + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return a list of the composing filters. + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a FullNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + IdFilter selects tests based on their id + + + + + Construct an IdFilter for a single value + + The id the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + FullName filter selects tests based on their FullName + + + + + Construct a MethodNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter + + The filter to be negated + + + + Gets the base filter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Gets the element name + + Element name + + + + PropertyFilter is able to select or exclude tests + based on their properties. + + + + + + Construct a PropertyFilter using a property name and expected value + + A property name + The expected value of the property + + + + Check whether the filter matches a test + + The test to be matched + + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + TestName filter selects tests based on their Name + + + + + Construct a TestNameFilter for a single name + + The name the filter will recognize. + + + + Match a test against a single value. + + + + + Gets the element name + + Element name + + + + ValueMatchFilter selects tests based on some value, which + is expected to be contained in the test. + + + + + Returns the value matched by the filter - used for testing + + + + + Indicates whether the value is a regular expression + + + + + Construct a ValueMatchFilter for a single value. + + The value to be included. + + + + Match the input provided by the derived class + + The value to be matchedT + True for a match, false otherwise. + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + Gets the element name + + Element name + + + + GenericMethodHelper is able to deduce the Type arguments for + a generic method from the actual arguments provided. + + + + + Construct a GenericMethodHelper for a method + + MethodInfo for the method to examine + + + + Return the type argments for the method, deducing them + from the arguments actually provided. + + The arguments to the method + An array of type arguments. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + InvalidTestFixtureException is thrown when an appropriate test + fixture constructor using the provided arguments cannot be found. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner. + + + + The MethodWrapper class wraps a MethodInfo so that it may + be used in a platform-independent manner. + + + + + Construct a MethodWrapper for a Type and a MethodInfo. + + + + + Construct a MethodInfo for a given Type and method name. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the spcified type are defined on the method. + + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Thrown when an assertion failed. Here to preserve the inner + exception and hence its stack trace. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + + + + Initializes a new instance of the class. + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + The ParameterWrapper class wraps a ParameterInfo so that it may + be used in a platform-independent manner. + + + + + Construct a ParameterWrapper for a given method and parameter + + + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter. + + + + + Gets the underlying ParameterInfo + + + + + Gets the Type of the parameter + + + + + Returns an array of custom attributes of the specified type applied to this method + + + + + Gets a value indicating whether one or more attributes of the specified type are defined on the parameter. + + + + + A PropertyBag represents a collection of name value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + + + + Adds a key/value pair to the property set + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + + True if their are _values present, otherwise false + + + + + Gets a collection containing all the keys in the property set + + + + + + Gets or sets the list of _values for a particular key + + + + + Returns an XmlNode representating the current PropertyBag. + + Not used + An XmlNode representing the PropertyBag + + + + Returns an XmlNode representing the PropertyBag after + adding it as a child of the supplied parent node. + + The parent node. + Not used + + + + + The PropertyNames class provides static constants for the + standard property ids that NUnit uses on tests. + + + + + The FriendlyName of the AppDomain in which the assembly is running + + + + + The selected strategy for joining parameter data into test cases + + + + + The process ID of the executing assembly + + + + + The stack trace from any data provider that threw + an exception. + + + + + The reason a test was not run + + + + + The author of the tests + + + + + The ApartmentState required for running the test + + + + + The categories applying to a test + + + + + The Description of a test + + + + + The number of threads to be used in running tests + + + + + The maximum time in ms, above which the test is considered to have failed + + + + + The ParallelScope associated with a test + + + + + The number of times the test should be repeated + + + + + Indicates that the test should be run on a separate thread + + + + + The culture to be set for a test + + + + + The UI culture to be set for a test + + + + + The type that is under test + + + + + The timeout value for the test + + + + + The test will be ignored until the given date + + + + + The optional Order the test will run in + + + + + Randomizer returns a set of random _values in a repeatable + way, to allow re-running of tests if necessary. It extends + the .NET Random class, providing random values for a much + wider range of types. + + The class is used internally by the framework to generate + test case data and is also exposed for use by users through + the TestContext.Random property. + + + For consistency with the underlying Random Type, methods + returning a single value use the prefix "Next..." Those + without an argument return a non-negative value up to + the full positive range of the Type. Overloads are provided + for specifying a maximum or a range. Methods that return + arrays or strings use the prefix "Get..." to avoid + confusion with the single-value methods. + + + + + Initial seed used to create randomizers for this run + + + + + Get a Randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same _values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Create a new Randomizer using the next seed + available to ensure that each randomizer gives + a unique sequence of values. + + + + + + Default constructor + + + + + Construct based on seed value + + + + + + Returns a random unsigned int. + + + + + Returns a random unsigned int less than the specified maximum. + + + + + Returns a random unsigned int within a specified range. + + + + + Returns a non-negative random short. + + + + + Returns a non-negative random short less than the specified maximum. + + + + + Returns a non-negative random short within a specified range. + + + + + Returns a random unsigned short. + + + + + Returns a random unsigned short less than the specified maximum. + + + + + Returns a random unsigned short within a specified range. + + + + + Returns a random long. + + + + + Returns a random long less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random ulong. + + + + + Returns a random ulong less than the specified maximum. + + + + + Returns a non-negative random long within a specified range. + + + + + Returns a random Byte + + + + + Returns a random Byte less than the specified maximum. + + + + + Returns a random Byte within a specified range + + + + + Returns a random SByte + + + + + Returns a random sbyte less than the specified maximum. + + + + + Returns a random sbyte within a specified range + + + + + Returns a random bool + + + + + Returns a random bool based on the probablility a true result + + + + + Returns a random double between 0.0 and the specified maximum. + + + + + Returns a random double within a specified range. + + + + + Returns a random float. + + + + + Returns a random float between 0.0 and the specified maximum. + + + + + Returns a random float within a specified range. + + + + + Returns a random enum value of the specified Type as an object. + + + + + Returns a random enum value of the specified Type. + + + + + Default characters for random functions. + + Default characters are the English alphabet (uppercase & lowercase), arabic numerals, and underscore + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + string representing the set of characters from which to construct the resulting string + A random string of arbitrary length + + + + Generate a random string based on the characters from the input string. + + desired length of output string. + A random string of arbitrary length + Uses DefaultStringChars as the input character set + + + + Generate a random string based on the characters from the input string. + + A random string of the default length + Uses DefaultStringChars as the input character set + + + + Returns a random decimal. + + + + + Returns a random decimal between positive zero and the specified maximum. + + + + + Returns a random decimal within a specified range, which is not + permitted to exceed decimal.MaxVal in the current implementation. + + + A limitation of this implementation is that the range from min + to max must not exceed decimal.MaxVal. + + + + + Helper methods for inspecting a type by reflection. + + Many of these methods take ICustomAttributeProvider as an + argument to avoid duplication, even though certain attributes can + only appear on specific types of members, like MethodInfo or Type. + + In the case where a type is being examined for the presence of + an attribute, interface or named member, the Reflect methods + operate with the full name of the member being sought. This + removes the necessity of the caller having a reference to the + assembly that defines the item being sought and allows the + NUnit core to inspect assemblies that reference an older + version of the NUnit framework. + + + + + Examine a fixture type and return an array of methods having a + particular attribute. The array is order with base methods first. + + The type to examine + The attribute Type to look for + Specifies whether to search the fixture type inheritance chain + The array of methods found + + + + Examine a fixture type and return true if it has a method with + a particular attribute. + + The type to examine + The attribute Type to look for + True if found, otherwise false + + + + Invoke the default constructor on a Type + + The Type to be constructed + An instance of the Type + + + + Invoke a constructor on a Type with arguments + + The Type to be constructed + Arguments to the constructor + An instance of the Type + + + + Returns an array of types from an array of objects. + Used because the compact framework doesn't support + Type.GetTypeArray() + + An array of objects + An array of Types + + + + Invoke a parameterless method returning void on an object. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + + + + Invoke a method, converting any TargetInvocationException to an NUnitException. + + A MethodInfo for the method to be invoked + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + Represents the result of running a single test case. + + + + + Construct a TestCaseResult based on a TestMethod + + A TestMethod to which the result applies. + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestResult class represents the result of a test. + + + + + Error message for when child tests have errors + + + + + Error message for when child tests are ignored + + + + + The minimum duration for tests + + + + + List of child results + + + + + Construct a test result given a Test + + The test to be used + + + + Gets the test with which this result is associated. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets or sets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Test HasChildren before accessing Children to avoid + the creation of an empty collection. + + + + + Gets the collection of child results. + + + + + Gets a TextWriter, which will write output to be included in the result. + + + + + Gets any text output written to this result. + + + + + Returns the Xml representation of the result. + + If true, descendant results are included + An XmlNode representing the result + + + + Adds the XML representation of the result as a child of the + supplied parent node.. + + The parent node. + If true, descendant results are included + + + + + Adds a child result to this result, setting this result's + ResultState to Failure if the child result failed. + + The result to be added + + + + Set the result of the test + + The ResultState to use in the result + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + + + + Set the result of the test + + The ResultState to use in the result + A message associated with the result state + Stack trace giving the location of the command + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + + + + Set the test result based on the type of exception thrown + + The exception that was thrown + THe FailureSite to use in the result + + + + RecordTearDownException appends the message and stacktrace + from an exception arising during teardown of the test + to any previously recorded information, so that any + earlier failure information is not lost. Note that + calling Assert.Ignore, Assert.Inconclusive, etc. during + teardown is treated as an error. If the current result + represents a suite, it may show a teardown error even + though all contained tests passed. + + The Exception to be recorded + + + + Adds a reason element to a node and returns it. + + The target node. + The new reason element. + + + + Adds a failure element to a node and returns it. + + The target node. + The new failure element. + + + + Represents the result of running a test suite + + + + + Construct a TestSuiteResult base on a TestSuite + + The TestSuite to which the result applies + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Add a child result + + The child result to be added + + + + StackFilter class is used to remove internal NUnit + entries from a stack trace so that the resulting + trace provides better information about the test. + + + + + Filters a raw stack trace and returns the result. + + The original stack trace + A filtered stack trace + + + + Provides methods to support legacy string comparison methods. + + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + Zero if the strings are equivalent, a negative number if strA is sorted first, a positive number if + strB is sorted first + + + + Compares two strings for equality, ignoring case if requested. + + The first string. + The second string.. + if set to true, the case of the letters in the strings is ignored. + True if the strings are equivalent, false if not. + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + The expected result to be returned + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + The expected result of the test, which + must match the method return type. + + + + + Gets a value indicating whether an expected result was specified. + + + + + Helper class used to save and restore certain static or + singleton settings in the environment that affect tests + or which might be changed by the user tests. + + An internal class is used to hold settings and a stack + of these objects is pushed and popped as Save and Restore + are called. + + + + + Link to a prior saved context + + + + + Indicates that a stop has been requested + + + + + The event listener currently receiving notifications + + + + + The number of assertions for the current test + + + + + The current culture + + + + + The current UI culture + + + + + The current test result + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + An existing instance of TestExecutionContext. + + + + The current context, head of the list of saved contexts. + + + + + Gets the current context. + + The current context. + + + + Clear the current context. This is provided to + prevent "leakage" of the CallContext containing + the current context back to any runners. + + + + + Gets or sets the current test + + + + + The time the current test started execution + + + + + The time the current test started in Ticks + + + + + Gets or sets the current test result + + + + + Gets a TextWriter that will send output to the current test result. + + + + + The current test object - that is the user fixture + object on which tests are being executed. + + + + + Get or set the working directory + + + + + Get or set indicator that run should stop on the first error + + + + + Gets an enum indicating whether a stop has been requested. + + + + + The current test event listener + + + + + The current WorkItemDispatcher + + + + + The ParallelScope to be used by tests running in this context. + For builds with out the parallel feature, it has no effect. + + + + + Gets the RandomGenerator specific to this Test + + + + + Gets the assert count. + + The assert count. + + + + Gets or sets the test case timeout value + + + + + Gets a list of ITestActions set by upstream tests + + + + + Saves or restores the CurrentCulture + + + + + Saves or restores the CurrentUICulture + + + + + The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter + + + + + Record any changes in the environment made by + the test code in the execution context so it + will be passed on to lower level tests. + + + + + Set up the execution environment to match a context. + Note that we may be running on the same thread where the + context was initially created or on a different thread. + + + + + Increments the assert count by one. + + + + + Increments the assert count by a specified amount. + + + + + Adds a new ValueFormatterFactory to the chain of formatters + + The new factory + + + + Enumeration indicating whether the tests are + running normally or being cancelled. + + + + + Running normally with no stop requested + + + + + A graceful stop has been requested + + + + + A forced stop has been requested + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Indicates whether this is a top-level filter, + not contained in any other filter. + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. This is overridden by each + different type of filter to perform the necessary tests. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test matches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Create a TestFilter instance from an xml representation. + + + + + Create a TestFilter from it's TNode representation + + + + + Nested class provides an empty filter - one that always + returns true when called. It never matches explicitly. + + + + + Adds an XML node + + True if recursive + The added XML node + + + + Adds an XML node + + Parent node + True if recursive + The added XML node + + + + The TestCaseParameters class encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a ParameterSet from an object implementing ITestCaseData + + + + + + Type arguments used to create a generic fixture instance + + + + + TestListener provides an implementation of ITestListener that + does nothing. It is used only through its NULL property. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test case has finished + + The result of the test + + + + Construct a new TestListener - private so it may not be used. + + + + + Get a listener that does nothing + + + + + TestNameGenerator is able to create test names according to + a coded pattern. + + + + + Construct a TestNameGenerator + + The pattern used by this generator. + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + The display name + + + + Get the display name for a TestMethod and it's arguments + + A TestMethod + Arguments to be used + The display name + + + + Get the display name for a MethodInfo + + A MethodInfo + The display name + + + + Get the display name for a method with args + + A MethodInfo + Argument list for the method + The display name + + + + TestParameters is the abstract base class for all classes + that know how to provide data for constructing a test. + + + + + Default Constructor creates an empty parameter set + + + + + Construct a parameter set with a list of arguments + + + + + + Construct a non-runnable ParameterSet, specifying + the provider exception that made it invalid. + + + + + Construct a ParameterSet from an object implementing ITestData + + + + + + The RunState for this set of parameters. + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets the property dictionary for this test + + + + + Applies ParameterSet _values to the test itself. + + A test. + + + + The original arguments provided by the user, + used for display purposes. + + + + + TestProgressReporter translates ITestListener events into + the async callbacks that are used to inform the client + software about the progress of a test run. + + + + + Initializes a new instance of the class. + + The callback handler to be used for reporting progress. + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished. Sends a result summary to the callback. + to + + The result of the test + + + + Returns the parent test item for the targer test item if it exists + + + parent test item + + + + Makes a string safe for use as an attribute, replacing + characters characters that can't be used with their + corresponding xml representations. + + The string to be used + A new string with the _values replaced + + + + ParameterizedFixtureSuite serves as a container for the set of test + fixtures created from a given Type using various parameters. + + + + + Initializes a new instance of the class. + + The ITypeInfo for the type that represents the suite. + + + + Gets a string representing the type of test + + + + + + ParameterizedMethodSuite holds a collection of individual + TestMethods with their arguments applied. + + + + + Construct from a MethodInfo + + + + + + Gets a string representing the type of test + + + + + + SetUpFixture extends TestSuite and supports + Setup and TearDown methods. + + + + + Initializes a new instance of the class. + + The type. + + + + The Test abstract class represents a test within the framework. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + The SetUp methods. + + + + + The teardown methods + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + TODO: Documentation needed for constructor + + + + + + Construct a test from a MethodInfo + + + + + + Gets or sets the id of the test + + + + + + Gets or sets the name of the test + + + + + Gets or sets the fully qualified name of the test + + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the TypeInfo of the fixture used in running this test + or null if no fixture type is associated with it. + + + + + Gets a MethodInfo for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Whether or not the test should be run + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Gets a string representing the type of test. Used as an attribute + value in the XML representation of a test and has no other + function in the framework. + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets the properties for this test + + + + + Returns true if this is a TestSuite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets or sets a fixture object for running this test. + + + + + Static prefix used for ids in this AppDomain. + Set by FrameworkController. + + + + + Gets or Sets the Int value representing the seed for the RandomGenerator + + + + + + Creates a TestResult for this test. + + A TestResult suitable for this type of test. + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object deriving from MemberInfo + + + + Modify a newly constructed test by applying any of NUnit's common + attributes, based on a supplied ICustomAttributeProvider, which is + usually the reflection element from which the test was constructed, + but may not be in some instances. The attributes retrieved are + saved for use in subsequent operations. + + An object deriving from MemberInfo + + + + Add standard attributes and members to a test node. + + + + + + + Returns the Xml representation of the test + + If true, include child tests recursively + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + TestAssembly is a TestSuite that represents the execution + of tests in a managed assembly. + + + + + Initializes a new instance of the class + specifying the Assembly and the path from which it was loaded. + + The assembly this test represents. + The path used to load the assembly. + + + + Initializes a new instance of the class + for a path which could not be loaded. + + The path used to load the assembly. + + + + Gets the Assembly represented by this instance. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + TestFixture is a surrogate for a user test fixture class, + containing one or more tests. + + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + The TestMethod class represents a Test implemented as a method. + + + + + The ParameterSet used to create this test method + + + + + Initializes a new instance of the class. + + The method to be used as a test. + + + + Initializes a new instance of the class. + + The method to be used as a test. + The suite or fixture to which the new test will be added + + + + Overridden to return a TestCaseResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Returns a TNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Gets this test's child tests + + A list of child tests + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns the name of the method + + + + + TestSuite represents a composite test, which contains other tests. + + + + + Our collection of child tests + + + + + Initializes a new instance of the class. + + The name of the suite. + + + + Initializes a new instance of the class. + + Name of the parent suite. + The name of the suite. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Initializes a new instance of the class. + + Type of the fixture. + + + + Sorts tests under this suite. + + + + + Adds a test to the suite. + + The test. + + + + Gets this test's child tests + + The list of child tests + + + + Gets a count of test cases represented by + or contained under this test. + + + + + + The arguments to use in creating the fixture + + + + + Set to true to suppress sorting this suite's contents + + + + + Overridden to return a TestSuiteResult. + + A TestResult for this test. + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets the name used for the top-level element in the + XML representation of this test + + + + + Returns an XmlNode representing the current result after + adding it as a child of the supplied parent node. + + The parent node. + If true, descendant results are included + + + + + Check that setup and teardown methods marked by certain attributes + meet NUnit's requirements and mark the tests not runnable otherwise. + + The attribute type to check for + + + + TypeHelper provides static methods that operate on Types. + + + + + A special value, which is used to indicate that BestCommonType() method + was unable to find a common type for the specified arguments. + + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The display name for the Type + + + + Gets the display name for a Type as used by NUnit. + + The Type for which a display name is needed. + The arglist provided. + The display name for the Type + + + + Returns the best fit for a common type to be used in + matching actual arguments to a methods Type parameters. + + The first type. + The second type. + Either type1 or type2, depending on which is more general. + + + + Determines whether the specified type is numeric. + + The type to be examined. + + true if the specified type is numeric; otherwise, false. + + + + + Convert an argument list to the required parameter types. + Currently, only widening numeric conversions are performed. + + An array of args to be converted + A ParameterInfo[] whose types will be used as targets + + + + Determines whether this instance can deduce type args for a generic type from the supplied arguments. + + The type to be examined. + The arglist. + The type args to be used. + + true if this the provided args give sufficient information to determine the type args to be used; otherwise, false. + + + + + Gets the _values for an enumeration, using Enum.GetTypes + where available, otherwise through reflection. + + + + + + + Gets the ids of the _values for an enumeration, + using Enum.GetNames where available, otherwise + through reflection. + + + + + + + The TypeWrapper class wraps a Type so it may be used in + a platform-independent manner. + + + + + Construct a TypeWrapper for a specified Type. + + + + + Gets the underlying Type on which this TypeWrapper is based. + + + + + Gets the base type of this type as an ITypeInfo + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Returns true if the Type wrapped is T + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type represents a static class. + + + + + Get the display name for this type + + + + + Get the display name for an object of this type, constructed with the specified args. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns an array of custom attributes of the specified type applied to this type + + + + + Returns a value indicating whether the type has an attribute of the specified type. + + + + + + + + Returns a flag indicating whether this type has a method with an attribute of the specified type. + + + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + Override ToString() so that error messages in NUnit's own tests make sense + + + + + Provides a platform-independent methods for getting attributes + for use by AttributeConstraint and AttributeExistsConstraint. + + + + + Gets the custom attributes from the given object. + + Portable libraries do not have an ICustomAttributeProvider, so we need to cast to each of + it's direct subtypes and try to get attributes off those instead. + The actual. + Type of the attribute. + if set to true [inherit]. + A list of the given attribute on the given object. + + + + Specifies flags that control binding and the way in which the search for members + and types is conducted by reflection. + + + + + Specifies no binding flag. + + + + + Specifies that only members declared at the level of the supplied type's hierarchy + should be considered. Inherited members are not considered. + + + + + Specifies that instance members are to be included in the search. + + + + + Specifies that static members are to be included in the search. + + + + + Specifies that public members are to be included in the search. + + + + + Specifies that non-public members are to be included in the search. + + + + + Specifies that public and protected static members up the hierarchy should be + returned. Private static members in inherited classes are not returned. Static + members include fields, methods, events, and properties. Nested types are not + returned. + + + + + A MarshalByRefObject that lives forever + + + + + Some path based methods that we need even in the Portable framework which + does not have the System.IO.Path class + + + + + Windows directory separator + + + + + Alternate directory separator + + + + + A volume separator character. + + + + + Get the file name and extension of the specified path string. + + The path string from which to obtain the file name and extension. + The filename as a . If the last character of is a directory or volume separator character, this method returns . If is null, this method returns null. + + + + Provides NUnit specific extensions to aid in Reflection + across multiple frameworks + + + This version of the class allows direct calls on Type on + those platforms that would normally require use of + GetTypeInfo(). + + + + + Returns an array of generic arguments for the give type + + + + + + + Gets the constructor with the given parameter types + + + + + + + + Gets the constructors for a type + + + + + + + + + + + + + + + + + + + + + + + Gets declared or inherited interfaces on this type + + + + + + + Gets the member on a given type by name. BindingFlags ARE IGNORED. + + + + + + + + + Gets all members on a given type. BindingFlags ARE IGNORED. + + + + + + + + Gets field of the given name on the type + + + + + + + + Gets property of the given name on the type + + + + + + + + Gets property of the given name on the type + + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + + Gets the method with the given name and parameter list + + + + + + + + + Gets public methods on the given type + + + + + + + Gets methods on a type + + + + + + + + Determines if one type can be implicitly converted from another + + + + + + + + Extensions to the various MemberInfo derived classes + + + + + Returns the get method for the given property + + + + + + + + Returns an array of custom attributes of the specified type applied to this member + + Portable throws an argument exception if T does not + derive from Attribute. NUnit uses interfaces to find attributes, thus + this method + + + + Returns an array of custom attributes of the specified type applied to this parameter + + + + + Returns an array of custom attributes of the specified type applied to this assembly + + + + + Extensions for Assembly that are not available in portable + + + + + DNX does not have a version of GetCustomAttributes on Assembly that takes an inherit + parameter since it doesn't make sense on Assemblies. This version just ignores the + inherit parameter. + + The assembly + The type of attribute you are looking for + Ignored + + + + + Gets the types in a given assembly + + + + + + + This class is a System.Diagnostics.Stopwatch on operating systems that support it. On those that don't, + it replicates the functionality at the resolution supported. + + + + + Gets the total elapsed time measured by the current instance, in milliseconds. + + + + + Gets a value indicating whether the Stopwatch timer is running. + + + + + Gets the current number of ticks in the timer mechanism. + + + If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current + value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the current + DateTime.Ticks property of the DateTime.Now instance. + + A long integer representing the tick counter value of the underlying timer mechanism. + + + + Stops time interval measurement and resets the elapsed time to zero. + + + + + Starts, or resumes, measuring elapsed time for an interval. + + + + + Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring elapsed time. + + A Stopwatch that has just begun measuring elapsed time. + + + + Stops measuring elapsed time for an interval. + + + + + Returns a string that represents the current object. + + + A string that represents the current object. + + + + + Gets the frequency of the timer as the number of ticks per second. + + + + + Indicates whether the timer is based on a high-resolution performance counter. + + + + + Class used to guard against unexpected argument values + or operations by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Throws an ArgumentOutOfRangeException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an ArgumentException if the specified condition is not met. + + The condition that must be met + The exception message to be used + The name of the argument + + + + Throws an InvalidOperationException if the specified condition is not met. + + The condition that must be met + The exception message to be used + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + DefaultTestAssemblyBuilder loads a single assembly and builds a TestSuite + containing test fixtures present in the assembly. + + + + + The default suite builder used by the test assembly builder. + + + + + Initializes a new instance of the class. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + + A TestSuite containing the tests found in the assembly + + + + + FrameworkController provides a facade for use in loading, browsing + and running tests without requiring a reference to the NUnit + framework. All calls are encapsulated in constructors for + this class and its nested classes, which only require the + types of the Common Type System as arguments. + + The controller supports four actions: Load, Explore, Count and Run. + They are intended to be called by a driver, which should allow for + proper sequencing of calls. Load must be called before any of the + other actions. The driver may support other actions, such as + reload on run, by combining these calls. + + + + + Construct a FrameworkController using the default builder and runner. + + The AssemblyName or path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController using the default builder and runner. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The full AssemblyName or the path to the test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Construct a FrameworkController, specifying the types to be used + for the runner and builder. This constructor is provided for + purposes of development. + + The test assembly + A prefix used for all test ids created under this controller. + A Dictionary of settings to use in loading and running the tests + The Type of the test runner + The Type of the test builder + + + + Gets the ITestAssemblyBuilder used by this controller instance. + + The builder. + + + + Gets the ITestAssemblyRunner used by this controller instance. + + The runner. + + + + Gets the AssemblyName or the path for which this FrameworkController was created + + + + + Gets the Assembly for which this + + + + + Gets a dictionary of settings for the FrameworkController + + + + + Loads the tests in the assembly + + + + + + Returns info about the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of exploring the tests + + + + Runs the tests in an assembly + + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly syncronously reporting back the test results through the callback + or through the return value + + The callback that receives the test results + A string containing the XML representation of the filter to use + The XML result of the test run + + + + Runs the tests in an assembly asyncronously reporting back the test results through the callback + + The callback that receives the test results + A string containing the XML representation of the filter to use + + + + Stops the test run + + True to force the stop, false for a cooperative stop + + + + Counts the number of test cases in the loaded TestSuite + + A string containing the XML representation of the filter to use + The number of tests + + + + Inserts settings element + + Target node + Settings dictionary + The new node + + + + FrameworkControllerAction is the base class for all actions + performed against a FrameworkController. + + + + + LoadTestsAction loads a test into the FrameworkController + + + + + LoadTestsAction loads the tests in an assembly. + + The controller. + The callback handler. + + + + ExploreTestsAction returns info about the tests in an assembly + + + + + Initializes a new instance of the class. + + The controller for which this action is being performed. + Filter used to control which tests are included (NYI) + The callback handler. + + + + CountTestsAction counts the number of test cases in the loaded TestSuite + held by the FrameworkController. + + + + + Construct a CountsTestAction and perform the count of test cases. + + A FrameworkController holding the TestSuite whose cases are to be counted + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunTestsAction runs the loaded TestSuite held by the FrameworkController. + + + + + Construct a RunTestsAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + RunAsyncAction initiates an asynchronous test run, returning immediately + + + + + Construct a RunAsyncAction and run all tests in the loaded TestSuite. + + A FrameworkController holding the TestSuite to run + A string containing the XML representation of the filter to use + A callback handler used to report results + + + + StopRunAction stops an ongoing run. + + + + + Construct a StopRunAction and stop any ongoing run. If no + run is in process, no error is raised. + + The FrameworkController for which a run is to be stopped. + True the stop should be forced, false for a cooperative stop. + >A callback handler used to report results + A forced stop will cause threads and processes to be killed as needed. + + + + The ITestAssemblyBuilder interface is implemented by a class + that is able to build a suite of tests given an assembly or + an assembly filename. + + + + + Build a suite of tests from a provided assembly + + The assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + Build a suite of tests given the filename of an assembly + + The filename of the assembly from which tests are to be built + A dictionary of options to use in building the suite + A TestSuite containing the tests found in the assembly + + + + The ITestAssemblyRunner interface is implemented by classes + that are able to execute a suite of tests loaded + from an assembly. + + + + + Gets the tree of loaded tests, or null if + no tests have been loaded. + + + + + Gets the tree of test results, if the test + run is completed, otherwise null. + + + + + Indicates whether a test has been loaded + + + + + Indicates whether a test is currently running + + + + + Indicates whether a test run is complete + + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + File name of the assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Loads the tests found in an Assembly, returning an + indication of whether or not the load succeeded. + + The assembly to load + Dictionary of options to use in loading the test + An ITest representing the loaded tests + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive ITestListener notifications. + A test filter used to select tests to be run + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any test-running threads + + + + Implementation of ITestAssemblyRunner + + + + + Initializes a new instance of the class. + + The builder. + + + + The tree of tests that was loaded by the builder + + + + + The test result, if a run has completed + + + + + Indicates whether a test is loaded + + + + + Indicates whether a test is running + + + + + Indicates whether a test run is complete + + + + + Our settings, specified when loading the assembly + + + + + The top level WorkItem created for the assembly as a whole + + + + + The TestExecutionContext for the top level WorkItem + + + + + Loads the tests found in an Assembly + + File name of the assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Loads the tests found in an Assembly + + The assembly to load + Dictionary of option settings for loading the assembly + True if the load was successful + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + + + + Run selected tests asynchronously, notifying the listener interface as it progresses. + + Interface to receive EventListener notifications. + A test filter used to select tests to be run + + RunAsync is a template method, calling various abstract and + virtual methods to be overridden by derived classes. + + + + + Wait for the ongoing run to complete. + + Time to wait in milliseconds + True if the run completed, otherwise false + + + + Initiate the test run. + + + + + Signal any test run that is in process to stop. Return without error if no test is running. + + If true, kill any tests that are currently running + + + + Create the initial TestExecutionContext used to run tests + + The ITestListener specified in the RunAsync call + + + + Handle the the Completed event for the top level work item + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first int is greater than the second + int. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that an async delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that an async delegate does not throw an exception. + + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + Delegate used by tests that execute async code and + capture any thrown exception. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter ids for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + A lambda that returns a Boolean + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Provides the Author of a test or test fixture. + + + + + Initializes a new instance of the class. + + The name of the author. + + + + Initializes a new instance of the class. + + The name of the author. + The email address of the author. + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Modifies a test by adding a category to it. + + The test to modify + + + + Marks a test to use a combinatorial join of any argument + data provided. Since this is the default, the attribute is + optional. + + + + + Default constructor + + + + + Marks a test to use a particular CombiningStrategy to join + any parameter data provided. Since this is the default, the + attribute is optional. + + + + + Construct a CombiningStrategyAttribute incorporating an + ICombiningStrategy and an IParamterDataProvider. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct a CombiningStrategyAttribute incorporating an object + that implements ICombiningStrategy and an IParameterDataProvider. + This constructor is provided for CLS compliance. + + Combining strategy to be used in combining data + An IParameterDataProvider to supply data + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Modify the test by adding the name of the combining strategy + to the properties. + + The test to modify + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Causes a test to be skipped if this CultureAttribute is not satisfied. + + The test to modify + + + + Tests to determine if the current culture is supported + based on the properties of this attribute. + + True, if the current culture is supported + + + + Test to determine if the a particular culture or comma- + delimited set of cultures is in use. + + Name of the culture or comma-separated list of culture ids + True if the culture is in use on the system + + + + Test to determine if one of a collection of cultures + is being used currently. + + + + + + + The abstract base class for all data-providing attributes + defined by NUnit. Used to select all data sources for a + method, class or parameter. + + + + + Default constructor + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointSourceAttribute. + + + + + Used to mark a field, property or method providing a set of datapoints to + be used in executing any theories within the same fixture that require an + argument of the Type provided. The data source may provide an array of + the required Type or an . + Synonymous with DatapointsAttribute. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct a description Attribute + + The text of the description + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + Modifies a test by marking it as explicit. + + The test to modify + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The date in the future to stop ignoring the test as a string in UTC time. + For example for a date and time, "2014-12-25 08:10:00Z" or for just a date, + "2014-12-25". If just a date is given, the Ignore will expire at midnight UTC. + + + Once the ignore until date has passed, the test will be marked + as runnable. Tests with an ignore until date will have an IgnoreUntilDate + property set which will appear in the test results. + + The string does not contain a valid string representation of a date and time. + + + + Modifies a test by marking it as Ignored. + + The test to modify + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple items may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + TestAssemblyDirectoryResolveAttribute is used to mark a test assembly as needing a + special assembly resolution hook that will explicitly search the test assembly's + directory for dependent assemblies. This works around a conflict between mixed-mode + assembly initialization and tests running in their own AppDomain in some cases. + + + + + LevelOfParallelismAttribute is used to set the number of worker threads + that may be allocated by the framework for running tests. + + + + + Construct a LevelOfParallelismAttribute. + + The number of worker threads to be created by the framework. + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + The abstract base class for all custom attributes defined by NUnit. + + + + + Default constructor + + + + + Attribute used to identify a method that is called once + to perform setup before any child tests are run. + + + + + Attribute used to identify a method that is called once + after all the child tests have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + Defines the order that the test will run in + + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + Marks a test to use a pairwise join of any argument + data provided. Arguments will be combined in such a + way that all possible pairs of arguments are used. + + + + + Default constructor + + + + + ParallelizableAttribute is used to mark tests that may be run in parallel. + + + + + Construct a ParallelizableAttribute using default ParallelScope.Self. + + + + + Construct a ParallelizableAttribute with a specified scope. + + The ParallelScope associated with this attribute. + + + + Modify the context to be used for child tests + + The current TestExecutionContext + + + + The ParallelScope enumeration permits specifying the degree to + which a test and its descendants may be run in parallel. + + + + + No Parallelism is permitted + + + + + The test itself may be run in parallel with others at the same level + + + + + Descendants of the test may be run in parallel with one another + + + + + Descendants of the test down to the level of TestFixtures may be run in parallel + + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Modifies a test by adding properties to it. + + The test to modify + + + + RandomAttribute is used to supply a set of random _values + to a single parameter of a parameterized test. + + + + + Construct a random set of values appropriate for the Type of the + parameter on which the attribute appears, specifying only the count. + + + + + + Construct a set of ints within a specified range + + + + + Construct a set of unsigned ints within a specified range + + + + + Construct a set of longs within a specified range + + + + + Construct a set of unsigned longs within a specified range + + + + + Construct a set of shorts within a specified range + + + + + Construct a set of unsigned shorts within a specified range + + + + + Construct a set of doubles within a specified range + + + + + Construct a set of floats within a specified range + + + + + Construct a set of bytes within a specified range + + + + + Construct a set of sbytes within a specified range + + + + + Get the collection of _values to be used as arguments. + + + + + RangeAttribute is used to supply a range of _values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of unsigned ints using default step of 1 + + + + + + + Construct a range of unsigned ints specifying the step size + + + + + + + + Construct a range of longs using a default step of 1 + + + + + + + Construct a range of longs + + + + + + + + Construct a range of unsigned longs using default step of 1 + + + + + + + Construct a range of unsigned longs specifying the step size + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RepeatAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + The test command for the RetryAttribute + + + + + Initializes a new instance of the class. + + The inner command. + The number of repetitions + + + + Runs the test, saving a TestResult in the supplied TestExecutionContext. + + The context in which the test should run. + A TestResult + + + + Marks a test to use a Sequential join of any argument + data provided. Arguments will be combined into test cases, + taking the next value of each argument until all are used. + + + + + Default constructor + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + SetUpFixtureAttribute is used to identify a SetUpFixture + + + + + Build a SetUpFixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A SetUpFixture object as a TestSuite. + + + + Attribute used to identify a method that is called + immediately after each test is run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + The author of this test + + + + + The type that this test is testing + + + + + Modifies a test by adding a description, if not already set. + + The test to modify + + + + Gets or sets the expected result. + + The result. + + + + Returns true if an expected result has been set + + + + + Construct a TestMethod from a given method. + + The method for which a test is to be constructed. + The suite to which the test will be added. + A TestMethod + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test case. + + + + + Gets the list of arguments to a test case + + + + + Gets the properties of the test case + + + + + Gets or sets the expected result. + + The result. + + + + Returns true if the expected result has been set + + + + + Gets or sets the description. + + The description. + + + + The author of this test + + + + + The type that this test is testing + + + + + Gets or sets the reason for ignoring the test + + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets or sets the reason for not running the test. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets and sets the category for this test case. + May be a comma-separated list of categories. + + + + + Performs several special conversions allowed by NUnit in order to + permit arguments with types that cannot be used in the constructor + of an Attribute such as TestCaseAttribute or to simplify their use. + + The arguments to be converted + The ParameterInfo array for the method + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The MethodInfo for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + TestCaseSourceAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + A set of parameters passed to the method, works only if the Source Name is a method. + If the source name is a field or property has no effect. + + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestMethods from a given MethodInfo, + using available parameter data. + + The IMethod for which tests are to be constructed. + The suite to which the tests will be added. + One or more TestMethods + + + + Returns a set of ITestCaseDataItems for use as arguments + to a parameterized test method. + + The method for which data is needed. + + + + + TestFixtureAttribute is used to mark a class that represents a TestFixture. + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the RunState of this test fixture. + + + + + The arguments originally provided to the attribute + + + + + Properties pertaining to this fixture + + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Descriptive text for this fixture + + + + + The author of this fixture + + + + + The type that this fixture is testing + + + + + Gets or sets the ignore reason. May set RunState as a side effect. + + The ignore reason. + + + + Gets or sets the reason for not running the fixture. + + The reason. + + + + Gets or sets the ignore reason. When set to a non-null + non-empty value, the test is marked as ignored. + + The ignore reason. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Build a fixture from type provided. Normally called for a Type + on which the attribute has been placed. + + The type info of the fixture to be used. + A an IEnumerable holding one TestFixture object. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + TestCaseSourceAttribute indicates the source to be used to + provide test fixture instances for a test class. + + + + + Error message string is public so the tests can use it + + + + + Construct with the name of the method, property or field that will provide data + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + Construct with a Type + + The type that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with every fixture created from + this attribute. May be a single category or a comma-separated list. + + + + + Construct one or more TestFixtures from a given Type, + using available parameter data. + + The TypeInfo for which fixures are to be constructed. + One or more TestFixtures as TestSuite + + + + Returns a set of ITestFixtureData items for use as arguments + to a parameterized test fixture. + + The type for which data is needed. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Indicates which class the test or test fixture is testing + + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Initializes a new instance of the class. + + The type that is being tested. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + public void TestDescriptionMethod() + {} + } + + + + + + Construct the attribute, specifying a combining strategy and source of parameter data. + + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary + + + + + Constructs for use with an Enum parameter. Will pass every enum + value in to the test. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of _values to be used as arguments + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of a static method, property or field that will provide data. + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of a static method, property or field that will provide data. + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + + An enumeration containing individual data items + + + + + A set of Assert methods operating on one or more collections + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset does not contain the subset + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + + + + Asserts that the superset contains the subset. + + The IEnumerable subset to be considered + The IEnumerable superset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset does not contain the superset + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that the subset contains the superset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + AndConstraint succeeds only if both members succeed. + + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attribute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + Construct a CollectionContainsConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Gets the expected object + + + + + Test whether the expected item is contained in the collection + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionEquivalentConstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether two collections are equivalent + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + If used performs a reverse comparison + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the collection is ordered + + + + + + + Returns the string representation of the constraint. + + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionSupersetConstraint is used to determine whether + one collection is a superset of another + + + + + Construct a CollectionSupersetConstraint + + The collection that the actual value is expected to be a superset of + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the actual collection is a superset of + the expected collection provided. + + + + + + + Flag the constraint to use the supplied predicate function + + The comparison function to use. + Self. + + + + CollectionTally counts (tallies) the number of + occurrences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + The number of objects remaining in the tally + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + ComparisonAdapter class centralizes all comparisons of + _values in NUnit, adapting to the use of any provided + , + or . + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps an + + + + + Returns a ComparisonAdapter that wraps a + + + + + Compares two objects + + + + + Construct a default ComparisonAdapter + + + + + Construct a ComparisonAdapter for an + + + + + Compares two objects + + + + + + + + ComparerAdapter extends and + allows use of an or + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare _values to + determine if one is greater than, equal to or less than + the other. + + + + + The value against which a comparison is to be made + + + + + If true, less than returns success + + + + + if true, equal returns success + + + + + if true, greater than returns success + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + The value against which to make a comparison. + if set to true less succeeds. + if set to true equal succeeds. + if set to true greater succeeds. + String used in describing the constraint. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use an and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Modifies the constraint to use a and returns self + + The comparer used for comparison tests + A constraint modified to use the given comparer + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + Construct a constraint with optional arguments + + Arguments to be saved + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + Retrieves the value to be tested from an ActualValueDelegate. + The default implementation simply evaluates the delegate but derived + classes may override it to provide for delayed processing. + + An ActualValueDelegate + Delegate evaluation result + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Resolves any pending operators and returns the resolved constraint. + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reorganized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + + + + Pushes the specified operator onto the stack. + + The operator to put onto the stack. + + + + Pops the topmost operator from the stack. + + The topmost operator on the stack + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The ConstraintBuilder using this stack. + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Pushes the specified constraint. As a side effect, + the constraint's Builder field is set to the + ConstraintBuilder owning this stack. + + The constraint to put onto the stack + + + + Pops this topmost constraint from the stack. + As a side effect, the constraint's Builder + field is set to null. + + The topmost contraint on the stack + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expression by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the Builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reorganized. When a constraint is appended, it is returned as the + value of the operation so that modifiers may be applied. However, + any partially built expression is attached to the constraint for + later resolution. When an operator is appended, the partial + expression is returned. If it's a self-resolving operator, then + a ResolvableConstraintExpression is returned. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. Note that the constraint + is not reduced at this time. For example, if there + is a NotOperator on the stack we don't reduce and + return a NotConstraint. The original constraint must + be returned because it may support modifiers that + are yet to be applied. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests if item is equal to zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + ConstraintStatus represents the status of a ConstraintResult + returned by a Constraint being applied to an actual value. + + + + + The status has not yet been set + + + + + The constraint succeeded + + + + + The constraint failed + + + + + An error occured in applying the constraint (reserved for future use) + + + + + Contain the result of matching a against an actual value. + + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + The status of the new ConstraintResult. + + + + Constructs a for a particular . + + The Constraint to which this result applies. + The actual value to which the Constraint was applied. + If true, applies a status of Success to the result, otherwise Failure. + + + + The actual value that was passed to the method. + + + + + Gets and sets the ResultStatus for this result. + + + + + True if actual value meets the Constraint criteria otherwise false. + + + + + Display friendly name of the constraint. + + + + + Description of the constraint may be affected by the state the constraint had + when was performed against the actual value. + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the result and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The _expected. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Flag the constraint to ignore case and return self. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + DictionaryContainsKeyConstraint is used to test whether a dictionary + contains an expected object as a key. + + + + + Construct a DictionaryContainsKeyConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected key is contained in the dictionary + + + + + DictionaryContainsValueConstraint is used to test whether a dictionary + contains an expected object as a value. + + + + + Construct a DictionaryContainsValueConstraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the expected value is contained in the dictionary + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that the collection is empty + + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EmptyStringConstraint tests whether a string is empty. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Gets the tolerance for this comparison. + + + The tolerance. + + + + + Gets a value indicating whether to compare case insensitive. + + + true if comparing case insensitive; otherwise, false. + + + + + Gets a value indicating whether or not to clip strings. + + + true if set to clip strings otherwise, false. + + + + + Gets the failure points. + + + The failure points. + + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flags the constraint to include + property in comparison of two values. + + + Using this modifier does not allow to use the + constraint modifier. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable _values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point _values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual _values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + The EqualConstraintResult class is tailored for formatting + and displaying the result of an EqualConstraint. + + + + + Construct an EqualConstraintResult + + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual collections or arrays. If both are identical, the value is + only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both _values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + EqualityAdapter class handles all equality comparisons + that use an , + or a . + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps an . + + + + + Returns an EqualityAdapter that uses a predicate function for items comparison. + + + + + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + Returns an that wraps an . + + + + + Returns an that wraps an . + + + + + that wraps an . + + + + + Returns an that wraps a . + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the _values are + allowed to deviate by up to 2 adjacent floating point _values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + Compares two floating point _values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point _values that are allowed to + be between the left and the right floating point _values + + True if both numbers are equal or close to being equal + + + Floating point _values can only represent a finite subset of natural numbers. + For example, the _values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point _values are between + the left and the right number. If the number of possible _values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point _values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point _values that are + allowed to be between the left and the right double precision floating point _values + + True if both numbers are equal or close to being equal + + + Double precision floating point _values can only represent a limited series of + natural numbers. For example, the _values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + _values are between the left and the right number. If the number of possible + _values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Interface for all constraints + + + + + The display name of this Constraint for use by ToString(). + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Arguments provided to this Constraint, for use in + formatting the description. + + + + + The ConstraintBuilder holding this constraint + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + A ConstraintResult + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + The IResolveConstraint interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Tests whether a value is less than the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + Initializes a new instance of the class. + + The expected value. + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Abstract method to get the max line length + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The failing constraint result + + + + Display Expected and Actual lines for given _values. This + method may be called by constraints that need more control over + the display of actual and expected _values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given _values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string _values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Custom value formatter function + + The value + + + + + Custom value formatter factory function + + The next formatter function + ValueFormatter + If the given formatter is unable to handle a certain format, it must call the next formatter in the chain + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Formatting strings used for expected and actual _values + + + + + Current head of chain of value formatters. Public for testing. + + + + + Add a formatter to the chain of responsibility. + + + + + + Formats text to represent a generalized value. + + The value + The formatted text + + + + Formats text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a collection or + array corresponding to a single int index into the collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test that the actual value is an NaN + + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + The Numerics class contains common operations on numeric _values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric _values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the _values are equal + + + + Compare two numeric _values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the _values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Returns the default NUnitComparer. + + + + + Compares two objects + + + + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occurred. + + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + Flags the comparer to include + property in comparison of two values. + + + Using this modifier does not allow to use the + modifier. + + + + + Compares two objects for equality within a tolerance. + + + + + Helper method to compare two arrays + + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Operator that requires both it's arguments to succeed + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + Constructs a CollectionOperator + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + _values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + The syntax element preceding this operator + + + + + The syntax element following this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Gets the name of the property to which the operator applies + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifies the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Gets text describing a constraint + + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Gets text describing a constraint + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Abstract base class used for prefixes + + + + + The base constraint + + + + + Prefix used in forming the constraint description + + + + + Construct given a base constraint + + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the value + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two _values are within a + specified range. + + + + + Initializes a new instance of the class. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use an and returns self. + + + + + Modifies the constraint to use a and returns self. + + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + Resolve the current expression to a Constraint + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Return the top-level constraint for this expression + + + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Description of this constraint + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Constructs a StringConstraint without an expected value + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Modify the constraint to ignore case in matching. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + Gets text describing a constraint + + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. This override only handles the special message + used when an exception is expected but none is thrown. + + The writer on which the actual value is displayed + + + + ThrowsExceptionConstraint tests that an exception has + been thrown, without any further tests. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Executes the code and returns success if an exception is thrown. + + A delegate representing the code to be tested + True if an exception is thrown, otherwise false + + + + Returns the ActualValueDelegate itself as the value to be tested. + + A delegate representing the code to be tested + The delegate itself + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Gets text describing a constraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Applies the constraint to an ActualValueDelegate that returns + the value to be tested. The default implementation simply evaluates + the delegate but derived classes may override it to provide for + delayed processing. + + An ActualValueDelegate + A ConstraintResult + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Returns a default Tolerance object, equivalent to + specifying an exact match unless + is set, in which case, the + will be used. + + + + + Returns an empty Tolerance object, equivalent to + specifying an exact match even if + is set. + + + + + Constructs a linear tolerance of a specified amount + + + + + Constructs a tolerance given an amount and + + + + + Gets the for the current Tolerance + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance has not been set or is using the . + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared _values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared _values my deviate from each other. + + + + + Compares two _values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + The type of the actual argument to which the constraint was applied + + + + + Construct a TypeConstraint for a given Type + + The expected type for the constraint + Prefix used in forming the constraint description + + + + Applies the constraint to an actual value, returning a ConstraintResult. + + The value to be tested + A ConstraintResult + + + + Apply the constraint to an actual value, returning true if it succeeds + + The actual argument + True if the constraint succeeds, otherwise false. + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + The Description of what this constraint tests, for + use in messages and in the ConstraintResult. + + + + + Check that all items are unique. + + + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new DictionaryContainsKeyConstraint checking for the + presence of a particular key in the dictionary. + + + + + Returns a new DictionaryContainsValueConstraint checking for the + presence of a particular value in the dictionary. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Abstract base for Exceptions that terminate a test and provide a ResultState. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Gets the ResultState provided by this exception + + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. Anything set through + this class applies to the entire test run. It should not normally + be used from within a test, since it is not thread-safe. + + + + + Default tolerance for floating point equality + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + The IApplyToContext interface is implemented by attributes + that want to make changes to the execution context before + a test is run. + + + + + Apply changes to the execution context + + The execution context + + + + The IApplyToTest interface is implemented by self-applying + attributes that modify the state of a test in some way. + + + + + Modifies a test as defined for the specific attribute. + + The test to modify + + + + CombiningStrategy is the abstract base for classes that + know how to combine values provided for individual test + parameters to create a set of test cases. + + + + + Gets the test cases generated by the CombiningStrategy. + + The test cases. + + + + ICommandWrapper is implemented by attributes and other + objects able to wrap a TestCommand with another command. + + + Attributes or other objects should implement one of the + derived interfaces, rather than this one, since they + indicate in which part of the command chain the wrapper + should be applied. + + + + + Wrap a command and return the result. + + The command to be wrapped + The wrapped command + + + + Objects implementing this interface are used to wrap + the TestMethodCommand itself. They apply after SetUp + has been run and before TearDown. + + + + + Objects implementing this interface are used to wrap + the entire test, including SetUp and TearDown. + + + + + Any ITest that implements this interface is at a level that the implementing + class should be disposed at the end of the test run + + + + + The IFixtureBuilder interface is exposed by a class that knows how to + build a TestFixture from one or more Types. In general, it is exposed + by an attribute, but may be implemented in a helper class used by the + attribute in some cases. + + + + + Build one or more TestFixtures from type provided. At least one + non-null TestSuite must always be returned, since the method is + generally called because the user has marked the target class as + a fixture. If something prevents the fixture from being used, it + will be returned nonetheless, labelled as non-runnable. + + The type info of the fixture to be used. + A TestSuite object or one derived from TestSuite. + + + + IImplyFixture is an empty marker interface used by attributes like + TestAttribute that cause the class where they are used to be treated + as a TestFixture even without a TestFixtureAttribute. + + Marker interfaces are not usually considered a good practice, but + we use it here to avoid cluttering the attribute hierarchy with + classes that don't contain any extra implementation. + + + + + The IMethodInfo class is used to encapsulate information + about a method in a platform-independent manner. + + + + + Gets the Type from which this method was reflected. + + + + + Gets the MethodInfo for this method. + + + + + Gets the name of the method. + + + + + Gets a value indicating whether the method is abstract. + + + + + Gets a value indicating whether the method is public. + + + + + Gets a value indicating whether the method contains unassigned generic type parameters. + + + + + Gets a value indicating whether the method is a generic method. + + + + + Gets a value indicating whether the MethodInfo represents the definition of a generic method. + + + + + Gets the return Type of the method. + + + + + Gets the parameters of the method. + + + + + + Returns the Type arguments of a generic method or the Type parameters of a generic method definition. + + + + + Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo. + + The type arguments to be used + A new IMethodInfo with the type arguments replaced + + + + Invokes the method, converting any TargetInvocationException to an NUnitException. + + The object on which to invoke the method + The argument list for the method + The return value from the invoked method + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + An IParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + An IParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IParameterDataSource interface is implemented by types + that can provide data for a test method parameter. + + + + + Gets an enumeration of data items for use as arguments + for a test method parameter. + + The parameter for which data is needed + An enumeration containing individual data items + + + + The IParameterInfo interface is an abstraction of a .NET parameter. + + + + + Gets a value indicating whether the parameter is optional + + + + + Gets an IMethodInfo representing the method for which this is a parameter + + + + + Gets the underlying .NET ParameterInfo + + + + + Gets the Type of the parameter + + + + + A PropertyBag represents a collection of name/value pairs + that allows duplicate entries with the same key. Methods + are provided for adding a new pair as well as for setting + a key to a single value. All keys are strings but _values + may be of any type. Null _values are not permitted, since + a null entry represents the absence of the key. + + The entries in a PropertyBag are of two kinds: those that + take a single value and those that take multiple _values. + However, the PropertyBag has no knowledge of which entries + fall into each category and the distinction is entirely + up to the code using the PropertyBag. + + When working with multi-valued properties, client code + should use the Add method to add name/value pairs and + indexing to retrieve a list of all _values for a given + key. For example: + + bag.Add("Tag", "one"); + bag.Add("Tag", "two"); + Assert.That(bag["Tag"], + Is.EqualTo(new string[] { "one", "two" })); + + When working with single-valued propeties, client code + should use the Set method to set the value and Get to + retrieve the value. The GetSetting methods may also be + used to retrieve the value in a type-safe manner while + also providing default. For example: + + bag.Set("Priority", "low"); + bag.Set("Priority", "high"); // replaces value + Assert.That(bag.Get("Priority"), + Is.EqualTo("high")); + Assert.That(bag.GetSetting("Priority", "low"), + Is.EqualTo("high")); + + + + + Adds a key/value pair to the property bag + + The key + The value + + + + Sets the value for a key, removing any other + _values that are already in the property set. + + + + + + + Gets a single value for a key, using the first + one if multiple _values are present and returning + null if the value is not found. + + + + + Gets a flag indicating whether the specified key has + any entries in the property set. + + The key to be checked + True if their are _values present, otherwise false + + + + Gets or sets the list of _values for a particular key + + The key for which the _values are to be retrieved or set + + + + Gets a collection containing all the keys in the property set + + + + + The IReflectionInfo interface is implemented by NUnit wrapper objects that perform reflection. + + + + + Returns an array of custom attributes of the specified type applied to this object + + + + + Returns a value indicating whether an attribute of the specified type is defined on this object. + + + + + The ISimpleTestBuilder interface is exposed by a class that knows how to + build a single TestMethod from a suitable MethodInfo Types. In general, + it is exposed by an attribute, but may be implemented in a helper class + used by the attribute in some cases. + + + + + Build a TestMethod from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the id of the test + + + + + Gets the name of the test + + + + + Gets the fully qualified name of the test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the Type of the test fixture, if applicable, or + null if no fixture type is associated with this test. + + + + + Gets an IMethod for the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets the RunState of the test, indicating whether it can be run. + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Gets the properties of the test + + + + + Gets the parent test, if any. + + The parent test or null if none exists. + + + + Returns true if this is a test suite + + + + + Gets a bool indicating whether the current test + has any descendant tests. + + + + + Gets this test's child tests + + A list of child tests + + + + Gets a fixture object for running this test. + + + + + The ITestBuilder interface is exposed by a class that knows how to + build one or more TestMethods from a MethodInfo. In general, it is exposed + by an attribute, which has additional information available to provide + the necessary test parameters to distinguish the test cases built. + + + + + Build one or more TestMethods from the provided MethodInfo. + + The method to be used as a test + The TestSuite to which the method will be added + A TestMethod object + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + This interface is not the same as the ITestCaseBuilder interface in NUnit 2.x. + We have reused the name because the two products don't interoperate at all. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + + + + Gets the expected result of the test case + + + + + Returns true if an expected result has been set + + + + + The ITestData interface is implemented by a class that + represents a single instance of a parameterized test. + + + + + Gets the name to be used for the test + + + + + Gets the RunState for this test case. + + + + + Gets the argument list to be provided to the test + + + + + Gets the property dictionary for the test case + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine if a test matches the filter expicitly. That is, it must + be a direct match of the test itself or one of it's children. + + The test to which the filter is applied + True if the test matches the filter explicityly, otherwise false + + + + The ITestCaseData interface is implemented by a class + that is able to return the data required to create an + instance of a parameterized test fixture. + + + + + Get the TypeArgs if separately set + + + + + The ITestListener interface is used internally to receive + notifications of significant events while a test is being + run. The events are propagated to clients by means of an + AsyncCallback. NUnit extensions may also monitor these events. + + + + + Called when a test has just started + + The test that is starting + + + + Called when a test has finished + + The result of the test + + + + The ITestResult interface represents the result of a test. + + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the elapsed time for running the test in seconds + + + + + Gets or sets the time the test started running. + + + + + Gets or sets the time the test finished running. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. Not available in + the Compact Framework 1.0. + + + + + Gets the number of asserts executed + when running the test and all its children. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + Indicates whether this result has any child results. + Accessing HasChildren should not force creation of the + Children collection in classes implementing this interface. + + + + + Gets the the collection of child results. + + + + + Gets the Test to which this result applies. + + + + + Gets any text output written to this result. + + + + + The ITypeInfo interface is an abstraction of a .NET Type + + + + + Gets the underlying Type on which this ITypeInfo is based + + + + + Gets the base type of this type as an ITypeInfo + + + + + Returns true if the Type wrapped is equal to the argument + + + + + Gets the Name of the Type + + + + + Gets the FullName of the Type + + + + + Gets the assembly in which the type is declared + + + + + Gets the Namespace of the Type + + + + + Gets a value indicating whether the type is abstract. + + + + + Gets a value indicating whether the Type is a generic Type + + + + + Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types. + + + + + Gets a value indicating whether the Type is a generic Type definition + + + + + Gets a value indicating whether the type is sealed. + + + + + Gets a value indicating whether this type is a static class. + + + + + Get the display name for this typeInfo. + + + + + Get the display name for an oject of this type, constructed with specific arguments + + + + + Returns a Type representing a generic type definition from which this Type can be constructed. + + + + + Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments + + + + + Returns a value indicating whether this type has a method with a specified public attribute + + + + + Returns an array of IMethodInfos for methods of this Type + that match the specified flags. + + + + + Returns a value indicating whether this Type has a public constructor taking the specified argument Types. + + + + + Construct an object of this Type, using the specified arguments. + + + + + An object implementing IXmlNodeBuilder is able to build + an XML representation of itself and any children. + + + + + Returns a TNode representing the current object. + + If true, children are included where applicable + A TNode representing the result + + + + Returns a TNode representing the current object after + adding it as a child of the supplied parent node. + + The parent node. + If true, children are included, where applicable + + + + + The ResultState class represents the outcome of running a test. + It contains two pieces of information. The Status of the test + is an enum indicating whether the test passed, failed, was + skipped or was inconclusive. The Label provides a more + detailed breakdown for use by client runners. + + + + + Initializes a new instance of the class. + + The TestStatus. + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + + + + Initializes a new instance of the class. + + The TestStatus. + The stage at which the result was produced + + + + Initializes a new instance of the class. + + The TestStatus. + The label. + The stage at which the result was produced + + + + The result is inconclusive + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test was skipped because it is explicit + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The test was not runnable. + + + + + A suite failed because one or more child tests failed or had errors + + + + + A suite failed in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeSetUp + + + + + A suite had an unexpected exception in its OneTimeDown + + + + + Gets the TestStatus for the test. + + The status. + + + + Gets the label under which this test result is + categorized, if any. + + + + + Gets the stage of test execution in which + the failure or other result took place. + + + + + Get a new ResultState, which is the same as the current + one but with the FailureSite set to the specified value. + + The FailureSite to use + A new ResultState + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occurred. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test can be executed. + + + + + The test is not runnable. + + + + + The test is runnable. + + + + + The test can only be run explicitly + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + TNode represents a single node in the XML representation + of a Test or TestResult. It replaces System.Xml.XmlNode and + System.Xml.Linq.XElement, providing a minimal set of methods + for operating on the XML in a platform-independent manner. + + + + + Constructs a new instance of TNode + + The name of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + + + + Constructs a new instance of TNode with a value + + The name of the node + The text content of the node + Flag indicating whether to use CDATA when writing the text + + + + Gets the name of the node + + + + + Gets the value of the node + + + + + Gets a flag indicating whether the value should be output using CDATA. + + + + + Gets the dictionary of attributes + + + + + Gets a list of child nodes + + + + + Gets the first ChildNode + + + + + Gets the XML representation of this node. + + + + + Create a TNode from it's XML text representation + + The XML text to be parsed + A TNode + + + + Adds a new element as a child of the current node and returns it. + + The element name. + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + + The element name + The text content of the new element + The newly created child element + + + + Adds a new element with a value as a child of the current node and returns it. + The value will be output using a CDATA section. + + The element name + The text content of the new element + The newly created child element + + + + Adds an attribute with a specified name and value to the XmlNode. + + The name of the attribute. + The value of the attribute. + + + + Finds a single descendant of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + + + Finds all descendants of this node matching an xpath + specification. The format of the specification is + limited to what is needed by NUnit and its tests. + + + + + Writes the XML representation of the node to an XmlWriter + + + + + + Class used to represent a list of XmlResults + + + + + Class used to represent the attributes of a node + + + + + Gets or sets the value associated with the specified key. + Overridden to return null if attribute is not found. + + The key. + Value of the attribute or null + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for equality with zero + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the supplied argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable to the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a superset of the collection supplied as an argument. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the actual value falls + inclusively within a specified range. + + from must be less than or equal to true + Inclusive beginning of the range. Must be less than or equal to to. + Inclusive end of the range. Must be greater than or equal to from. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + The test that is going to be run. + + + + Executed after each test is run + + The test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the _values of a property + + The collection of property _values + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an InvalidOperationException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an InvalidOperationException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It is derived from TestCaseParameters and adds a + fluent syntax for use in initializing the test case. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Marks the test case as explicit. + + + + + Marks the test case as explicit, specifying the reason. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Provide the context information of the current test. + This is an adapter for the internal ExecutionContext + class, hiding the internals from the user test. + + + + + Construct a TestContext for an ExecutionContext + + The ExecutionContext to adapt + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TextWriter that will send output to the current test result. + + + + + Get a representation of the current test. + + + + + Gets a Representation of the TestResult for the current test. + + + + + Gets the directory to be used for outputting files created + by this test run. + + + + + Gets the random generator. + + + The random generator. + + + + Write the string representation of a boolean value to the current result + + + Write a char to the current result + + + Write a char array to the current result + + + Write the string representation of a double to the current result + + + Write the string representation of an Int32 value to the current result + + + Write the string representation of an Int64 value to the current result + + + Write the string representation of a decimal value to the current result + + + Write the string representation of an object to the current result + + + Write the string representation of a Single value to the current result + + + Write a string to the current result + + + Write the string representation of a UInt32 value to the current result + + + Write the string representation of a UInt64 value to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a formatted string to the current result + + + Write a line terminator to the current result + + + Write the string representation of a boolean value to the current result followed by a line terminator + + + Write a char to the current result followed by a line terminator + + + Write a char array to the current result followed by a line terminator + + + Write the string representation of a double to the current result followed by a line terminator + + + Write the string representation of an Int32 value to the current result followed by a line terminator + + + Write the string representation of an Int64 value to the current result followed by a line terminator + + + Write the string representation of a decimal value to the current result followed by a line terminator + + + Write the string representation of an object to the current result followed by a line terminator + + + Write the string representation of a Single value to the current result followed by a line terminator + + + Write a string to the current result followed by a line terminator + + + Write the string representation of a UInt32 value to the current result followed by a line terminator + + + Write the string representation of a UInt64 value to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + Write a formatted string to the current result followed by a line terminator + + + + This method adds the a new ValueFormatterFactory to the + chain of responsibility used for fomatting values in messages. + The scope of the change is the current TestContext. + + The factory delegate + + + + This method provides a simplified way to add a ValueFormatter + delegate to the chain of responsibility, creating the factory + delegate internally. It is useful when the Type of the object + is the only criterion for selection of the formatter, since + it can be used without getting involved with a compould function. + + The type supported by this formatter + The ValueFormatter delegate + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Construct a TestAdapter for a Test + + The Test to be adapted + + + + Gets the unique Id of a test + + + + + The name of the test, which may or may not be + the same as the method name. + + + + + The name of the method representing the test. + + + + + The FullName of the test + + + + + The ClassName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a TestResult + + The TestResult to be adapted + + + + Gets a ResultState representing the outcome of the test. + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets the number of test cases that failed + when running the test and all its children. + + + + + Gets the number of test cases that passed + when running the test and all its children. + + + + + Gets the number of test cases that were skipped + when running the test and all its children. + + + + + Gets the number of test cases that were inconclusive + when running the test and all its children. + + + + + The TestFixtureData class represents a set of arguments + and other parameter info to be used for a parameterized + fixture. It is derived from TestFixtureParameters and adds a + fluent syntax for use in initializing the fixture. + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Marks the test fixture as explicit. + + + + + Marks the test fixture as explicit, specifying the reason. + + + + + Ignores this TestFixture, specifying the reason. + + The reason. + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected ArgumentException + + + + + Creates a constraint specifying an expected ArgumentNUllException + + + + + Creates a constraint specifying an expected InvalidOperationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Env is a static class that provides some of the features of + System.Environment that are not available under all runtimes + + + + + The newline sequence in the current environment. + + + + + Path to the 'My Documents' folder + + + + + Directory used for file output if not specified on commandline. + + + + + PackageSettings is a static class containing constant values that + are used as keys in setting up a TestPackage. These values are used in + the engine and framework. Setting values may be a string, int or bool. + + + + + Flag (bool) indicating whether tests are being debugged. + + + + + Flag (bool) indicating whether to pause execution of tests to allow + the user to attache a debugger. + + + + + The InternalTraceLevel for this run. Values are: "Default", + "Off", "Error", "Warning", "Info", "Debug", "Verbose". + Default is "Off". "Debug" and "Verbose" are synonyms. + + + + + Full path of the directory to be used for work and result files. + This path is provided to tests by the frameowrk TestContext. + + + + + The name of the config to use in loading a project. + If not specified, the first config found is used. + + + + + Bool indicating whether the engine should determine the private + bin path by examining the paths to all the tests. Defaults to + true unless PrivateBinPath is specified. + + + + + The ApplicationBase to use in loading the tests. If not + specified, and each assembly has its own process, then the + location of the assembly is used. For multiple assemblies + in a single process, the closest common root directory is used. + + + + + Path to the config file to use in running the tests. + + + + + Bool flag indicating whether a debugger should be launched at agent + startup. Used only for debugging NUnit itself. + + + + + Indicates how to load tests across AppDomains. Values are: + "Default", "None", "Single", "Multiple". Default is "Multiple" + if more than one assembly is loaded in a process. Otherwise, + it is "Single". + + + + + The private binpath used to locate assemblies. Directory paths + is separated by a semicolon. It's an error to specify this and + also set AutoBinPath to true. + + + + + The maximum number of test agents permitted to run simultneously. + Ignored if the ProcessModel is not set or defaulted to Multiple. + + + + + Indicates how to allocate assemblies to processes. Values are: + "Default", "Single", "Separate", "Multiple". Default is "Multiple" + for more than one assembly, "Separate" for a single assembly. + + + + + Indicates the desired runtime to use for the tests. Values + are strings like "net-4.5", "mono-4.0", etc. Default is to + use the target framework for which an assembly was built. + + + + + Bool flag indicating that the test should be run in a 32-bit process + on a 64-bit system. By default, NUNit runs in a 64-bit process on + a 64-bit system. Ignored if set on a 32-bit system. + + + + + Indicates that test runners should be disposed after the tests are executed + + + + + Bool flag indicating that the test assemblies should be shadow copied. + Defaults to false. + + + + + Integer value in milliseconds for the default timeout value + for test cases. If not specified, there is no timeout except + as specified by attributes on the tests themselves. + + + + + A TextWriter to which the internal trace will be sent. + + + + + A list of tests to be loaded. + + + + + The number of test threads to run for the assembly. If set to + 1, a single queue is used. If set to 0, tests are executed + directly, without queuing. + + + + + The random seed to be used for this assembly. If specified + as the value reported from a prior run, the framework should + generate identical random values for tests as were used for + that run, provided that no change has been made to the test + assembly. Default is a random value itself. + + + + + If true, execution stops after the first error or failure. + + + + + If true, use of the event queue is suppressed and test events are synchronous. + + + + + If the package represents an assembly, then this is the CLR version + stored in the assembly image. If it represents a project or other + group of assemblies, it is the maximum version for all the assemblies. + + + + + True if any assembly in the package requires running as a 32-bit + process when on a 64-bit system. + + + + + True if any assembly in the package requires a special assembly resolution hook + in the default AppDomain in order to find dependent assemblies. + + + + + The FrameworkName specified on a TargetFrameworkAttribute for the assembly + + + + + A shim of the .NET interface for platforms that do not support it. + Used to indicate that a control can be the target of a callback event on the server. + + + + + Processes a callback event that targets a control. + + + + + + Returns the results of a callback event that targets a control. + + + + + + A shim of the .NET attribute for platforms that do not support it. + + + + diff --git a/packages/repositories.config b/packages/repositories.config new file mode 100644 index 00000000..4eeba693 --- /dev/null +++ b/packages/repositories.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file