diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -18,3 +18,12 @@ MonoPlay/obj/ Implab.Test/Implab.Format.Test/bin/ Implab.Test/Implab.Format.Test/obj/ *.suo +Implab.Format.Test/bin/ +Implab.Format.Test/obj/ +packages/ +Implab.Playground/obj/ +Implab.Playground/bin/ +Implab.ServiceHost/bin/ +Implab.ServiceHost/obj/ +Implab.ServiceHost.Test/bin/ +Implab.ServiceHost.Test/obj/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -1,1 +1,6 @@ f1da3afc3521e0e1631ac19e09690bc0a241841a release v2.1 +34df34841225f14ec65f4a5f28585d32b55829ad v3.0.1-beta +547a2fc0d93ea5f867c778d7eeaa5888cc24fb9e v3.0.6 +f1696cdc3d7a5a9e19569567722285926c5d61b0 v3.0.8 +74e048cbaac8cdd5a0825b1fd8b47dd932a05ae8 v3.0.10 +95896f882995c74202bded87392585d287b16e82 v3.0.14 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceRoot}/Implab.Playground/bin/Debug/netcoreapp2.0/Implab.Playground.dll", + "args": [ + "-f", "netcoreapp2.0" + ], + "cwd": "${workspaceRoot}/Implab.Playground", + "stopAtEntry": false, + "console": "internalConsole" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +// Поместите параметры в этот файл, чтобы перезаписать параметры по умолчанию и пользовательские параметры. +{ + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/bin": true, + "**/obj": true + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,37 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "0.1.0", + "command": "dotnet", + "args": [ + ], + "showOutput": "silent", + "tasks": [ + { + "taskName": "build", + // Show the output window only if unrecognized errors occur. + "showOutput": "always", + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile", + + "args" : [ + "/p:Configuration=Debug" + ] + }, + { + "taskName": "clean", + // Show the output window only if unrecognized errors occur. + "showOutput": "always", + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile" + }, + { + "taskName": "test", + "isTestCommand": true, + // Show the output window only if unrecognized errors occur. + "showOutput": "always", + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Implab.Diagnostics.Interactive/Implab.Diagnostics.Interactive.csproj b/Implab.Diagnostics.Interactive/Implab.Diagnostics.Interactive.csproj deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/Implab.Diagnostics.Interactive.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Debug - AnyCPU - {1DB7DB0C-8AA9-484B-A681-33AE94038391} - Library - Properties - Implab.Diagnostics.Interactive - Implab.Diagnostics.Interactive - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - Form - - - TraceForm.cs - - - - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - TraceForm.cs - - - - - - - - \ No newline at end of file diff --git a/Implab.Diagnostics.Interactive/InteractiveListener.cs b/Implab.Diagnostics.Interactive/InteractiveListener.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/InteractiveListener.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Implab.Parallels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Implab.Diagnostics.Interactive -{ - public class InteractiveListener: ListenerBase - { - TraceForm m_form; - - SynchronizationContext m_syncGuiThread; - readonly Promise m_guiStarted = new Promise(); - - readonly IPromise m_guiFinished; - // readonly IPromise m_workerFinished = new Promise(); - - readonly MTQueue m_queue = new MTQueue(); - readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false); - - int m_queueLength; - bool m_exitPending; - - readonly object m_pauseLock = new object(); - bool m_paused; - readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true); - - public InteractiveListener() { - m_guiFinished = AsyncPool.RunThread(GuiThread); - /*m_workerFinished = */AsyncPool.RunThread(QueueThread); - - m_guiStarted.Join(); - } - - void GuiThread() { - m_form = new TraceForm(); // will create SynchronizationContext - - m_form.PauseEvents += (s,a) => Pause(); - m_form.ResumeEvents += (s, a) => Resume(); - - m_syncGuiThread = SynchronizationContext.Current; - m_guiStarted.Resolve(); - Application.Run(); - } - - void QueueThread() { - while (!m_exitPending) { - if (m_paused) - m_pauseEvent.WaitOne(); - - TraceViewItem item; - if (m_queue.TryDequeue(out item)) { - Interlocked.Decrement(ref m_queueLength); - - m_syncGuiThread.Send(x => m_form.AddTraceEvent(item),null); - } else { - m_queueEvent.WaitOne(); - } - } - } - - public void Pause() { - // for consistency we need to set this properties atomically - lock (m_pauseLock) { - m_pauseEvent.Reset(); - m_paused = true; - } - } - - public void Resume() { - // for consistency we need to set this properties atomically - lock (m_pauseLock) { - m_paused = false; - m_pauseEvent.Set(); - } - } - - void Enqueue(TraceViewItem item) { - m_queue.Enqueue(item); - if (Interlocked.Increment(ref m_queueLength) == 1) - m_queueEvent.Set(); - } - - public void ShowForm() { - m_syncGuiThread.Post(x => m_form.Show(), null); - } - - public void HideForm() { - m_syncGuiThread.Post(x => m_form.Hide(), null); - } - - void Terminate() { - m_exitPending = true; - Resume(); - m_syncGuiThread.Post(x => Application.ExitThread(), null); - } - - protected override void Dispose(bool disposing) { - if (disposing) { - Terminate(); - m_guiFinished.Join(); - } - base.Dispose(disposing); - } - - public override void Write(LogEventArgs args, object entry) { - var item = new TraceViewItem { - Indent = args.Operation.Level, - Message = entry.ToString(), - Thread = args.ThreadId, - Channel = args.ChannelName, - Timestamp = Environment.TickCount - }; - - Enqueue(item); - } - } -} diff --git a/Implab.Diagnostics.Interactive/Properties/AssemblyInfo.cs b/Implab.Diagnostics.Interactive/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Implab.Diagnostics.Interactive")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Implab.Diagnostics.Interactive")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[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("1c156c51-4884-43b2-a823-d86313872e82")] - -// 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/Implab.Diagnostics.Interactive/Properties/DataSources/TraceViewItem.datasource b/Implab.Diagnostics.Interactive/Properties/DataSources/TraceViewItem.datasource deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/Properties/DataSources/TraceViewItem.datasource +++ /dev/null @@ -1,10 +0,0 @@ - - - - Implab.Diagnostics.Interactive.TraceViewItem, Implab.Diagnostics.Interactive - \ No newline at end of file diff --git a/Implab.Diagnostics.Interactive/TextStyle.cs b/Implab.Diagnostics.Interactive/TextStyle.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/TextStyle.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Implab.Diagnostics.Interactive { - class TextStyle { - public Color TextColor { - get; - set; - } - - public FontStyle FontStyle { - get; - set; - } - - public int PaddingLeft { - get; - set; - } - } -} diff --git a/Implab.Diagnostics.Interactive/TraceForm.Designer.cs b/Implab.Diagnostics.Interactive/TraceForm.Designer.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/TraceForm.Designer.cs +++ /dev/null @@ -1,134 +0,0 @@ -namespace Implab.Diagnostics.Interactive { - partial class TraceForm { - /// - /// 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.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.eventsDataGrid = new System.Windows.Forms.DataGridView(); - this.traceViewItemBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.threadDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Channel = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).BeginInit(); - this.SuspendLayout(); - // - // eventsDataGrid - // - this.eventsDataGrid.AllowUserToAddRows = false; - this.eventsDataGrid.AllowUserToDeleteRows = false; - this.eventsDataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.eventsDataGrid.AutoGenerateColumns = false; - this.eventsDataGrid.BackgroundColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - dataGridViewCellStyle1.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.eventsDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; - this.eventsDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.eventsDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.threadDataGridViewTextBoxColumn, - this.Channel, - this.messageDataGridViewTextBoxColumn}); - this.eventsDataGrid.DataSource = this.traceViewItemBindingSource; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.eventsDataGrid.DefaultCellStyle = dataGridViewCellStyle3; - this.eventsDataGrid.Location = new System.Drawing.Point(12, 12); - this.eventsDataGrid.Name = "eventsDataGrid"; - this.eventsDataGrid.ReadOnly = true; - this.eventsDataGrid.RowHeadersWidth = 17; - this.eventsDataGrid.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.eventsDataGrid.Size = new System.Drawing.Size(939, 480); - this.eventsDataGrid.TabIndex = 1; - this.eventsDataGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.eventsDataGrid_CellFormatting); - // - // traceViewItemBindingSource - // - this.traceViewItemBindingSource.DataSource = typeof(Implab.Diagnostics.Interactive.TraceViewItem); - // - // threadDataGridViewTextBoxColumn - // - this.threadDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; - this.threadDataGridViewTextBoxColumn.DataPropertyName = "Thread"; - this.threadDataGridViewTextBoxColumn.HeaderText = "TID"; - this.threadDataGridViewTextBoxColumn.Name = "threadDataGridViewTextBoxColumn"; - this.threadDataGridViewTextBoxColumn.ReadOnly = true; - this.threadDataGridViewTextBoxColumn.Width = 5; - // - // Channel - // - this.Channel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.Channel.DataPropertyName = "Channel"; - this.Channel.HeaderText = "Channel"; - this.Channel.Name = "Channel"; - this.Channel.ReadOnly = true; - this.Channel.Width = 79; - // - // messageDataGridViewTextBoxColumn - // - this.messageDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.messageDataGridViewTextBoxColumn.DataPropertyName = "FormattedMessage"; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.messageDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; - this.messageDataGridViewTextBoxColumn.HeaderText = "Message"; - this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn"; - this.messageDataGridViewTextBoxColumn.ReadOnly = true; - // - // TraceForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(963, 504); - this.Controls.Add(this.eventsDataGrid); - this.Name = "TraceForm"; - this.Text = "TraceForm"; - ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.DataGridView eventsDataGrid; - private System.Windows.Forms.BindingSource traceViewItemBindingSource; - private System.Windows.Forms.DataGridViewTextBoxColumn threadDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn Channel; - private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn; - - } -} \ No newline at end of file diff --git a/Implab.Diagnostics.Interactive/TraceForm.cs b/Implab.Diagnostics.Interactive/TraceForm.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/TraceForm.cs +++ /dev/null @@ -1,53 +0,0 @@ -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 Implab.Diagnostics.Interactive { - public partial class TraceForm : Form { - readonly Dictionary m_threadColors = new Dictionary(); - readonly Random m_rand = new Random(); - - public event EventHandler PauseEvents; - - public event EventHandler ResumeEvents; - - public TraceForm() { - InitializeComponent(); - } - - protected override void OnFormClosing(FormClosingEventArgs e) { - base.OnFormClosing(e); - if (!e.Cancel && e.CloseReason == CloseReason.UserClosing) { - e.Cancel = true; - Hide(); - } - } - - public void AddTraceEvent(TraceViewItem item) { - traceViewItemBindingSource.Add(item); - eventsDataGrid.FirstDisplayedScrollingRowIndex = eventsDataGrid.RowCount - 1; - } - - Color GetThreadColor(int thread) { - Color result; - if (!m_threadColors.TryGetValue(thread, out result)) { - result = Color.FromArgb(m_rand.Next(4)*64, m_rand.Next(4)*64, m_rand.Next(4)*64); - m_threadColors[thread] = result; - } - return result; - } - - private void eventsDataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { - var data = (TraceViewItem)traceViewItemBindingSource[e.RowIndex]; - if (e.ColumnIndex == messageDataGridViewTextBoxColumn.Index) - e.CellStyle.Padding = new Padding(data.Indent * 10,0,0,0); - e.CellStyle.ForeColor = GetThreadColor(data.Thread); - } - } -} diff --git a/Implab.Diagnostics.Interactive/TraceForm.resx b/Implab.Diagnostics.Interactive/TraceForm.resx deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/TraceForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - True - - - 17, 17 - - \ No newline at end of file diff --git a/Implab.Diagnostics.Interactive/TraceViewItem.cs b/Implab.Diagnostics.Interactive/TraceViewItem.cs deleted file mode 100644 --- a/Implab.Diagnostics.Interactive/TraceViewItem.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Implab.Diagnostics.Interactive { - public class TraceViewItem { - string m_formattedValue; - - public string Message { get; set; } - public int Timestamp { get; set; } - public int Indent { get; set; } - public int Thread { get; set; } - public string Channel { get; set; } - - public string FormattedMessage { - get { - if (m_formattedValue == null) { - m_formattedValue = Message.Replace("\r",String.Empty).Replace("\n", " | "); - } - return m_formattedValue; - } - } - } -} diff --git a/Implab.Fx.Test/Implab.Fx.Test.csproj b/Implab.Fx.Test/Implab.Fx.Test.csproj deleted file mode 100644 --- a/Implab.Fx.Test/Implab.Fx.Test.csproj +++ /dev/null @@ -1,114 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {2F31E405-E267-4195-A05D-574093C21209} - Library - Properties - Implab.Fx.Test - Implab.Fx.Test - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - 3.5 - - - - - - - - - - - - Form - - - MainForm.cs - - - Form - - - OverlayForm.cs - - - - - MainForm.cs - - - - - OverlayForm.cs - - - - - - - {06E706F8-6881-43EB-927E-FFC503AF6ABC} - Implab.Fx - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - \ No newline at end of file diff --git a/Implab.Fx.Test/Implab.Fx.Test.mono.csproj b/Implab.Fx.Test/Implab.Fx.Test.mono.csproj deleted file mode 100644 --- a/Implab.Fx.Test/Implab.Fx.Test.mono.csproj +++ /dev/null @@ -1,80 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {2BD05F84-E067-4B87-9477-FDC2676A21C6} - Library - Implab.Fx.Test - Implab.Fx.Test - v4.5 - - - true - full - false - bin\Debug - DEBUG;MONO - prompt - 4 - false - - - true - bin\Release - prompt - 4 - false - MONO - - - true - full - false - bin\Debug - DEBUG;TRACE;NET_4_5;MONO - prompt - 4 - false - - - true - bin\Release - NET_4_5;MONO - prompt - 4 - false - - - - - - - - - - - - {06E706F8-6881-43EB-927E-FFC503AF6ABC} - Implab.Fx - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Implab.Fx.Test/OverlayTest.cs b/Implab.Fx.Test/OverlayTest.cs deleted file mode 100644 --- a/Implab.Fx.Test/OverlayTest.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Windows.Forms; -using Implab.Fx.Test.Sample; -using Implab.Fx; - -#if MONO - -using NUnit.Framework; -using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; -using TestMethod = NUnit.Framework.TestAttribute; - -#else - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -#endif - -namespace Implab.Fx.Test -{ - [TestClass] - public class OverlayTest - { - [TestMethod] - public void TestMethod1() - { - var mainForm = new MainForm(); - - mainForm.ButtonEvent += (sender, args) => - { - var overlay = new OverlayForm(); - mainForm.OverlayFadeIn(overlay).On( - o => o.ButtonEvent += (s2, args2) => o.CloseFadeOut() - ); - }; - - Application.Run(mainForm); - } - } -} diff --git a/Implab.Fx.Test/Properties/AssemblyInfo.cs b/Implab.Fx.Test/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/Implab.Fx.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Implab.Fx.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Implab.Fx.Test")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[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("ac9cc552-177e-4b6d-923c-763dc6f87dd6")] - -// 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.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Implab.Fx.Test/Sample/MainForm.Designer.cs b/Implab.Fx.Test/Sample/MainForm.Designer.cs deleted file mode 100644 --- a/Implab.Fx.Test/Sample/MainForm.Designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace Implab.Fx.Test.Sample -{ - partial class MainForm - { - /// - /// 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.button1 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.listBox1 = new System.Windows.Forms.ListBox(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(138, 12); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 0; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // comboBox1 - // - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(138, 41); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(121, 21); - this.comboBox1.TabIndex = 1; - // - // listBox1 - // - this.listBox1.FormattingEnabled = true; - this.listBox1.Location = new System.Drawing.Point(12, 12); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(120, 95); - this.listBox1.TabIndex = 2; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 262); - this.Controls.Add(this.listBox1); - this.Controls.Add(this.comboBox1); - this.Controls.Add(this.button1); - this.Name = "MainForm"; - this.Text = "MainForm"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button button1; - private System.Windows.Forms.ComboBox comboBox1; - private System.Windows.Forms.ListBox listBox1; - } -} \ No newline at end of file diff --git a/Implab.Fx.Test/Sample/MainForm.cs b/Implab.Fx.Test/Sample/MainForm.cs deleted file mode 100644 --- a/Implab.Fx.Test/Sample/MainForm.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace Implab.Fx.Test.Sample -{ - public partial class MainForm : Form - { - public event EventHandler ButtonEvent; - - public MainForm() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - EventHandler temp = ButtonEvent; - if (temp != null) - { - temp(this,new EventArgs()); - } - } - } -} diff --git a/Implab.Fx.Test/Sample/MainForm.resx b/Implab.Fx.Test/Sample/MainForm.resx deleted file mode 100644 --- a/Implab.Fx.Test/Sample/MainForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/Implab.Fx.Test/Sample/OverlayForm.Designer.cs b/Implab.Fx.Test/Sample/OverlayForm.Designer.cs deleted file mode 100644 --- a/Implab.Fx.Test/Sample/OverlayForm.Designer.cs +++ /dev/null @@ -1,99 +0,0 @@ -namespace Implab.Fx.Test.Sample -{ - partial class OverlayForm - { - /// - /// 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.button1 = new System.Windows.Forms.Button(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.label1 = new System.Windows.Forms.Label(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 12); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 0; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // checkBox1 - // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(12, 88); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(80, 17); - this.checkBox1.TabIndex = 1; - this.checkBox1.Text = "checkBox1"; - this.checkBox1.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 42); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 2; - this.label1.Text = "label1"; - // - // progressBar1 - // - this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(12, 59); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(260, 23); - this.progressBar1.TabIndex = 3; - // - // OverlayForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 262); - this.Controls.Add(this.progressBar1); - this.Controls.Add(this.label1); - this.Controls.Add(this.checkBox1); - this.Controls.Add(this.button1); - this.Name = "OverlayForm"; - this.Text = "OverlayForm"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button button1; - private System.Windows.Forms.CheckBox checkBox1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ProgressBar progressBar1; - } -} \ No newline at end of file diff --git a/Implab.Fx.Test/Sample/OverlayForm.cs b/Implab.Fx.Test/Sample/OverlayForm.cs deleted file mode 100644 --- a/Implab.Fx.Test/Sample/OverlayForm.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace Implab.Fx.Test.Sample -{ - public partial class OverlayForm : Form - { - public event EventHandler ButtonEvent; - - public OverlayForm() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - EventHandler temp = ButtonEvent; - if (temp != null) - { - temp(this,new EventArgs()); - } - } - } -} diff --git a/Implab.Fx.Test/Sample/OverlayForm.resx b/Implab.Fx.Test/Sample/OverlayForm.resx deleted file mode 100644 --- a/Implab.Fx.Test/Sample/OverlayForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/Implab.Fx/Animation.cs b/Implab.Fx/Animation.cs deleted file mode 100644 --- a/Implab.Fx/Animation.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Timers; -using System.ComponentModel; -using System.Diagnostics; - -namespace Implab.Fx -{ - public delegate void AnimationStep(T target, int elapsed, int duration); - - public class Animation where TArg: class - { - int m_duration; - int m_delay; - int m_elapsed; - int m_prevTicks; - TArg m_arg; - ISynchronizeInvoke m_syncronizationObject; - - public event AnimationStep Step; - - Promise m_promise; - - public Animation(TArg target, int duration, int delay) - { - if (duration <= 0) - throw new ArgumentOutOfRangeException("duration"); - if (delay <= 0) - throw new ArgumentOutOfRangeException("delay"); - - m_arg = target; - m_syncronizationObject = target as ISynchronizeInvoke; - m_duration = duration; - m_delay = delay; - m_promise = new Promise(); - } - - public Animation(TArg target) - : this(target, 500, 30) - { - } - - public TArg Traget - { - get { return m_arg; } - } - - public Promise Play() - { - var timer = new Timer(m_delay); - - timer.AutoReset = false; - timer.SynchronizingObject = m_syncronizationObject; - timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); - - m_prevTicks = Environment.TickCount; - - timer.Start(); - - return m_promise; - } - - void timer_Elapsed(object sender, ElapsedEventArgs args) - { - var timer = sender as Timer; - - var dt = Environment.TickCount - m_prevTicks; - m_prevTicks = Environment.TickCount; - - m_elapsed += dt; - - if (m_elapsed > m_duration) - m_elapsed = m_duration; - - try - { - var handler = Step; - if (handler != null) - handler(m_arg, m_elapsed, m_duration); - } - catch (Exception e) - { - Trace.TraceError(e.ToString()); - } - - if (m_elapsed < m_duration) - timer.Start(); - else - { - timer.Dispose(); - m_promise.Resolve(m_arg); - } - } - } -} diff --git a/Implab.Fx/AnimationHelpers.cs b/Implab.Fx/AnimationHelpers.cs deleted file mode 100644 --- a/Implab.Fx/AnimationHelpers.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Diagnostics; - -namespace Implab.Fx -{ - public static class AnimationHelpers - { - public static Animation AnimateProperty(this Animation animation, Action setter, Func getter, TVal newValue, Func fx) where TTarget : class - { - if (animation == null) - throw new ArgumentNullException("animation"); - - TVal oldValue = getter(animation.Traget); - - animation.Step += (target, elaped, duration) => - { - var value = fx(oldValue, newValue, elaped, duration); - setter(target, value); - }; - - return animation; - } - - public static Animation AnimateTransparency(this T ctl, float newValue) where T : Form - { - var anim = new Animation(ctl); - - anim.AnimateProperty( - (target, value) => target.Opacity = value, - target => target.Opacity, - newValue, - (ov, nv, el, du) => ov + ((float)el / du) * (nv - ov) - ); - return anim; - } - - public static IPromise CloseFadeOut(this T ctl) where T : Form - { - var anim = ctl.AnimateTransparency(0); - - return anim - .Play() - .DispatchToControl(ctl) - .Then(frm => { - frm.Close(); - return frm; - }); - } - - public static IPromise OverlayFadeIn(this Form that, T overlay) where T : Form - { - if (that == null) - throw new ArgumentNullException("that"); - if (overlay == null) - throw new ArgumentNullException("overlay"); - - // setup overlay - overlay.Opacity = 0; - overlay.FormBorderStyle = FormBorderStyle.None; - overlay.ShowInTaskbar = false; - - that.AddOwnedForm(overlay); - - EventHandler handler = (object sender, EventArgs args) => - { - overlay.Bounds = that.RectangleToScreen(that.ClientRectangle); - }; - - // attach handlers - that.Move += handler; - that.Resize += handler; - that.Shown += handler; - - // remove handlers to release overlay - overlay.FormClosed += (sender, args) => - { - that.Move -= handler; - that.Resize -= handler; - that.Shown -= handler; - }; - - overlay.Show(that); - overlay.Bounds = that.RectangleToScreen(that.ClientRectangle); - - return overlay - .AnimateTransparency(1) - .Play() - .DispatchToControl(overlay); - } - } -} diff --git a/Implab.Fx/ControlBoundPromise.cs b/Implab.Fx/ControlBoundPromise.cs deleted file mode 100644 --- a/Implab.Fx/ControlBoundPromise.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Windows.Forms; -using System; - - -namespace Implab.Fx { - public class ControlBoundPromise : Promise { - readonly Control m_target; - - public ControlBoundPromise(Control target) { - Safe.ArgumentNotNull(target, "target"); - - m_target = target; - } - - protected override void SignalHandler(HandlerDescriptor handler, int signal) { - if (m_target.InvokeRequired) - m_target.BeginInvoke(new Action.HandlerDescriptor, int>(base.SignalHandler), handler, signal); - else - base.SignalHandler(handler, signal); - } - } -} - diff --git a/Implab.Fx/Implab.Fx.csproj b/Implab.Fx/Implab.Fx.csproj deleted file mode 100644 --- a/Implab.Fx/Implab.Fx.csproj +++ /dev/null @@ -1,88 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {06E706F8-6881-43EB-927E-FFC503AF6ABC} - Library - Properties - Implab.Fx - Implab.Fx - v4.5 - 512 - 0.2 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - \ No newline at end of file diff --git a/Implab.Fx/PromiseHelpers.cs b/Implab.Fx/PromiseHelpers.cs deleted file mode 100644 --- a/Implab.Fx/PromiseHelpers.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Threading; - -namespace Implab.Fx -{ - public static class PromiseHelpers - { - /// - /// Перенаправляет обработку обещания в поток указанного элемента управления. - /// - /// Тип результата обещания - /// Исходное обещание - /// Элемент управления - /// Новое обещание, обработчики которого будут выполнены в потоке элемента управления. - /// Параметр не может быть null. - /// - /// client - /// .Get("description.txt") // returns a promise - /// .DispatchToControl(m_ctl) // handle the promise in the thread of the control - /// .Then( - /// description => m_ctl.Text = description // now it's safe - /// ) - /// - public static IPromise DispatchToControl(this IPromise that, Control ctl) - { - Safe.ArgumentNotNull(that, "that"); - Safe.ArgumentNotNull(ctl, "ctl"); - - var directed = new ControlBoundPromise(ctl); - - directed.On(that.Cancel, PromiseEventType.Cancelled); - - that.On( - directed.Resolve, - directed.Reject, - directed.Cancel - ); - - return directed; - } - } -} diff --git a/Implab.Fx/Properties/AssemblyInfo.cs b/Implab.Fx/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/Implab.Fx/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Implab.Fx")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Implab.Fx")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[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("d239c29f-98e2-4942-9569-554a8511d07b")] - -// 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("2.0.*")] diff --git a/Implab.Playground/App.config b/Implab.Playground/App.config new file mode 100644 --- /dev/null +++ b/Implab.Playground/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Implab.Playground/Implab.Playground.csproj b/Implab.Playground/Implab.Playground.csproj new file mode 100644 --- /dev/null +++ b/Implab.Playground/Implab.Playground.csproj @@ -0,0 +1,27 @@ + + + netcoreapp2.0;;net46 + /usr/lib/mono/4.6-api/ + + + + netcoreapp2.0;net46 + + + + Exe + false + + + + + + + + + + + + + + diff --git a/Implab.Playground/Program.cs b/Implab.Playground/Program.cs new file mode 100644 --- /dev/null +++ b/Implab.Playground/Program.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Dynamic; +using System.Linq; +using Implab.Components; +using Implab.Diagnostics; +using Implab.ServiceHost.Unity; +using Implab.Xml; +using Unity; +using Unity.Injection; +using Unity.Registration; + +namespace Implab.Playground { + using System.Reactive.Linq; + using static Trace; + + class Foo { + + } + + class Bar : Foo { + + } + public class Program { + + static void Main(string[] args) { + Trace.Log("First!"); + Log("+1!"); + + using(TraceRegistry.Global.OfType().Subscribe(ch => { + Console.WriteLine($"{ch.Id}: {ch.Source.Name}"); + + })) { + Trace.Log("Hi!"); + Log("Respect!"); + } + } + + + } +} diff --git a/Implab.Playground/data/sample.xml b/Implab.Playground/data/sample.xml new file mode 100644 --- /dev/null +++ b/Implab.Playground/data/sample.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + FOO! + + + + + + + GOOD + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Baaar + + + + !]]> + + + + + name @#$%^&]]> + + + false + + + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/Implab.ServiceHost.Test.csproj b/Implab.ServiceHost.Test/Implab.ServiceHost.Test.csproj new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/Implab.ServiceHost.Test.csproj @@ -0,0 +1,29 @@ + + + netcoreapp2.0;net46 + /usr/lib/mono/4.5/ + + + + netcoreapp2.0;net46 + + + + false + + + + + + + + + + + + + + + + + diff --git a/Implab.ServiceHost.Test/data/container/basic.xml b/Implab.ServiceHost.Test/data/container/basic.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/basic.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + I'm default! + + + + + + + GOOD + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Baaar + + + + !]]> + + + + + name @#$%^&]]> + + + false + + + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/data/container/empty.xml b/Implab.ServiceHost.Test/data/container/empty.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/empty.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/data/container/generic.services.xml b/Implab.ServiceHost.Test/data/container/generic.services.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/generic.services.xml @@ -0,0 +1,65 @@ + + + + + + + + + + 5 + + + + + 3 + + + + + 1 + + + + + 2 + + + + + + + + + + + + + + + + + boxForString + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/data/container/p2.xml b/Implab.ServiceHost.Test/data/container/p2.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/p2.xml @@ -0,0 +1,6 @@ + + + Trohn + Javolta + 88 + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/data/container/serialized.instances.xml b/Implab.ServiceHost.Test/data/container/serialized.instances.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/serialized.instances.xml @@ -0,0 +1,16 @@ + + + + + + + + + + Com + Truise + 99 + + + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/data/container/simple.services.xml b/Implab.ServiceHost.Test/data/container/simple.services.xml new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/data/container/simple.services.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + 1 + 2 + 3 + + + + + + + + + + + + + + + + + + + 5 + + + + + 3 + + + + + 1 + + + + + 2 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/Baz.cs b/Implab.ServiceHost.Test/src/Mock/Baz.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/Baz.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Implab.ServiceHost.Test.Mock { + public class Baz { + + public Guid Id { + get; set; + } + + public int[] Numbers { + get; set; + } + + public Nut[] Nuts { + get; set; + } + + public class Nut { + public int Size { get; set; } + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/BazFactory.cs b/Implab.ServiceHost.Test/src/Mock/BazFactory.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/BazFactory.cs @@ -0,0 +1,17 @@ +using System; +using Implab.Components; + +namespace Implab.ServiceHost.Test.Mock { + public class BazFactory : IFactory { + + public Func IdGenerator { + get; set; + } + + Baz IFactory.Create() { + return new Baz { + Id = IdGenerator?.Invoke() ?? Guid.Empty + }; + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/BoxFactory`1.cs b/Implab.ServiceHost.Test/src/Mock/BoxFactory`1.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/BoxFactory`1.cs @@ -0,0 +1,13 @@ +using System; +using Implab.Components; + +namespace Implab.ServiceHost.Test.Mock { + public class BoxFactory : IFactory> { + public IBox Create() { + return new Box { + Name = "Creepy sugar" + }; + } + } + +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/Box`1.cs b/Implab.ServiceHost.Test/src/Mock/Box`1.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/Box`1.cs @@ -0,0 +1,13 @@ +namespace Implab.ServiceHost.Test.Mock { + public class Box : IBox { + + public string Name { get; set; } + + public T Value { get; set; } + + public T GetBoxValue() { + return Value; + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/GuidFactory.cs b/Implab.ServiceHost.Test/src/Mock/GuidFactory.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/GuidFactory.cs @@ -0,0 +1,10 @@ +using System; +using Implab.Components; + +namespace Implab.ServiceHost.Test.Mock { + public class GuidFactory : IFactory { + public Guid Create() { + return Guid.NewGuid(); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/IBox.cs b/Implab.ServiceHost.Test/src/Mock/IBox.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/IBox.cs @@ -0,0 +1,6 @@ +namespace Implab.ServiceHost.Test.Mock { + public interface IBox { + string Name { get; } + T GetBoxValue(); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/Person.cs b/Implab.ServiceHost.Test/src/Mock/Person.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/Person.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Test.Mock +{ + [XmlRoot(Namespace="urn:implab:test:model")] + public class Person { + public string FirstName { get; set; } + + public string LastName { get; set; } + + public int Age { get; set; } + + [XmlIgnore] + public bool AgeSpecified { get; set; } + + + [XmlElement("Tag")] + public string[] Tags { get; set; } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/Mock/SetOfBoxes`1.cs b/Implab.ServiceHost.Test/src/Mock/SetOfBoxes`1.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/Mock/SetOfBoxes`1.cs @@ -0,0 +1,21 @@ +using System; +using System.Linq; + +namespace Implab.ServiceHost.Test.Mock { + public class SetOfBoxes { + + public Guid Uuid { get; set; } + + public IBox[] Boxes { + get; set; + } + + public void BoxValues(T[] items) { + if (items == null || items.Length == 0) + return; + + Boxes = items.Select(x => new Box {Value = x}).ToArray(); + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost.Test/src/UnityConfigTest.cs b/Implab.ServiceHost.Test/src/UnityConfigTest.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost.Test/src/UnityConfigTest.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Implab.Components; +using Implab.Diagnostics; +using Implab.ServiceHost.Test.Mock; +using Implab.ServiceHost.Unity; +using Unity; +using Xunit; + +namespace Implab.Test { + + public class UnityConfigTest { + + [Fact] + public void CreateContainer() { + var container = new UnityContainer(); + + container.LoadXmlConfiguration(Path.Combine("data","container","empty.xml")); + } + + [Fact] + public void SimpleServicesContainer() { + var container = new UnityContainer(); + + container.LoadXmlConfiguration(Path.Combine("data","container","simple.services.xml")); + + // named service registration + var baz1 = container.Resolve("Baz1"); + + Assert.Equal(new [] {1,2,3}, baz1.Numbers); + + // default service registration + var baz = container.Resolve(); + + Assert.Equal(new [] {2,5,5,1,3}, baz.Nuts.Select(x => x.Size)); + + // ServiceFactory registered without a name + // explicitly provides 'Baz2' service + var baz2 = container.Resolve("Baz2"); + + // ServiceFactory registered with name 'Baz3' + // provides by default the service registration with same name + var baz3 = container.Resolve("Baz3"); + + // This factory uses GuidGenerator registration + // to generate a new id value + Assert.NotEqual(Guid.Empty, baz3.Id); + } + + [Fact] + public void GenericServicesContainer() { + var container = new UnityContainer(); + container.LoadXmlConfiguration(Path.Combine("data","container","generic.services.xml")); + + // resolve using a generig interface mapping + var box = container.Resolve>(); + + Assert.NotNull(box.GetBoxValue()); + + // registered generic defines dependency of type {T} + // in this case it should resolve to the default Nut with Size=2 + Assert.Equal(box.GetBoxValue().Size,2); + + // generic factory which provides generic services + var box2 = container.Resolve>(); + + var set1 = container.Resolve>(); + + Assert.Equal(new int?[] {null,2,1}, set1.Boxes?.Select(x => x.GetBoxValue()?.Size)); + } + + [Fact] + public void SerializedInstances() { + var container = new UnityContainer(); + container.LoadXmlConfiguration(Path.Combine("data","container","serialized.instances.xml")); + + var p1 = container.Resolve("p1"); + var p2 = container.Resolve("p2"); + + Assert.Equal("Com", p1.FirstName); + Assert.True(p1.AgeSpecified); + Assert.Equal(99, p1.Age); + + Assert.Equal("Javolta", p2.LastName); + Assert.True(p2.AgeSpecified); + Assert.Equal(88, p2.Age); + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/Implab.ServiceHost.csproj b/Implab.ServiceHost/Implab.ServiceHost.csproj new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/Implab.ServiceHost.csproj @@ -0,0 +1,36 @@ + + + + Sergey Smirnov + Implab.ServiceHost + The configurable application host. + Provides simple and flexible Xml configuration for UnityContainer. + + 2012-2018 Sergey Smirnov + 1.0.3 + https://bitbucket.org/wozard/implabnet/src/v3/Implab/license.txt + https://bitbucket.org/wozard/implabnet + https://bitbucket.org/wozard/implabnet + mercurial + Implab;Xml configuration;IoC;Unity container + + + + + netcoreapp2.0;net46 + /usr/lib/mono/4.5/ + + + + netcoreapp2.0;net46 + + + + + + + + + + + diff --git a/Implab.ServiceHost/docs/XmlConfiguration.ru.md b/Implab.ServiceHost/docs/XmlConfiguration.ru.md new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/docs/XmlConfiguration.ru.md @@ -0,0 +1,113 @@ +# XML Конфигурация IoC контейнера + +Библиоетка создавалась для загрузки и применения конфигурации к IoC контейнеру, она не предназначена для конфигурирования +контейнера во время выполнения, большинство контейнеров уже обладают данным функционалом. + +На данный момент поддерживается единственный вид контейнера - [Unity Container](https://unitycontainer.github.io/) + +Unity уже обладает средствами загрузки конфигурации из XML, данная библиотека реализует аналогичный функционал, кроме того, позволяет решать следующие задачи: + +- Конфигурация является простым Xml документом, который можно получить из любого источика и не ограничивается `.config` файлами приложения +- Включение существующе конфигурации `` в текущую +- Поддержка сериализованных объектов в качестве регистраций сервисов и параметров +- Поддержка специфиакции генериков любой вложенности, например `Dictionary{Foo,Bar{Int32}}` +- Поддержка фабрик в XML конфигурации +- Расширение схемы XML конфигурации собственными элементами + +## Общая архитектура + +Пространство имен `Implab.ServiceHost.Unity` содержит в себе классы для загрузки и применения XML конфигурации к IoC контейнеру. + +Применение конфигурации к контейнеру состоит из следующих основных шагов: + +1. Настраивается схема `ContainerConfigurationSchema` XML конфигурации контейнера +2. Загружается документ и десереализуется в виде `ContainerElement` +3. Создается `ContainerBuilder` при помощи которого применяются настройки из `ContainerElement` к контейнеру + +Схема `ContainerConfigurationSchema` определяет элементы документа, которые могут быть использованы в конфигурации контейнера, позволяет создать `XmlSerializer`, который используется для загрузки конфигурации. + +`ContainerBuilder` - основной класс, который используется для применения конфигурации к контейнеру, он добавляет записи регистрации сервисов из конфигурации в контейнер. + +`ContainerElement` - Конфигурация контейнера, которая загружается из документа, состоит из директив для `ContainerBuilder`, а также из записей регистрации сервисов. + +В библиотеки приняты следующие правила именования классов: + +- `***Builder` используются для применения конфигурации к контейнеру, +- `***Element` содержат информацию о конфигурации и десериализуются из исходного документа. + +## Структура конфигурации контейнера + +Элемент верхнего уровня всегда `container`, он используется для хранения набора элеметов, которые распознаются и выполняются `ContainerBuilder`. + +Все элементы, входящие в контейнер наследуются от абстрактного класса `ContainerItemElement`, +который позволяет получить текущий `ContainerBuilder` и выполнить над ним какие-либо действия. + +Основные элементы конфигурации контенейра + +- `` - включение конфигурации из указанного места +- `` - добавление пространства имен для поиска типов +- `` - добавление в контейнер регистрации типа ``My.App.MyGenericType`1`` +- `` - фабрика, регистрирует свой тип, а также тип `Foo` +- `` - сериализованный экземпляр объекта, использует `XmlSerializer` для десериализации +- `` - значение объекта в виде строки, используется для простых типов + +Полный набор элементов, доступных для использования в контейнере определяет схема `ContainerConfigurationSchema`, +разработчик может расширить контейнер совими собственными элементами зарегистрировав их в схеме. + +### register + +О + + +Например, мы используем компоненту `MyHttpClient` для загрузки данных + +```xml + + + socks5://proxy1.my.company + + +``` + +При частом использовании можно сделать описание конфигурации несколько проще, +описав новый эелемент конфигурации + +```csharp +public class MyHttpClientElement : ContainerItemElement { + + public string Proxy { get; set; } + + public override void Visit(ContainerBuilder builder) { + // создаем описание элемента + var registration = new RegistrationElement { + RegistrationType = "IClient", + ImplementationType = "My.App.MyHttpClient", + Injectors = new [] { + new PropertyInjectionElement { + Name = "Proxy", + Value = ValueParameterElement { + Value = Proxy + } + } + } + }; + + // применяем созданное описание к контейнеру + builder.Visit(registration) + } +} +``` + +Регистрируем новый элемент в схеме + +```csharp +schema.RegisterContainerElement("http"); +``` + +Используем новый элемент в конфигурации + +```xml + + socks5://proxy1.my.company + +``` \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/AbstractContainerItem.cs b/Implab.ServiceHost/src/Unity/AbstractContainerItem.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/AbstractContainerItem.cs @@ -0,0 +1,12 @@ +namespace Implab.ServiceHost.Unity { + + /// + /// Базовый класс для элеметов контейнера. + /// + /// + /// XmlSerializer требует использования классов при объявлении свойств, которые будут сериализованы + /// + public abstract class AbstractContainerItem { + public abstract void Visit(ContainerBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/AbstractInjectionParameter.cs b/Implab.ServiceHost/src/Unity/AbstractInjectionParameter.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/AbstractInjectionParameter.cs @@ -0,0 +1,12 @@ +using System; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public abstract class AbstractInjectionParameter : IInjectionParameter { + + [XmlAttribute("type")] + public string TypeName { get; set; } + + public abstract void Visit(InjectionParameterBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/AbstractMemberInjection.cs b/Implab.ServiceHost/src/Unity/AbstractMemberInjection.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/AbstractMemberInjection.cs @@ -0,0 +1,10 @@ +using System; + +namespace Implab.ServiceHost.Unity { + /// + /// Base class for injections, each injection is applied to the type registration context. + /// + public abstract class AbstractMemberInjection : ITypeMemberInjection { + public abstract void Visit(TypeRegistrationBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/AbstractRegistration.cs b/Implab.ServiceHost/src/Unity/AbstractRegistration.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/AbstractRegistration.cs @@ -0,0 +1,48 @@ +using System; +using System.Xml.Serialization; +using Unity.Lifetime; +using Unity.Registration; + +namespace Implab.ServiceHost.Unity +{ + /// + /// Базовая информаци о регистрации в контейнере: тип, имя и время жизни + /// + public abstract class AbstractRegistration : AbstractContainerItem, IRegistration { + + /// + /// An optional name for a registration in the container + /// + [XmlAttribute("name")] + public string Name { + get; set; + } + + [XmlElement("signleton", typeof(SingletonLifetimeElement))] + [XmlElement("context", typeof(ContextLifetimeElement))] + [XmlElement("container", typeof(ContainerLifetimeElement))] + [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] + public LifetimeElement Lifetime {get; set;} + + /// + /// A type specification for the service registration, + /// + [XmlAttribute("type")] + public string RegistrationType { get; set; } + + public virtual LifetimeManager GetLifetime(ContainerBuilder builder) { + return Lifetime?.GetLifetime(builder); + } + + public virtual Type GetRegistrationType(Func resolver) { + return resolver(RegistrationType); + } + + public virtual Type GetRegistrationType(ContainerBuilder builder) { + return builder.ResolveType(RegistrationType); + } + + + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ArrayParameterElement.cs b/Implab.ServiceHost/src/Unity/ArrayParameterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ArrayParameterElement.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity +{ + public class ArrayParameterElement : AbstractInjectionParameter { + + [XmlAttribute("itemsType")] + public string ItemsType { get; set; } + + [XmlElement("dependency", typeof(DependencyParameterElement))] + [XmlElement("value", typeof(ValueParameterElement))] + [XmlElement("serialized", typeof(SerializedParameterElement))] + [XmlElement("default", typeof(DefaultParameterElement))] + public AbstractInjectionParameter[] Items { get; set; } + + public override void Visit(InjectionParameterBuilder builder) { + builder.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ArrayTypeReference.cs b/Implab.ServiceHost/src/Unity/ArrayTypeReference.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ArrayTypeReference.cs @@ -0,0 +1,57 @@ +using System; +using System.Text; + +namespace Implab.ServiceHost.Unity { + public class ArrayTypeReference : TypeReference { + public int Rank { get; private set; } + + public TypeReference ItemsType { get; private set; } + + public override string Name { + get { + return ItemsType.Name; + } + } + + public override string ClrName { + get { + return new StringBuilder() + .Append(ItemsType.ClrName) + .Append("[") + .Append(',', Rank - 1) + .Append("]") + .ToString(); + } + } + + public override string Namespace { + get { + return ItemsType.Namespace; + } + } + + public override int GenericParametersCount { + get { + return 0; + } + } + + internal ArrayTypeReference(TypeReference itemsType, int rank) { + ItemsType = itemsType; + Rank = rank; + } + + internal override void Visit(TypeResolutionContext visitor) { + visitor.Visit(this); + } + + override public string ToString() { + return new StringBuilder() + .Append(ItemsType.ToString()) + .Append('[') + .Append(',', Rank - 1) + .Append(']') + .ToString(); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/AssemblyElement.cs b/Implab.ServiceHost/src/Unity/AssemblyElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/AssemblyElement.cs @@ -0,0 +1,14 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity +{ + [XmlRoot("assembly", Namespace = Schema.ContainerConfigurationNamespace)] + public class AssemblyElement : AbstractContainerItem { + [XmlAttribute("name")] + public string AssemblyName { get; set; } + + public override void Visit(ContainerBuilder builder) { + builder.AddAssembly(AssemblyName); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ConstructorInjectionElement.cs b/Implab.ServiceHost/src/Unity/ConstructorInjectionElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ConstructorInjectionElement.cs @@ -0,0 +1,17 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class ConstructorInjectionElement : AbstractMemberInjection { + + [XmlElement("dependency", typeof(DependencyParameterElement))] + [XmlElement("value", typeof(ValueParameterElement))] + [XmlElement("serialized", typeof(SerializedParameterElement))] + [XmlElement("default", typeof(DefaultParameterElement))] + [XmlElement("array", typeof(ArrayParameterElement))] + public AbstractInjectionParameter[] Parameters { get; set; } + + public override void Visit(TypeRegistrationBuilder builder) { + builder.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ContainerBuilder.cs b/Implab.ServiceHost/src/Unity/ContainerBuilder.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ContainerBuilder.cs @@ -0,0 +1,161 @@ +using System; +using System.IO; +using System.Reflection; +using Implab.Diagnostics; +using Unity; + +namespace Implab.ServiceHost.Unity { + using Log = Trace; + + public class ContainerBuilder { + + readonly TypeResolver m_resolver; + + readonly IUnityContainer m_container; + + readonly ContainerConfigurationSchema m_schema; + + Uri m_location; + + public IUnityContainer Container { + get { + return m_container; + } + } + + public ContainerBuilder() : this(null, null) { + } + + public ContainerBuilder(IUnityContainer container, ContainerConfigurationSchema schema) { + m_container = container ?? new UnityContainer(); + m_resolver = new TypeResolver(); + m_schema = schema ?? ContainerConfigurationSchema.Default; + } + + public Type ResolveType(string typeReference) { + var resolved = string.IsNullOrEmpty(typeReference) ? null : m_resolver.Resolve(typeReference, true); + Log.Debug("ResolveType('{0}'): {1}", typeReference, resolved?.FullName); + return resolved; + } + + public void Visit(ITypeRegistration registration) { + Safe.ArgumentNotNull(registration, nameof(registration)); + + var registrationType = registration.GetRegistrationType(this); + var implementationType = registration.GetImplementationType(this) ?? registrationType; + + if (registrationType == null) + throw new Exception($"A type must be specified for the registration {registration.Name}"); + + var builder = new TypeRegistrationBuilder( + m_resolver, + registrationType, + implementationType, + this + ); + + builder.Lifetime = registration.GetLifetime(this); + + if (registration.MemberInjections != null) { + foreach(var member in registration.MemberInjections) + member.Visit(builder); + } + + m_container.RegisterType( + builder.RegistrationType, + builder.ImplementationType, + registration.Name, + builder.Lifetime, + builder.Injections + ); + } + + public void Visit(IInstanceRegistration registration) { + Safe.ArgumentNotNull(registration, nameof(registration)); + + var registrationType = registration.GetRegistrationType(this); + + var builder = new InstanceRegistrationBuilder ( + m_resolver, + registrationType, + this + ); + + builder.Lifetime = registration.GetLifetime(this); + + if (registration.MemberInjections != null) { + foreach(var member in registration.MemberInjections) + member.Visit(builder.ValueBuilder); + } + + if (builder.RegistrationType == null && builder.ValueBuilder.ValueType == null) + throw new Exception($"A type must be specified for the registration {registration.Name}"); + + m_container.RegisterInstance( + builder.RegistrationType ?? builder.ValueBuilder.ValueType, + registration.Name, + builder.ValueBuilder.Value, + builder.Lifetime + ); + } + + public void AddNamespace(string ns) { + m_resolver.AddNamespace(ns); + Log.Log($"AddNamespace: {ns}"); + } + + public void AddAssembly(string assembly) { + var asm = Assembly.Load(assembly); + Log.Log($"AddAssembly: {assembly} -> {asm.FullName}"); + } + + /// + /// Includes the confguration. Creates a new , + /// and loads the configuration to it. The created builder will share the + /// container and will have its own isolated type resolver. + /// + /// A path to configuration relative to the current configuration. + public void Include(string file) { + var includeContext = new ContainerBuilder(m_container, m_schema); + + if (m_location != null) { + var uri = new Uri(m_location, file); + includeContext.LoadConfig(uri); + } else { + includeContext.LoadConfig(file); + } + } + + /// + /// Resolves a path ralatively to the current container configuration location. + /// + /// A path yto resolve + /// Resolved Uri fot the specified location + public Uri MakeLocationUri(string location) { + return m_location != null ? new Uri(m_location, location) : new Uri(location); + } + + /// + /// Loads a configuration from the specified local file. + /// + /// The path to the configuration file. + public void LoadConfig(string file) { + Safe.ArgumentNotEmpty(file, nameof(file)); + + LoadConfig(new Uri(Path.GetFullPath(file))); + } + + public void LoadConfig(Uri location) { + Safe.ArgumentNotNull(location, nameof(location)); + + Log.Log($"LoadConfig {location}"); + Safe.ArgumentNotNull(location, nameof(location)); + + m_location = location; + + var config = m_schema.LoadConfig(location.ToString()); + config.Visit(this); + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ContainerConfigurationSchema.cs b/Implab.ServiceHost/src/Unity/ContainerConfigurationSchema.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ContainerConfigurationSchema.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.Serialization; +using Implab.Components; + +namespace Implab.ServiceHost.Unity { + public class ContainerConfigurationSchema { + + public static ContainerConfigurationSchema Default { get; private set; } = CreateDefault(); + + readonly LazyAndWeak m_seralizer; + + readonly XmlAttributeOverrides m_overrides = new XmlAttributeOverrides(); + + readonly XmlAttributes m_containerItems = new XmlAttributes(); + + public XmlSerializer Serializer { + get { + return m_seralizer.Value; + } + } + + public ContainerConfigurationSchema() { + m_overrides.Add(typeof(ContainerElement), nameof(ContainerElement.Items), m_containerItems); + + m_seralizer = new LazyAndWeak(() => new XmlSerializer(typeof(ContainerElement), m_overrides)); + } + + public void RegisterContainerElement(Type type, string name) { + Safe.ArgumentNotNull(type, nameof(type)); + Safe.ArgumentNotEmpty(name, nameof(name)); + + if(!type.IsSubclassOf(typeof(AbstractContainerItem))) + throw new Exception($"RegisterContainerElement '{name}': {type} must be subclass of {typeof(AbstractContainerItem)}"); + + m_containerItems.XmlElements.Add( + new XmlElementAttribute(name, type) + ); + } + + public void RegisterContainerElement(string name) where T : AbstractContainerItem { + RegisterContainerElement(typeof(T), name); + } + + public ContainerElement LoadConfig(string uri) { + using (var reader = XmlReader.Create(uri)) { + return (ContainerElement)Serializer.Deserialize(reader); + } + } + + static ContainerConfigurationSchema CreateDefault() { + var schema = new ContainerConfigurationSchema(); + + schema.RegisterContainerElement("register"); + schema.RegisterContainerElement("factory"); + schema.RegisterContainerElement("serialized"); + schema.RegisterContainerElement("value"); + schema.RegisterContainerElement("include"); + schema.RegisterContainerElement("assembly"); + schema.RegisterContainerElement("namespace"); + + return schema; + } + + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ContainerElement.cs b/Implab.ServiceHost/src/Unity/ContainerElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ContainerElement.cs @@ -0,0 +1,19 @@ +using Implab.Xml; +using System.Collections.Generic; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + [XmlRoot("container", Namespace = Schema.ContainerConfigurationNamespace)] + public class ContainerElement : AbstractContainerItem { + + public List Items { get; set; } = new List(); + + public override void Visit(ContainerBuilder context) { + if (Items != null) + foreach(var item in Items) + item.Visit(context); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ContainerLifetimeElement.cs b/Implab.ServiceHost/src/Unity/ContainerLifetimeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ContainerLifetimeElement.cs @@ -0,0 +1,12 @@ +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity +{ + public class ContainerLifetimeElement : LifetimeElement { + public override LifetimeManager GetLifetime(ContainerBuilder builder) { + return new ContainerControlledLifetimeManager(); + } + + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ContextLifetimeElement.cs b/Implab.ServiceHost/src/Unity/ContextLifetimeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ContextLifetimeElement.cs @@ -0,0 +1,10 @@ +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity +{ + public class ContextLifetimeElement : LifetimeElement { + public override LifetimeManager GetLifetime(ContainerBuilder builder) { + return new PerResolveLifetimeManager(); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/DefaultParameterElement.cs b/Implab.ServiceHost/src/Unity/DefaultParameterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/DefaultParameterElement.cs @@ -0,0 +1,13 @@ +namespace Implab.ServiceHost.Unity +{ + public class DefaultParameterElement : AbstractInjectionParameter { + public string Value { + get { return null; } + } + + public override void Visit(InjectionParameterBuilder builder) { + var type = builder.ResolveInjectedValueType(TypeName); + builder.SetValue(type, Safe.CreateDefaultValue(type)); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/DependencyParameterElement.cs b/Implab.ServiceHost/src/Unity/DependencyParameterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/DependencyParameterElement.cs @@ -0,0 +1,17 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class DependencyParameterElement : AbstractInjectionParameter { + + [XmlAttribute("name")] + public string DependencyName { get; set; } + + [XmlAttribute("optional")] + public bool Optional { get; set; } + + public override void Visit(InjectionParameterBuilder builder) { + var type = builder.ResolveInjectedValueType(TypeName); + builder.SetDependency(type, DependencyName, Optional); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/FactoryActivator.cs b/Implab.ServiceHost/src/Unity/FactoryActivator.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/FactoryActivator.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Implab.Components; +using Unity; +using Unity.Injection; +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity { + public class FactoryActivator : ITypeRegistration { + + class FactoryInjector : ITypeMemberInjection { + public InjectionFactory Factory { get; set; } + public void Visit(TypeRegistrationBuilder builder) { + builder.AddInjectionMember(Factory); + } + } + + + public Type FactoryType { get; set; } + + public string FactoryName { get; set; } + + public Type RegistrationType { get; set; } + + public LifetimeManager Lifetime { get; set; } + + public IEnumerable MemberInjections { + get { + if (RegistrationType == null) + throw new Exception($"RegistrationType must be specified"); + if (!typeof(IFactory<>).MakeGenericType(RegistrationType).IsAssignableFrom(FactoryType)) + throw new Exception($"The factory {FactoryType} can't be used to create {RegistrationType} instances"); + + if (FactoryType.ContainsGenericParameters) { + yield return new FactoryInjector { + Factory = CreateDynamicInjectionFactory(FactoryName) + }; + } else { + yield return new FactoryInjector { + Factory = (InjectionFactory)GetType() + .GetMethod(nameof(CreateInjectionFactory), BindingFlags.Static | BindingFlags.NonPublic) + .MakeGenericMethod(FactoryType, RegistrationType) + .Invoke(null, new [] { FactoryName }) + }; + } + } + } + + public string Name { get; set; } + + public Type GetRegistrationType(ContainerBuilder builder) { + return RegistrationType; + } + + public LifetimeManager GetLifetime(ContainerBuilder builder) { + return Lifetime; + } + + public Type GetImplementationType(ContainerBuilder builder) { + return null; + } + + /// + /// Указывает зависимость, реализующую интерфейс , + /// которая будет использоваться в качестве фабрики для создания объектов + /// + /// + static InjectionFactory CreateInjectionFactory(string dependencyName) where TFac : IFactory { + + return new InjectionFactory(c => c.Resolve(dependencyName).Create()); + } + + static InjectionFactory CreateDynamicInjectionFactory(string dependencyName) { + return new InjectionFactory((c,t,name) => ((IFactory)c.Resolve(t, dependencyName)).Create()); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/FactoryElement.cs b/Implab.ServiceHost/src/Unity/FactoryElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/FactoryElement.cs @@ -0,0 +1,73 @@ +using System; +using System.Xml.Serialization; +using Implab.Components; + +namespace Implab.ServiceHost.Unity { + /// + /// Расширяет стандартную регистрацию типа до фабрики, вместе с регистрацией + /// самой фабрики создаются регистрации сервисов, которые она предоставляет. + /// + public class FactoryElement : RegisterElement, ITypeRegistration { + + /// + /// Записи о сервисах, которые создаются данной фабрикой. + /// + /// + /// Сервисы, которые указаны в регистарциях они должны соответсвовать тому, + /// что фабрика возвращает, но это остается на откуп контейнера + /// + [XmlElement("provides")] + public ProvidesElement[] Provides { get; set; } + + /// + /// Переопределяет стандарное поведение регистрации типа в контейнере, + /// дополняя его регистрацией фабричных методов для получения типов. + /// + /// Объект для конфигурирования контейнера. + public override void Visit(ContainerBuilder builder) { + var factoryType = GetRegistrationType(builder.ResolveType); + + base.Visit(builder); + + if (Provides != null && Provides.Length > 0) { + // если регистрации явно заданы, используеися информация из них + foreach(var item in Provides) { + var activator = new FactoryActivator { + Name = item.RegistrationName, + RegistrationType = builder.ResolveType(item.RegistrationType), + FactoryName = Name, + FactoryType = factoryType, + Lifetime = item.Lifetime?.GetLifetime(builder) + }; + builder.Visit(activator); + } + } else { + // если регистрация явно не задана, в качестве сервиса для регистрации + // используется тип создаваемый фабрикой, который будет добавлен в контейнер + // с темже именем, что и сама фабрика (разные типы могут иметь одно имя для регистрации) + var providedType = ( + factoryType.IsGenericType && factoryType.GetGenericTypeDefinition() == typeof(IFactory<>) ? + factoryType : + factoryType.GetInterface(typeof(IFactory<>).FullName) + )? + .GetGenericArguments()[0]; + + // не удалось определеить тип + if (providedType == null) + throw new ArgumentException("Failed to determine a type provided by the factory"); + + if (providedType.IsGenericParameter) + throw new ArgumentException("Can't register a generic type paramter as a service"); + + var activator = new FactoryActivator { + Name = Name, + RegistrationType = providedType, + FactoryName = Name, + FactoryType = factoryType + }; + + builder.Visit(activator); + } + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/HierarchicalLifetimeElement.cs b/Implab.ServiceHost/src/Unity/HierarchicalLifetimeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/HierarchicalLifetimeElement.cs @@ -0,0 +1,10 @@ +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity +{ + public class HierarchicalLifetimeElement : LifetimeElement { + public override LifetimeManager GetLifetime(ContainerBuilder builder) { + return new HierarchicalLifetimeManager(); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/IInjectionParameter.cs b/Implab.ServiceHost/src/Unity/IInjectionParameter.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/IInjectionParameter.cs @@ -0,0 +1,5 @@ +namespace Implab.ServiceHost.Unity { + public interface IInjectionParameter { + void Visit(InjectionParameterBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/IInstanceRegistration.cs b/Implab.ServiceHost/src/Unity/IInstanceRegistration.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/IInstanceRegistration.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Implab.ServiceHost.Unity { + public interface IInstanceRegistration : IRegistration { + + IEnumerable MemberInjections { get; } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/IRegistration.cs b/Implab.ServiceHost/src/Unity/IRegistration.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/IRegistration.cs @@ -0,0 +1,12 @@ +using System; +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity { + public interface IRegistration { + string Name { get; } + + Type GetRegistrationType(ContainerBuilder builder); + + LifetimeManager GetLifetime(ContainerBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ITypeMemberInjection.cs b/Implab.ServiceHost/src/Unity/ITypeMemberInjection.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ITypeMemberInjection.cs @@ -0,0 +1,6 @@ +namespace Implab.ServiceHost.Unity +{ + public interface ITypeMemberInjection { + void Visit(TypeRegistrationBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ITypeRegistration.cs b/Implab.ServiceHost/src/Unity/ITypeRegistration.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ITypeRegistration.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace Implab.ServiceHost.Unity { + public interface ITypeRegistration : IRegistration { + Type GetImplementationType(ContainerBuilder builder); + + IEnumerable MemberInjections { get; } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/IncludeElement.cs b/Implab.ServiceHost/src/Unity/IncludeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/IncludeElement.cs @@ -0,0 +1,13 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + [XmlRoot("include", Namespace = Schema.ContainerConfigurationNamespace)] + public class IncludeElement : AbstractContainerItem { + [XmlAttribute("href")] + public string Href { get; set; } + + public override void Visit(ContainerBuilder builder) { + builder.Include(Href); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/InjectionValueBuilder.cs b/Implab.ServiceHost/src/Unity/InjectionValueBuilder.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/InjectionValueBuilder.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using Unity.Injection; + +namespace Implab.ServiceHost.Unity { + + public class InjectionParameterBuilder { + + readonly TypeResolver m_resolver; + + public Type DefaultType { get; private set; } + + public Type ValueType { get; private set; } + + public ContainerBuilder Root { get; private set; } + + object m_value; + + public object Value { + get { + if (!ValueSpecified) + throw new InvalidOperationException("The regular value must be set (dependency or array are not situable in this context)"); + return m_value; + } + } + + public bool ValueSpecified { get; private set; } + + InjectionParameterValue m_injection; + + public InjectionParameterValue Injection { + get { + if (m_injection == null) + throw new InvalidOperationException("The injection parameter is not specified"); + return m_injection; + } + } + + public bool InjectionSpecified { + get { return m_injection != null; } + } + + internal InjectionParameterBuilder(TypeResolver resolver, Type defaultType, ContainerBuilder root) { + m_resolver = resolver; + DefaultType = defaultType; + Root = root; + } + + public Type ResolveInjectedValueType(string typeSpec) { + if (string.IsNullOrEmpty(typeSpec)) { + if (DefaultType == null) + throw new Exception("The type must be specified"); + return DefaultType; + } + return m_resolver.Resolve(typeSpec, true); + } + + public Type ResolveType(string typeSpec) { + return string.IsNullOrEmpty(typeSpec) ? null : m_resolver.Resolve(typeSpec, true); + } + + public void SetValue(Type type, object value) { + Safe.ArgumentNotNull(type, nameof(type)); + + ValueType = type; + m_value = value; + ValueSpecified = true; + + m_injection = new InjectionParameter(type, value); + } + + public void SetDependency(Type type, string name, bool optional) { + Safe.ArgumentNotNull(type, nameof(type)); + + ValueType = type; + ValueSpecified = false; + m_value = null; + + m_injection = optional ? + type.IsGenericParameter ? + new OptionalGenericParameter(type.Name, name) + : (InjectionParameterValue)new OptionalParameter(type, name) + : new ResolvedParameter(type, name); + } + + internal void Visit(ArrayParameterElement arrayParameter) { + Type itemsType = null; + var arrayType = string.IsNullOrEmpty(arrayParameter.TypeName) ? null : ResolveType(arrayParameter.TypeName); + + if (arrayType == null) + arrayType = DefaultType; + + + if (!string.IsNullOrEmpty(arrayParameter.ItemsType)) { + itemsType = ResolveType(arrayParameter.ItemsType); + arrayType = itemsType.MakeArrayType(); + } else { + itemsType = GetItemsType(arrayType); + } + + if (itemsType == null) + throw new Exception("Failed to determine array elements type"); + + InjectionParameterValue[] injections = (arrayParameter.Items ?? new AbstractInjectionParameter[0]) + .Select(x => { + var builder = new InjectionParameterBuilder(m_resolver, itemsType, Root); + x.Visit(builder); + return builder.Injection; + }) + .ToArray(); + + m_injection = itemsType.IsGenericParameter ? + (InjectionParameterValue)new GenericResolvedArrayParameter(itemsType.Name, injections) : + new ResolvedArrayParameter(itemsType, injections); + + ValueType = arrayType; + m_value = null; + ValueSpecified = false; + } + + Type GetItemsType(Type collectionType) { + if (collectionType == null) + return null; + + Type itemsType = null; + + if (collectionType.IsGenericType && collectionType.GetGenericTypeDefinition() == typeof(IEnumerable<>)) { + itemsType = collectionType.GetGenericArguments()[0]; + } else if (collectionType == typeof(IEnumerable)) { + itemsType = typeof(object); + } else { + itemsType = collectionType.GetInterface(typeof(IEnumerable<>).FullName)?.GetGenericArguments()[0]; + } + + return itemsType; + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/InstanceRegistrationBuilder.cs b/Implab.ServiceHost/src/Unity/InstanceRegistrationBuilder.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/InstanceRegistrationBuilder.cs @@ -0,0 +1,13 @@ +using System; + +namespace Implab.ServiceHost.Unity +{ + public class InstanceRegistrationBuilder : RegistrationBuilder { + + public InjectionParameterBuilder ValueBuilder { get; private set; } + + internal InstanceRegistrationBuilder(TypeResolver typeResolver, Type registrationType, ContainerBuilder root) : base(registrationType, root) { + ValueBuilder = new InjectionParameterBuilder(typeResolver, registrationType, root); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/LifetimeElement.cs b/Implab.ServiceHost/src/Unity/LifetimeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/LifetimeElement.cs @@ -0,0 +1,7 @@ +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity { + public abstract class LifetimeElement { + public abstract LifetimeManager GetLifetime(ContainerBuilder builder); + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/MethodInjectionElement.cs b/Implab.ServiceHost/src/Unity/MethodInjectionElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/MethodInjectionElement.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class MethodInjectionElement : AbstractMemberInjection { + + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlElement("dependency", typeof(DependencyParameterElement))] + [XmlElement("value", typeof(ValueParameterElement))] + [XmlElement("serialized", typeof(SerializedParameterElement))] + [XmlElement("default", typeof(DefaultParameterElement))] + [XmlElement("array", typeof(ArrayParameterElement))] + public AbstractInjectionParameter[] Parameters { get; set; } + + public override void Visit(TypeRegistrationBuilder context) { + context.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/NamespaceElement.cs b/Implab.ServiceHost/src/Unity/NamespaceElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/NamespaceElement.cs @@ -0,0 +1,15 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity +{ + [XmlRoot("namespace", Namespace = Schema.ContainerConfigurationNamespace)] + public class NamespaceElement : AbstractContainerItem { + + [XmlAttribute("name")] + public string Name { get; set; } + + public override void Visit(ContainerBuilder builder) { + builder.AddNamespace(Name); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/NestedTypeReference.cs b/Implab.ServiceHost/src/Unity/NestedTypeReference.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/NestedTypeReference.cs @@ -0,0 +1,48 @@ +using System; +using System.Text; + +namespace Implab.ServiceHost.Unity { + public class NestedTypeReference : TypeReference { + + readonly string m_name; + + readonly int m_genericParametersCount; + + public TypeReference DeclaringType { get; private set; } + + public override string Name { + get { + return m_name; + } + } + + public override string Namespace { + get { + return DeclaringType.Namespace; + } + } + + public override int GenericParametersCount { + get { + return m_genericParametersCount; + } + } + + internal NestedTypeReference(TypeReference declaringType, string name, int parametersCount) { + DeclaringType = declaringType; + m_name = name; + m_genericParametersCount = parametersCount; + } + + internal override void Visit(TypeResolutionContext visitor) { + visitor.Visit(this); + } + + internal override void WriteTypeName(StringBuilder builder) { + builder + .Append(DeclaringType) + .Append('+') + .Append(Name); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/PropertyInjectionElement.cs b/Implab.ServiceHost/src/Unity/PropertyInjectionElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/PropertyInjectionElement.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class PropertyInjectionElement : AbstractMemberInjection { + + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlElement("dependency", typeof(DependencyParameterElement))] + [XmlElement("value", typeof(ValueParameterElement))] + [XmlElement("serialized", typeof(SerializedParameterElement))] + [XmlElement("default", typeof(DefaultParameterElement))] + [XmlElement("array", typeof(ArrayParameterElement))] + public AbstractInjectionParameter Value { get; set; } + + public override void Visit(TypeRegistrationBuilder context) { + context.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ProvidesElement.cs b/Implab.ServiceHost/src/Unity/ProvidesElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ProvidesElement.cs @@ -0,0 +1,17 @@ +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class ProvidesElement { + [XmlAttribute("type")] + public string RegistrationType { get; set; } + + [XmlAttribute("name")] + public string RegistrationName { get; set; } + + [XmlElement("signleton", typeof(SingletonLifetimeElement))] + [XmlElement("context", typeof(ContextLifetimeElement))] + [XmlElement("container", typeof(ContainerLifetimeElement))] + [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] + public LifetimeElement Lifetime {get; set;} + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/RegisterElement.cs b/Implab.ServiceHost/src/Unity/RegisterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/RegisterElement.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Xml.Serialization; +using Unity.Lifetime; +using Unity.Registration; + +namespace Implab.ServiceHost.Unity { + + [XmlRoot("register", Namespace = Schema.ContainerConfigurationNamespace)] + public class RegisterElement : AbstractRegistration, ITypeRegistration { + + /// + /// An optional type which is registered as a service in the container, must be assignable to . + /// + [XmlAttribute("mapTo")] + public string MapToType { get; set; } + + + [XmlElement("constructor", typeof(ConstructorInjectionElement))] + [XmlElement("property", typeof(PropertyInjectionElement))] + [XmlElement("method", typeof(MethodInjectionElement))] + public AbstractMemberInjection[] Injectors { get; set; } + + IEnumerable ITypeRegistration.MemberInjections { + get { + return Injectors; + } + } + + public Type GetImplementationType(ContainerBuilder builder) { + return builder.ResolveType(MapToType); + } + + public override void Visit(ContainerBuilder builder) { + builder.Visit(this); + } + } + +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/RegistrationBuilder.cs b/Implab.ServiceHost/src/Unity/RegistrationBuilder.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/RegistrationBuilder.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using Implab.Xml; +using Unity.Injection; +using Unity.Lifetime; +using Unity.Registration; + +namespace Implab.ServiceHost.Unity { + /// + /// Базовый класс для формирования записей в контейнере, созволяет указать время жизни для записи + /// + public abstract class RegistrationBuilder { + public ContainerBuilder Root { + get; private set; + } + + public Type RegistrationType { + get; + private set; + } + + internal LifetimeManager Lifetime { get; set; } + + protected RegistrationBuilder(Type registrationType, ContainerBuilder root) { + Root = root; + RegistrationType = registrationType; + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/RootTypeReference.cs b/Implab.ServiceHost/src/Unity/RootTypeReference.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/RootTypeReference.cs @@ -0,0 +1,36 @@ +using System; + +namespace Implab.ServiceHost.Unity +{ + public class RootTypeReference : TypeReference { + readonly string m_name; + + readonly string m_namespace; + + readonly int m_genericParametersCount; + + public override string Name { + get { return m_name; } + } + + public override string Namespace { + get { return m_namespace; } + } + + public override int GenericParametersCount { + get { return m_genericParametersCount; } + } + + internal RootTypeReference(string ns, string name, int genericParameters) { + m_name = name; + m_genericParametersCount = genericParameters; + m_namespace = ns; + } + + internal override void Visit(TypeResolutionContext visitor) { + visitor.Visit(this); + } + + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/Schema.cs b/Implab.ServiceHost/src/Unity/Schema.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/Schema.cs @@ -0,0 +1,5 @@ +namespace Implab.ServiceHost.Unity { + public static class Schema { + public const string ContainerConfigurationNamespace = "http://implab.org/schemas/servicehost/unity.v1.xsd"; + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/SerializedElement.cs b/Implab.ServiceHost/src/Unity/SerializedElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/SerializedElement.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Xml; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class SerializedElement : AbstractRegistration, IInstanceRegistration { + [XmlAttribute("href")] + public string Location { get; set; } + + [XmlAttribute("serializedType")] + public string SerializedType { get; set; } + + + [XmlAnyElement] + public XmlElement[] Content { get; set; } + + public IEnumerable MemberInjections { + get { + yield return new SerializedParameterElement { + TypeName = SerializedType, + Location = Location, + Content = Content + }; + } + } + + public override void Visit(ContainerBuilder builder) { + builder.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/SerializedParameterElement.cs b/Implab.ServiceHost/src/Unity/SerializedParameterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/SerializedParameterElement.cs @@ -0,0 +1,33 @@ +using System; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity +{ + public class SerializedParameterElement : AbstractInjectionParameter { + [XmlAttribute("href")] + public string Location { get; set; } + + [XmlAnyElement] + public XmlElement[] Content { get; set; } + + public XmlReader GetReader(InjectionParameterBuilder builder) { + if (!string.IsNullOrEmpty(Location)) + return XmlReader.Create(builder.Root.MakeLocationUri(Location).ToString()); + if (Content != null && Content.Length > 0) + return Content[0].CreateNavigator().ReadSubtree(); + + throw new Exception("No content found, expected XML document"); + } + + public override void Visit(InjectionParameterBuilder builder) { + var type = builder.ResolveInjectedValueType(TypeName); + + var serializer = new XmlSerializer(type); + using(var reader = GetReader(builder)) + builder.SetValue(type, serializer.Deserialize(reader)); + + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/SingletonLifetimeElement.cs b/Implab.ServiceHost/src/Unity/SingletonLifetimeElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/SingletonLifetimeElement.cs @@ -0,0 +1,10 @@ +using Unity.Lifetime; + +namespace Implab.ServiceHost.Unity +{ + public class SingletonLifetimeElement : LifetimeElement { + public override LifetimeManager GetLifetime(ContainerBuilder builder) { + return new SingletonLifetimeManager(); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/SpecializedTypeReference.cs b/Implab.ServiceHost/src/Unity/SpecializedTypeReference.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/SpecializedTypeReference.cs @@ -0,0 +1,52 @@ +using System; +using System.Linq; +using System.Text; + +namespace Implab.ServiceHost.Unity { + public class SpecializedTypeReference : TypeReference { + public override string Name { + get { + return GenericType.Name; + } + } + + public override string Namespace { + get { + return GenericType.Namespace; + } + } + + public override int GenericParametersCount { + get { + return GenericParameters.Length; + } + } + + public TypeReference GenericType { get; private set; } + + public TypeReference[] GenericParameters { get; private set; } + + internal SpecializedTypeReference(TypeReference genericType, TypeReference[] genericParameters) { + GenericType = genericType; + GenericParameters = genericParameters; + } + + internal override void Visit(TypeResolutionContext visitor) { + visitor.Visit(this); + } + + internal override void WriteTypeName(StringBuilder builder) { + GenericType.WriteTypeName(builder); + } + + internal override void WriteTypeParams(StringBuilder builder) { + builder.Append('{'); + for (var i = 0; i < GenericParameters.Length; i++) { + if (i > 0) + builder.Append(','); + builder.Append(GenericParameters[i]); + } + builder.Append('}'); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/TypeReference.cs b/Implab.ServiceHost/src/Unity/TypeReference.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/TypeReference.cs @@ -0,0 +1,182 @@ +using System; +using System.Linq; +using System.Text; + +namespace Implab.ServiceHost.Unity { + /// + /// Ссылка на тип, является абстрактной записью имени CLR типа. + /// + /// + /// Ссылка на тип содержит сокращенную информацию о типе и для ее интерпретации + /// требуется некоторый контекст, который позволит превратить ее в полноценный + /// . Ссылки на тип позволяют записать: + /// + /// общие типы, их специализации + /// вложенные типы + /// массивы + /// + /// + /// Для получения из ссылки на тип конкретного CLR типа используется . + /// + /// + /// Ссылку на тип можно создать либо програмно при помощи методов , + /// , , , + /// либо разобрав строку со спецификацией при помощи метода . + /// + /// + /// Спецификация ссыдки на тип имеет следующий вид Name.Space.MyType+Nested{String}[][], где: + /// + /// + /// . + /// Разделяет элементы пространства имен + /// + /// + /// + + /// Разделяет вложенные типы + /// + /// + /// [], [,,,] + /// Указывает на то, что тип является массивом, также указывается его размерность + /// + /// + /// {}, {,,}, {Int32,String} + /// Указывает на то, что тип является общим, также + /// указывается количество параметров, либо конкретные типы для + /// специализации + /// + /// + /// + /// + public abstract class TypeReference { + + /// + /// Имя типа без дополнительных элементов, указывающих на то, что он общий или массив. + /// + /// + /// Для массивов это имя его элементов. + /// + public abstract string Name { get; } + + /// + /// Пространство имен в котором нахожится тип. + /// + /// + /// Для вложенных типов это пространтство имен типа самого верхнего уровня, + /// для массивов - пространство имен его элементов. + /// + public abstract string Namespace { get; } + + /// + /// Количество параметров общего типа. + /// + /// + /// + /// Вложенные типы неявно получают параметры от типов в которых они объявлены, + /// данное свойство это не учитывает, возвращается только количество собственных + /// параметров. + /// + /// + /// Данное свойство используется для получения CRL имени типа. + /// + /// + public abstract int GenericParametersCount { get; } + + public virtual string ClrName { + get { + return GenericParametersCount != 0 ? $"{Name}`{GenericParametersCount}" : Name; + } + } + + /// + /// Создает ссылку на специализацию текущего типа. + /// + /// Ссылки на типы, которые будут использоваться для специализации текущего типа. + /// Специализация данного типа. + public virtual SpecializedTypeReference MakeGenericType(TypeReference[] genericParameters) { + if (GenericParametersCount == 0) + throw new InvalidOperationException("Can't specialize a non-geneic type"); + + if (genericParameters == null || GenericParametersCount != genericParameters.Length) + throw new InvalidOperationException("Generic parameters count mismatch"); + + return new SpecializedTypeReference(this, genericParameters); + } + + /// + /// Создает ссылку на тип массива указанной размерности, элементами которого являются экземпаляры даннго типа. + /// + /// Размерность, если размерность 1 создается вектор (). + /// Ссылка на тип массива + public ArrayTypeReference MakeArrayType(int rank) { + Safe.ArgumentInRange(rank > 0, nameof(rank)); + + return new ArrayTypeReference(this, rank); + } + + /// + /// Создает ссылку на вложенный тип. + /// + /// Имя типа + /// Количество параметров, если это общий тип, иначе 0. + /// Ссылка на вложенный тип. + public TypeReference Create(string name, int genericParameters) { + Safe.ArgumentNotEmpty(name, nameof(name)); + Safe.ArgumentInRange(genericParameters >= 0, nameof(genericParameters)); + + return new NestedTypeReference(this, name, genericParameters); + } + + /// + /// Возвращает строковое представление ссылки на тип. + /// + /// + public override string ToString() { + var builder = new StringBuilder(); + WriteTypeName(builder); + WriteTypeParams(builder); + return builder.ToString(); + } + + internal virtual void WriteTypeName(StringBuilder builder) { + if (!string.IsNullOrEmpty(Namespace)) + builder + .Append(Namespace) + .Append('.'); + builder.Append(Name); + } + + internal virtual void WriteTypeParams(StringBuilder builder) { + if (GenericParametersCount > 0) + builder + .Append('{') + .Append(',', GenericParametersCount-1) + .Append('}'); + } + + internal abstract void Visit(TypeResolutionContext visitor); + + /// + /// Создает ссылку на тип. + /// + /// Пространство имен, либо его фрагмент. + /// Имя типа без указания на количество параметров, либо на то, что это массив. + /// Количество параметров типа, если это общий тип, иначе 0. + /// Ссылка на тип. + public static TypeReference Create(string ns, string name, int genericParameters) { + Safe.ArgumentNotEmpty(name, nameof(name)); + Safe.ArgumentInRange(genericParameters >= 0, nameof(genericParameters)); + return new RootTypeReference(ns, name, genericParameters); + } + + /// + /// Разирает строковую запись ссылки на тип. + /// + /// Строковая запись ссылки на тип, например Dictionary{String,String} + /// Ссылка на тип. + public static TypeReference Parse(string typeSpec) { + var parser = new TypeReferenceParser(typeSpec); + return parser.Parse(); + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/TypeReferenceParser.cs b/Implab.ServiceHost/src/Unity/TypeReferenceParser.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/TypeReferenceParser.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; + +namespace Implab.ServiceHost.Unity { + internal class TypeReferenceParser { + enum TokenType { + None, + + Word, + + Dot, + + Comma, + + OpenList, + + CloseList, + + OpenArray, + + CloseArray, + + Plus, + + Eof + } + + readonly Regex _tokens = new Regex(@"\G(?:([\w]+)|\s*([\+\.{},\[\]])\s*)", RegexOptions.Compiled); + + TokenType m_token; + + string m_tokenValue; + + int m_pos; + + int m_tokenPos; + + readonly string m_text; + + TokenType Token { get { return m_token; } } + + string TokenValue { get { return m_tokenValue; } } + + int TokenPos { get { return m_tokenPos; } } + + public TypeReferenceParser(string text) { + Safe.ArgumentNotEmpty(text, nameof(text)); + m_text = text; + } + + bool ReadToken() { + if (m_pos >= m_text.Length) { + m_token = TokenType.Eof; + m_tokenValue = null; + return false; + } + + var m = _tokens.Match(m_text, m_pos); + + if (m.Success) { + m_tokenPos = m_pos; + m_pos += m.Length; + if (m.Groups[1].Success) { + m_token = TokenType.Word; + m_tokenValue = m.Groups[1].Value; + } else if (m.Groups[2].Success) { + m_tokenValue = null; + switch (m.Groups[2].Value) { + case "{": + m_token = TokenType.OpenList; + break; + case "}": + m_token = TokenType.CloseList; + break; + case ".": + m_token = TokenType.Dot; + break; + case ",": + m_token = TokenType.Comma; + break; + case "[": + m_token = TokenType.OpenArray; + break; + case "]": + m_token = TokenType.CloseArray; + break; + case "+": + m_token = TokenType.Plus; + break; + } + } + return true; + } + throw new FormatException($"Failed to parse '{m_text}' at pos {m_pos}"); + } + + public TypeReference Parse() { + var result = ReadTypeReference(); + if (Token != TokenType.Eof) + ThrowUnexpectedToken(); + return result; + } + + string[] ReadQTypeName() { + var parts = new List(); + + string current = null; + bool stop = false; + while ((!stop) && ReadToken()) { + switch (Token) { + case TokenType.Word: + if (current != null) + ThrowUnexpectedToken(); + current = TokenValue; + break; + case TokenType.Dot: + if (current == null) + ThrowUnexpectedToken(); + parts.Add(current); + current = null; + break; + default: + stop = true; + break; + } + } + if (current != null) + parts.Add(current); + + if (parts.Count == 0) + return null; + + return parts.ToArray(); + } + + string ReadNQTypeName() { + ReadToken(); + if (Token != TokenType.Word) + ThrowUnexpectedToken(); + return TokenValue; + } + + TypeReference ReadTypeReference() { + + var parts = ReadQTypeName(); + if (parts == null) + return null; + + var genericParameters = ReadGenericParams(); + + var typeReference = TypeReference.Create( + string.Join(".", parts, 0, parts.Length - 1), + parts[parts.Length - 1], + genericParameters.Length + ); + + if (genericParameters.Length > 0 && genericParameters.All(x => x != null)) + typeReference = typeReference.MakeGenericType(genericParameters); + + typeReference = ReadArraySpec(typeReference); + + if(Token == TokenType.Plus) + return ReadNestedType(typeReference); + + return typeReference; + } + + TypeReference ReadNestedType(TypeReference declaringType) { + var name = ReadNQTypeName(); + if(string.IsNullOrEmpty(name)) + throw new FormatException("Nested type name can't be empty"); + ReadToken(); + + var genericParameters = ReadGenericParams(); + + var typeReference = declaringType.Create( + name, + genericParameters.Length + ); + + if (genericParameters.Length > 0 && genericParameters.All(x => x != null)) + typeReference = typeReference.MakeGenericType(genericParameters); + + typeReference = ReadArraySpec(typeReference); + + if(Token == TokenType.Plus) + return ReadNestedType(typeReference); + + return typeReference; + } + + TypeReference[] ReadGenericParams() { + if (Token == TokenType.OpenList) { + var genericParameters = ReadTypeReferenceList(); + if (Token != TokenType.CloseList) + ThrowUnexpectedToken(); + ReadToken(); + + return genericParameters; + } + + return Array.Empty(); + } + + TypeReference ReadArraySpec(TypeReference typeReference) { + while (Token == TokenType.OpenArray) { + var rank = CountRank(); + if (Token != TokenType.CloseArray) + ThrowUnexpectedToken(); + + typeReference = typeReference.MakeArrayType(rank); + + ReadToken(); + } + + return typeReference; + } + + int CountRank() { + int rank = 0; + do { + rank++; + } while(ReadToken() && Token == TokenType.Comma); + return rank; + } + + TypeReference[] ReadTypeReferenceList() { + var list = new List(); + + do { + var typeReference = ReadTypeReference(); + list.Add(typeReference); + } while (Token == TokenType.Comma); + + return list.ToArray(); + } + + void ThrowUnexpectedToken() { + throw new FormatException($"Unexpected '{Token}' at pos {TokenPos}: -->{m_text.Substring(TokenPos, Math.Min(m_text.Length - TokenPos, 10))}"); + } + + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/TypeRegistrationBuilder.cs b/Implab.ServiceHost/src/Unity/TypeRegistrationBuilder.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/TypeRegistrationBuilder.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Unity.Injection; +using Unity.Registration; + +namespace Implab.ServiceHost.Unity { + public class TypeRegistrationBuilder : RegistrationBuilder { + + readonly TypeResolver m_resolver; + + readonly List m_injections = new List(); + + internal InjectionMember[] Injections { get { return m_injections.ToArray(); } } + + public Type ImplementationType { + get; + private set; + } + + internal TypeRegistrationBuilder(TypeResolver resolver, Type registrationType, Type implementationType, ContainerBuilder root) : base(registrationType, root) { + ImplementationType = implementationType; + + // when registering a generic mapping, register all generic parameter names as local types + if (ImplementationType.IsGenericTypeDefinition) { + m_resolver = new TypeResolver(resolver); + + foreach (var p in ImplementationType.GetGenericArguments()) + m_resolver.AddMapping(p.Name, p); + } else { + m_resolver = resolver; + } + } + + internal void Visit(ConstructorInjectionElement constructorInjection) { + + + var parameters = constructorInjection.Parameters? + .Select(x => { + var valueBuilder = new InjectionParameterBuilder(m_resolver, null, Root); + x.Visit(valueBuilder); + return valueBuilder.Injection; + }) + .ToArray(); + + var injection = parameters != null ? new InjectionConstructor(parameters) : new InjectionConstructor(); + m_injections.Add(injection); + } + + internal void Visit(MethodInjectionElement methodInjection) { + var parameters = methodInjection.Parameters? + .Select(x => { + var valueBuilder = new InjectionParameterBuilder(m_resolver, null, Root); + x.Visit(valueBuilder); + return valueBuilder.Injection; + }) + .ToArray(); + + var injection = parameters != null ? new InjectionMethod(methodInjection.Name, parameters) : new InjectionMethod(methodInjection.Name); + m_injections.Add(injection); + } + + internal void Visit(PropertyInjectionElement propertyInjection) { + if (propertyInjection.Value == null) + throw new Exception($"A value value must be specified for the property '{propertyInjection.Name}'"); + + var propertyType = ImplementationType.GetProperty(propertyInjection.Name)?.PropertyType; + var valueContext = new InjectionParameterBuilder(m_resolver, propertyType, Root); + + propertyInjection.Value.Visit(valueContext); + var injection = new InjectionProperty(propertyInjection.Name, valueContext.Injection); + m_injections.Add(injection); + } + + public void AddInjectionMember(InjectionMember injection) { + Safe.ArgumentNotNull(injection, nameof(injection)); + + m_injections.Add(injection); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/TypeResolutionContext.cs b/Implab.ServiceHost/src/Unity/TypeResolutionContext.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/TypeResolutionContext.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using Implab.Diagnostics; + +namespace Implab.ServiceHost.Unity { + using static Trace; + + /// + /// Позволяет обойти вложенные типы и собрать цеочку из типов и параметров генериков, которые они предлагают + /// + internal class TypeResolutionContext { + readonly TypeResolver m_resolver; + + + readonly List m_genericParameters = new List(); + + public IEnumerable GenericParameters { get { return m_genericParameters; } } + + public Type ResolvedType { get; private set; } + + + public int ArrayRank { get; private set; } + + + public bool ThrowOnFail { get; private set; } + + public TypeResolutionContext(TypeResolver resolver, bool throwOnFail) { + m_resolver = resolver; + ThrowOnFail = throwOnFail; + } + + public Type MakeType() { + return m_genericParameters.Count > 0 ? + ResolvedType?.MakeGenericType(m_genericParameters.ToArray()) : + ResolvedType; + } + + public void Visit(SpecializedTypeReference typeReference) { + typeReference.GenericType.Visit(this); + + if (ResolvedType != null) { + foreach (var genericParamRef in typeReference.GenericParameters) { + var context = new TypeResolutionContext(m_resolver, ThrowOnFail); + genericParamRef.Visit(context); + m_genericParameters.Add(context.MakeType()); + } + } + } + + public void Visit(NestedTypeReference typeReference) { + typeReference.DeclaringType.Visit(this); + if (ResolvedType != null) + ResolvedType = ResolvedType?.GetNestedType(typeReference.ClrName) ?? Failed(typeReference); + } + + public void Visit(RootTypeReference typeReference) { + ResolvedType = m_resolver.Resolve(typeReference.Namespace, typeReference.ClrName) ?? Failed(typeReference); + } + + public void Visit(ArrayTypeReference typeReference) { + var context = new TypeResolutionContext(m_resolver, ThrowOnFail); + typeReference.ItemsType.Visit(context); + ResolvedType = typeReference.Rank == 1 ? + context.MakeType()?.MakeArrayType() : + context.MakeType()?.MakeArrayType(typeReference.Rank); + } + + Type Failed(TypeReference reference) { + Log($"Falied to resolve {reference}"); + if (ThrowOnFail) + throw new Exception($"Failed to resolve {reference}"); + return null; + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/TypeResolver.cs b/Implab.ServiceHost/src/Unity/TypeResolver.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/TypeResolver.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using Implab.Diagnostics; + +namespace Implab.ServiceHost.Unity { + using System.Diagnostics; + using static Trace; + public class TypeResolver { + readonly Dictionary m_cache = new Dictionary(); + + Regex _nsRx = new Regex(@"^\w+(\.\w+)*$", RegexOptions.Compiled); + readonly LinkedList m_namespases = new LinkedList(); + + internal Type Resolve(string ns, string typeName) { + var fullName = string.IsNullOrEmpty(ns) ? typeName : $"{ns}.{typeName}"; + + return ProbeInNamespaces(fullName); + } + + public Type Resolve(TypeReference typeReference, bool throwOnFail) { + var context = new TypeResolutionContext(this, throwOnFail); + typeReference.Visit(context); + return context.MakeType(); + } + + public Type Resolve(string typeSpec, bool throwOnFail) { + Safe.ArgumentNotEmpty(typeSpec, nameof(typeSpec)); + var typeReference = TypeReference.Parse(typeSpec); + return Resolve(typeReference, throwOnFail); + } + + LinkedListNode m_insertAt; + + readonly TypeResolver m_parent; + + public TypeResolver() : this(null) { + } + + public TypeResolver(TypeResolver parent) { + m_parent = parent; + m_insertAt = new LinkedListNode(string.Empty); + m_namespases.AddFirst(m_insertAt); + } + + public void AddNamespace(string ns) { + Safe.ArgumentMatch(ns, nameof(ns), _nsRx); + if (m_insertAt != null) + m_namespases.AddAfter(m_insertAt, ns); + else + m_namespases.AddFirst(ns); + } + + public void AddMapping(string typeName, Type type) { + Safe.ArgumentNotEmpty(typeName, nameof(typeName)); + Safe.ArgumentNotNull(type, nameof(type)); + + m_cache[typeName] = type; + } + + Type ProbeInNamespaces(string localName) { + + Type resolved; + if (!m_cache.TryGetValue(localName, out resolved)) { + foreach (var ns in m_namespases) { + var typeName = string.IsNullOrEmpty(ns) ? localName : $"{ns}.{localName}"; + resolved = Probe(typeName); + if (resolved != null) { + Log($"Probe '{localName}' -> '{resolved.FullName}'"); + break; + } + } + + if (resolved == null && m_parent != null) + resolved = m_parent.ProbeInNamespaces(localName); + + if(resolved == null) + Log($"Probe '{localName}' failed"); + + m_cache[localName] = resolved; + } + + return resolved; + } + + Type Probe(string typeName) { + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + + foreach (var assembly in assemblies) { + var type = assembly.GetType(typeName); + if (type != null) + return type; + } + return null; + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/UnityContainerExtensions.cs b/Implab.ServiceHost/src/Unity/UnityContainerExtensions.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/UnityContainerExtensions.cs @@ -0,0 +1,40 @@ +using System.IO; +using Unity; + +namespace Implab.ServiceHost.Unity +{ + public static class UnityContainerExtensions + { + public static IUnityContainer LoadXmlConfiguration(this IUnityContainer container, string file, ContainerConfigurationSchema schema) { + Safe.ArgumentNotNull(container, nameof(container)); + var builder = new ContainerBuilder(container,schema); + builder.LoadConfig(file); + return builder.Container; + } + + public static IUnityContainer LoadXmlConfiguration(this IUnityContainer container, Stream stream, ContainerConfigurationSchema schema) { + Safe.ArgumentNotNull(container, nameof(container)); + Safe.ArgumentNotNull(stream, nameof(stream)); + + if (schema == null) + schema = ContainerConfigurationSchema.Default; + + var builder = new ContainerBuilder(container,schema); + var config = (ContainerElement)schema.Serializer.Deserialize(stream); + if (config.Items != null) { + foreach(var item in config.Items) + item?.Visit(builder); + } + + return builder.Container; + } + + public static IUnityContainer LoadXmlConfiguration(this IUnityContainer container, Stream stream) { + return LoadXmlConfiguration(container, stream, ContainerConfigurationSchema.Default); + } + + public static IUnityContainer LoadXmlConfiguration(this IUnityContainer container, string file) { + return LoadXmlConfiguration(container, file, ContainerConfigurationSchema.Default); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ValueElement.cs b/Implab.ServiceHost/src/Unity/ValueElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ValueElement.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class ValueElement : AbstractRegistration, IInstanceRegistration { + + [XmlAttribute("value")] + public string Value { get; set; } + + [XmlText] + public string Text { get; set; } + + string GetTextValue() { + return string.IsNullOrEmpty(Value) ? Text : Value; + } + + public string TypeName { + get { + return RegistrationType; + } + } + + public IEnumerable MemberInjections { + get { + yield return new ValueParameterElement { + Value = Value, + Text = Text + }; + } + } + + public override void Visit(ContainerBuilder builder) { + builder.Visit(this); + } + } +} \ No newline at end of file diff --git a/Implab.ServiceHost/src/Unity/ValueParameterElement.cs b/Implab.ServiceHost/src/Unity/ValueParameterElement.cs new file mode 100644 --- /dev/null +++ b/Implab.ServiceHost/src/Unity/ValueParameterElement.cs @@ -0,0 +1,21 @@ +using System.ComponentModel; +using System.Xml.Serialization; + +namespace Implab.ServiceHost.Unity { + public class ValueParameterElement : AbstractInjectionParameter { + [XmlAttribute("value")] + public string Value { get; set; } + + [XmlText] + public string Text { get; set; } + + string GetTextValue() { + return string.IsNullOrEmpty(Value) ? Text : Value; + } + + public override void Visit(InjectionParameterBuilder builder) { + var type = builder.ResolveInjectedValueType(TypeName); + builder.SetValue(type, TypeDescriptor.GetConverter(type).ConvertFromString(GetTextValue())); + } + } +} \ No newline at end of file diff --git a/Implab.Test/AsyncTests.cs b/Implab.Test/AsyncTests.cs deleted file mode 100644 --- a/Implab.Test/AsyncTests.cs +++ /dev/null @@ -1,863 +0,0 @@ -using System; -using System.Reflection; -using System.Threading; -using Implab.Parallels; - -#if MONO - -using NUnit.Framework; -using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; -using TestMethodAttribute = NUnit.Framework.TestAttribute; - -#else - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -#endif - -namespace Implab.Test { - [TestClass] - public class AsyncTests { - [TestMethod] - public void ResolveTest() { - int res = -1; - var p = new Promise(); - p.Then(x => res = x); - p.Resolve(100); - - Assert.AreEqual(100, res); - } - - [TestMethod] - public void RejectTest() { - int res = -1; - Exception err = null; - - var p = new Promise(); - p.Then( - x => res = x, - e => { - err = e; - return -2; - } - ); - p.Reject(new ApplicationException("error")); - - Assert.AreEqual(res, -1); - Assert.AreEqual(err.Message, "error"); - - } - - [TestMethod] - public void CancelExceptionTest() { - var p = new Promise(); - p.CancelOperation(null); - - var p2 = p.Then(x => x, null, reason => { - throw new ApplicationException("CANCELLED"); - }); - - try { - p2.Join(); - Assert.Fail(); - } catch (ApplicationException err) { - Assert.AreEqual("CANCELLED", err.InnerException.Message); - } - - } - - [TestMethod] - public void ContinueOnCancelTest() { - var p = new Promise(); - p.CancelOperation(null); - - var p2 = p - .Then(x => x, null, reason => { - throw new ApplicationException("CANCELLED"); - }) - .Then(x => x, e => true); - - Assert.AreEqual(true, p2.Join()); - } - - [TestMethod] - public void JoinSuccessTest() { - var p = new Promise(); - p.Resolve(100); - Assert.AreEqual(p.Join(), 100); - } - - [TestMethod] - public void JoinFailTest() { - var p = new Promise(); - p.Reject(new ApplicationException("failed")); - - try { - p.Join(); - throw new ApplicationException("WRONG!"); - } catch (TargetInvocationException err) { - Assert.AreEqual(err.InnerException.Message, "failed"); - } catch { - Assert.Fail("Got wrong excaption"); - } - } - - [TestMethod] - public void MapTest() { - var p = new Promise(); - - var p2 = p.Then(x => x.ToString()); - p.Resolve(100); - - Assert.AreEqual(p2.Join(), "100"); - } - - [TestMethod] - public void FixErrorTest() { - var p = new Promise(); - - var p2 = p.Then(x => x, e => 101); - - p.Reject(new Exception()); - - Assert.AreEqual(p2.Join(), 101); - } - - [TestMethod] - public void ChainTest() { - var p1 = new Promise(); - - var p3 = p1.Chain(x => { - var p2 = new Promise(); - p2.Resolve(x.ToString()); - return p2; - }); - - p1.Resolve(100); - - Assert.AreEqual(p3.Join(), "100"); - } - - [TestMethod] - public void ChainFailTest() { - var p1 = new Promise(); - - var p3 = p1.Chain(x => { - var p2 = new Promise(); - p2.Reject(new Exception("DIE!!!")); - return p2; - }); - - p1.Resolve(100); - - Assert.IsTrue(p3.IsResolved); - } - - [TestMethod] - public void PoolTest() { - var pid = Thread.CurrentThread.ManagedThreadId; - var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); - - Assert.AreNotEqual(pid, p.Join()); - } - - [TestMethod] - public void WorkerPoolSizeTest() { - var pool = new WorkerPool(5, 10, 1); - - Assert.AreEqual(5, pool.PoolSize); - - pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); - pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); - pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); - - Assert.AreEqual(5, pool.PoolSize); - - for (int i = 0; i < 100; i++) - pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); - Thread.Sleep(200); - Assert.AreEqual(10, pool.PoolSize); - - pool.Dispose(); - } - - [TestMethod] - public void WorkerPoolCorrectTest() { - var pool = new WorkerPool(0,1000,100); - - const int iterations = 1000; - int pending = iterations; - var stop = new ManualResetEvent(false); - - var count = 0; - for (int i = 0; i < iterations; i++) { - pool - .Invoke(() => 1) - .Then(x => Interlocked.Add(ref count, x)) - .Then(x => Math.Log10(x)) - .On(() => { - Interlocked.Decrement(ref pending); - if (pending == 0) - stop.Set(); - }, PromiseEventType.All); - } - - stop.WaitOne(); - - Assert.AreEqual(iterations, count); - Console.WriteLine("Max threads: {0}", pool.MaxRunningThreads); - pool.Dispose(); - - } - - [TestMethod] - public void WorkerPoolDisposeTest() { - var pool = new WorkerPool(5, 20); - Assert.AreEqual(5, pool.PoolSize); - pool.Dispose(); - Thread.Sleep(500); - Assert.AreEqual(0, pool.PoolSize); - pool.Dispose(); - } - - [TestMethod] - public void MTQueueTest() { - var queue = new MTQueue(); - int res; - - queue.Enqueue(10); - Assert.IsTrue(queue.TryDequeue(out res)); - Assert.AreEqual(10, res); - Assert.IsFalse(queue.TryDequeue(out res)); - - for (int i = 0; i < 1000; i++) - queue.Enqueue(i); - - for (int i = 0; i < 1000; i++) { - queue.TryDequeue(out res); - Assert.AreEqual(i, res); - } - - int writers = 0; - int readers = 0; - var stop = new ManualResetEvent(false); - int total = 0; - - const int itemsPerWriter = 10000; - const int writersCount = 10; - - for (int i = 0; i < writersCount; i++) { - Interlocked.Increment(ref writers); - AsyncPool - .RunThread(() => { - for (int ii = 0; ii < itemsPerWriter; ii++) { - queue.Enqueue(1); - } - return 1; - }) - .On(() => Interlocked.Decrement(ref writers), PromiseEventType.All); - } - - for (int i = 0; i < 10; i++) { - Interlocked.Increment(ref readers); - AsyncPool - .RunThread(() => { - int t; - do { - while (queue.TryDequeue(out t)) - Interlocked.Add(ref total, t); - } while (writers > 0); - return 1; - }) - .On(() => { - Interlocked.Decrement(ref readers); - if (readers == 0) - stop.Set(); - }, PromiseEventType.All); - } - - stop.WaitOne(); - - Assert.AreEqual(100000, total); - } - - [TestMethod] - public void AsyncQueueTest() { - var queue = new AsyncQueue(); - int res; - - queue.Enqueue(10); - Assert.IsTrue(queue.TryDequeue(out res)); - Assert.AreEqual(10, res); - Assert.IsFalse(queue.TryDequeue(out res)); - - for (int i = 0; i < 1000; i++) - queue.Enqueue(i); - - for (int i = 0; i < 1000; i++) { - queue.TryDequeue(out res); - Assert.AreEqual(i, res); - } - - const int count = 10000000; - - int res1 = 0, res2 = 0; - var t1 = Environment.TickCount; - - AsyncPool.RunThread( - () => { - for (var i = 0; i < count; i++) - queue.Enqueue(1); - Console.WriteLine("done writer #1: {0} ms", Environment.TickCount - t1); - }, - () => { - for (var i = 0; i < count; i++) - queue.Enqueue(2); - Console.WriteLine("done writer #2: {0} ms", Environment.TickCount - t1); - }, - () => { - int temp; - int i = 0; - while (i < count) - if (queue.TryDequeue(out temp)) { - i++; - res1 += temp; - } - Console.WriteLine("done reader #1: {0} ms", Environment.TickCount - t1); - }, - () => { - int temp; - int i = 0; - while (i < count) - if (queue.TryDequeue(out temp)) { - i++; - res2 += temp; - } - Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1); - } - ) - .Bundle() - .Join(); - - Assert.AreEqual(count * 3, res1 + res2); - - Console.WriteLine( - "done: {0} ms, summ#1: {1}, summ#2: {2}, total: {3}, count: {4}", - Environment.TickCount - t1, - res1, - res2, - res1 + res2, - count - ); - } - - [TestMethod] - public void AsyncQueueBatchTest() { - var queue = new AsyncQueue(); - - const int wBatch = 29; - const int wCount = 400000; - const int total = wBatch * wCount * 2; - const int summ = wBatch * wCount * 3; - - int r1 = 0, r2 = 0; - const int rBatch = 111; - int read = 0; - - var t1 = Environment.TickCount; - - AsyncPool.RunThread( - () => { - var buffer = new int[wBatch]; - for(int i = 0; i { - var buffer = new int[wBatch]; - for(int i = 0; i { - var buffer = new int[rBatch]; - - while(read < total) { - int actual; - if (queue.TryDequeueRange(buffer,0,rBatch,out actual)) { - for(int i=0; i< actual; i++) - r1 += buffer[i]; - Interlocked.Add(ref read, actual); - } - } - - Console.WriteLine("done reader #1: {0} ms", Environment.TickCount - t1); - }, - () => { - var buffer = new int[rBatch]; - - while(read < total) { - int actual; - if (queue.TryDequeueRange(buffer,0,rBatch,out actual)) { - for(int i=0; i< actual; i++) - r2 += buffer[i]; - Interlocked.Add(ref read, actual); - } - } - - Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1); - } - ) - .Bundle() - .Join(); - - Assert.AreEqual(summ , r1 + r2); - - Console.WriteLine( - "done: {0} ms, summ#1: {1}, summ#2: {2}, total: {3}, count: {4}", - Environment.TickCount - t1, - r1, - r2, - r1 + r2, - total - ); - } - - [TestMethod] - public void AsyncQueueChunkDequeueTest() { - var queue = new AsyncQueue(); - - const int wBatch = 31; - const int wCount = 200000; - const int total = wBatch * wCount * 3; - const int summ = wBatch * wCount * 6; - - int r1 = 0, r2 = 0; - const int rBatch = 1024; - int read = 0; - - var t1 = Environment.TickCount; - - AsyncPool.RunThread( - () => { - var buffer = new int[wBatch]; - for(int i = 0; i { - var buffer = new int[wBatch]; - for(int i = 0; i { - var buffer = new int[wBatch]; - for(int i = 0; i { - var buffer = new int[rBatch]; - int count = 1; - double avgchunk = 0; - while(read < total) { - int actual; - if (queue.TryDequeueChunk(buffer,0,rBatch,out actual)) { - for(int i=0; i< actual; i++) - r2 += buffer[i]; - Interlocked.Add(ref read, actual); - avgchunk = avgchunk*(count-1)/count + actual/(double)count; - count ++; - } - } - - Console.WriteLine("done reader #2: {0} ms, avg chunk size: {1}", Environment.TickCount - t1, avgchunk); - } - ) - .Bundle() - .Join(); - - Assert.AreEqual(summ , r1 + r2); - - Console.WriteLine( - "done: {0} ms, summ#1: {1}, summ#2: {2}, total: {3}, count: {4}", - Environment.TickCount - t1, - r1, - r2, - r1 + r2, - total - ); - } - - [TestMethod] - public void AsyncQueueDrainTest() { - var queue = new AsyncQueue(); - - const int wBatch = 11; - const int wCount = 200000; - const int total = wBatch * wCount * 3; - const int summ = wBatch * wCount * 3; - - int r1 = 0, r2 = 0; - const int rBatch = 11; - int read = 0; - - var t1 = Environment.TickCount; - - AsyncPool.RunThread( - () => { - var buffer = new int[wBatch]; - for(int i = 0; i { - for(int i =0; i < wCount * wBatch; i++) - queue.Enqueue(1); - Console.WriteLine("done writer #2: {0} ms", Environment.TickCount - t1); - }, - () => { - var buffer = new int[wBatch]; - for(int i = 0; i { - int temp; - int count = 0; - while (read < total) - if (queue.TryDequeue(out temp)) { - count++; - r1 += temp; - Interlocked.Increment(ref read); - } - Console.WriteLine("done reader #1: {0} ms, {1} count", Environment.TickCount - t1, count); - },*/ - /*() => { - var buffer = new int[rBatch]; - var count = 0; - while(read < total) { - int actual; - if (queue.TryDequeueRange(buffer,0,rBatch,out actual)) { - for(int i=0; i< actual; i++) - r1 += buffer[i]; - Interlocked.Add(ref read, actual); - count += actual; - } - } - - Console.WriteLine("done reader #1: {0} ms, {1} items", Environment.TickCount - t1, count); - },*/ - () => { - var count = 0; - while(read < total) { - var buffer = queue.Drain(); - for(int i=0; i< buffer.Length; i++) - r1 += buffer[i]; - Interlocked.Add(ref read, buffer.Length); - count += buffer.Length; - } - Console.WriteLine("done reader #1: {0} ms, {1} items", Environment.TickCount - t1, count); - }, - () => { - var count = 0; - while(read < total) { - var buffer = queue.Drain(); - for(int i=0; i< buffer.Length; i++) - r2 += buffer[i]; - Interlocked.Add(ref read, buffer.Length); - count += buffer.Length; - } - Console.WriteLine("done reader #2: {0} ms, {1} items", Environment.TickCount - t1, count); - } - ) - .Bundle() - .Join(); - - Assert.AreEqual(summ , r1 + r2); - - Console.WriteLine( - "done: {0} ms, summ#1: {1}, summ#2: {2}, total: {3}, count: {4}", - Environment.TickCount - t1, - r1, - r2, - r1 + r2, - total - ); - } - - [TestMethod] - public void ParallelMapTest() { - - const int count = 100000; - - var args = new double[count]; - var rand = new Random(); - - for (int i = 0; i < count; i++) - args[i] = rand.NextDouble(); - - var t = Environment.TickCount; - var res = args.ParallelMap(x => Math.Sin(x*x), 4).Join(); - - Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); - - t = Environment.TickCount; - for (int i = 0; i < count; i++) - Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); - Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); - } - - [TestMethod] - public void ChainedMapTest() { - - using (var pool = new WorkerPool()) { - const int count = 10000; - - var args = new double[count]; - var rand = new Random(); - - for (int i = 0; i < count; i++) - args[i] = rand.NextDouble(); - - var t = Environment.TickCount; - var res = args - .ChainedMap( - // Analysis disable once AccessToDisposedClosure - x => pool.Invoke( - () => Math.Sin(x * x) - ), - 4 - ) - .Join(); - - Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); - - t = Environment.TickCount; - for (int i = 0; i < count; i++) - Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); - Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); - Console.WriteLine("Max workers: {0}", pool.MaxRunningThreads); - } - } - - [TestMethod] - public void ParallelForEachTest() { - - const int count = 100000; - - var args = new int[count]; - var rand = new Random(); - - for (int i = 0; i < count; i++) - args[i] = (int)(rand.NextDouble() * 100); - - int result = 0; - - var t = Environment.TickCount; - args.ParallelForEach(x => Interlocked.Add(ref result, x), 4).Join(); - - Console.WriteLine("Iteration complete in {0} ms, result: {1}", Environment.TickCount - t, result); - - int result2 = 0; - - t = Environment.TickCount; - for (int i = 0; i < count; i++) - result2 += args[i]; - Assert.AreEqual(result2, result); - Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); - } - - [TestMethod] - public void ComplexCase1Test() { - var flags = new bool[3]; - - // op1 (aync 200ms) => op2 (async 200ms) => op3 (sync map) - - var step1 = PromiseHelper - .Sleep(200, "Alan") - .On(() => flags[0] = true, PromiseEventType.Cancelled); - var p = step1 - .Chain(x => - PromiseHelper - .Sleep(200, "Hi, " + x) - .Then(y => y) - .On(() => flags[1] = true, PromiseEventType.Cancelled) - ) - .On(() => flags[2] = true, PromiseEventType.Cancelled); - step1.Join(); - p.Cancel(); - try { - Assert.AreEqual(p.Join(), "Hi, Alan"); - Assert.Fail("Shouldn't get here"); - } catch (OperationCanceledException) { - } - - Assert.IsFalse(flags[0]); - Assert.IsTrue(flags[1]); - Assert.IsTrue(flags[2]); - } - - [TestMethod] - public void ChainedCancel1Test() { - // при отмене сцепленной асинхронной операции все обещание должно - // завершаться ошибкой OperationCanceledException - var p = PromiseHelper - .Sleep(1, "Hi, HAL!") - .Then(x => { - // запускаем две асинхронные операции - var result = PromiseHelper.Sleep(1000, "HEM ENABLED!!!"); - // вторая операция отменяет первую до завершения - PromiseHelper - .Sleep(100, "HAL, STOP!") - .Then(result.Cancel); - return result; - }); - try { - p.Join(); - } catch (TargetInvocationException err) { - Assert.IsTrue(err.InnerException is OperationCanceledException); - } - } - - [TestMethod] - public void ChainedCancel2Test() { - // при отмене цепочки обещаний, вложенные операции также должны отменяться - var pSurvive = new Promise(); - var hemStarted = new Signal(); - var p = PromiseHelper - .Sleep(1, "Hi, HAL!") - .Chain(() => { - hemStarted.Set(); - // запускаем две асинхронные операции - var result = PromiseHelper - .Sleep(2000, "HEM ENABLED!!!") - .Then(() => pSurvive.Resolve(false)); - - result - .On(() => pSurvive.Resolve(true), PromiseEventType.Cancelled); - - return result; - }); - - hemStarted.Wait(); - p.Cancel(); - - try { - p.Join(); - Assert.Fail(); - } catch (OperationCanceledException) { - } - Assert.IsTrue(pSurvive.Join()); - } - - [TestMethod] - public void SharedLockTest() { - var l = new SharedLock(); - int shared = 0; - int exclusive = 0; - var s1 = new Signal(); - var log = new AsyncQueue(); - - try { - AsyncPool.RunThread( - () => { - log.Enqueue("Reader #1 started"); - try { - l.LockShared(); - log.Enqueue("Reader #1 lock got"); - if (Interlocked.Increment(ref shared) == 2) - s1.Set(); - s1.Wait(); - log.Enqueue("Reader #1 finished"); - Interlocked.Decrement(ref shared); - } finally { - l.Release(); - log.Enqueue("Reader #1 lock released"); - } - }, - () => { - log.Enqueue("Reader #2 started"); - - try { - l.LockShared(); - log.Enqueue("Reader #2 lock got"); - - if (Interlocked.Increment(ref shared) == 2) - s1.Set(); - s1.Wait(); - log.Enqueue("Reader #2 upgrading to writer"); - Interlocked.Decrement(ref shared); - l.Upgrade(); - log.Enqueue("Reader #2 upgraded"); - - Assert.AreEqual(1, Interlocked.Increment(ref exclusive)); - Assert.AreEqual(0, shared); - log.Enqueue("Reader #2 finished"); - Interlocked.Decrement(ref exclusive); - } finally { - l.Release(); - log.Enqueue("Reader #2 lock released"); - } - }, - () => { - log.Enqueue("Writer #1 started"); - try { - l.LockExclusive(); - log.Enqueue("Writer #1 got the lock"); - Assert.AreEqual(1, Interlocked.Increment(ref exclusive)); - Interlocked.Decrement(ref exclusive); - log.Enqueue("Writer #1 is finished"); - } finally { - l.Release(); - log.Enqueue("Writer #1 lock released"); - } - } - ).Bundle().Join(1000); - log.Enqueue("Done"); - } catch(Exception error) { - log.Enqueue(error.Message); - throw; - } finally { - foreach (var m in log) - Console.WriteLine(m); - } - } - - #if NET_4_5 - - [TestMethod] - public async void TaskInteropTest() { - var promise = new Promise(); - promise.Resolve(10); - var res = await promise; - - Assert.AreEqual(10, res); - } - - #endif - } -} - diff --git a/Implab.Test/CancelationTests.cs b/Implab.Test/CancelationTests.cs deleted file mode 100644 --- a/Implab.Test/CancelationTests.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using Implab.Parallels; - -#if MONO - -using NUnit.Framework; -using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; -using TestMethodAttribute = NUnit.Framework.TestAttribute; - -#else - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -#endif - -namespace Implab.Test { - [TestClass] - public class CancelationTests { - - [TestMethod] - public void PromiseCancelTest() { - var p = new Promise(); - bool requested = false; - var reason = new Exception("Test"); - - // request cancelation - p.Cancel(reason); - - Assert.IsTrue(p.IsCancellationRequested); - Assert.AreSame(reason, p.CancellationReason); - Assert.IsFalse(p.IsCancelled); - - p.CancellationRequested(r => { - Assert.AreSame(reason, r); - requested = true; - }); - - Assert.IsTrue(requested); - - // cancel the promise - Assert.IsTrue(p.CancelOperationIfRequested()); - Assert.IsTrue(p.IsCancelled); - Assert.AreSame(reason, p.Error); - } - - [TestMethod] - public void CancelActionBeforeStartTask() { - bool run = false; - var task = new ActionTask(() => { - run = true; - }, null, null, true); - - // request cancelation - task.Cancel(); - Assert.IsTrue(task.IsCancelled); - task.Resolve(); - Assert.IsFalse(run); - } - - [TestMethod] - public void CancelActionAfterTaskStarted() { - var finish = new Signal(); - var started = new Signal(); - - var task = new ActionTask(() => { - started.Set(); - finish.Wait(); - }, null, null, true); - - AsyncPool.RunThread(() => { - task.Resolve(); - }); - - started.Wait(1000); - - task.Cancel(); - Assert.IsTrue(task.IsCancellationRequested); - Assert.IsFalse(task.IsCancelled); - Assert.IsFalse(task.IsResolved); - - finish.Set(); - task.Join(1000); - - } - - [TestMethod] - public void CancelTaskChainFromBottom() { - var started = new Signal(); - var check1 = new Signal(); - var requested = false; - var p1 = AsyncPool.RunThread(token => { - token.CancellationRequested(reason => requested = true); - started.Set(); - check1.Wait(); - token.CancelOperationIfRequested(); - }); - - started.Wait(); - - var p2 = p1.Then(() => { - }); - - Assert.IsFalse(p1.IsResolved); - Assert.IsFalse(p2.IsResolved); - - p2.Cancel(); - - Assert.IsFalse(p2.IsCancelled); - Assert.IsFalse(p1.IsCancelled); - Assert.IsTrue(requested); - - check1.Set(); - - try { - p2.Join(1000); - Assert.Fail("The chain isn't cancelled"); - } catch(OperationCanceledException){ - } - - Assert.IsTrue(p1.IsCancelled); - Assert.IsTrue(p2.IsCancelled); - } - - - - [TestMethod] - public void CancellableAsyncTask() { - var finish = new Signal(); - var started = new Signal(); - - var p = AsyncPool.RunThread(token => { - token.CancellationRequested(r => finish.Set()); - started.Set(); - finish.Wait(); - Assert.IsTrue(token.CancelOperationIfRequested()); - }); - - started.Wait(1000); - Assert.IsFalse(p.IsResolved); - p.Cancel(); - try { - p.Join(1000); - } catch (OperationCanceledException) { - } - } - } -} - diff --git a/Implab.Test/Implab.Format.Test/Implab.Format.Test.csproj b/Implab.Test/Implab.Format.Test/Implab.Format.Test.csproj deleted file mode 100644 --- a/Implab.Test/Implab.Format.Test/Implab.Format.Test.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {4D364996-7ECD-4193-8F90-F223FFEA49DA} - Library - Implab.Format.Test - Implab.Format.Test - v4.5 - 0.2 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - - - - - - - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - - \ No newline at end of file diff --git a/Implab.Test/Implab.Format.Test/packages.config b/Implab.Test/Implab.Format.Test/packages.config deleted file mode 100644 --- a/Implab.Test/Implab.Format.Test/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Implab.Test/Implab.Test.csproj b/Implab.Test/Implab.Test.csproj --- a/Implab.Test/Implab.Test.csproj +++ b/Implab.Test/Implab.Test.csproj @@ -1,84 +1,24 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {63F92C0C-61BF-48C0-A377-8D67C3C661D0} - Library - Properties - Implab.Test - Implab.Test - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - + + + netcoreapp2.0;net46 + /usr/lib/mono/4.5/ - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + + + netcoreapp2.0;net46 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false + + + false - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - + - - - - 3.5 - - - - - - - - + + + + + + - - - {99B95D0D-9CF9-4F70-8ADF-F4D0AA5CB0D9} - Implab - - - - - \ No newline at end of file + + diff --git a/Implab.Test/Implab.Test.mono.csproj b/Implab.Test/Implab.Test.mono.csproj deleted file mode 100644 --- a/Implab.Test/Implab.Test.mono.csproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {2BD05F84-E067-4B87-9477-FDC2676A21C6} - Library - Implab.Test - Implab.Test - v4.5 - 0.2 - - - true - full - false - bin\Debug - DEBUG;MONO - prompt - 4 - false - - - true - bin\Release - prompt - 4 - false - MONO - - - true - full - false - bin\Debug - DEBUG;TRACE;NET_4_5;MONO - prompt - 4 - false - - - true - bin\Release - NET_4_5;MONO - prompt - 4 - false - - - - - - - - - - - - - - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - \ No newline at end of file diff --git a/Implab.Test/Properties/AssemblyInfo.cs b/Implab.Test/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/Implab.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Implab.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Implab.Test")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[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("bfcae720-21eb-4411-b70a-6eeab99071de")] - -// 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("0.0.*")] diff --git a/Implab.Test/RunnableComponentTests.cs b/Implab.Test/RunnableComponentTests.cs deleted file mode 100644 --- a/Implab.Test/RunnableComponentTests.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Reflection; -using System.Threading; -using Implab.Parallels; -using Implab.Components; - -#if MONO - -using NUnit.Framework; -using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; -using TestMethodAttribute = NUnit.Framework.TestAttribute; -using AssertFailedException = NUnit.Framework.AssertionException; -#else - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -#endif - -namespace Implab.Test { - [TestClass] - public class RunnableComponentTests { - - static void ShouldThrow(Action action) { - try { - action(); - Assert.Fail(); - } catch (AssertFailedException) { - throw; - } catch { - } - } - - class Runnable : RunnableComponent { - public Runnable(bool initialized) : base(initialized) { - } - - public Action MockInit { - get; - set; - } - - public Func MockStart { - get; - set; - } - - public Func MockStop { - get; - set; - } - - protected override IPromise OnStart() { - return MockStart != null ? MockStart() : base.OnStart(); - } - - protected override IPromise OnStop() { - return MockStop != null ? MockStop() : base.OnStart(); - } - - protected override void OnInitialize() { - if (MockInit != null) - MockInit(); - } - } - - [TestMethod] - public void NormalFlowTest() { - var comp = new Runnable(false); - - Assert.AreEqual(ExecutionState.Created, comp.State); - - comp.Init(); - - Assert.AreEqual(ExecutionState.Ready, comp.State); - - comp.Start().Join(1000); - - Assert.AreEqual(ExecutionState.Running, comp.State); - - comp.Stop().Join(1000); - - Assert.AreEqual(ExecutionState.Disposed, comp.State); - - } - - [TestMethod] - public void InitFailTest() { - var comp = new Runnable(false) { - MockInit = () => { - throw new Exception("BAD"); - } - }; - - ShouldThrow(() => comp.Start()); - ShouldThrow(() => comp.Stop()); - Assert.AreEqual(ExecutionState.Created, comp.State); - - ShouldThrow(comp.Init); - - Assert.AreEqual(ExecutionState.Failed, comp.State); - - ShouldThrow(() => comp.Start()); - ShouldThrow(() => comp.Stop()); - Assert.AreEqual(ExecutionState.Failed, comp.State); - - comp.Dispose(); - Assert.AreEqual(ExecutionState.Disposed, comp.State); - } - - [TestMethod] - public void DisposedTest() { - - var comp = new Runnable(false); - comp.Dispose(); - - ShouldThrow(() => comp.Start()); - ShouldThrow(() => comp.Stop()); - ShouldThrow(comp.Init); - - Assert.AreEqual(ExecutionState.Disposed, comp.State); - } - - [TestMethod] - public void StartCancelTest() { - var comp = new Runnable(true) { - MockStart = () => PromiseHelper.Sleep(100000, 0) - }; - - var p = comp.Start(); - Assert.AreEqual(ExecutionState.Starting, comp.State); - p.Cancel(); - ShouldThrow(() => p.Join(1000)); - Assert.AreEqual(ExecutionState.Failed, comp.State); - - Assert.IsTrue(comp.LastError is OperationCanceledException); - - comp.Dispose(); - } - - [TestMethod] - public void StartStopTest() { - var stop = new Signal(); - var comp = new Runnable(true) { - MockStart = () => PromiseHelper.Sleep(100000, 0), - MockStop = () => AsyncPool.RunThread(stop.Wait) - }; - - var p1 = comp.Start(); - var p2 = comp.Stop(); - // should enter stopping state - - ShouldThrow(p1.Join); - Assert.IsTrue(p1.IsCancelled); - Assert.AreEqual(ExecutionState.Stopping, comp.State); - - stop.Set(); - p2.Join(1000); - Assert.AreEqual(ExecutionState.Disposed, comp.State); - } - - [TestMethod] - public void StartStopFailTest() { - var comp = new Runnable(true) { - MockStart = () => PromiseHelper.Sleep(100000, 0).Then(null,null,x => { throw new Exception("I'm dead"); }) - }; - - comp.Start(); - var p = comp.Stop(); - // if Start fails to cancel, should fail to stop - ShouldThrow(() => p.Join(1000)); - Assert.AreEqual(ExecutionState.Failed, comp.State); - Assert.IsNotNull(comp.LastError); - Assert.AreEqual("I'm dead", comp.LastError.Message); - } - - [TestMethod] - public void StopCancelTest() { - var comp = new Runnable(true) { - MockStop = () => PromiseHelper.Sleep(100000, 0) - }; - - comp.Start(); - var p = comp.Stop(); - Assert.AreEqual(ExecutionState.Stopping, comp.State); - p.Cancel(); - ShouldThrow(() => p.Join(1000)); - Assert.AreEqual(ExecutionState.Failed, comp.State); - Assert.IsTrue(comp.LastError is OperationCanceledException); - - comp.Dispose(); - } - - } -} - diff --git a/Implab.Test/src/DiagnosticsTest.cs b/Implab.Test/src/DiagnosticsTest.cs new file mode 100644 --- /dev/null +++ b/Implab.Test/src/DiagnosticsTest.cs @@ -0,0 +1,34 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Implab.Components; +using Implab.Diagnostics; +using Xunit; + +namespace Implab.Test { + + public class DiagnosticsTest { + class Foo {} + + [Fact] + public void TestRegistration() { + var channel = TraceSourceChannel.Default; + + Assert.Equal(typeof(Foo), channel.Id); + Assert.Equal(typeof(Foo).FullName, channel.Source.Name); + + TraceSourceChannel found = null; + int visited = 0; + + TraceRegistry.Global.Subscribe(x => { + visited++; + found = x as TraceSourceChannel; + }); + + Assert.Equal(1,visited); + Assert.Equal(channel, found); + + } + + } +} \ No newline at end of file diff --git a/Implab.Test/Implab.Format.Test/JsonTests.cs b/Implab.Test/src/JsonTests.cs rename from Implab.Test/Implab.Format.Test/JsonTests.cs rename to Implab.Test/src/JsonTests.cs --- a/Implab.Test/Implab.Format.Test/JsonTests.cs +++ b/Implab.Test/src/JsonTests.cs @@ -1,56 +1,61 @@ -using NUnit.Framework; +using Xunit; using System; -using Implab.Formats.JSON; using Implab.Automaton; +using Implab.Xml; +using System.Xml; +using Implab.Formats; +using Implab.Formats.Json; +using System.IO; +using Implab.Test.Model; -namespace Implab.Format.Test { - [TestFixture] +namespace Implab.Test { public class JsonTests { - [Test] + + [Fact] public void TestScannerValidTokens() { - using (var scanner = new JSONScanner(@"9123, -123, 0, 0.1, -0.2, -0.1e3, 1.3E-3, ""some \t\n\u0020 text"", literal []{}:")) { + using (var scanner = JsonStringScanner.Create(@"9123, -123, 0, 0.1, -0.2, -0.1e3, 1.3E-3, ""some \t\n\u0020 text"", literal []{}:")) { - Tuple[] expexted = { - new Tuple(JsonTokenType.Number, 9123d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, -123d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, 0d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, 0.1d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, -0.2d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, -0.1e3d), - new Tuple(JsonTokenType.ValueSeparator, ", "), - new Tuple(JsonTokenType.Number, 1.3E-3d), - new Tuple(JsonTokenType.ValueSeparator, ", "), + Tuple[] expexted = { + new Tuple(JsonTokenType.Number, "9123"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "-123"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "0"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "0.1"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "-0.2"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "-0.1e3"), + new Tuple(JsonTokenType.ValueSeparator, null), + new Tuple(JsonTokenType.Number, "1.3E-3"), + new Tuple(JsonTokenType.ValueSeparator, null), new Tuple(JsonTokenType.String, "some \t\n text"), - new Tuple(JsonTokenType.ValueSeparator, ", "), + new Tuple(JsonTokenType.ValueSeparator, null), new Tuple(JsonTokenType.Literal, "literal"), - new Tuple(JsonTokenType.BeginArray, " ["), - new Tuple(JsonTokenType.EndArray, "]"), - new Tuple(JsonTokenType.BeginObject, "{"), - new Tuple(JsonTokenType.EndObject, "}"), - new Tuple(JsonTokenType.NameSeparator, ":") + new Tuple(JsonTokenType.BeginArray, null), + new Tuple(JsonTokenType.EndArray, null), + new Tuple(JsonTokenType.BeginObject, null), + new Tuple(JsonTokenType.EndObject, null), + new Tuple(JsonTokenType.NameSeparator, null) }; - object value; + string value; JsonTokenType tokenType; for (var i = 0; i < expexted.Length; i++) { - - Assert.IsTrue(scanner.ReadToken(out value, out tokenType)); - Assert.AreEqual(expexted[i].Item1, tokenType); - Assert.AreEqual(expexted[i].Item2, value); + + Assert.True(scanner.ReadToken(out value, out tokenType)); + Assert.Equal(expexted[i].Item1, tokenType); + Assert.Equal(expexted[i].Item2, value); } - Assert.IsFalse(scanner.ReadToken(out value, out tokenType)); + Assert.False(scanner.ReadToken(out value, out tokenType)); } } - [Test] + [Fact] public void TestScannerBadTokens() { - var bad = new [] { + var bad = new[] { " 1", " literal", " \"", @@ -66,22 +71,120 @@ namespace Implab.Format.Test { "-.123" }; - foreach (var json in bad) - using (var scanner = new JSONScanner(json)) { + foreach (var json in bad) { + using (var scanner = JsonStringScanner.Create(json)) { try { - object value; + string value; JsonTokenType token; scanner.ReadToken(out value, out token); - if (!Object.Equals(value,json)) { - Console.WriteLine("'{0}' is read as {1}", json, value is String ? String.Format("'{0}'", value) : value ); + if (!Object.Equals(value, json)) { + Console.WriteLine("'{0}' is read as {1}", json, value is String ? String.Format("'{0}'", value) : value); continue; } - Assert.Fail("Token '{0}' shouldn't pass", json); + Assert.True(false, $"Token '{json}' shouldn't pass"); } catch (ParserException e) { Console.WriteLine(e.Message); } } - + } + } + + [Fact] + public void JsonXmlReaderSimpleTest() { + //var json = "\"some text\""; + //Console.WriteLine($"JSON: {json}"); + //Console.WriteLine("XML"); + /*using (var xmlReader = new JsonXmlReader(new JSONParser(json), new JsonXmlReaderOptions { NamespaceUri = "JsonXmlReaderSimpleTest", RootName = "string", NodesPrefix = "json" })) { + Assert.AreEqual(xmlReader.ReadState, System.Xml.ReadState.Initial); + + AssertRead(xmlReader, XmlNodeType.XmlDeclaration); + AssertRead(xmlReader, XmlNodeType.Element); + AssertRead(xmlReader, XmlNodeType.Text); + AssertRead(xmlReader, XmlNodeType.EndElement); + Assert.IsFalse(xmlReader.Read()); + }*/ + + DumpJsonParse("\"text value\""); + DumpJsonParse("null"); + DumpJsonParse("true"); + DumpJsonParse("{}"); + DumpJsonParse("[]"); + DumpJsonParse("{\"one\":1, \"two\":2}"); + DumpJsonParse("[1,\"\",2,3]"); + DumpJsonParse("[{\"info\": [7,8,9]}]"); + DumpJsonFlatParse("[1,2,\"\",[3,4],{\"info\": [5,6]},{\"num\": [7,8,null]}, null,[null]]"); + } + + [Fact] + public void XmlToJsonTransform() { + var person = new Person { + FirstName = "Charlie", + LastName = "Brown", + Age = 19, + AgeSpecified = true + }; + + var doc = SerializationHelpers.SerializeAsXmlDocument(person); + + using (var writer = new StringWriter()) { + XmlToJson.Default.Transform(doc,null, writer); + Console.WriteLine(writer.ToString()); + } + } + + [Fact] + public void JsonSerialization() { + var person = new Person { + FirstName = "Charlie", + LastName = "Brown", + Age = 19, + AgeSpecified = true, + Tags = new [] { "brave", "stupid" } + }; + + var data = SerializationHelpers.SerializeJsonAsString(person); + Console.WriteLine(data); + var clone = SerializationHelpers.DeserializeJsonFromString(data); + + Assert.Equal(person.FirstName, clone.FirstName); + Assert.Equal(person.LastName, clone.LastName); + Assert.Equal(person.Age, clone.Age); + Assert.Equal(person.AgeSpecified, clone.AgeSpecified); + Assert.Equal(person.Tags, person.Tags); + } + + void AssertRead(XmlReader reader, XmlNodeType expected) { + Assert.True(reader.Read()); + Console.WriteLine($"{new string(' ', reader.Depth * 2)}{reader}"); + Assert.Equal(expected, reader.NodeType); + } + + void DumpJsonParse(string json) { + Console.WriteLine($"JSON: {json}"); + Console.WriteLine("XML"); + using (var xmlWriter = XmlWriter.Create(Console.Out, new XmlWriterSettings { + Indent = true, + CloseOutput = false, + ConformanceLevel = ConformanceLevel.Document + })) + using (var xmlReader = new JsonXmlReader(JsonReader.ParseString(json), new JsonXmlReaderOptions { NamespaceUri = "JsonXmlReaderSimpleTest", RootName = "Data", NodesPrefix = "json", CaseTransform = JsonXmlCaseTransform.UcFirst, ArrayItemName = "Item" })) { + xmlWriter.WriteNode(xmlReader, false); + } + Console.WriteLine(); + } + + void DumpJsonFlatParse(string json) { + Console.WriteLine($"JSON: {json}"); + Console.WriteLine("XML"); + using (var xmlWriter = XmlWriter.Create(Console.Out, new XmlWriterSettings { + Indent = true, + CloseOutput = false, + ConformanceLevel = ConformanceLevel.Document + })) + using (var xmlReader = new JsonXmlReader(JsonReader.ParseString(json), new JsonXmlReaderOptions { NamespaceUri = "JsonXmlReaderSimpleTest", NodesPrefix = "", FlattenArrays = true })) { + xmlWriter.WriteNode(xmlReader, false); + } + Console.WriteLine(); } } } diff --git a/Implab.Test/src/MockPollComponent.cs b/Implab.Test/src/MockPollComponent.cs new file mode 100644 --- /dev/null +++ b/Implab.Test/src/MockPollComponent.cs @@ -0,0 +1,37 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Implab.Components; + +namespace Implab.Test { + public class MockPollComponent : PollingComponent { + + public Func PollWorker { get; set;} + + public Func StartWorker { get; set; } + + public Func StopWorker { get; set; } + + public MockPollComponent(bool initialized) : base(initialized) { + } + + protected async override Task Poll(CancellationToken ct) { + if(PollWorker!= null) + await PollWorker.Invoke(ct); + } + + protected async override Task StopInternalAsync(CancellationToken ct) { + await base.StopInternalAsync(ct); + if (StopWorker != null) + await StopWorker.Invoke(ct); + } + + protected async override Task StartInternalAsync(CancellationToken ct) { + await base.StartInternalAsync(ct); + if (StartWorker != null) + await StartWorker.Invoke(ct); + } + + + } +} \ No newline at end of file diff --git a/Implab.Test/src/Model/Person.cs b/Implab.Test/src/Model/Person.cs new file mode 100644 --- /dev/null +++ b/Implab.Test/src/Model/Person.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace Implab.Test.Model { + + [XmlRoot(Namespace="urn:implab:test:model")] + public class Person { + public string FirstName { get; set; } + + public string LastName { get; set; } + + public int Age { get; set; } + + [XmlIgnore] + public bool AgeSpecified { get; set; } + + + [XmlElement("Tag")] + public string[] Tags { get; set; } + } +} \ No newline at end of file diff --git a/Implab.Test/PromiseHelper.cs b/Implab.Test/src/PromiseHelper.cs rename from Implab.Test/PromiseHelper.cs rename to Implab.Test/src/PromiseHelper.cs --- a/Implab.Test/PromiseHelper.cs +++ b/Implab.Test/src/PromiseHelper.cs @@ -1,13 +1,39 @@ -using Implab.Parallels; +using Implab; +using System; using System.Threading; namespace Implab.Test { static class PromiseHelper { - public static IPromise Sleep(int timeout, T retVal) { - return AsyncPool.Invoke((ct) => { - ct.CancellationRequested(ct.CancelOperation); - Thread.Sleep(timeout); - return retVal; + public static IPromise Sleep(int timeout, T retVal, CancellationToken ct = default(CancellationToken)) { + + Timer timer = null; + + return Promise.Create((d) => { + timer = new Timer(x => { + d.Resolve(retVal); + }, null, timeout, Timeout.Infinite); + + if(ct.CanBeCanceled) + ct.Register(d.Cancel); + + }).Finally(() => { + Safe.Dispose(timer); + }); + } + + public static IPromise Sleep(int timeout, CancellationToken ct = default(CancellationToken)) { + Timer timer = null; + + return Promise.Create((d) => { + timer = new Timer(x => { + d.Resolve(); + }, null, timeout, Timeout.Infinite); + + if(ct.CanBeCanceled) + ct.Register(d.Cancel); + + }).Finally(() => { + Safe.Dispose(timer); }); } } diff --git a/Implab.Test/src/RunnableComponentTests.cs b/Implab.Test/src/RunnableComponentTests.cs new file mode 100644 --- /dev/null +++ b/Implab.Test/src/RunnableComponentTests.cs @@ -0,0 +1,264 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Implab.Components; +using Xunit; + +namespace Implab.Test { + + public class RunnableComponentTests { + [Fact] + public async Task SimpleStartStop() { + + using (var m = new MockPollComponent(true)) { + m.StartWorker = async (ct) => await Task.Yield(); + m.StopWorker = async (ct) => await Task.Yield(); + + Assert.Equal(ExecutionState.Ready, m.State); + Assert.NotNull(m.Completion); + + m.Start(); + await m.Completion; + Assert.Equal(ExecutionState.Running, m.State); + + m.Stop(); + await m.Completion; + Assert.Equal(ExecutionState.Stopped, m.State); + } + } + + [Fact] + public async Task SyncStart() { + using (var m = new MockPollComponent(true)) { + m.Start(); + Assert.Equal(ExecutionState.Running, m.State); + await m.Completion; + } + } + + [Fact] + public async Task AsyncStarting() { + using (var m = new MockPollComponent(true)) { + var signal = Safe.CreateTask(); + + m.StartWorker = async (ct) => await signal; + m.Start(); + + Assert.Equal(ExecutionState.Starting, m.State); + Assert.False(m.Completion.IsCompleted); + + signal.Start(); + + await m.Completion; + + Assert.Equal(ExecutionState.Running, m.State); + } + } + + [Fact] + public async Task FailWhileStarting() { + using (var m = new MockPollComponent(true)) { + const string failMessage = "Fail me"; + var signal = new Task(() => { + throw new Exception(failMessage); + }); + + m.StartWorker = async (ct) => await signal; + m.Start(); + + Assert.Equal(ExecutionState.Starting, m.State); + Assert.False(m.Completion.IsCompleted); + + signal.Start(); + try { + await m.Completion; + Assert.True(false); + } catch (Exception e) { + Assert.Equal(failMessage, e.Message); + } + + Assert.Equal(ExecutionState.Failed, m.State); + } + } + + [Fact] + public async Task SyncStop() { + using (var m = new MockPollComponent(true)) { + m.Start(); + Assert.Equal(ExecutionState.Running, m.State); + m.Stop(); + Assert.Equal(ExecutionState.Stopped, m.State); + await m.Completion; + } + } + + [Fact] + public async Task AsyncStopping() { + using (var m = new MockPollComponent(true)) { + var signal = Safe.CreateTask(); + + m.StopWorker = async (ct) => await signal; + + // Start + m.Start(); + Assert.Equal(ExecutionState.Running, m.State); + + // Stop + m.Stop(); + Assert.Equal(ExecutionState.Stopping, m.State); + Assert.False(m.Completion.IsCompleted); + signal.Start(); + + await m.Completion; + + Assert.Equal(ExecutionState.Stopped, m.State); + } + } + + [Fact] + public async Task FailWhileStopping() { + using (var m = new MockPollComponent(true)) { + const string failMessage = "Fail me"; + var signal = new Task(() => { + throw new Exception(failMessage); + }); + + m.StopWorker = async (ct) => await signal; + + // Start + m.Start(); + Assert.Equal(ExecutionState.Running, m.State); + + // Stop + m.Stop(); + Assert.Equal(ExecutionState.Stopping, m.State); + Assert.False(m.Completion.IsCompleted); + + signal.Start(); + try { + await m.Completion; + Assert.True(false); + } catch (Exception e) { + Assert.Equal(failMessage, e.Message); + } + + Assert.Equal(ExecutionState.Failed, m.State); + } + } + + [Fact] + public async Task ThrowOnInvalidTrasition() { + using (var m = new MockPollComponent(false)) { + var started = Safe.CreateTask(); + var stopped = Safe.CreateTask(); + + m.StartWorker = async (ct) => await started; + m.StopWorker = async (ct) => await stopped; + + Assert.Throws(() => m.Start()); + + // Initialize + m.Initialize(); + await m.Completion; + + // Start + m.Start(); + Assert.Equal(ExecutionState.Starting, m.State); + + // Check invalid transitions + Assert.Throws(() => m.Start()); + + // Component can be stopped before started + // m.Stop(CancellationToken.None); + + // Running + started.Start(); + await m.Completion; + Assert.Equal(ExecutionState.Running, m.State); + + + Assert.Throws(() => m.Start()); + + // Stop + m.Stop(); + + // Check invalid transitions + Assert.Throws(() => m.Start()); + Assert.Throws(() => m.Stop()); + + // Stopped + stopped.Start(); + await m.Completion; + Assert.Equal(ExecutionState.Stopped, m.State); + + // Check invalid transitions + Assert.Throws(() => m.Start()); + Assert.Throws(() => m.Stop()); + } + } + + [Fact] + public async Task CancelStart() { + using (var m = new MockPollComponent(true)) { + m.StartWorker = (ct) => Safe.CreateTask(ct); + + m.Start(); + var start = m.Completion; + + Assert.Equal(ExecutionState.Starting, m.State); + m.Stop(); + await m.Completion; + Assert.Equal(ExecutionState.Stopped, m.State); + Assert.True(start.IsCompleted); + Assert.True(start.IsCanceled); + } + } + + [Fact] + public async Task AwaitWorker() { + using (var m = new MockPollComponent(true)) { + var worker = Safe.CreateTask(); + + m.PollWorker = (ct) => worker; + + m.Start(CancellationToken.None); + await m.Completion; + + Assert.Equal(ExecutionState.Running, m.State); + + m.Stop(CancellationToken.None); + Assert.Equal(ExecutionState.Stopping, m.State); + worker.Start(); + await m.Completion; + Assert.Equal(ExecutionState.Stopped, m.State); + } + } + + [Fact] + public async Task CancelWorker() { + using (var m = new MockPollComponent(true)) { + var worker = Safe.CreateTask(); + + var started = Safe.CreateTask(); + + m.PollWorker = async (ct) => { + started.Start(); + await worker; + ct.ThrowIfCancellationRequested(); + }; + + m.Start(CancellationToken.None); + await m.Completion; + await started; // await for the poll worker to start + + Assert.Equal(ExecutionState.Running, m.State); + + m.Stop(CancellationToken.None); + Assert.Equal(ExecutionState.Stopping, m.State); + worker.Start(); + await m.Completion; + Assert.Equal(ExecutionState.Stopped, m.State); + } + } + } +} diff --git a/Implab.mono.sln b/Implab.mono.sln deleted file mode 100644 --- a/Implab.mono.sln +++ /dev/null @@ -1,301 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab", "Implab\Implab.csproj", "{F550F1F8-8746-4AD0-9614-855F4C4B7F05}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE8D8D18-437A-445C-B662-4C2CE79A76F6}" - ProjectSection(SolutionItems) = preProject - Implab.vsmdi = Implab.vsmdi - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BCA337C3-BFDC-4825-BBDB-E6D467E4E452}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test.mono", "Implab.Test\Implab.Test.mono.csproj", "{2BD05F84-E067-4B87-9477-FDC2676A21C6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Format.Test", "Implab.Test\Implab.Format.Test\Implab.Format.Test.csproj", "{4D364996-7ECD-4193-8F90-F223FFEA49DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoPlay", "MonoPlay\MonoPlay.csproj", "{15DD7123-D504-4627-8B4F-D00C7F04D033}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug 4.5|Any CPU = Debug 4.5|Any CPU - Release 4.5|Any CPU = Release 4.5|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.ActiveCfg = Debug|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.Build.0 = Debug|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.Build.0 = Debug|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.Build.0 = Release|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.ActiveCfg = Release|Any CPU - {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.Build.0 = Release|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.Build.0 = Release|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug 4.5|Any CPU.ActiveCfg = Debug|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug 4.5|Any CPU.Build.0 = Debug|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release 4.5|Any CPU.Build.0 = Release|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release|Any CPU.Build.0 = Release|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.Build.0 = Release|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.Build.0 = Release|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {2BD05F84-E067-4B87-9477-FDC2676A21C6} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452} - {4D364996-7ECD-4193-8F90-F223FFEA49DA} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452} - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - Policies = $0 - $0.CSharpFormattingPolicy = $1 - $1.IndentSwitchBody = True - $1.NamespaceBraceStyle = EndOfLine - $1.ClassBraceStyle = EndOfLine - $1.InterfaceBraceStyle = EndOfLine - $1.StructBraceStyle = EndOfLine - $1.EnumBraceStyle = EndOfLine - $1.MethodBraceStyle = EndOfLine - $1.ConstructorBraceStyle = EndOfLine - $1.DestructorBraceStyle = EndOfLine - $1.BeforeMethodDeclarationParentheses = False - $1.BeforeMethodCallParentheses = False - $1.BeforeConstructorDeclarationParentheses = False - $1.NewLineBeforeConstructorInitializerColon = NewLine - $1.NewLineAfterConstructorInitializerColon = SameLine - $1.BeforeIndexerDeclarationBracket = False - $1.BeforeDelegateDeclarationParentheses = False - $1.NewParentheses = False - $1.SpacesBeforeBrackets = False - $1.inheritsSet = Mono - $1.inheritsScope = text/x-csharp - $1.scope = text/x-csharp - $0.TextStylePolicy = $2 - $2.FileWidth = 120 - $2.EolMarker = Unix - $2.inheritsSet = VisualStudio - $2.inheritsScope = text/plain - $2.scope = text/x-csharp - $0.DotNetNamingPolicy = $3 - $3.DirectoryNamespaceAssociation = PrefixedHierarchical - $3.ResourceNamePolicy = MSBuild - $0.TextStylePolicy = $4 - $4.FileWidth = 120 - $4.TabsToSpaces = False - $4.inheritsSet = VisualStudio - $4.inheritsScope = text/plain - $4.scope = application/xml - $0.XmlFormattingPolicy = $5 - $5.inheritsSet = Mono - $5.inheritsScope = application/xml - $5.scope = application/xml - $0.TextStylePolicy = $6 - $6.FileWidth = 120 - $6.TabsToSpaces = False - $6.inheritsSet = VisualStudio - $6.inheritsScope = text/plain - $6.scope = text/plain - $0.NameConventionPolicy = $7 - $7.Rules = $8 - $8.NamingRule = $9 - $9.Name = Namespaces - $9.AffectedEntity = Namespace - $9.VisibilityMask = VisibilityMask - $9.NamingStyle = PascalCase - $9.IncludeInstanceMembers = True - $9.IncludeStaticEntities = True - $8.NamingRule = $10 - $10.Name = Types - $10.AffectedEntity = Class, Struct, Enum, Delegate - $10.VisibilityMask = VisibilityMask - $10.NamingStyle = PascalCase - $10.IncludeInstanceMembers = True - $10.IncludeStaticEntities = True - $8.NamingRule = $11 - $11.Name = Interfaces - $11.RequiredPrefixes = $12 - $12.String = I - $11.AffectedEntity = Interface - $11.VisibilityMask = VisibilityMask - $11.NamingStyle = PascalCase - $11.IncludeInstanceMembers = True - $11.IncludeStaticEntities = True - $8.NamingRule = $13 - $13.Name = Attributes - $13.RequiredSuffixes = $14 - $14.String = Attribute - $13.AffectedEntity = CustomAttributes - $13.VisibilityMask = VisibilityMask - $13.NamingStyle = PascalCase - $13.IncludeInstanceMembers = True - $13.IncludeStaticEntities = True - $8.NamingRule = $15 - $15.Name = Event Arguments - $15.RequiredSuffixes = $16 - $16.String = EventArgs - $15.AffectedEntity = CustomEventArgs - $15.VisibilityMask = VisibilityMask - $15.NamingStyle = PascalCase - $15.IncludeInstanceMembers = True - $15.IncludeStaticEntities = True - $8.NamingRule = $17 - $17.Name = Exceptions - $17.RequiredSuffixes = $18 - $18.String = Exception - $17.AffectedEntity = CustomExceptions - $17.VisibilityMask = VisibilityMask - $17.NamingStyle = PascalCase - $17.IncludeInstanceMembers = True - $17.IncludeStaticEntities = True - $8.NamingRule = $19 - $19.Name = Methods - $19.AffectedEntity = Methods - $19.VisibilityMask = VisibilityMask - $19.NamingStyle = PascalCase - $19.IncludeInstanceMembers = True - $19.IncludeStaticEntities = True - $8.NamingRule = $20 - $20.Name = Static Readonly Fields - $20.AffectedEntity = ReadonlyField - $20.VisibilityMask = Internal, Protected, Public - $20.NamingStyle = PascalCase - $20.IncludeInstanceMembers = False - $20.IncludeStaticEntities = True - $8.NamingRule = $21 - $21.Name = Fields (Non Private) - $21.AffectedEntity = Field - $21.VisibilityMask = Internal, Public - $21.NamingStyle = CamelCase - $21.IncludeInstanceMembers = True - $21.IncludeStaticEntities = True - $8.NamingRule = $22 - $22.Name = ReadOnly Fields (Non Private) - $22.AffectedEntity = ReadonlyField - $22.VisibilityMask = Internal, Public - $22.NamingStyle = CamelCase - $22.IncludeInstanceMembers = True - $22.IncludeStaticEntities = False - $8.NamingRule = $23 - $23.Name = Fields (Private) - $23.RequiredPrefixes = $24 - $24.String = m_ - $23.AffectedEntity = Field, ReadonlyField - $23.VisibilityMask = Private, Protected - $23.NamingStyle = CamelCase - $23.IncludeInstanceMembers = True - $23.IncludeStaticEntities = False - $8.NamingRule = $25 - $25.Name = Static Fields (Private) - $25.RequiredPrefixes = $26 - $26.String = _ - $25.AffectedEntity = Field - $25.VisibilityMask = Private - $25.NamingStyle = CamelCase - $25.IncludeInstanceMembers = False - $25.IncludeStaticEntities = True - $8.NamingRule = $27 - $27.Name = ReadOnly Fields (Private) - $27.RequiredPrefixes = $28 - $28.String = m_ - $27.AffectedEntity = ReadonlyField - $27.VisibilityMask = Private, Protected - $27.NamingStyle = CamelCase - $27.IncludeInstanceMembers = True - $27.IncludeStaticEntities = False - $8.NamingRule = $29 - $29.Name = Constant Fields - $29.AffectedEntity = ConstantField - $29.VisibilityMask = VisibilityMask - $29.NamingStyle = AllUpper - $29.IncludeInstanceMembers = True - $29.IncludeStaticEntities = True - $8.NamingRule = $30 - $30.Name = Properties - $30.AffectedEntity = Property - $30.VisibilityMask = VisibilityMask - $30.NamingStyle = PascalCase - $30.IncludeInstanceMembers = True - $30.IncludeStaticEntities = True - $8.NamingRule = $31 - $31.Name = Events - $31.AffectedEntity = Event - $31.VisibilityMask = VisibilityMask - $31.NamingStyle = PascalCase - $31.IncludeInstanceMembers = True - $31.IncludeStaticEntities = True - $8.NamingRule = $32 - $32.Name = Enum Members - $32.AffectedEntity = EnumMember - $32.VisibilityMask = VisibilityMask - $32.NamingStyle = PascalCase - $32.IncludeInstanceMembers = True - $32.IncludeStaticEntities = True - $8.NamingRule = $33 - $33.Name = Parameters - $33.AffectedEntity = Parameter, LocalVariable - $33.VisibilityMask = VisibilityMask - $33.NamingStyle = CamelCase - $33.IncludeInstanceMembers = True - $33.IncludeStaticEntities = True - $8.NamingRule = $34 - $34.Name = Type Parameters - $34.RequiredPrefixes = $35 - $35.String = T - $34.AffectedEntity = TypeParameter - $34.VisibilityMask = VisibilityMask - $34.NamingStyle = PascalCase - $34.IncludeInstanceMembers = True - $34.IncludeStaticEntities = True - version = 0.2 - StartupItem = MonoPlay\MonoPlay.csproj - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = Implab.vsmdi - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Implab.sln b/Implab.sln --- a/Implab.sln +++ b/Implab.sln @@ -1,270 +1,69 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab", "Implab\Implab.csproj", "{F550F1F8-8746-4AD0-9614-855F4C4B7F05}" + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2005 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Implab", "Implab\Implab.csproj", "{FF2052B6-9C8F-4022-A347-F07ABF635885}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE8D8D18-437A-445C-B662-4C2CE79A76F6}" - ProjectSection(SolutionItems) = preProject - Implab.vsmdi = Implab.vsmdi - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Implab.Test", "Implab.Test\Implab.Test.csproj", "{6CD0DA18-8D9B-4AA8-A3DC-17322E27335E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Playground", "Implab.Playground\Implab.Playground.csproj", "{100DFEB0-75BE-436F-ADDF-1F46EF433F46}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test", "Implab.Test\Implab.Test.csproj", "{63F92C0C-61BF-48C0-A377-8D67C3C661D0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.ServiceHost", "Implab.ServiceHost\Implab.ServiceHost.csproj", "{8B79FCBE-50DD-40A0-9B5E-E572072E4868}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx.Test", "Implab.Fx.Test\Implab.Fx.Test.csproj", "{2F31E405-E267-4195-A05D-574093C21209}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.ServiceHost.Test", "Implab.ServiceHost.Test\Implab.ServiceHost.Test.csproj", "{CB844F94-E555-4F25-A932-7CB85C98CF86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU - Debug 4.5|Any CPU = Debug 4.5|Any CPU - Release 4.5|Any CPU = Release 4.5|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.Build.0 = Release|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Implab\Implab.csproj - Policies = $0 - $0.CSharpFormattingPolicy = $1 - $1.IndentSwitchBody = True - $1.NamespaceBraceStyle = EndOfLine - $1.ClassBraceStyle = EndOfLine - $1.InterfaceBraceStyle = EndOfLine - $1.StructBraceStyle = EndOfLine - $1.EnumBraceStyle = EndOfLine - $1.MethodBraceStyle = EndOfLine - $1.ConstructorBraceStyle = EndOfLine - $1.DestructorBraceStyle = EndOfLine - $1.BeforeMethodDeclarationParentheses = False - $1.BeforeMethodCallParentheses = False - $1.BeforeConstructorDeclarationParentheses = False - $1.NewLineBeforeConstructorInitializerColon = NewLine - $1.NewLineAfterConstructorInitializerColon = SameLine - $1.BeforeIndexerDeclarationBracket = False - $1.BeforeDelegateDeclarationParentheses = False - $1.NewParentheses = False - $1.SpacesBeforeBrackets = False - $1.inheritsSet = Mono - $1.inheritsScope = text/x-csharp - $1.scope = text/x-csharp - $0.TextStylePolicy = $2 - $2.FileWidth = 120 - $2.EolMarker = Unix - $2.inheritsSet = VisualStudio - $2.inheritsScope = text/plain - $2.scope = text/x-csharp - $0.DotNetNamingPolicy = $3 - $3.DirectoryNamespaceAssociation = PrefixedHierarchical - $3.ResourceNamePolicy = MSBuild - $0.TextStylePolicy = $4 - $4.FileWidth = 120 - $4.TabsToSpaces = False - $4.inheritsSet = VisualStudio - $4.inheritsScope = text/plain - $4.scope = application/xml - $0.XmlFormattingPolicy = $5 - $5.inheritsSet = Mono - $5.inheritsScope = application/xml - $5.scope = application/xml - $0.TextStylePolicy = $6 - $6.FileWidth = 120 - $6.TabsToSpaces = False - $6.inheritsSet = VisualStudio - $6.inheritsScope = text/plain - $6.scope = text/plain - $0.NameConventionPolicy = $7 - $7.Rules = $8 - $8.NamingRule = $9 - $9.Name = Namespaces - $9.AffectedEntity = Namespace - $9.VisibilityMask = VisibilityMask - $9.NamingStyle = PascalCase - $9.IncludeInstanceMembers = True - $9.IncludeStaticEntities = True - $8.NamingRule = $10 - $10.Name = Types - $10.AffectedEntity = Class, Struct, Enum, Delegate - $10.VisibilityMask = VisibilityMask - $10.NamingStyle = PascalCase - $10.IncludeInstanceMembers = True - $10.IncludeStaticEntities = True - $8.NamingRule = $11 - $11.Name = Interfaces - $11.RequiredPrefixes = $12 - $12.String = I - $11.AffectedEntity = Interface - $11.VisibilityMask = VisibilityMask - $11.NamingStyle = PascalCase - $11.IncludeInstanceMembers = True - $11.IncludeStaticEntities = True - $8.NamingRule = $13 - $13.Name = Attributes - $13.RequiredSuffixes = $14 - $14.String = Attribute - $13.AffectedEntity = CustomAttributes - $13.VisibilityMask = VisibilityMask - $13.NamingStyle = PascalCase - $13.IncludeInstanceMembers = True - $13.IncludeStaticEntities = True - $8.NamingRule = $15 - $15.Name = Event Arguments - $15.RequiredSuffixes = $16 - $16.String = EventArgs - $15.AffectedEntity = CustomEventArgs - $15.VisibilityMask = VisibilityMask - $15.NamingStyle = PascalCase - $15.IncludeInstanceMembers = True - $15.IncludeStaticEntities = True - $8.NamingRule = $17 - $17.Name = Exceptions - $17.RequiredSuffixes = $18 - $18.String = Exception - $17.AffectedEntity = CustomExceptions - $17.VisibilityMask = VisibilityMask - $17.NamingStyle = PascalCase - $17.IncludeInstanceMembers = True - $17.IncludeStaticEntities = True - $8.NamingRule = $19 - $19.Name = Methods - $19.AffectedEntity = Methods - $19.VisibilityMask = VisibilityMask - $19.NamingStyle = PascalCase - $19.IncludeInstanceMembers = True - $19.IncludeStaticEntities = True - $8.NamingRule = $20 - $20.Name = Static Readonly Fields - $20.AffectedEntity = ReadonlyField - $20.VisibilityMask = Internal, Protected, Public - $20.NamingStyle = CamelCase - $20.IncludeInstanceMembers = False - $20.IncludeStaticEntities = True - $8.NamingRule = $21 - $21.Name = Fields (Non Private) - $21.AffectedEntity = Field - $21.VisibilityMask = Internal, Public - $21.NamingStyle = CamelCase - $21.IncludeInstanceMembers = True - $21.IncludeStaticEntities = True - $8.NamingRule = $22 - $22.Name = ReadOnly Fields (Non Private) - $22.AffectedEntity = ReadonlyField - $22.VisibilityMask = Internal, Public - $22.NamingStyle = CamelCase - $22.IncludeInstanceMembers = True - $22.IncludeStaticEntities = False - $8.NamingRule = $23 - $23.Name = Fields (Private) - $23.RequiredPrefixes = $24 - $24.String = m_ - $23.AffectedEntity = Field, ReadonlyField - $23.VisibilityMask = Private, Protected - $23.NamingStyle = CamelCase - $23.IncludeInstanceMembers = True - $23.IncludeStaticEntities = False - $8.NamingRule = $25 - $25.Name = Static Fields (Private) - $25.RequiredPrefixes = $26 - $26.String = _ - $25.AffectedEntity = Field - $25.VisibilityMask = Private - $25.NamingStyle = CamelCase - $25.IncludeInstanceMembers = False - $25.IncludeStaticEntities = True - $8.NamingRule = $27 - $27.Name = ReadOnly Fields (Private) - $27.RequiredPrefixes = $28 - $28.String = m_ - $27.AffectedEntity = ReadonlyField - $27.VisibilityMask = Private, Protected - $27.NamingStyle = CamelCase - $27.IncludeInstanceMembers = True - $27.IncludeStaticEntities = False - $8.NamingRule = $29 - $29.Name = Constant Fields - $29.AffectedEntity = ConstantField - $29.VisibilityMask = VisibilityMask - $29.NamingStyle = AllUpper - $29.IncludeInstanceMembers = True - $29.IncludeStaticEntities = True - $8.NamingRule = $30 - $30.Name = Properties - $30.AffectedEntity = Property - $30.VisibilityMask = VisibilityMask - $30.NamingStyle = PascalCase - $30.IncludeInstanceMembers = True - $30.IncludeStaticEntities = True - $8.NamingRule = $31 - $31.Name = Events - $31.AffectedEntity = Event - $31.VisibilityMask = VisibilityMask - $31.NamingStyle = PascalCase - $31.IncludeInstanceMembers = True - $31.IncludeStaticEntities = True - $8.NamingRule = $32 - $32.Name = Enum Members - $32.AffectedEntity = EnumMember - $32.VisibilityMask = VisibilityMask - $32.NamingStyle = PascalCase - $32.IncludeInstanceMembers = True - $32.IncludeStaticEntities = True - $8.NamingRule = $33 - $33.Name = Parameters - $33.AffectedEntity = Parameter, LocalVariable - $33.VisibilityMask = VisibilityMask - $33.NamingStyle = CamelCase - $33.IncludeInstanceMembers = True - $33.IncludeStaticEntities = True - $8.NamingRule = $34 - $34.Name = Type Parameters - $34.RequiredPrefixes = $35 - $35.String = T - $34.AffectedEntity = TypeParameter - $34.VisibilityMask = VisibilityMask - $34.NamingStyle = PascalCase - $34.IncludeInstanceMembers = True - $34.IncludeStaticEntities = True - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = Implab.vsmdi + {FF2052B6-9C8F-4022-A347-F07ABF635885}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF2052B6-9C8F-4022-A347-F07ABF635885}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF2052B6-9C8F-4022-A347-F07ABF635885}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF2052B6-9C8F-4022-A347-F07ABF635885}.Release|Any CPU.Build.0 = Release|Any CPU + {6CD0DA18-8D9B-4AA8-A3DC-17322E27335E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CD0DA18-8D9B-4AA8-A3DC-17322E27335E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CD0DA18-8D9B-4AA8-A3DC-17322E27335E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CD0DA18-8D9B-4AA8-A3DC-17322E27335E}.Release|Any CPU.Build.0 = Release|Any CPU + {100DFEB0-75BE-436F-ADDF-1F46EF433F46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {100DFEB0-75BE-436F-ADDF-1F46EF433F46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {100DFEB0-75BE-436F-ADDF-1F46EF433F46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {100DFEB0-75BE-436F-ADDF-1F46EF433F46}.Release|Any CPU.Build.0 = Release|Any CPU + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|x64.ActiveCfg = Debug|x64 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|x64.Build.0 = Debug|x64 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|x86.ActiveCfg = Debug|x86 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Debug|x86.Build.0 = Debug|x86 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|Any CPU.Build.0 = Release|Any CPU + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|x64.ActiveCfg = Release|x64 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|x64.Build.0 = Release|x64 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|x86.ActiveCfg = Release|x86 + {8B79FCBE-50DD-40A0-9B5E-E572072E4868}.Release|x86.Build.0 = Release|x86 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|x64.ActiveCfg = Debug|x64 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|x64.Build.0 = Debug|x64 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|x86.ActiveCfg = Debug|x86 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Debug|x86.Build.0 = Debug|x86 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|Any CPU.Build.0 = Release|Any CPU + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|x64.ActiveCfg = Release|x64 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|x64.Build.0 = Release|x64 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|x86.ActiveCfg = Release|x86 + {CB844F94-E555-4F25-A932-7CB85C98CF86}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {36D837FC-4CDD-4AEA-87BF-F130FEB22E02} + EndGlobalSection EndGlobal diff --git a/Implab.suo b/Implab.suo deleted file mode 100644 index 2551c242a8fc7c93912d4e7a7aa20b99c6d0d1d9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - - - \ No newline at end of file diff --git a/Implab/AbstractPromise.cs b/Implab/AbstractPromise.cs deleted file mode 100644 --- a/Implab/AbstractPromise.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using Implab.Parallels; - -namespace Implab { - public abstract class AbstractPromise : AbstractEvent, IPromise { - public struct HandlerDescriptor { - readonly Action m_handler; - readonly Action m_error; - readonly Action m_cancel; - readonly PromiseEventType m_mask; - - public HandlerDescriptor(Action success, Action error, Action cancel) { - m_handler = success; - m_error = error; - m_cancel = cancel; - m_mask = PromiseEventType.Success; - } - - public HandlerDescriptor(Action handler, PromiseEventType mask) { - m_handler = handler; - m_error = null; - m_cancel = null; - m_mask = mask; - } - - public void SignalSuccess() { - if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - - public void SignalError(Exception err) { - if (m_error != null) { - try { - m_error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } else if ((m_mask & PromiseEventType.Error ) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - - public void SignalCancel(Exception reason) { - if (m_cancel != null) { - try { - m_cancel(reason); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } else if ( (m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - - - #region implemented abstract members of AbstractPromise - - protected override void SignalHandler(HandlerDescriptor handler, int signal) { - switch (signal) { - case SUCCEEDED_STATE: - handler.SignalSuccess(); - break; - case REJECTED_STATE: - handler.SignalError(Error); - break; - case CANCELLED_STATE: - handler.SignalCancel(CancellationReason); - break; - default: - throw new InvalidOperationException(String.Format("Invalid promise signal: {0}", signal)); - } - } - - protected override Signal GetResolveSignal() { - var signal = new Signal(); - On(signal.Set, PromiseEventType.All); - return signal; - } - - #endregion - - public Type PromiseType { - get { - return typeof(void); - } - } - - public IPromise On(Action success, Action error, Action cancel) { - AddHandler(new HandlerDescriptor(success, error, cancel)); - return this; - } - - public IPromise On(Action success, Action error) { - AddHandler(new HandlerDescriptor(success, error, null)); - return this; - } - - public IPromise On(Action success) { - AddHandler(new HandlerDescriptor(success, null, null)); - return this; - } - - public IPromise On(Action handler, PromiseEventType events) { - AddHandler(new HandlerDescriptor(handler,events)); - return this; - } - - public IPromise Cast() { - throw new InvalidCastException(); - } - - public void Join() { - WaitResult(-1); - } - - public void Join(int timeout) { - WaitResult(timeout); - } - - protected void SetResult() { - if(BeginSetResult()) - EndSetResult(); - } - } -} - diff --git a/Implab/AbstractPromiseT.cs b/Implab/AbstractPromiseT.cs deleted file mode 100644 --- a/Implab/AbstractPromiseT.cs +++ /dev/null @@ -1,204 +0,0 @@ -using System; -using Implab.Parallels; - -namespace Implab { - public abstract class AbstractPromise : AbstractEvent.HandlerDescriptor>, IPromise { - public struct HandlerDescriptor { - readonly Action m_handler; - readonly Action m_success; - readonly Action m_error; - readonly Action m_cancel; - readonly PromiseEventType m_mask; - - public HandlerDescriptor(Action success, Action error, Action cancel) { - m_success = success; - m_error = error; - m_cancel = cancel; - - m_handler = null; - m_mask = 0; - } - - public HandlerDescriptor(Action success, Action error, Action cancel) { - m_handler = success; - m_success = null; - m_error = error; - m_cancel = cancel; - m_mask = PromiseEventType.Success; - } - - public HandlerDescriptor(Action handler, PromiseEventType mask) { - m_handler = handler; - m_mask = mask; - m_success = null; - m_error = null; - m_cancel = null; - } - - public void SignalSuccess(T result) { - if (m_success != null) { - try { - m_success(result); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } else if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - - public void SignalError(Exception err) { - if (m_error != null) { - try { - m_error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } else if ((m_mask & PromiseEventType.Error) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - - public void SignalCancel(Exception reason) { - if (m_cancel != null) { - try { - m_cancel(reason); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } else if ((m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) { - try { - m_handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - - public Type PromiseType { - get { - return typeof(T); - } - } - - public T Join() { - WaitResult(-1); - return m_result; - } - public T Join(int timeout) { - WaitResult(timeout); - return m_result; - } - - void IPromise.Join() { - WaitResult(-1); - } - void IPromise.Join(int timeout) { - WaitResult(timeout); - } - - public IPromise On(Action success, Action error, Action cancel) { - AddHandler(new HandlerDescriptor(success, error, cancel)); - return this; - } - - public IPromise On(Action success, Action error) { - AddHandler(new HandlerDescriptor(success, error, null)); - return this; - } - - public IPromise On(Action success) { - AddHandler(new HandlerDescriptor(success, null, null)); - return this; - } - - public IPromise On(Action handler, PromiseEventType events) { - AddHandler(new HandlerDescriptor(handler, events)); - return this; - } - - public IPromise On(Action success, Action error, Action cancel) { - AddHandler(new HandlerDescriptor(success, error, cancel)); - return this; - } - - public IPromise On(Action success, Action error) { - AddHandler(new HandlerDescriptor(success, error, null)); - return this; - } - - public IPromise On(Action success) { - AddHandler(new HandlerDescriptor(success, null, null)); - return this; - } - - IPromise IPromise.On(Action success, Action error, Action cancel) { - AddHandler(new HandlerDescriptor(success, error, cancel)); - return this; - } - - IPromise IPromise.On(Action success, Action error) { - AddHandler(new HandlerDescriptor(success, error, null)); - return this; - } - - IPromise IPromise.On(Action success) { - AddHandler(new HandlerDescriptor(success, null, null)); - return this; - } - - IPromise IPromise.On(Action handler, PromiseEventType events) { - AddHandler(new HandlerDescriptor(handler, events)); - return this; - } - - public IPromise Cast() { - return (IPromise)this; - } - - #region implemented abstract members of AbstractPromise - - protected override Signal GetResolveSignal() { - var signal = new Signal(); - AddHandler(new HandlerDescriptor(signal.Set, PromiseEventType.All)); - return signal; - } - - protected override void SignalHandler(HandlerDescriptor handler, int signal) { - switch (signal) { - case SUCCEEDED_STATE: - handler.SignalSuccess(m_result); - break; - case REJECTED_STATE: - handler.SignalError(Error); - break; - case CANCELLED_STATE: - handler.SignalCancel(CancellationReason); - break; - default: - throw new InvalidOperationException(String.Format("Invalid promise signal: {0}", signal)); - } - } - - #endregion - - T m_result; - - protected void SetResult(T value) { - if (BeginSetResult()) { - m_result = value; - EndSetResult(); - } - } - } -} - diff --git a/Implab/AbstractTask.cs b/Implab/AbstractTask.cs deleted file mode 100644 --- a/Implab/AbstractTask.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Threading; - -namespace Implab { - /// - /// Базовый класс для реализации задачь. Задача представляет собой некторое - /// действие, которое можно иницировать и обработать результат его выполнения - /// в виде обещания, для этого оно реализует интерфейс . - /// - /// - /// Данный класс определяет стандартное поведение при обработки результатов, в частности - /// обработку и - /// - public abstract class AbstractTask : AbstractPromise { - int m_cancelationLock; - - /// - /// Получает эксклюзивное право отмены задания, используется для отмены задания до начала его выполнения. - /// - /// true, if cancelation was locked, false otherwise. - protected bool LockCancelation() { - return 0 == Interlocked.CompareExchange(ref m_cancelationLock, 1, 0); - } - - - - protected void SetErrorInternal(Exception error) { - // unwrap - while (error is PromiseTransientException && error.InnerException != null) - error = error.InnerException; - - if (error is OperationCanceledException) - SetCancelled(error); - else - SetError(error); - } - - protected void SetCancelledInternal(Exception reason) { - SetCancelled( - reason == null ? new OperationCanceledException() : reason is OperationCanceledException ? reason : new OperationCanceledException(null, reason) - ); - } - } -} - diff --git a/Implab/AbstractTaskT.cs b/Implab/AbstractTaskT.cs deleted file mode 100644 --- a/Implab/AbstractTaskT.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; - -namespace Implab { - public abstract class AbstractTask : AbstractPromise { - int m_cancelationLock; - - /// - /// Получает эксклюзивное право отмены задания, используется для отмены задания до начала его выполнения. - /// - /// true, if cancelation was locked, false otherwise. - protected bool LockCancelation() { - return 0 == Interlocked.CompareExchange(ref m_cancelationLock, 1, 0); - } - - - - protected void SetErrorInternal(Exception error) { - // unwrap - while (error is PromiseTransientException && error.InnerException != null) - error = error.InnerException; - - if (error is OperationCanceledException) - SetCancelled(error); - else - SetError(error); - } - - protected void SetCancelledInternal(Exception reason) { - SetCancelled( - reason == null ? new OperationCanceledException() : reason is OperationCanceledException ? reason : new OperationCanceledException(null, reason) - ); - } - } -} - diff --git a/Implab/ActionChainTask.cs b/Implab/ActionChainTask.cs deleted file mode 100644 --- a/Implab/ActionChainTask.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace Implab { - public class ActionChainTask : ActionChainTaskBase, IDeferred { - readonly Func m_task; - - /// - /// Initializes a new instance of the class. - /// - /// The operation which will be performed when the is called. - /// The error handler which will invoke when the is called or when the task fails with an error. - /// The cancellation handler. - /// If set to true will automatically accept - /// all cancel requests before the task is started with , - /// after that all requests are directed to the task. - public ActionChainTask(Func task, Func error, Func cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { - m_task = task; - } - - public void Resolve() { - if (m_task != null && LockCancelation()) { - try { - var p = m_task(); - p.On(SetResult, HandleErrorInternal, HandleCancelInternal); - CancellationRequested(p.Cancel); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - - } -} - diff --git a/Implab/ActionChainTaskBase.cs b/Implab/ActionChainTaskBase.cs deleted file mode 100644 --- a/Implab/ActionChainTaskBase.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Threading; - -namespace Implab { - public class ActionChainTaskBase : AbstractTask { - readonly Func m_error; - readonly Func m_cancel; - - protected ActionChainTaskBase(Func error, Func cancel, bool autoCancellable) { - m_error = error; - m_cancel = cancel; - if (autoCancellable) - CancellationRequested(CancelOperation); - } - - public void Reject(Exception error) { - if (LockCancelation()) - HandleErrorInternal(error); - } - - public override void CancelOperation(Exception reason) { - if (LockCancelation()) - // отмена вызвана до начала выполнения задачи - HandleCancelInternal(reason); - } - - protected void HandleCancelInternal(Exception reason) { - if (m_cancel != null) { - try { - // вызываем обработчик отмены - var p = m_cancel(reason); - p.On(SetResult, HandleErrorInternal, SetCancelledInternal); - // сообщаем асинхронной операции, что клиент уже не хочет получать результат - // т.е. если он инициировал отмену, задача отменилась, вызвался обрабочик отмены - // отбработчику сообщили, что результат уже не нужен и уже сам обработчик решает - // отдавать ли результат или подтвердить отмену (или вернуть ошибку). - CancellationRequested(p.Cancel); - } catch (Exception err) { - SetErrorInternal(err); - } - } else { - SetCancelledInternal(reason); - } - } - - protected void HandleErrorInternal(Exception error) { - if (m_error != null) { - try { - var p = m_error(error); - p.On(SetResult, SetErrorInternal, SetCancelledInternal); - CancellationRequested(p.Cancel); - } catch (Exception err) { - SetErrorInternal(err); - } - } else { - SetErrorInternal(error); - } - } - - } -} - diff --git a/Implab/ActionChainTaskT.cs b/Implab/ActionChainTaskT.cs deleted file mode 100644 --- a/Implab/ActionChainTaskT.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace Implab { - public class ActionChainTask : ActionChainTaskBase, IDeferred { - readonly Func m_task; - - public ActionChainTask(Func task, Func error, Func cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { - m_task = task; - } - - public void Resolve(T value) { - if (m_task != null && LockCancelation()) { - try { - var p = m_task(value); - p.On(SetResult, HandleErrorInternal, HandleCancelInternal); - CancellationRequested(p.Cancel); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - - } -} - diff --git a/Implab/ActionTask.cs b/Implab/ActionTask.cs deleted file mode 100644 --- a/Implab/ActionTask.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Implab { - public class ActionTask : ActionTaskBase, IDeferred { - readonly Action m_task; - public ActionTask(Action task, Action error, Action cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { - m_task = task; - } - - public void Resolve() { - if (m_task != null && LockCancelation()) { - try { - m_task(); - SetResult(); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - } -} - diff --git a/Implab/ActionTaskBase.cs b/Implab/ActionTaskBase.cs deleted file mode 100644 --- a/Implab/ActionTaskBase.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; - -namespace Implab { - public class ActionTaskBase : AbstractTask { - readonly Action m_cancel; - readonly Action m_error; - - protected ActionTaskBase( Action error, Action cancel, bool autoCancellable) { - m_error = error; - m_cancel = cancel; - if (autoCancellable) - CancellationRequested(CancelOperation); - } - - public void Reject(Exception error) { - Safe.ArgumentNotNull(error, "error"); - if (LockCancelation()) - HandleErrorInternal(error); - } - - public override void CancelOperation(Exception reason) { - if (LockCancelation()) - HandleCancelInternal(reason); - } - - protected void HandleErrorInternal(Exception error) { - if (m_error != null) { - try { - m_error(error); - SetResult(); - } catch(Exception err) { - SetErrorInternal(err); - } - } else { - SetErrorInternal(error); - } - } - - protected void HandleCancelInternal(Exception error) { - if (m_cancel != null) { - try { - m_cancel(error); - SetResult(); - } catch(Exception err) { - SetErrorInternal(err); - } - } else { - SetCancelledInternal(error); - } - } - } -} - diff --git a/Implab/ActionTaskT.cs b/Implab/ActionTaskT.cs deleted file mode 100644 --- a/Implab/ActionTaskT.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Implab { - public class ActionTask : ActionTaskBase, IDeferred { - readonly Action m_task; - public ActionTask(Action task, Action error, Action cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { - m_task = task; - } - - public void Resolve(T value) { - if (m_task != null && LockCancelation()) { - try { - m_task(value); - SetResult(); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - } -} - diff --git a/Implab/Automaton/EnumAlphabet.cs b/Implab/Automaton/EnumAlphabet.cs deleted file mode 100644 --- a/Implab/Automaton/EnumAlphabet.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Diagnostics.CodeAnalysis; - -namespace Implab.Automaton { - /// - /// Алфавит символами которого являются элементы перечислений. - /// - /// Тип перечислений - public class EnumAlphabet : IndexedAlphabetBase where T : struct, IConvertible { - [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")] - static readonly Lazy _symbols = new Lazy(GetSymbols); - - [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")] - static readonly Lazy> _fullAlphabet = new Lazy>(CreateEnumAlphabet); - - static EnumAlphabet CreateEnumAlphabet() { - var symbols = _symbols.Value; - - if ( - symbols[symbols.Length - 1].ToInt32(CultureInfo.InvariantCulture) >= symbols.Length - || symbols[0].ToInt32(CultureInfo.InvariantCulture) != 0 - ) - throw new InvalidOperationException("The specified enumeration must be zero-based and continuously numbered"); - - return new EnumAlphabet(symbols.Select(x => x.ToInt32(CultureInfo.InvariantCulture)).ToArray()); - } - - static T[] GetSymbols() { - if (!typeof(T).IsEnum) - throw new InvalidOperationException("Invalid generic parameter, enumeration is required"); - - if (Enum.GetUnderlyingType(typeof(T)) != typeof(Int32)) - throw new InvalidOperationException("Only enums based on Int32 are supported"); - - return ((T[])Enum.GetValues(typeof(T))) - .OrderBy(x => x.ToInt32(CultureInfo.InvariantCulture)) - .ToArray(); - } - - public static EnumAlphabet FullAlphabet { - get { - return _fullAlphabet.Value; - } - } - - - public EnumAlphabet() - : base(_symbols.Value.Length) { - } - - public EnumAlphabet(int[] map) - : base(map) { - Debug.Assert(map.Length == _symbols.Value.Length); - } - - - public override int GetSymbolIndex(T symbol) { - return symbol.ToInt32(CultureInfo.InvariantCulture); - } - - } -} diff --git a/Implab/Components/App.cs b/Implab/Components/App.cs deleted file mode 100644 --- a/Implab/Components/App.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Implab.Components { - /// - /// Global application components and services. - /// - public static class App { - readonly static ComponentContainer _root = new ComponentContainer(); - - /// - /// The container for application level components. - /// - /// Pools of disposable objects can be placed here and they will be automatically - /// disposed when application domain is unloaded. - public static ICollection RootContainer { - get { return _root; } - } - - static App() { - AppDomain.CurrentDomain.DomainUnload += (sender, e) => _root.Dispose(); - } - } -} - diff --git a/Implab/Components/ComponentContainer.cs b/Implab/Components/ComponentContainer.cs deleted file mode 100644 --- a/Implab/Components/ComponentContainer.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Implab.Components { - /// - /// Component container, used to store track components in multi-threaded environmment. - /// - /// Instanses of this class are thread safe. - public class ComponentContainer : Disposable, ICollection { - readonly HashSet m_components = new HashSet(); - - /// - /// Removes currently stored compoenents from the container and disposes them if possible. - /// - /// - /// A new components may be added before this method completes. - /// - public void Clear() { - T[] removed; - - lock (m_components) { - removed = new T[m_components.Count]; - m_components.CopyTo(removed); - m_components.Clear(); - } - - foreach (var item in removed.OfType()) - item.Dispose(); - } - - /// - /// Checks whether the specified item in the collection. - /// - /// The item to check. - public bool Contains(T item) { - lock (m_components) - return m_components.Contains(item); - } - - /// - /// Copies currently stored components to the specified array. - /// - /// A destination array for components. - /// A starting index in the destination array. - public void CopyTo(T[] array, int arrayIndex) { - lock (m_components) - m_components.CopyTo(array, arrayIndex); - } - - /// - /// Remove the specified item from the collection. - /// - /// The item to remove. - public bool Remove(T item) { - lock (m_components) - return m_components.Remove(item); - } - - /// - /// Gets the count of components in the collection. - /// - public int Count { - get { - lock (m_components) - return m_components.Count; - } - } - - /// - /// Gets a value indicating whether this instance is read only. - /// - /// - /// Always false. - /// - public bool IsReadOnly { - get { - return false; - } - } - - /// - /// Gets the enumerator for components in the collection. - /// - /// The enumerator. - public IEnumerator GetEnumerator() { - T[] items; - lock (m_components) { - items = new T[m_components.Count]; - m_components.CopyTo(items); - return (IEnumerator)items.GetEnumerator(); - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - /// - /// Add the specified item to the collection. - /// - /// The item to add. - /// - /// If the collection is alredy disposed, the item isn't added to the collection and disposed if possible. - /// - public void Add(T item) { - Safe.ArgumentNotNull(item, "item"); - - lock (m_components) { - if (IsDisposed) - Safe.Dispose(item); - else - m_components.Add(item); - } - } - - /// - /// Disposes the components stored in the collection. - /// - /// If set to true the collection is disposing. - protected override void Dispose(bool disposing) { - base.Dispose(disposing); - Clear(); - } - } -} - diff --git a/Implab/Components/RunnableComponent.cs b/Implab/Components/RunnableComponent.cs deleted file mode 100644 --- a/Implab/Components/RunnableComponent.cs +++ /dev/null @@ -1,264 +0,0 @@ -using System; - -namespace Implab.Components { - public abstract class RunnableComponent : IDisposable, IRunnable, IInitializable { - enum Commands { - Ok = 0, - Fail, - Init, - Start, - Stop, - Dispose, - Last = Dispose - } - - class StateMachine { - static readonly ExecutionState[,] _transitions; - - static StateMachine() { - _transitions = new ExecutionState[(int)ExecutionState.Last + 1, (int)Commands.Last + 1]; - - Edge(ExecutionState.Created, ExecutionState.Initializing, Commands.Init); - Edge(ExecutionState.Created, ExecutionState.Disposed, Commands.Dispose); - - Edge(ExecutionState.Initializing, ExecutionState.Ready, Commands.Ok); - Edge(ExecutionState.Initializing, ExecutionState.Failed, Commands.Fail); - - Edge(ExecutionState.Ready, ExecutionState.Starting, Commands.Start); - Edge(ExecutionState.Ready, ExecutionState.Disposed, Commands.Dispose); - - Edge(ExecutionState.Starting, ExecutionState.Running, Commands.Ok); - Edge(ExecutionState.Starting, ExecutionState.Failed, Commands.Fail); - Edge(ExecutionState.Starting, ExecutionState.Stopping, Commands.Stop); - Edge(ExecutionState.Starting, ExecutionState.Disposed, Commands.Dispose); - - Edge(ExecutionState.Running, ExecutionState.Failed, Commands.Fail); - Edge(ExecutionState.Running, ExecutionState.Stopping, Commands.Stop); - Edge(ExecutionState.Running, ExecutionState.Disposed, Commands.Dispose); - - Edge(ExecutionState.Stopping, ExecutionState.Failed, Commands.Fail); - Edge(ExecutionState.Stopping, ExecutionState.Disposed, Commands.Ok); - - Edge(ExecutionState.Failed, ExecutionState.Disposed, Commands.Dispose); - } - - static void Edge(ExecutionState s1, ExecutionState s2, Commands cmd) { - _transitions[(int)s1, (int)cmd] = s2; - } - - public ExecutionState State { - get; - private set; - } - - public StateMachine(ExecutionState initial) { - State = initial; - } - - public bool Move(Commands cmd) { - var next = _transitions[(int)State, (int)cmd]; - if (next == ExecutionState.Undefined) - return false; - State = next; - return true; - } - } - - IPromise m_pending; - Exception m_lastError; - - readonly StateMachine m_stateMachine; - - protected RunnableComponent(bool initialized) { - m_stateMachine = new StateMachine(initialized ? ExecutionState.Ready : ExecutionState.Created); - } - - protected virtual int DisposeTimeout { - get { - return 10000; - } - } - - void ThrowInvalidCommand(Commands cmd) { - if (m_stateMachine.State == ExecutionState.Disposed) - throw new ObjectDisposedException(ToString()); - - throw new InvalidOperationException(String.Format("Commnd {0} is not allowed in the state {1}", cmd, m_stateMachine.State)); - } - - void Move(Commands cmd) { - if (!m_stateMachine.Move(cmd)) - ThrowInvalidCommand(cmd); - } - - void Invoke(Commands cmd, Action action) { - lock (m_stateMachine) - Move(cmd); - - try { - action(); - lock(m_stateMachine) - Move(Commands.Ok); - - } catch (Exception err) { - lock (m_stateMachine) { - Move(Commands.Fail); - m_lastError = err; - } - throw; - } - } - - IPromise InvokeAsync(Commands cmd, Func action, Action chain) { - IPromise promise = null; - IPromise prev; - - var task = new ActionChainTask(action, null, null, true); - - lock (m_stateMachine) { - Move(cmd); - - prev = m_pending; - - Action errorOrCancel = e => { - if (e == null) - e = new OperationCanceledException(); - - lock (m_stateMachine) { - if (m_pending == promise) { - Move(Commands.Fail); - m_pending = null; - m_lastError = e; - } - } - throw new PromiseTransientException(e); - }; - - promise = task.Then( - () => { - lock(m_stateMachine) { - if (m_pending == promise) { - Move(Commands.Ok); - m_pending = null; - } - } - }, - errorOrCancel, - errorOrCancel - ); - - m_pending = promise; - } - - if (prev == null) - task.Resolve(); - else - chain(prev, task); - - return promise; - } - - - #region IInitializable implementation - - public void Init() { - Invoke(Commands.Init, OnInitialize); - } - - protected virtual void OnInitialize() { - } - - #endregion - - #region IRunnable implementation - - public IPromise Start() { - return InvokeAsync(Commands.Start, OnStart, null); - } - - protected virtual IPromise OnStart() { - return Promise.SUCCESS; - } - - public IPromise Stop() { - return InvokeAsync(Commands.Stop, OnStop, StopPending).Then(Dispose); - } - - protected virtual IPromise OnStop() { - return Promise.SUCCESS; - } - - /// - /// Stops the current operation if one exists. - /// - /// Current. - /// Stop. - protected virtual void StopPending(IPromise current, IDeferred stop) { - if (current == null) { - stop.Resolve(); - } else { - // связваем текущую операцию с операцией остановки - current.On( - stop.Resolve, // если текущая операция заверщилась, то можно начинать остановку - stop.Reject, // если текущая операция дала ошибку - то все плохо, нельзя продолжать - e => stop.Resolve() // если текущая отменилась, то можно начинать остановку - ); - // посылаем текущей операции сигнал остановки - current.Cancel(); - } - } - - public ExecutionState State { - get { - return m_stateMachine.State; - } - } - - public Exception LastError { - get { - return m_lastError; - } - } - - #endregion - - #region IDisposable implementation - - public void Dispose() { - IPromise pending; - lock (m_stateMachine) { - if (m_stateMachine.State == ExecutionState.Disposed) - return; - - Move(Commands.Dispose); - - GC.SuppressFinalize(this); - - pending = m_pending; - m_pending = null; - } - if (pending != null) { - pending.Cancel(); - pending.Timeout(DisposeTimeout).On( - () => Dispose(true, null), - err => Dispose(true, err), - reason => Dispose(true, new OperationCanceledException("The operation is cancelled", reason)) - ); - } else { - Dispose(true, m_lastError); - } - } - - ~RunnableComponent() { - Dispose(false, null); - } - - #endregion - - protected virtual void Dispose(bool disposing, Exception lastError) { - - } - - } -} - diff --git a/Implab/Diagnostics/ConsoleTraceListener.cs b/Implab/Diagnostics/ConsoleTraceListener.cs deleted file mode 100644 --- a/Implab/Diagnostics/ConsoleTraceListener.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text; - -namespace Implab.Diagnostics { - public class ConsoleTraceListener: ListenerBase { - - static readonly object _consoleLock = new object(); - - public override void Write(LogEventArgs args, object entry) { - var msg = new StringBuilder(); - - for (int i = 0; i < args.Operation.Level; i++) - msg.Append(" "); - msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry); - - lock (_consoleLock) { - Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1); - Console.WriteLine(msg); - } - } - } -} diff --git a/Implab/Diagnostics/EventText.cs b/Implab/Diagnostics/EventText.cs deleted file mode 100644 --- a/Implab/Diagnostics/EventText.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab.Diagnostics { - public struct EventText { - public int indent; - - public string content; - } -} diff --git a/Implab/Diagnostics/Extensions.cs b/Implab/Diagnostics/Extensions.cs deleted file mode 100644 --- a/Implab/Diagnostics/Extensions.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace Implab.Diagnostics { - public static class Extensions { - public static IPromise EndLogicalOperation(this IPromise promise) { - Safe.ArgumentNotNull(promise, "promise"); - var op = TraceContext.Instance.DetachLogicalOperation(); - - return promise.On( - x => { - TraceContext.Instance.EnterLogicalOperation(op,true); - TraceLog.TraceInformation("promise = {0}", x); - TraceLog.EndLogicalOperation(); - TraceContext.Instance.Leave(); - }, - err =>{ - TraceContext.Instance.EnterLogicalOperation(op,true); - TraceLog.TraceError("promise died {0}", err); - TraceLog.EndLogicalOperation(); - TraceContext.Instance.Leave(); - }, - reason => { - TraceContext.Instance.EnterLogicalOperation(op,true); - TraceLog.TraceInformation("promise cancelled {0}", reason == null ? "" : reason.Message); - TraceLog.EndLogicalOperation(); - TraceContext.Instance.Leave(); - } - ); - } - - public static IPromise EndLogicalOperation(this IPromise promise) { - Safe.ArgumentNotNull(promise, "promise"); - var op = TraceContext.Instance.DetachLogicalOperation(); - - return promise.On(() => { - TraceContext.Instance.EnterLogicalOperation(op,true); - TraceLog.EndLogicalOperation(); - TraceContext.Instance.Leave(); - }, PromiseEventType.All); - } - } -} - diff --git a/Implab/Diagnostics/ILogWriter.cs b/Implab/Diagnostics/ILogWriter.cs deleted file mode 100644 --- a/Implab/Diagnostics/ILogWriter.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Implab.Diagnostics { - public interface ILogWriter { - void Write(LogEventArgs args, TEvent entry); - } -} - diff --git a/Implab/Diagnostics/ListenerBase.cs b/Implab/Diagnostics/ListenerBase.cs deleted file mode 100644 --- a/Implab/Diagnostics/ListenerBase.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using Implab.Components; - -namespace Implab.Diagnostics { - public abstract class ListenerBase : ServiceLocator, ILogWriter, ILogWriter { - - readonly Dictionary m_subscriptions = new Dictionary(); - - protected ListenerBase() { - Register(this); - } - - public void Subscribe(Type eventType) { - if (eventType == null) - throw new ArgumentNullException("eventType"); - GetType().GetMethod("Subscribe", new Type[0]).MakeGenericMethod(eventType).Invoke(this, null); - } - - public void Subscribe() { - Subscribe(LogChannel.Default); - } - - public void Subscribe(LogChannel channel) { - if (channel == null) - throw new ArgumentNullException("channel"); - - lock (m_subscriptions) { - AssertNotDisposed(); - if (m_subscriptions.ContainsKey(channel)) - return; - - var writer = GetService>(); - - EventHandler> handler = (sender, args) => writer.Write(args,args.Value); - - channel.Events += handler; - - Action unsubscribe = () => { - channel.Events -= handler; - }; - - m_subscriptions.Add(channel, unsubscribe); - } - } - - public void Unsubscribe(LogChannel channel) { - if (channel == null) - throw new ArgumentNullException("channel"); - - lock (m_subscriptions) { - Action subscription; - if (m_subscriptions.TryGetValue(channel, out subscription)) { - subscription(); - m_subscriptions.Remove(channel); - } - } - } - - public void UnsubscribeAll() { - lock (m_subscriptions) { - foreach (var subscription in m_subscriptions.Values) - subscription(); - m_subscriptions.Clear(); - } - } - - #region ILogWriter implementation - public abstract void Write(LogEventArgs args, object entry); - #endregion - - #region ILogWriter implementation - public virtual void Write(LogEventArgs args, TraceEvent entry) { - Write(args, (object)entry); - } - #endregion - - - protected override void Dispose(bool disposing) { - base.Dispose(disposing); - if (disposing) { - UnsubscribeAll(); - } - } - } -} diff --git a/Implab/Diagnostics/LogChannel.cs b/Implab/Diagnostics/LogChannel.cs deleted file mode 100644 --- a/Implab/Diagnostics/LogChannel.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab.Diagnostics { - /// - /// Канал, через который публикуются события журнала. - /// - /// Тип событий в канале - /// - /// Событиями журнала могут быть любые типы, например строки, в которых будет передаваться - /// информация, или структуры с набором полей, описывающих важность, текст и другую информацию. - /// - public class LogChannel { - static LogChannel _default = new LogChannel(); - - /// - /// Канал по-умолчанию для событий типа . - /// - public static LogChannel Default { - get { - return _default; - } - } - - /// - /// Событие появление новой записи в журнале, на это событие подписываются слушатели. - /// - public event EventHandler> Events; - - /// - /// Имя канала, полезно для отображения в журнале - /// - public string Name { - get; - private set; - } - - /// - /// Создает журнал, имя типа событий назначается в качетве имени канала. - /// - public LogChannel() - : this(null) { - } - - /// - /// Содает канал с указанным именем. - /// - /// Имя канала. - public LogChannel(string name) { - if (String.IsNullOrEmpty(name)) - name = typeof(TEvent).Name; - Name = name; - } - - /// - /// Отправляет запись журнала через канал подписчикам. - /// - /// Запись журнала. - /// - /// Контекст трассировки от которого рассылается сообщение определяется автоматически из текущего потока. - /// - public void LogEvent(TEvent data) { - var t = Events; - if (t != null) { - var traceContext = TraceContext.Instance; - t( - this, - new LogEventArgs( - data, - Name, - traceContext.ThreadId, - traceContext.CurrentOperation, - traceContext.CurrentOperation.Duration - ) - ); - } - } - } -} diff --git a/Implab/Diagnostics/LogEventArgs.cs b/Implab/Diagnostics/LogEventArgs.cs deleted file mode 100644 --- a/Implab/Diagnostics/LogEventArgs.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Implab.Diagnostics { - public class LogEventArgs : EventArgs { - public string ChannelName { - get; - private set; - } - public int ThreadId { - get; - private set; - } - public LogicalOperation Operation { - get; - private set; - } - public int OperationTimeOffset { - get; - private set; - } - public LogEventArgs(string channelName, int threadId, LogicalOperation operation, int timeOffset) { - ChannelName = channelName; - ThreadId = threadId; - Operation = operation; - OperationTimeOffset = timeOffset; - } - } -} - diff --git a/Implab/Diagnostics/LogEventArgsT.cs b/Implab/Diagnostics/LogEventArgsT.cs deleted file mode 100644 --- a/Implab/Diagnostics/LogEventArgsT.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Implab.Diagnostics { - public class LogEventArgs : LogEventArgs { - public TEvent Value { - get; - private set; - } - - public LogEventArgs(TEvent value,string channelName, int threadId, LogicalOperation operation, int timeOffset) : base(channelName, threadId, operation, timeOffset) { - Value = value; - } - } -} - diff --git a/Implab/Diagnostics/LogicalOperation.cs b/Implab/Diagnostics/LogicalOperation.cs deleted file mode 100644 --- a/Implab/Diagnostics/LogicalOperation.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; - -namespace Implab.Diagnostics { - public class LogicalOperation { - public static readonly LogicalOperation EMPTY = new LogicalOperation("__EMPTY__", null); - - readonly LogicalOperation m_parent; - readonly string m_name; - readonly int m_level; - readonly int m_timestamp; - - public LogicalOperation() - : this(null, null) { - } - - public LogicalOperation(string name, LogicalOperation parent) { - m_name = name ?? String.Empty; - m_parent = parent; - - m_level = parent == null ? 0 : parent.Level + 1; - m_timestamp = Environment.TickCount; - } - - public int Duration { - get { - var dt = Environment.TickCount - m_timestamp; - return dt < 0 ? int.MaxValue + dt : dt; // handle overflow - } - } - - public LogicalOperation Parent { - get { - return m_parent; - } - } - - public int Level { - get { return m_level; } - } - - public string Name { - get { return m_name; } - } - } -} diff --git a/Implab/Diagnostics/OperationContext.cs b/Implab/Diagnostics/OperationContext.cs deleted file mode 100644 --- a/Implab/Diagnostics/OperationContext.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace Implab.Diagnostics { - struct OperationContext { - public readonly static OperationContext EMPTY = new OperationContext(LogicalOperation.EMPTY, false); - - LogicalOperation m_initial; - LogicalOperation m_current; - bool m_ownership; - - public OperationContext(LogicalOperation operation, bool ownership) { - Safe.ArgumentNotNull(operation, "operation"); - - m_initial = operation; - m_current = operation; - m_ownership = ownership; - } - - public LogicalOperation CurrentOperation { - get { return m_current; } - } - - public void BeginLogicalOperation(string name) { - m_current = new LogicalOperation(name, m_current); - } - - public LogicalOperation DetachLogicalOperation() { - var detached = m_current; - if (m_current != LogicalOperation.EMPTY) { - if (m_current != m_initial) - m_current = m_current.Parent; - else if (m_ownership) - m_current = LogicalOperation.EMPTY; - else { - TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context"); - detached = LogicalOperation.EMPTY; - } - } else { - TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context"); - } - - return detached; - } - - public LogicalOperation EndLogicalOperation() { - var current = m_current; - if (m_current != LogicalOperation.EMPTY && (m_current != m_initial || m_ownership)) { - m_current = m_current.Parent; - if (current == m_initial) { - // we have complete the owned operation - m_initial = m_current; - m_ownership = false; - } - } else { - TraceLog.TraceWarning("EndLogicalOperation can't be applied in the current context"); - } - return current; - } - - public void Leave() { - - if ((m_ownership && m_current != LogicalOperation.EMPTY) || (!m_ownership && m_current != m_initial) ) - TraceLog.TraceWarning("Trying to leave unfinished logical operation {0}", m_current.Name); - } - } -} - diff --git a/Implab/Diagnostics/TextFileListener.cs b/Implab/Diagnostics/TextFileListener.cs deleted file mode 100644 --- a/Implab/Diagnostics/TextFileListener.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.IO; -using System.Text; - -namespace Implab.Diagnostics { - public class TextFileListener: ListenerBase { - readonly TextWriter m_textWriter; - - public TextFileListener(string fileName) { - m_textWriter = File.CreateText(fileName); - - m_textWriter.WriteLine("LOG {0}", DateTime.Now); - } - - #region implemented abstract members of ListenerBase - - public override void Write(LogEventArgs args, object entry) { - var msg = new StringBuilder(); - for (int i = 0; i < args.Operation.Level; i++) - msg.Append(" "); - msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, args.ChannelName, entry); - - lock (m_textWriter) { - if (!IsDisposed) { - // тут гарантировано еще не освобожден m_textWriter - m_textWriter.WriteLine(msg); - m_textWriter.Flush(); - } - } - } - - #endregion - - protected override void Dispose(bool disposing) { - base.Dispose(disposing); - if (disposing) { - // IsDisposed = true - lock (m_textWriter) { - Safe.Dispose(m_textWriter); - } - } - } - - - } -} diff --git a/Implab/Diagnostics/TraceContext.cs b/Implab/Diagnostics/TraceContext.cs deleted file mode 100644 --- a/Implab/Diagnostics/TraceContext.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; - -namespace Implab.Diagnostics { - /// - /// Trace context is bound to the specific thread, each thread has it's own ThreadContext. - /// - /// - /// ThreadContext manages relations between logical operations and threads. - /// - public class TraceContext { - - [ThreadStatic] - static TraceContext _instance; - - OperationContext m_current = OperationContext.EMPTY; - readonly Stack m_stack = new Stack(); - readonly int m_threadId; - - public static TraceContext Instance { - get { - if (_instance == null) - _instance = new TraceContext(); - return _instance; - } - } - - public TraceContext() { - m_threadId = Thread.CurrentThread.ManagedThreadId; - } - - public int ThreadId { - get { return m_threadId; } - } - - public LogicalOperation CurrentOperation { - get { - return m_current.CurrentOperation; - } - } - - public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) { - //var prev = CurrentOperation; - //LogChannel.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name))); - m_stack.Push(m_current); - m_current = new OperationContext(operation, takeOwnership); - } - - public void StartLogicalOperation(string name) { - LogChannel.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, name)); - m_current.BeginLogicalOperation(name); - } - - public void StartLogicalOperation() { - StartLogicalOperation(String.Empty); - } - - public void EndLogicalOperation() { - var op = m_current.EndLogicalOperation(); - LogChannel.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration))); - } - - public LogicalOperation DetachLogicalOperation() { - var prev = m_current.DetachLogicalOperation(); - //LogChannel.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("{0} -> {1}",prev.Name, CurrentOperation.Name))); - return prev; - } - - public void Leave() { - if (m_stack.Count > 0) { - m_current.Leave(); - //var prev = CurrentOperation; - m_current = m_stack.Pop(); - //LogChannel.Default.LogEvent(new TraceEvent(TraceEventType.Leave, String.Format("{0} -> {1}", prev.Name, CurrentOperation.Name))); - } else { - TraceLog.TraceWarning("Attempt to leave the last operation context"); - m_current = OperationContext.EMPTY; - } - } - } -} - diff --git a/Implab/Diagnostics/TraceEvent.cs b/Implab/Diagnostics/TraceEvent.cs deleted file mode 100644 --- a/Implab/Diagnostics/TraceEvent.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Implab.Diagnostics { - public class TraceEvent { - public string Message { - get; - private set; - } - - public TraceEventType EventType { - get; - private set; - } - - public TraceEvent(TraceEventType type, string message) { - EventType = type; - Message = message; - } - - public override string ToString() { - /*return EventType == TraceEventType.Information ? Message : String.Format("{0}: {1}", EventType, Message);*/ - return Message; - } - - public static TraceEvent Create(TraceEventType type, string format, params object[] args) { - return new TraceEvent(type, format == null ? String.Empty : String.Format(format, args)); - } - } -} diff --git a/Implab/Diagnostics/TraceEventType.cs b/Implab/Diagnostics/TraceEventType.cs deleted file mode 100644 --- a/Implab/Diagnostics/TraceEventType.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Implab.Diagnostics { - public enum TraceEventType { - Information = 1, - Warning, - Error, - OperationStarted, - OperationCompleted, - Attach, - Detach, - Enter, - Leave - } -} diff --git a/Implab/Diagnostics/TraceLog.cs b/Implab/Diagnostics/TraceLog.cs deleted file mode 100644 --- a/Implab/Diagnostics/TraceLog.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Implab.Diagnostics { - /// - /// Класс для публикации событий выполнения программы, события публикуются через . - /// Журнал трассировки отражает логический ход выполнения программы и существует всегда, поскольку тесно связан с - /// контекстом трассировки. - /// - public static class TraceLog { - [Conditional("TRACE")] - public static void StartLogicalOperation() { - TraceContext.Instance.StartLogicalOperation(); - } - - [Conditional("TRACE")] - public static void StartLogicalOperation(string name) { - TraceContext.Instance.StartLogicalOperation(name); - } - - [Conditional("TRACE")] - public static void EndLogicalOperation() { - TraceContext.Instance.EndLogicalOperation(); - } - - [Conditional("TRACE")] - public static void TraceInformation(string format, params object[] arguments) { - LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Information, format, arguments)); - } - - [Conditional("TRACE")] - public static void TraceWarning(string format, params object[] arguments) { - LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Warning, format, arguments)); - } - - [Conditional("TRACE")] - public static void TraceError(string format, params object[] arguments) { - LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Error, format, arguments)); - } - - [Conditional("TRACE")] - public static void TraceError(Exception err) { - TraceError("{0}", err); - } - } -} diff --git a/Implab/Formats/JSON/JSONXmlReader.cs b/Implab/Formats/JSON/JSONXmlReader.cs deleted file mode 100644 --- a/Implab/Formats/JSON/JSONXmlReader.cs +++ /dev/null @@ -1,335 +0,0 @@ -using Implab; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Xml; - -namespace Implab.Formats.JSON { - public class JSONXmlReader : XmlReader { - - enum ValueContext { - Undefined, - ElementStart, - ElementValue, - ElementEnd, - ElementEmpty - } - - struct LocalNameContext { - public string localName; - public bool isArray; - } - - JSONParser m_parser; - ValueContext m_valueContext; - ReadState m_state = ReadState.Initial; - Stack m_localNameStack = new Stack(); - LocalNameContext m_localName; - int m_depthCorrection; - - readonly string m_rootName; - readonly string m_prefix; - readonly string m_namespaceUri; - readonly bool m_flattenArrays; - readonly string m_arrayItemName; - readonly XmlNameTable m_nameTable; - - JSONXmlReader(JSONParser parser, JSONXmlReaderOptions options) { - m_parser = parser; - - if (options != null) { - m_prefix = options.NodesPrefix ?? String.Empty; - m_namespaceUri = options.NamespaceURI ?? String.Empty; - m_rootName = options.RootName ?? "json"; - m_flattenArrays = options.FlattenArrays; - m_arrayItemName = options.ArrayItemName ?? "item"; - m_nameTable = options.NameTable ?? new NameTable(); - } else { - m_prefix = String.Empty; - m_namespaceUri = String.Empty; - m_rootName = "json"; - m_flattenArrays = false; - m_arrayItemName = "item"; - m_nameTable = new NameTable(); - } - } - - /// - /// Always 0, JSON doesn't support attributes - /// - public override int AttributeCount { - get { return 0; } - } - - public override string BaseURI { - get { return String.Empty; } - } - - public override int Depth { - get { - return m_localNameStack.Count + m_depthCorrection; - } - } - - public override bool EOF { - get { return m_parser.EOF; } - } - - /// - /// Always throws an exception - /// - /// - /// - public override string GetAttribute(int i) { - throw new ArgumentOutOfRangeException(); - } - - /// - /// Always returns empty string - /// - /// - /// - /// - public override string GetAttribute(string name, string namespaceURI) { - return String.Empty; - } - - /// - /// Always returns empty string - /// - /// - /// - public override string GetAttribute(string name) { - return String.Empty; - } - - public override bool IsEmptyElement { - get { return m_parser.ElementType == JSONElementType.Value && m_valueContext == ValueContext.ElementEmpty; } - } - - public override string LocalName { - get { return m_localName.localName; } - } - - public override string LookupNamespace(string prefix) { - if (String.IsNullOrEmpty(prefix) || prefix == m_prefix) - return m_namespaceUri; - - return String.Empty; - } - - public override bool MoveToAttribute(string name, string ns) { - return false; - } - - public override bool MoveToAttribute(string name) { - return false; - } - - public override bool MoveToElement() { - return false; - } - - public override bool MoveToFirstAttribute() { - return false; - } - - public override bool MoveToNextAttribute() { - return false; - } - - public override XmlNameTable NameTable { - get { return m_nameTable; } - } - - public override string NamespaceURI { - get { return m_namespaceUri; } - } - - public override XmlNodeType NodeType { - get { - switch (m_parser.ElementType) { - case JSONElementType.BeginObject: - case JSONElementType.BeginArray: - return XmlNodeType.Element; - case JSONElementType.EndObject: - case JSONElementType.EndArray: - return XmlNodeType.EndElement; - case JSONElementType.Value: - switch (m_valueContext) { - case ValueContext.ElementStart: - case ValueContext.ElementEmpty: - return XmlNodeType.Element; - case ValueContext.ElementValue: - return XmlNodeType.Text; - case ValueContext.ElementEnd: - return XmlNodeType.EndElement; - default: - throw new InvalidOperationException(); - } - default: - throw new InvalidOperationException(); - } - } - } - - public override string Prefix { - get { return m_prefix; } - } - - public override bool Read() { - if (m_state != ReadState.Interactive && m_state != ReadState.Initial) - return false; - - if (m_state == ReadState.Initial) - m_state = ReadState.Interactive; - - try { - switch (m_parser.ElementType) { - case JSONElementType.Value: - switch (m_valueContext) { - case ValueContext.ElementStart: - SetLocalName(String.Empty); - m_valueContext = ValueContext.ElementValue; - return true; - case ValueContext.ElementValue: - RestoreLocalName(); - m_valueContext = ValueContext.ElementEnd; - return true; - case ValueContext.ElementEmpty: - case ValueContext.ElementEnd: - RestoreLocalName(); - break; - } - break; - case JSONElementType.EndArray: - case JSONElementType.EndObject: - RestoreLocalName(); - break; - } - string itemName = m_parser.ElementType == JSONElementType.None ? m_rootName : m_flattenArrays ? m_localName.localName : m_arrayItemName; - while (m_parser.Read()) { - if (!String.IsNullOrEmpty(m_parser.ElementName)) - itemName = m_parser.ElementName; - - switch (m_parser.ElementType) { - case JSONElementType.BeginArray: - if (m_flattenArrays && !m_localName.isArray) { - m_depthCorrection--; - SetLocalName(itemName, true); - continue; - } - SetLocalName(itemName, true); - break; - case JSONElementType.BeginObject: - SetLocalName(itemName); - break; - case JSONElementType.EndArray: - if (m_flattenArrays && !m_localNameStack.Peek().isArray) { - RestoreLocalName(); - m_depthCorrection++; - continue; - } - break; - case JSONElementType.EndObject: - break; - case JSONElementType.Value: - SetLocalName(itemName); - m_valueContext = m_parser.ElementValue == null ? ValueContext.ElementEmpty : ValueContext.ElementStart; - break; - } - return true; - } - - m_state = ReadState.EndOfFile; - return false; - } catch { - m_state = ReadState.Error; - throw; - } - } - - public override bool ReadAttributeValue() { - return false; - } - - public override ReadState ReadState { - get { return m_state; } - } - - public override void ResolveEntity() { - // do nothing - } - - public override string Value { - get { - if (m_parser.ElementValue == null) - return String.Empty; - if (Convert.GetTypeCode(m_parser.ElementValue) == TypeCode.Double) - return ((double)m_parser.ElementValue).ToString(CultureInfo.InvariantCulture); - return m_parser.ElementValue.ToString(); - } - } - - void SetLocalName(string name) { - m_localNameStack.Push(m_localName); - m_localName.localName = name; - m_localName.isArray = false; - } - - void SetLocalName(string name, bool isArray) { - m_localNameStack.Push(m_localName); - m_localName.localName = name; - m_localName.isArray = isArray; - } - - void RestoreLocalName() { - m_localName = m_localNameStack.Pop(); - } - - public override void Close() { - - } - - protected override void Dispose(bool disposing) { - #if MONO - disposing = true; - #endif - if (disposing) { - m_parser.Dispose(); - } - base.Dispose(disposing); - } - - public static JSONXmlReader Create(string file, JSONXmlReaderOptions options) { - return Create(File.OpenText(file), options); - } - - /// - /// Creates the XmlReader for the specified text stream with JSON data. - /// - /// Text reader. - /// Options. - /// - /// The reader will be disposed when the XmlReader is disposed. - /// - public static JSONXmlReader Create(TextReader reader, JSONXmlReaderOptions options) { - return new JSONXmlReader(new JSONParser(reader), options); - } - - /// - /// Creates the XmlReader for the specified stream with JSON data. - /// - /// Stream. - /// Options. - /// - /// The stream will be disposed when the XmlReader is disposed. - /// - public static JSONXmlReader Create(Stream stream, JSONXmlReaderOptions options) { - Safe.ArgumentNotNull(stream, "stream"); - // HACK don't dispose StreaReader to keep stream opened - return Create(new StreamReader(stream), options); - } - } -} diff --git a/Implab/Formats/JSON/JSONXmlReaderOptions.cs b/Implab/Formats/JSON/JSONXmlReaderOptions.cs deleted file mode 100644 --- a/Implab/Formats/JSON/JSONXmlReaderOptions.cs +++ /dev/null @@ -1,62 +0,0 @@ - -using System.Xml; - -namespace Implab.Formats.JSON { - /// - /// Набор необязательных параметров для , позволяющий управлять процессом - /// интерпретации JSON документа. - /// - public class JSONXmlReaderOptions { - /// - /// Пространство имен в котором будут располагаться читаемые элементы документа - /// - public string NamespaceURI { - get; - set; - } - - /// - /// Интерпретировать массивы как множественные элементы (убирает один уровень вложенности), иначе массив - /// представляется в виде узла, дочерними элементами которого являются элементы массива, имена дочерних элементов - /// определяются свойством . По умолчанию false. - /// - public bool FlattenArrays { - get; - set; - } - - /// - /// Префикс, для узлов документа - /// - public string NodesPrefix { - get; - set; - } - - /// - /// Имя корневого элемента в xml документе - /// - public string RootName { - get; - set; - } - - /// - /// Имя элемента для массивов, если не включена опция . - /// По умолчанию item. - /// - public string ArrayItemName { - get; - set; - } - - /// - /// Таблица атомизированных строк для построения документа. - /// - public XmlNameTable NameTable { - get; - set; - } - - } -} diff --git a/Implab/Formats/ReaderScanner.cs b/Implab/Formats/ReaderScanner.cs deleted file mode 100644 --- a/Implab/Formats/ReaderScanner.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.IO; - -namespace Implab.Formats { - public class ReaderScanner: TextScanner { - const int CHUNK_SIZE = 1024*4; - const int BUFFER_MAX = CHUNK_SIZE*1024; - - readonly TextReader m_reader; - - public ReaderScanner(TextReader reader, int limit, int chunk) : base(limit, chunk) { - Safe.ArgumentNotNull(reader, "reader"); - m_reader = reader; - } - - public ReaderScanner(TextReader reader) : this(reader, BUFFER_MAX, CHUNK_SIZE) { - } - - protected override int Read(char[] buffer, int offset, int size) { - return m_reader.Read(buffer, offset, size); - } - - protected override void Dispose(bool disposing) { - if (disposing) - Safe.Dispose(m_reader); - base.Dispose(disposing); - } - } -} - diff --git a/Implab/Formats/ScannerContext.cs b/Implab/Formats/ScannerContext.cs deleted file mode 100644 --- a/Implab/Formats/ScannerContext.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Implab.Formats { - /// - /// Represents a scanner configuration usefull to recongnize token, based on the DFA. - /// - public class ScannerContext { - - public int[,] Dfa { get; private set; } - - public bool[] Final { get; private set; } - - public TTag[][] Tags { get; private set; } - - public int State { get; private set; } - - public int[] Alphabet { get; private set; } - - public ScannerContext(int[,] dfa, bool[] final, TTag[][] tags, int state, int[] alphabet) { - Dfa = dfa; - Final = final; - Tags = tags; - State = state; - Alphabet = alphabet; - } - - public bool Execute(TextScanner scanner, out TTag[] tag) { - return scanner.ReadToken(Dfa, Final, Tags, State, Alphabet, out tag); - } - } -} - diff --git a/Implab/Formats/StringScanner.cs b/Implab/Formats/StringScanner.cs deleted file mode 100644 --- a/Implab/Formats/StringScanner.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Implab.Formats { - public class StringScanner: TextScanner { - const int CHUNK_SIZE = 1024; - - public StringScanner(string text) : base(null) { - Safe.ArgumentNotNull(text, "text"); - var data = text.ToCharArray(); - Feed(data, 0, data.Length); - } - - protected override int Read(char[] buffer, int offset, int size) { - return 0; - } - } -} - diff --git a/Implab/Formats/TextScanner.cs b/Implab/Formats/TextScanner.cs deleted file mode 100644 --- a/Implab/Formats/TextScanner.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using Implab.Components; -using System.Diagnostics; -using Implab.Automaton; -using System.Text; - -namespace Implab.Formats { - public abstract class TextScanner : Disposable { - readonly int m_bufferMax; - readonly int m_chunkSize; - - char[] m_buffer; - int m_bufferOffset; - int m_bufferSize; - int m_tokenOffset; - int m_tokenLength; - - /// - /// Initializes a new instance of the class. - /// - /// Buffer max. - /// Chunk size. - protected TextScanner(int bufferMax, int chunkSize) { - Debug.Assert(m_chunkSize <= m_bufferMax); - - m_bufferMax = bufferMax; - m_chunkSize = chunkSize; - } - - /// - /// Initializes a new instance of the class. - /// - /// Buffer. - protected TextScanner(char[] buffer) { - if (buffer != null) { - m_buffer = buffer; - m_bufferSize = buffer.Length; - } - } - - /// - /// (hungry) Reads the next token. - /// - /// true, if token internal was read, false if there is no more tokens in the stream. - /// The transition map for the automaton - /// Final states of the automaton. - /// Tags. - /// The initial state for the automaton. - /// - /// - internal bool ReadToken(int[,] dfa, bool[] final, TTag[][] tags, int state, int[] alphabet, out TTag[] tag) { - m_tokenLength = 0; - tag = null; - - var maxSymbol = alphabet.Length - 1; - int next; - do { - // after the next chunk is read the offset in the buffer may change - int pos = m_bufferOffset + m_tokenLength; - next = state; - while (pos < m_bufferSize) { - var ch = m_buffer[pos]; - - next = dfa[next, ch > maxSymbol ? AutomatonConst.UNCLASSIFIED_INPUT : alphabet[ch]]; - - if (next == AutomatonConst.UNREACHABLE_STATE) - break; - - state = next; - pos++; - } - m_tokenLength = pos - m_bufferOffset; - } while (next != AutomatonConst.UNREACHABLE_STATE && Feed()); - - m_tokenOffset = m_bufferOffset; - m_bufferOffset += m_tokenLength; - - if (final[state]) { - tag = tags[state]; - return true; - } - - if (m_bufferOffset == m_bufferSize) { - if (m_tokenLength == 0) //EOF - return false; - - throw new ParserException(); - } - - throw new ParserException(String.Format("Unexpected symbol '{0}'", m_buffer[m_bufferOffset])); - - } - - protected void Feed(char[] buffer, int offset, int length) { - m_buffer = buffer; - m_bufferOffset = offset; - m_bufferSize = offset + length; - } - - protected bool Feed() { - if (m_chunkSize <= 0) - return false; - - if (m_buffer != null) { - var free = m_buffer.Length - m_bufferSize; - - if (free < m_chunkSize) { - free += m_chunkSize; - var used = m_bufferSize - m_bufferOffset; - var size = used + free; - - if (size > m_bufferMax) - throw new ParserException(String.Format("The buffer limit ({0} Kb) is reached", m_bufferMax / 1024)); - - var temp = new char[size]; - - var read = Read(temp, used, m_chunkSize); - if (read == 0) - return false; - - Array.Copy(m_buffer, m_bufferOffset, temp, 0, used); - - m_bufferOffset = 0; - m_bufferSize = used + read; - m_buffer = temp; - } else { - var read = Read(m_buffer, m_bufferSize, m_chunkSize); - if (read == 0) - return false; - m_bufferSize += m_chunkSize; - } - return true; - } else { - Debug.Assert(m_bufferOffset == 0); - m_buffer = new char[m_chunkSize]; - m_bufferSize = Read(m_buffer, 0, m_chunkSize); - return (m_bufferSize != 0); - } - } - - protected abstract int Read(char[] buffer, int offset, int size); - - public string GetTokenValue() { - return new String(m_buffer, m_tokenOffset, m_tokenLength); - } - - public void CopyTokenTo(char[] buffer, int offset) { - Array.Copy(m_buffer, m_tokenOffset,buffer, offset, m_tokenLength); - } - - public void CopyTokenTo(StringBuilder sb) { - sb.Append(m_buffer, m_tokenOffset, m_tokenLength); - } - - } -} - diff --git a/Implab/FuncChainTask.cs b/Implab/FuncChainTask.cs deleted file mode 100644 --- a/Implab/FuncChainTask.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Implab { - public class FuncChainTask : FuncChainTaskBase, IDeferred { - readonly Func> m_task; - - public FuncChainTask(Func> task, Func> error, Func> cancel, bool autoCancellable) - : base(error, cancel, autoCancellable) { - m_task = task; - } - - public void Resolve() { - if (m_task != null && LockCancelation()) { - try { - var operation = m_task(); - operation.On(SetResult, HandleErrorInternal, HandleCancelInternal); - CancellationRequested(operation.Cancel); - } catch (Exception err) { - SetErrorInternal(err); - } - } - } - } -} \ No newline at end of file diff --git a/Implab/FuncChainTaskBase.cs b/Implab/FuncChainTaskBase.cs deleted file mode 100644 --- a/Implab/FuncChainTaskBase.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace Implab { - public class FuncChainTaskBase : AbstractTask { - readonly Func> m_error; - readonly Func> m_cancel; - - protected FuncChainTaskBase( Func> error, Func> cancel, bool autoCancellable) { - m_error = error; - m_cancel = cancel; - if (autoCancellable) - CancellationRequested(CancelOperation); - } - - public void Reject(Exception error) { - if (LockCancelation()) - HandleErrorInternal(error); - } - - public override void CancelOperation(Exception reason) { - if (LockCancelation()) - HandleCancelInternal(reason); - } - - protected void HandleErrorInternal(Exception error) { - if (m_error != null) { - try { - var p = m_error(error); - p.On(SetResult, SetErrorInternal, SetCancelledInternal); - CancellationRequested(p.Cancel); - } catch(Exception err) { - SetErrorInternal(err); - } - } else { - SetErrorInternal(error); - } - } - - protected void HandleCancelInternal(Exception reason) { - if (m_cancel != null) { - try { - var p = m_cancel(reason); - p.On(SetResult, HandleErrorInternal, SetCancelledInternal); - CancellationRequested(p.Cancel); - } catch (Exception err) { - SetErrorInternal(err); - } - } else { - SetCancelledInternal(reason); - } - } - } -} - diff --git a/Implab/FuncChainTaskT.cs b/Implab/FuncChainTaskT.cs deleted file mode 100644 --- a/Implab/FuncChainTaskT.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Implab { - public class FuncChainTask : FuncChainTaskBase, IDeferred { - readonly Func> m_task; - - public FuncChainTask(Func> task, Func> error, Func> cancel, bool autoCancellable) : base(error, cancel, autoCancellable){ - m_task = task; - } - - public void Resolve(TArg value) { - if (m_task != null && LockCancelation()) { - try { - var operation = m_task(value); - operation.On(SetResult, HandleErrorInternal, SetCancelled); - CancellationRequested(operation.Cancel); - } catch (Exception err) { - SetErrorInternal(err); - } - } - } - } -} \ No newline at end of file diff --git a/Implab/FuncTask.cs b/Implab/FuncTask.cs deleted file mode 100644 --- a/Implab/FuncTask.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Threading; - -namespace Implab { - public class FuncTask : FuncTaskBase, IDeferred { - readonly Func m_task; - - public FuncTask(Func task, Func error, Func cancel, bool autoCancellable) : base(error, cancel, autoCancellable) { - m_task = task; - } - - public void Resolve() { - if (m_task != null && LockCancelation()) { - try { - SetResult(m_task()); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - } -} - diff --git a/Implab/FuncTaskBase.cs b/Implab/FuncTaskBase.cs deleted file mode 100644 --- a/Implab/FuncTaskBase.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; - -namespace Implab { - public class FuncTaskBase : AbstractTask { - readonly Func m_cancel; - readonly Func m_error; - - protected FuncTaskBase( Func error, Func cancel, bool autoCancellable) { - m_error = error; - m_cancel = cancel; - if (autoCancellable) - CancellationRequested(CancelOperation); - } - - public void Reject(Exception error) { - Safe.ArgumentNotNull(error, "error"); - if (LockCancelation()) - HandleErrorInternal(error); - } - - protected void HandleErrorInternal(Exception error) { - if (m_error != null) { - try { - SetResult(m_error(error)); - } catch(Exception err) { - SetErrorInternal(err); - } - } else { - SetErrorInternal(error); - } - } - - public override void CancelOperation(Exception reason) { - if (LockCancelation()) - HandleCancelInternal(reason); - } - - protected void HandleCancelInternal(Exception reason) { - if (m_cancel != null) { - try { - SetResult(m_cancel(reason)); - } catch (Exception err) { - SetErrorInternal(err); - } - } else { - SetCancelledInternal(reason); - } - } - - } -} - diff --git a/Implab/FuncTaskT.cs b/Implab/FuncTaskT.cs deleted file mode 100644 --- a/Implab/FuncTaskT.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Implab { - public class FuncTask : FuncTaskBase, IDeferred { - readonly Func m_task; - - public FuncTask(Func task, Func error,Func cancel, bool autoCancellable) : base(error,cancel, autoCancellable) { - m_task = task; - } - - public void Resolve(TArg value) { - if (m_task != null && LockCancelation()) { - try { - SetResult(m_task(value)); - } catch(Exception err) { - SetErrorInternal(err); - } - } - } - } -} - diff --git a/Implab/ICancellable.cs b/Implab/ICancellable.cs deleted file mode 100644 --- a/Implab/ICancellable.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Implab { - public interface ICancellable { - void Cancel(); - void Cancel(Exception reason); - } -} diff --git a/Implab/ICancellationToken.cs b/Implab/ICancellationToken.cs deleted file mode 100644 --- a/Implab/ICancellationToken.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; - -namespace Implab { - public interface ICancellationToken { - /// - /// Indicates wherther the cancellation was requested. - /// - bool IsCancellationRequested { get ; } - - /// - /// The reason why the operation should be cancelled. - /// - Exception CancellationReason { get ; } - - /// - /// Accepts if requested. - /// - /// true, if if requested was accepted, false otherwise. - bool CancelOperationIfRequested(); - - /// - /// Sets the token to cancelled state. - /// - /// The reason why the operation was cancelled. - void CancelOperation(Exception reason); - - /// - /// Adds the listener for the cancellation request, is the cancellation was requested the - /// is executed immediatelly. - /// - /// The handler which will be executed if the cancel occurs. - void CancellationRequested(Action handler); - - } -} - diff --git a/Implab/IDeferred.cs b/Implab/IDeferred.cs deleted file mode 100644 --- a/Implab/IDeferred.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Implab { - /// - /// Deferred result, usually used by asynchronous services as the service part of the promise. - /// - public interface IDeferred : ICancellationToken { - - void Resolve(); - - /// - /// Reject the promise with the specified error. - /// - /// The reason why the promise is rejected. - /// - /// Some exceptions are treated in a special case: - /// is interpreted as call to method, - /// and is always unwrapped and its - /// is used as the reason to reject promise. - /// - void Reject(Exception error); - } -} - diff --git a/Implab/IDeferredT.cs b/Implab/IDeferredT.cs deleted file mode 100644 --- a/Implab/IDeferredT.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Implab { - public interface IDeferred : ICancellationToken { - void Resolve(T value); - - void Reject(Exception error); - } -} - diff --git a/Implab/IProgressHandler.cs b/Implab/IProgressHandler.cs deleted file mode 100644 --- a/Implab/IProgressHandler.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab { - public interface IProgressHandler { - string Message { - get; - set; - } - float CurrentProgress { - get; - set; - } - void InitProgress(float current, float max, string message); - } -} diff --git a/Implab/IProgressNotifier.cs b/Implab/IProgressNotifier.cs deleted file mode 100644 --- a/Implab/IProgressNotifier.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab -{ - public interface IProgressNotifier - { - event EventHandler> MessageUpdated; - event EventHandler> ProgressUpdated; - event EventHandler ProgressInit; - } -} diff --git a/Implab/IServiceLocator.cs b/Implab/IServiceLocator.cs deleted file mode 100644 --- a/Implab/IServiceLocator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Implab { - public interface IServiceLocator: IServiceProvider { - T GetService(); - bool TryGetService(out T service); - bool TryGetService (Type serviceType, out object service); - } -} diff --git a/Implab/ITaskController.cs b/Implab/ITaskController.cs deleted file mode 100644 --- a/Implab/ITaskController.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Implab { - public interface ITaskController: IProgressHandler, ICancellable { - bool IsCancelled { - get; - } - - event EventHandler Cancelled; - } -} diff --git a/Implab/Implab.csproj b/Implab/Implab.csproj --- a/Implab/Implab.csproj +++ b/Implab/Implab.csproj @@ -1,277 +1,26 @@ - - + + - Debug - AnyCPU - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Library - Implab - Implab - v4.5 - 8.0.30703 - 2.0 - - - true - full - false - bin\Debug - TRACE;DEBUG; - prompt - 4 - false - true - - - full - true - bin\Release - prompt - 4 - false + Sergey Smirnov + Implab library + Provides some helper clesses like XML serialization helpers, JSON XML reader, + JSON pull-parser, ECMA-style promises, lightweight synchonization routines Signal + and SharedLock, Trace helpers on top of System.Diagnostics, ObjectPool etc. + + 2012-2018 Sergey Smirnov + 3.0.14 + https://bitbucket.org/wozard/implabnet/src/v3/Implab/license.txt + https://bitbucket.org/wozard/implabnet + https://bitbucket.org/wozard/implabnet + mercurial + IMPLAB;Json pull-parser;Json Xml;async;diagnostics;serialization; + netstandard2.0;net46 + /usr/lib/mono/4.5/ + NETFX_TRACE_BUG;$(DefineConstants) - - true - full - false - bin\Debug - TRACE;DEBUG;NET_4_5 - prompt - 4 - true - false - - - true - bin\Release - prompt - 4 - false - NET_4_5 - - - true - full - false - bin\Debug - TRACE;DEBUG;NET_4_5;MONO - prompt - 4 - true - false - - - true - bin\Release - NET_4_5;MONO; - prompt - 4 - false - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - I - - - - - Attribute - - - - - EventArgs - - - - - Exception - - - - - - - - - m_ - - - - - _ - - - - - m_ - - - - - - - - - - T - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/Implab/Implab.nuspec b/Implab/Implab.nuspec new file mode 100644 --- /dev/null +++ b/Implab/Implab.nuspec @@ -0,0 +1,17 @@ + + + + Implab + $version$ + $title$ + Implab team + Implab team + https://implab.org/ + + false + Common components for asynchronous applications, tracing, logging, json and xml traits. + Added strong name. + Copyright 2017 + async xml json + + \ No newline at end of file diff --git a/Implab/Parallels/ArrayTraits.cs b/Implab/Parallels/ArrayTraits.cs deleted file mode 100644 --- a/Implab/Parallels/ArrayTraits.cs +++ /dev/null @@ -1,207 +0,0 @@ -using Implab.Diagnostics; -using System; -using System.Diagnostics; -using System.Threading; - -namespace Implab.Parallels { - public static class ArrayTraits { - class ArrayIterator : DispatchPool { - readonly Action m_action; - readonly TSrc[] m_source; - readonly Promise m_promise = new Promise(); - readonly LogicalOperation m_logicalOperation; - - int m_pending; - int m_next; - - public ArrayIterator(TSrc[] source, Action action, int threads) - : base(threads) { - - Debug.Assert(source != null); - Debug.Assert(action != null); - - m_logicalOperation = TraceContext.Instance.CurrentOperation; - m_next = 0; - m_source = source; - m_pending = source.Length; - m_action = action; - - m_promise.On(Dispose, PromiseEventType.All); - - InitPool(); - } - - public Promise Promise { - get { - return m_promise; - } - } - - protected override void Worker() { - TraceContext.Instance.EnterLogicalOperation(m_logicalOperation, false); - try { - base.Worker(); - } finally { - TraceContext.Instance.Leave(); - } - } - - protected override bool TryDequeue(out int unit) { - unit = Interlocked.Increment(ref m_next) - 1; - return unit < m_source.Length; - } - - protected override void InvokeUnit(int unit) { - try { - m_action(m_source[unit]); - var pending = Interlocked.Decrement(ref m_pending); - if (pending == 0) - m_promise.Resolve(m_source.Length); - } catch (Exception e) { - m_promise.Reject(e); - } - } - } - - class ArrayMapper: DispatchPool { - readonly Func m_transform; - readonly TSrc[] m_source; - readonly TDst[] m_dest; - readonly Promise m_promise = new Promise(); - readonly LogicalOperation m_logicalOperation; - - int m_pending; - int m_next; - - public ArrayMapper(TSrc[] source, Func transform, int threads) - : base(threads) { - - Debug.Assert (source != null); - Debug.Assert( transform != null); - - m_next = 0; - m_source = source; - m_dest = new TDst[source.Length]; - m_pending = source.Length; - m_transform = transform; - m_logicalOperation = TraceContext.Instance.CurrentOperation; - - m_promise.On(Dispose, PromiseEventType.All); - - InitPool(); - } - - public Promise Promise { - get { - return m_promise; - } - } - - protected override void Worker() { - TraceContext.Instance.EnterLogicalOperation(m_logicalOperation,false); - try { - base.Worker(); - } finally { - TraceContext.Instance.Leave(); - } - } - - protected override bool TryDequeue(out int unit) { - unit = Interlocked.Increment(ref m_next) - 1; - return unit < m_source.Length; - } - - protected override void InvokeUnit(int unit) { - try { - m_dest[unit] = m_transform(m_source[unit]); - var pending = Interlocked.Decrement(ref m_pending); - if (pending == 0) - m_promise.Resolve(m_dest); - } catch (Exception e) { - m_promise.Reject(e); - } - } - } - - public static IPromise ParallelMap (this TSrc[] source, Func transform, int threads) { - if (source == null) - throw new ArgumentNullException("source"); - if (transform == null) - throw new ArgumentNullException("transform"); - - var mapper = new ArrayMapper(source, transform, threads); - return mapper.Promise; - } - - public static IPromise ParallelForEach(this TSrc[] source, Action action, int threads) { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - var iter = new ArrayIterator(source, action, threads); - return iter.Promise; - } - - public static IPromise ChainedMap(this TSrc[] source, Func> transform, int threads) { - if (source == null) - throw new ArgumentNullException("source"); - if (transform == null) - throw new ArgumentNullException("transform"); - if (threads <= 0) - throw new ArgumentOutOfRangeException("threads","Threads number must be greater then zero"); - - if (source.Length == 0) - return Promise.FromResult(new TDst[0]); - - var promise = new Promise(); - var res = new TDst[source.Length]; - var pending = source.Length; - - object locker = new object(); - int slots = threads; - - // Analysis disable AccessToDisposedClosure - AsyncPool.RunThread(() => { - for (int i = 0; i < source.Length; i++) { - if(promise.IsResolved) - break; // stop processing in case of error or cancellation - var idx = i; - - if (Interlocked.Decrement(ref slots) < 0) { - lock(locker) { - while(slots < 0) - Monitor.Wait(locker); - } - } - - try { - transform(source[i]) - .On( x => { - Interlocked.Increment(ref slots); - lock (locker) { - Monitor.Pulse(locker); - } - }) - .On( - x => { - res[idx] = x; - var left = Interlocked.Decrement(ref pending); - if (left == 0) - promise.Resolve(res); - }, - promise.Reject - ); - - } catch (Exception e) { - promise.Reject(e); - } - } - return 0; - }); - - return promise; - } - - } -} diff --git a/Implab/Parallels/AsyncPool.cs b/Implab/Parallels/AsyncPool.cs deleted file mode 100644 --- a/Implab/Parallels/AsyncPool.cs +++ /dev/null @@ -1,155 +0,0 @@ -using Implab.Diagnostics; -using System; -using System.Threading; -using System.Linq; - -namespace Implab.Parallels { - /// - /// Класс для распаралеливания задач. - /// - /// - /// Используя данный класс и лямда выражения можно распараллелить - /// вычисления, для этого используется концепция обещаний. - /// - public static class AsyncPool { - - public static IPromise Invoke(Func func) { - var p = new Promise(); - var caller = TraceContext.Instance.CurrentOperation; - - ThreadPool.QueueUserWorkItem(param => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - p.Resolve(func()); - } catch(Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - - return p; - } - - public static IPromise Invoke(Func func) { - var p = new Promise(); - var caller = TraceContext.Instance.CurrentOperation; - - ThreadPool.QueueUserWorkItem(param => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - p.Resolve(func(p)); - } catch(Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - - return p; - } - - public static IPromise RunThread(Func func) { - var p = new Promise(); - - var caller = TraceContext.Instance.CurrentOperation; - - var worker = new Thread(() => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - p.Resolve(func()); - } catch (Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - worker.IsBackground = true; - worker.Start(); - - return p; - } - - public static IPromise RunThread(Func func) { - var p = new Promise(); - - var caller = TraceContext.Instance.CurrentOperation; - - var worker = new Thread(() => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - p.Resolve(func(p)); - } catch (Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - worker.IsBackground = true; - worker.Start(); - - return p; - } - - - public static IPromise RunThread(Action func) { - var p = new Promise(); - - var caller = TraceContext.Instance.CurrentOperation; - - var worker = new Thread(() => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - func(); - p.Resolve(); - } catch (Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - worker.IsBackground = true; - worker.Start(); - - return p; - } - - public static IPromise RunThread(Action func) { - var p = new Promise(); - - var caller = TraceContext.Instance.CurrentOperation; - - var worker = new Thread(() => { - TraceContext.Instance.EnterLogicalOperation(caller,false); - try { - func(p); - p.Resolve(); - } catch (Exception e) { - p.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - worker.IsBackground = true; - worker.Start(); - - return p; - } - - public static IPromise[] RunThread(params Action[] func) { - return func.Select(f => RunThread(f)).ToArray(); - } - - public static IPromise[] RunThread(params Action[] func) { - return func.Select(f => RunThread(f)).ToArray(); - } - - public static IPromise[] RunThread(params Func[] func) { - return func.Select(f => RunThread(f)).ToArray(); - } - - public static IPromise[] RunThread(params Func[] func) { - return func.Select(f => RunThread(f)).ToArray(); - } - } -} diff --git a/Implab/Parallels/MTQueue.cs b/Implab/Parallels/MTQueue.cs deleted file mode 100644 --- a/Implab/Parallels/MTQueue.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System.Threading; -using System.Collections.Generic; -using System; -using System.Collections; - -namespace Implab.Parallels { - public class MTQueue : IEnumerable { - class Node { - public Node(T value) { - this.value = value; - } - public readonly T value; - public Node next; - } - - Node m_first; - Node m_last; - - public void Enqueue(T value) { - Thread.MemoryBarrier(); - - var last = m_last; - var next = new Node(value); - - // Interlocaked.CompareExchange implies Thread.MemoryBarrier(); - // to ensure that the next node is completely constructed - while (last != Interlocked.CompareExchange(ref m_last, next, last)) - last = m_last; - - if (last != null) - last.next = next; - else - m_first = next; - } - - public bool TryDequeue(out T value) { - Node first; - Node next; - value = default(T); - - Thread.MemoryBarrier(); - do { - first = m_first; - if (first == null) - return false; - next = first.next; - if (next == null) { - // this is the last element, - // then try to update the tail - if (first != Interlocked.CompareExchange(ref m_last, null, first)) { - // this is the race condition - if (m_last == null) - // the queue is empty - return false; - // tail has been changed, we need to restart - continue; - } - - // tail succesfully updated and first.next will never be changed - // other readers will fail due to inconsistency m_last != m_fist && m_first.next == null - // however the parallel writer may update the m_first since the m_last is null - - // so we need to fix inconsistency by setting m_first to null or if it has been - // updated by the writer already then we should just to give up - Interlocked.CompareExchange(ref m_first, null, first); - break; - - } - if (first == Interlocked.CompareExchange(ref m_first, next, first)) - // head succesfully updated - break; - } while (true); - - value = first.value; - return true; - } - - #region IEnumerable implementation - - class Enumerator : IEnumerator { - Node m_current; - Node m_first; - - public Enumerator(Node first) { - m_first = first; - } - - #region IEnumerator implementation - - public bool MoveNext() { - m_current = m_current == null ? m_first : m_current.next; - return m_current != null; - } - - public void Reset() { - m_current = null; - } - - object IEnumerator.Current { - get { - if (m_current == null) - throw new InvalidOperationException(); - return m_current.value; - } - } - - #endregion - - #region IDisposable implementation - - public void Dispose() { - } - - #endregion - - #region IEnumerator implementation - - public T Current { - get { - if (m_current == null) - throw new InvalidOperationException(); - return m_current.value; - } - } - - #endregion - } - - public IEnumerator GetEnumerator() { - return new Enumerator(m_first); - } - - #endregion - - #region IEnumerable implementation - - IEnumerator IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - #endregion - } -} diff --git a/Implab/Parallels/WorkerPool.cs b/Implab/Parallels/WorkerPool.cs deleted file mode 100644 --- a/Implab/Parallels/WorkerPool.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Threading; -using System.Diagnostics; -using Implab.Diagnostics; - -namespace Implab.Parallels { - public class WorkerPool : DispatchPool { - - AsyncQueue m_queue = new AsyncQueue(); - int m_queueLength; - readonly int m_threshold = 1; - - public WorkerPool(int minThreads, int maxThreads, int threshold) - : base(minThreads, maxThreads) { - m_threshold = threshold; - InitPool(); - } - - public WorkerPool(int minThreads, int maxThreads) : - base(minThreads, maxThreads) { - InitPool(); - } - - public WorkerPool(int threads) - : base(threads) { - InitPool(); - } - - public WorkerPool() { - InitPool(); - } - - public IPromise Invoke(Func task) { - if (task == null) - throw new ArgumentNullException("task"); - if (IsDisposed) - throw new ObjectDisposedException(ToString()); - - var promise = new FuncTask(task, null, null, true); - - var lop = TraceContext.Instance.CurrentOperation; - - EnqueueTask(delegate { - TraceContext.Instance.EnterLogicalOperation(lop, false); - - promise.Resolve(); - - TraceContext.Instance.Leave(); - }); - - return promise; - } - - public IPromise Invoke(Action task) { - if (task == null) - throw new ArgumentNullException("task"); - if (IsDisposed) - throw new ObjectDisposedException(ToString()); - - var promise = new ActionTask(task, null, null, true); - - var lop = TraceContext.Instance.CurrentOperation; - - EnqueueTask(delegate { - TraceContext.Instance.EnterLogicalOperation(lop, false); - - promise.Resolve(); - - TraceContext.Instance.Leave(); - }); - - return promise; - } - - public IPromise Invoke(Func task) { - if (task == null) - throw new ArgumentNullException("task"); - if (IsDisposed) - throw new ObjectDisposedException(ToString()); - - var promise = new Promise(); - - var lop = TraceContext.Instance.CurrentOperation; - - EnqueueTask(delegate { - TraceContext.Instance.EnterLogicalOperation(lop, false); - try { - if (!promise.CancelOperationIfRequested()) - promise.Resolve(task(promise)); - } catch (Exception e) { - promise.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - - return promise; - } - - public IPromise Invoke(Action task) { - if (task == null) - throw new ArgumentNullException("task"); - if (IsDisposed) - throw new ObjectDisposedException(ToString()); - - var promise = new Promise(); - - var lop = TraceContext.Instance.CurrentOperation; - - EnqueueTask(delegate { - TraceContext.Instance.EnterLogicalOperation(lop, false); - try { - if (!promise.CancelOperationIfRequested()) { - task(promise); - promise.Resolve(); - } - } catch (Exception e) { - promise.Reject(e); - } finally { - TraceContext.Instance.Leave(); - } - }); - - return promise; - } - - protected void EnqueueTask(Action unit) { - Debug.Assert(unit != null); - var len = Interlocked.Increment(ref m_queueLength); - m_queue.Enqueue(unit); - - if (len > m_threshold * PoolSize) { - StartWorker(); - } - - SignalThread(); - } - - protected override bool TryDequeue(out Action unit) { - if (m_queue.TryDequeue(out unit)) { - Interlocked.Decrement(ref m_queueLength); - return true; - } - return false; - } - - protected override void InvokeUnit(Action unit) { - unit(); - } - - } -} diff --git a/Implab/ProgressInitEventArgs.cs b/Implab/ProgressInitEventArgs.cs deleted file mode 100644 --- a/Implab/ProgressInitEventArgs.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab -{ - [Serializable] - public class ProgressInitEventArgs: EventArgs - { - public float MaxProgress - { - get; - private set; - } - - public float CurrentProgress - { - get; - private set; - } - - public string Message - { - get; - private set; - } - - public ProgressInitEventArgs(float current, float max, string message) - { - this.MaxProgress = max; - this.CurrentProgress = current; - this.Message = message; - } - } -} diff --git a/Implab/Promise.cs b/Implab/Promise.cs deleted file mode 100644 --- a/Implab/Promise.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Implab.Parallels; - -namespace Implab { - public class Promise : AbstractPromise, IDeferred { - public static readonly Promise SUCCESS; - - static Promise() { - SUCCESS = new Promise(); - SUCCESS.Resolve(); - } - - public void Resolve() { - SetResult(); - } - - public void Reject(Exception error) { - SetError(error); - } - } -} - diff --git a/Implab/PromiseAwaiter.cs b/Implab/PromiseAwaiter.cs deleted file mode 100644 --- a/Implab/PromiseAwaiter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Implab { - public struct PromiseAwaiter : INotifyCompletion { - readonly IPromise m_promise; - - public PromiseAwaiter(IPromise promise) { - m_promise = promise; - } - - public void OnCompleted (Action continuation) { - if (m_promise != null) - m_promise.On(continuation, PromiseEventType.All); - } - - public void GetResult() { - m_promise.Join(); - } - - public bool IsCompleted { - get { - return m_promise.IsResolved; - } - } - } -} - diff --git a/Implab/PromiseAwaiterT.cs b/Implab/PromiseAwaiterT.cs deleted file mode 100644 --- a/Implab/PromiseAwaiterT.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Implab { - public struct PromiseAwaiter : INotifyCompletion { - readonly IPromise m_promise; - - public PromiseAwaiter(IPromise promise) { - m_promise = promise; - } - - public void OnCompleted (Action continuation) { - if (m_promise != null) - m_promise.On(continuation, PromiseEventType.All); - } - - public T GetResult() { - return m_promise.Join(); - } - - public bool IsCompleted { - get { - return m_promise.IsResolved; - } - } - } -} - diff --git a/Implab/PromiseEventType.cs b/Implab/PromiseEventType.cs deleted file mode 100644 --- a/Implab/PromiseEventType.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Implab { - [Flags] - public enum PromiseEventType { - Success = 1, - Error = 2, - Cancelled = 4, - /// - /// Завершено успешно, либо возникла ошибка, - /// - All = 7, - /// - /// Заврешено успешно, либо возникла ошибка. - /// - Complete = 3, - - ErrorOrCancel = 6 - } -} - diff --git a/Implab/PromiseT.cs b/Implab/PromiseT.cs deleted file mode 100644 --- a/Implab/PromiseT.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Diagnostics; -using Implab.Parallels; - -namespace Implab { - - /// - /// Класс для асинхронного получения результатов. Так называемое "обещание". - /// - /// Тип получаемого результата - /// - /// Сервис при обращении к его методу дает обещаиние о выполнении операции, - /// клиент получив такое обещание может установить ряд обратных вызово для получения - /// событий выполнения обещания, тоесть завершения операции и предоставлении результатов. - /// - /// Обещение может быть как выполнено, так и выполнено с ошибкой. Для подписки на - /// данные события клиент должен использовать методы Then. - /// - /// - /// Сервис, в свою очередь, по окончанию выполнения операции (возможно с ошибкой), - /// использует методы Resolve либо Reject для оповещения клиетна о - /// выполнении обещания. - /// - /// - /// Если сервер успел выполнить обещание еще до того, как клиент на него подписался, - /// то в момент подписки клиента будут вызваны соответсвующие события в синхронном - /// режиме и клиент будет оповещен в любом случае. Иначе, обработчики добавляются в - /// список в порядке подписания и в этом же порядке они будут вызваны при выполнении - /// обещания. - /// - /// - /// Обрабатывая результаты обещания можно преобразовывать результаты либо инициировать - /// связанные асинхронные операции, которые также возвращают обещания. Для этого следует - /// использовать соответствующую форму методе Then. - /// - /// - /// Также хорошим правилом является то, что Resolve и Reject должен вызывать - /// только инициатор обещания иначе могут возникнуть противоречия. - /// - /// - public class Promise : AbstractPromise, IDeferred { - - public static IPromise FromResult(T value) { - return new SuccessPromise(value); - } - - public static IPromise FromException(Exception error) { - var p = new Promise(); - p.Reject(error); - return p; - } - - public virtual void Resolve(T value) { - SetResult(value); - } - - public void Reject(Exception error) { - SetError(error); - } - } -} diff --git a/Implab/Properties/AssemblyInfo.cs b/Implab/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/Implab/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Implab")] -[assembly: AssemblyDescription("Tools")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Implab")] -[assembly: AssemblyTrademark("")] -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("2.1.*")] -[assembly: ComVisible(false)] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/Implab/SuccessPromise.cs b/Implab/SuccessPromise.cs deleted file mode 100644 --- a/Implab/SuccessPromise.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; - -namespace Implab { - public class SuccessPromise : IPromise { - #region IPromise implementation - - public IPromise On(Action success, Action error, Action cancel) { - if (success != null) { - try { - success(); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success, Action error) { - if (success != null) { - try { - success(); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success) { - if (success != null) { - try { - success(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - return this; - } - - public IPromise On(Action handler, PromiseEventType events) { - if (handler != null && events.HasFlag(PromiseEventType.Success)) { - try { - handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - return this; - } - - public IPromise Cast() { - throw new InvalidCastException(); - } - - public void Join() { - } - - public void Join(int timeout) { - } - - public Type PromiseType { - get { - return typeof(void); - } - } - - public bool IsResolved { - get { - return true; - } - } - - public bool IsCancelled { - get { - return false; - } - } - - public Exception Error { - get { - return null; - } - } - - #endregion - - #region ICancellable implementation - - public void Cancel() { - } - - public void Cancel(Exception reason) { - } - - #endregion - - } -} - diff --git a/Implab/SuccessPromiseT.cs b/Implab/SuccessPromiseT.cs deleted file mode 100644 --- a/Implab/SuccessPromiseT.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; - -namespace Implab { - public class SuccessPromise : IPromise { - readonly T m_value; - - public SuccessPromise(T value){ - m_value = value; - } - - public IPromise On(Action success, Action error, Action cancel) { - if (success != null) { - try { - success(m_value); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success, Action error) { - if (success != null) { - try { - success(m_value); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success) { - if (success != null) { - try { - success(m_value); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - return this; - } - - public T Join() { - return m_value; - } - - public T Join(int timeout) { - return m_value; - } - - public IPromise On(Action success, Action error, Action cancel) { - if (success != null) { - try { - success(); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success, Action error) { - if (success != null) { - try { - success(); - } catch(Exception err) { - if (error != null) { - try { - error(err); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - } - } - return this; - } - - public IPromise On(Action success) { - if (success != null) { - try { - success(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - return this; - } - - public IPromise On(Action handler, PromiseEventType events) { - if (handler != null && events.HasFlag(PromiseEventType.Success)) { - try { - handler(); - // Analysis disable once EmptyGeneralCatchClause - } catch { - } - } - return this; - } - - IPromise IPromise.On(Action success, Action error, Action cancel) { - return On(success, error, cancel); - } - - IPromise IPromise.On(Action success, Action error) { - return On(success, error); - } - - IPromise IPromise.On(Action success) { - return On(success); - } - - IPromise IPromise.On(Action handler, PromiseEventType events) { - return On(handler, events); - } - - public IPromise Cast() { - return new SuccessPromise((T2)(object)m_value); - } - - void IPromise.Join() { - } - - void IPromise.Join(int timeout) { - } - - public Type PromiseType { - get { - return typeof(T); - } - } - - public bool IsResolved { - get { - return true; - } - } - - public bool IsCancelled { - get { - return false; - } - } - - public Exception Error { - get { - return null; - } - } - - public void Cancel() { - } - - public void Cancel(Exception reason) { - } - } -} - diff --git a/Implab/SyncContextPromise.cs b/Implab/SyncContextPromise.cs deleted file mode 100644 --- a/Implab/SyncContextPromise.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Threading; -using System; - -namespace Implab { - public class SyncContextPromise : Promise { - readonly SynchronizationContext m_context; - - public SyncContextPromise(SynchronizationContext context) { - Safe.ArgumentNotNull(context, "context"); - m_context = context; - } - - protected override void SignalHandler(HandlerDescriptor handler, int signal) { - m_context.Post(x => base.SignalHandler(handler, signal), null); - } - } -} - diff --git a/Implab/TaskController.cs b/Implab/TaskController.cs deleted file mode 100644 --- a/Implab/TaskController.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; - -namespace Implab -{ - /// - /// This class allows to interact with asyncronuos task. - /// - /// - /// Members of this object are thread safe. - /// - public class TaskController: IProgressNotifier, ITaskController - { - readonly object m_lock; - string m_message; - - float m_current; - float m_max; - - bool m_cancelled; - - public event EventHandler Cancelled; - public event EventHandler> MessageUpdated; - public event EventHandler> ProgressUpdated; - public event EventHandler ProgressInit; - - public TaskController() - { - m_lock = new Object(); - } - - public string Message - { - get - { - lock (m_lock) - return m_message; - } - set - { - lock (m_lock) - { - m_message = value; - OnMessageUpdated(); - } - } - } - - public float CurrentProgress - { - get - { - lock (m_lock) - return m_current; - } - set - { - lock (m_lock) - { - var prev = m_current; - m_current = value; - if (m_current >= m_max) - m_current = m_max; - if (m_current != prev) - OnProgressUpdated(); - } - } - } - - public void InitProgress(float current, float max, string message) - { - if (max < 0) - throw new ArgumentOutOfRangeException("max"); - if (current < 0 || current > max) - throw new ArgumentOutOfRangeException("current"); - - lock(m_lock) { - m_current = current; - m_max = max; - m_message = message; - OnProgressInit(); - } - } - - public bool IsCancelled { - get { - lock (m_lock) - return m_cancelled; - } - } - - public void Cancel() { - lock (m_lock) { - if (!m_cancelled) - m_cancelled = true; - } - } - - public void Cancel(Exception reason) { - lock (m_lock) { - if (!m_cancelled) - m_cancelled = true; - } - } - - protected virtual void OnCancelled() { - var temp = Cancelled; - if (temp != null) { - temp(this,new EventArgs()); - } - } - - protected virtual void OnMessageUpdated() - { - var temp = MessageUpdated; - if (temp != null) - { - temp(this, new ValueEventArgs(m_message)); - } - } - - protected virtual void OnProgressUpdated() - { - var temp = ProgressUpdated; - if (temp != null) - { - temp(this,new ValueEventArgs(m_current)); - } - } - - protected virtual void OnProgressInit() - { - var temp = ProgressInit; - if (temp != null) - { - temp(this, new ProgressInitEventArgs(m_current,m_max, m_message)); - } - } - } -} diff --git a/Implab/ValueEventArgs.cs b/Implab/ValueEventArgs.cs deleted file mode 100644 --- a/Implab/ValueEventArgs.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab -{ - [Serializable] - public class ValueEventArgs: EventArgs - { - public ValueEventArgs(T value) - { - this.Value = value; - } - public T Value - { - get; - private set; - } - } -} diff --git a/Implab/implab.snk b/Implab/implab.snk new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2a97e5bd29ee66d5071da2075f5e6471e9418560 GIT binary patch literal 596 zc$@)L0;~N80ssI2Bme+XQ$aES1ONa50097>8h#|4vJ)g>rhZCkG@b$eW)d55JbM%cx|Eq*jW%iTc*wDy z=nX8^^ZeEm2Kw%Q(-NIcCe`?0SQp2vk2<2D59vJ#-^38)QA@>+9Kd>r=&+r|h(_-B zT<3J#>{@uc*l?`s~%-VX@7 z&)eD_@-zp-KxVqv5vC@m*d|_D@!Efr-e0UFc&t6G>#M2>k57u?tk*d#p*`{$8=CfB zt5S9K_M1j@6Q+>r`r%C&v0edT;8{+5CERgD1P*K~sefevEZJshQkU5s{VtEo^mU!c zE5_2Pa)Jlm##;S!2}-MPMBB+)APHoX;bziy9XYG1A1}2;e4XHG9wX@cJZ8M&wjtay z&Vlfmgx+R>dG$!%t0!veEMORO*fm^1m@FO=PDV)El`Y?s9ZT)dGFoKWl@R`yz1E!? zW-Nd|wE7&fCz5#c$EQO~%&&SXocLUC?cz1#H4%;ZfX|! : ICancellationToken, ICancellable { - - const int UNRESOLVED_SATE = 0; - const int TRANSITIONAL_STATE = 1; - protected const int SUCCEEDED_STATE = 2; - protected const int REJECTED_STATE = 3; - protected const int CANCELLED_STATE = 4; - - const int CANCEL_NOT_REQUESTED = 0; - const int CANCEL_REQUESTING = 1; - const int CANCEL_REQUESTED = 2; - - const int RESERVED_HANDLERS_COUNT = 4; - - int m_state; - Exception m_error; - int m_handlersCount; + /// + /// Abstract class for creation of custom one-shot thread safe events. + /// + /// + /// + /// An event is something that should happen in the future and the + /// triggering of the event causes execution of some pending actions + /// which are formely event handlers. One-shot events occur only once + /// and any handler added after the event is triggered should run + /// without a delay. + /// + /// + /// The lifecycle of the one-shot event is tipically consists of following + /// phases. + /// + /// Pending state. This is the initial state of the event. Any + /// handler added to the event will be queued for the future execution. + /// + /// Transitional state. This is intermediate state between pending + /// and fulfilled states, during this state internal initialization and storing + /// of the result occurs. + /// + /// Fulfilled state. The event contains the result, all queued + /// handlers are signalled to run and newly added handlers are executed + /// immediatelly. + /// + /// + /// + /// + public abstract class AbstractEvent where THandler : class { + const int PendingState = 0; - //readonly THandler[] m_handlers = new THandler[RESERVED_HANDLERS_COUNT]; - THandler[] m_handlers; - MTQueue m_extraHandlers; - int m_handlerPointer = -1; - int m_handlersCommited; + const int TransitionalState = 1; - int m_cancelRequest; - Exception m_cancelationReason; - MTQueue> m_cancelationHandlers; + const int ResolvedState = 2; + volatile int m_state; - #region state managment - bool BeginTransit() { - return UNRESOLVED_SATE == Interlocked.CompareExchange(ref m_state, TRANSITIONAL_STATE, UNRESOLVED_SATE); - } + THandler m_handler; + SimpleAsyncQueue m_extraHandlers; - void CompleteTransit(int state) { - if (TRANSITIONAL_STATE != Interlocked.CompareExchange(ref m_state, state, TRANSITIONAL_STATE)) - throw new InvalidOperationException("Can't complete transition when the object isn't in the transitional state"); - } - - void WaitTransition() { - while (m_state == TRANSITIONAL_STATE) { - Thread.MemoryBarrier(); + public bool IsResolved { + get { + return m_state > TransitionalState; } } - protected bool BeginSetResult() { - if (!BeginTransit()) { - WaitTransition(); - if (m_state != CANCELLED_STATE) - throw new InvalidOperationException("The promise is already resolved"); - return false; - } - return true; + #region state managment + protected bool BeginTransit() { + return PendingState == Interlocked.CompareExchange(ref m_state, TransitionalState, PendingState); } - protected void EndSetResult() { - CompleteTransit(SUCCEEDED_STATE); + protected void CompleteTransit() { +#if DEBUG + if (TransitionalState != Interlocked.CompareExchange(ref m_state, ResolvedState, TransitionalState)) + throw new InvalidOperationException("Can't complete transition when the object isn't in the transitional state"); +#else + m_state = ResolvedState; +#endif Signal(); } + protected void WaitTransition() { + if (m_state == TransitionalState) { + SpinWait spin = new SpinWait(); + do { + spin.SpinOnce(); + } while (m_state == TransitionalState); + } + } + - - /// - /// Выполняет обещание, сообщая об ошибке - /// - /// - /// Поскольку обещание должно работать в многопточной среде, при его выполнении сразу несколько потоков - /// могу вернуть ошибку, при этом только первая будет использована в качестве результата, остальные - /// будут проигнорированы. - /// - /// Исключение возникшее при выполнении операции - /// Данное обещание уже выполнено - protected void SetError(Exception error) { - if (BeginTransit()) { - m_error = error; - CompleteTransit(REJECTED_STATE); - - Signal(); - } else { - WaitTransition(); - if (m_state == SUCCEEDED_STATE) - throw new InvalidOperationException("The promise is already resolved"); - } - } - - /// - /// Отменяет операцию, если это возможно. - /// - /// Для определения была ли операция отменена следует использовать свойство . - protected void SetCancelled(Exception reason) { - if (BeginTransit()) { - m_error = reason; - CompleteTransit(CANCELLED_STATE); - Signal(); - } - } - - protected abstract void SignalHandler(THandler handler, int signal); + protected abstract void SignalHandler(THandler handler); void Signal() { - var hp = m_handlerPointer; - var slot = hp +1 ; - while (slot < m_handlersCommited) { - if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) == hp) { - SignalHandler(m_handlers[slot], m_state); - } - hp = m_handlerPointer; - slot = hp +1 ; - } - - - if (m_extraHandlers != null) { - THandler handler; - while (m_extraHandlers.TryDequeue(out handler)) - SignalHandler(handler, m_state); - } + THandler handler; + while (TryDequeueHandler(out handler)) + SignalHandler(handler); } #endregion - protected abstract Signal GetResolveSignal(); - - #region synchronization traits - protected void WaitResult(int timeout) { - if (!(IsResolved || GetResolveSignal().Wait(timeout))) - throw new TimeoutException(); - - switch (m_state) { - case SUCCEEDED_STATE: - return; - case CANCELLED_STATE: - throw new OperationCanceledException("The operation has been cancelled", m_error); - case REJECTED_STATE: - throw new TargetInvocationException(m_error); - default: - throw new ApplicationException(String.Format("The promise state {0} is invalid", m_state)); - } - } - #endregion - #region handlers managment protected void AddHandler(THandler handler) { - if (m_state > 1) { + if (IsResolved) { // the promise is in the resolved state, just invoke the handler - SignalHandler(handler, m_state); + SignalHandler(handler); } else { - var slot = Interlocked.Increment(ref m_handlersCount) - 1; - - if (slot < RESERVED_HANDLERS_COUNT) { - - if (slot == 0) { - m_handlers = new THandler[RESERVED_HANDLERS_COUNT]; - } else { - while (m_handlers == null) - Thread.MemoryBarrier(); - } - - m_handlers[slot] = handler; - - while (slot != Interlocked.CompareExchange(ref m_handlersCommited, slot + 1, slot)) { - } + EnqueueHandler(handler); - if (m_state > 1) { - do { - var hp = m_handlerPointer; - slot = hp + 1; - if (slot < m_handlersCommited) { - if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) != hp) - continue; - SignalHandler(m_handlers[slot], m_state); - } - break; - } while(true); - } - } else { - if (slot == RESERVED_HANDLERS_COUNT) { - m_extraHandlers = new MTQueue(); - } else { - while (m_extraHandlers == null) - Thread.MemoryBarrier(); - } - - m_extraHandlers.Enqueue(handler); - - if (m_state > 1 && m_extraHandlers.TryDequeue(out handler)) + if (IsResolved && TryDequeueHandler(out handler)) // if the promise have been resolved while we was adding the handler to the queue // we can't guarantee that someone is still processing it // therefore we need to fetch a handler from the queue and execute it // note that fetched handler may be not the one that we have added // even we can fetch no handlers at all :) - SignalHandler(handler, m_state); - } + SignalHandler(handler); } + } - #endregion - - #region IPromise implementation - - public bool IsResolved { - get { - Thread.MemoryBarrier(); - return m_state > 1; - } - } - - public bool IsCancelled { - get { - Thread.MemoryBarrier(); - return m_state == CANCELLED_STATE; - } - } - - #endregion - - public Exception Error { - get { - return m_error; + void EnqueueHandler(THandler handler) { + if (Interlocked.CompareExchange(ref m_handler, handler, null) != null) { + if (m_extraHandlers == null) + // compare-exchange will protect from loosing already created queue + Interlocked.CompareExchange(ref m_extraHandlers, new SimpleAsyncQueue(), null); + m_extraHandlers.Enqueue(handler); } } - public bool CancelOperationIfRequested() { - if (IsCancellationRequested) { - CancelOperation(CancellationReason); + bool TryDequeueHandler(out THandler handler) { + handler = Interlocked.Exchange(ref m_handler, null); + if (handler != null) return true; - } - return false; - } - - public virtual void CancelOperation(Exception reason) { - SetCancelled(reason); - } - - public void CancellationRequested(Action handler) { - Safe.ArgumentNotNull(handler, "handler"); - if (IsCancellationRequested) - handler(CancellationReason); - - if (m_cancelationHandlers == null) - Interlocked.CompareExchange(ref m_cancelationHandlers, new MTQueue>(), null); - - m_cancelationHandlers.Enqueue(handler); - - if (IsCancellationRequested && m_cancelationHandlers.TryDequeue(out handler)) - // TryDeque implies MemoryBarrier() - handler(m_cancelationReason); - } - - public bool IsCancellationRequested { - get { - do { - if (m_cancelRequest == CANCEL_NOT_REQUESTED) - return false; - if (m_cancelRequest == CANCEL_REQUESTED) - return true; - Thread.MemoryBarrier(); - } while(true); - } - } - - public Exception CancellationReason { - get { - do { - Thread.MemoryBarrier(); - } while(m_cancelRequest == CANCEL_REQUESTING); - - return m_cancelationReason; - } - } - - #region ICancellable implementation - - public void Cancel() { - Cancel(null); - } - - public void Cancel(Exception reason) { - if (CANCEL_NOT_REQUESTED == Interlocked.CompareExchange(ref m_cancelRequest, CANCEL_REQUESTING, CANCEL_NOT_REQUESTED)) { - m_cancelationReason = reason; - m_cancelRequest = CANCEL_REQUESTED; - if (m_cancelationHandlers != null) { - Action handler; - while (m_cancelationHandlers.TryDequeue(out handler)) - handler(m_cancelationReason); - } - } + return m_extraHandlers != null && m_extraHandlers.TryDequeue(out handler); } #endregion diff --git a/Implab/Automaton/AutomatonConst.cs b/Implab/src/Automaton/AutomatonConst.cs rename from Implab/Automaton/AutomatonConst.cs rename to Implab/src/Automaton/AutomatonConst.cs --- a/Implab/Automaton/AutomatonConst.cs +++ b/Implab/src/Automaton/AutomatonConst.cs @@ -1,9 +1,9 @@  namespace Implab.Automaton { public static class AutomatonConst { - public const int UNREACHABLE_STATE = -1; + public const int UnreachableState = -1; - public const int UNCLASSIFIED_INPUT = 0; + public const int UnclassifiedInput = 0; } } diff --git a/Implab/Automaton/AutomatonTransition.cs b/Implab/src/Automaton/AutomatonTransition.cs rename from Implab/Automaton/AutomatonTransition.cs rename to Implab/src/Automaton/AutomatonTransition.cs --- a/Implab/Automaton/AutomatonTransition.cs +++ b/Implab/src/Automaton/AutomatonTransition.cs @@ -1,7 +1,7 @@ using System; namespace Implab.Automaton { - public struct AutomatonTransition : IEquatable { + public class AutomatonTransition : IEquatable { public readonly int s1; public readonly int s2; public readonly int edge; @@ -28,6 +28,14 @@ namespace Implab.Automaton { public override int GetHashCode() { return s1 + s2 + edge; } + + public static bool operator == (AutomatonTransition rv, AutomatonTransition lv) { + return rv.Equals(lv); + } + + public static bool operator !=(AutomatonTransition rv, AutomatonTransition lv) { + return rv.Equals(lv); + } } } diff --git a/Implab/Automaton/DFATable.cs b/Implab/src/Automaton/DFATable.cs rename from Implab/Automaton/DFATable.cs rename to Implab/src/Automaton/DFATable.cs --- a/Implab/Automaton/DFATable.cs +++ b/Implab/src/Automaton/DFATable.cs @@ -20,7 +20,7 @@ namespace Implab.Automaton { #region IDFADefinition implementation public bool IsFinalState(int s) { - Safe.ArgumentInRange(s, 0, m_stateCount, "s"); + Safe.ArgumentInRange(s >= 0 && s < m_stateCount, nameof(s)); return m_finalStates.Contains(s); } @@ -46,7 +46,7 @@ namespace Implab.Automaton { #endregion public void SetInitialState(int s) { - Safe.ArgumentAssert(s >= 0, "s"); + Safe.ArgumentInRange(s >= 0, nameof(s)); m_stateCount = Math.Max(m_stateCount, s + 1); m_initialState = s; } @@ -57,9 +57,9 @@ namespace Implab.Automaton { } public void Add(AutomatonTransition item) { - Safe.ArgumentAssert(item.s1 >= 0, "item"); - Safe.ArgumentAssert(item.s2 >= 0, "item"); - Safe.ArgumentAssert(item.edge >= 0, "item"); + Safe.ArgumentAssert(item.s1 >= 0, nameof(item)); + Safe.ArgumentAssert(item.s2 >= 0, nameof(item)); + Safe.ArgumentAssert(item.edge >= 0, nameof(item)); m_stateCount = Math.Max(m_stateCount, Math.Max(item.s1, item.s2) + 1); m_symbolCount = Math.Max(m_symbolCount, item.edge + 1); @@ -116,10 +116,10 @@ namespace Implab.Automaton { for (int i = 0; i < StateCount; i++) for (int j = 0; j < AlphabetSize; j++) - table[i, j] = AutomatonConst.UNREACHABLE_STATE; + table[i, j] = AutomatonConst.UnreachableState; foreach (var t in this) - table[t.s1,t.edge] = t.s2; + table[t.s1,t.edge] = (byte)t.s2; return table; } @@ -290,11 +290,11 @@ namespace Implab.Automaton { var nextCls = 0; foreach (var item in minClasses) { - if (nextCls == AutomatonConst.UNCLASSIFIED_INPUT) + if (nextCls == AutomatonConst.UnclassifiedInput) nextCls++; // сохраняем DFAConst.UNCLASSIFIED_INPUT - var cls = item.Contains(AutomatonConst.UNCLASSIFIED_INPUT) ? AutomatonConst.UNCLASSIFIED_INPUT : nextCls++; + var cls = item.Contains(AutomatonConst.UnclassifiedInput) ? AutomatonConst.UnclassifiedInput : nextCls++; optimalDFA.AddSymbol(cls); foreach (var a in item) @@ -311,7 +311,7 @@ namespace Implab.Automaton { optimalDFA.Add(t); } - protected string PrintDFA(IAlphabet inputAlphabet, IAlphabet stateAlphabet) { + /*protected string PrintDFA(IAlphabet inputAlphabet, IAlphabet stateAlphabet) { Safe.ArgumentNotNull(inputAlphabet, "inputAlphabet"); Safe.ArgumentNotNull(stateAlphabet, "stateAlphabet"); @@ -326,7 +326,7 @@ namespace Implab.Automaton { data.Add(String.Format( "{0} -> {2} [label={1}];", String.Join("", stateAlphabet.GetSymbols(t.s1)), - ToLiteral(ToLiteral(String.Join("", t.edge == AutomatonConst.UNCLASSIFIED_INPUT ? new [] { "@" } : inputAlphabet.GetSymbols(t.edge).Select(x => x.ToString())))), + ToLiteral(ToLiteral(String.Join("", t.edge == AutomatonConst.UnclassifiedInput ? new [] { "@" } : inputAlphabet.GetSymbols(t.edge).Select(x => x.ToString())))), String.Join("", stateAlphabet.GetSymbols(t.s2)) )); data.Add("}"); @@ -343,6 +343,6 @@ namespace Implab.Automaton { return writer.ToString(); } } - } + }*/ } } diff --git a/Implab/Automaton/IAlphabet.cs b/Implab/src/Automaton/IAlphabet.cs rename from Implab/Automaton/IAlphabet.cs rename to Implab/src/Automaton/IAlphabet.cs diff --git a/Implab/Automaton/IAlphabetBuilder.cs b/Implab/src/Automaton/IAlphabetBuilder.cs rename from Implab/Automaton/IAlphabetBuilder.cs rename to Implab/src/Automaton/IAlphabetBuilder.cs diff --git a/Implab/Automaton/IDFATable.cs b/Implab/src/Automaton/IDFATable.cs rename from Implab/Automaton/IDFATable.cs rename to Implab/src/Automaton/IDFATable.cs diff --git a/Implab/Automaton/IDFATableBuilder.cs b/Implab/src/Automaton/IDFATableBuilder.cs rename from Implab/Automaton/IDFATableBuilder.cs rename to Implab/src/Automaton/IDFATableBuilder.cs diff --git a/Implab/Automaton/IndexedAlphabetBase.cs b/Implab/src/Automaton/IndexedAlphabetBase.cs rename from Implab/Automaton/IndexedAlphabetBase.cs rename to Implab/src/Automaton/IndexedAlphabetBase.cs diff --git a/Implab/Automaton/MapAlphabet.cs b/Implab/src/Automaton/MapAlphabet.cs rename from Implab/Automaton/MapAlphabet.cs rename to Implab/src/Automaton/MapAlphabet.cs --- a/Implab/Automaton/MapAlphabet.cs +++ b/Implab/src/Automaton/MapAlphabet.cs @@ -54,7 +54,7 @@ namespace Implab.Automaton { return cls; if (!m_supportUnclassified) throw new ArgumentOutOfRangeException("symbol", "The specified symbol isn't in the alphabet"); - return AutomatonConst.UNCLASSIFIED_INPUT; + return AutomatonConst.UnclassifiedInput; } public int Count { diff --git a/Implab/Automaton/ParserException.cs b/Implab/src/Automaton/ParserException.cs rename from Implab/Automaton/ParserException.cs rename to Implab/src/Automaton/ParserException.cs diff --git a/Implab/Automaton/RegularExpressions/AltToken.cs b/Implab/src/Automaton/RegularExpressions/AltToken.cs rename from Implab/Automaton/RegularExpressions/AltToken.cs rename to Implab/src/Automaton/RegularExpressions/AltToken.cs diff --git a/Implab/Automaton/RegularExpressions/BinaryToken.cs b/Implab/src/Automaton/RegularExpressions/BinaryToken.cs rename from Implab/Automaton/RegularExpressions/BinaryToken.cs rename to Implab/src/Automaton/RegularExpressions/BinaryToken.cs diff --git a/Implab/Automaton/RegularExpressions/CatToken.cs b/Implab/src/Automaton/RegularExpressions/CatToken.cs rename from Implab/Automaton/RegularExpressions/CatToken.cs rename to Implab/src/Automaton/RegularExpressions/CatToken.cs diff --git a/Implab/Automaton/RegularExpressions/EmptyToken.cs b/Implab/src/Automaton/RegularExpressions/EmptyToken.cs rename from Implab/Automaton/RegularExpressions/EmptyToken.cs rename to Implab/src/Automaton/RegularExpressions/EmptyToken.cs diff --git a/Implab/Automaton/RegularExpressions/EndToken.cs b/Implab/src/Automaton/RegularExpressions/EndToken.cs rename from Implab/Automaton/RegularExpressions/EndToken.cs rename to Implab/src/Automaton/RegularExpressions/EndToken.cs diff --git a/Implab/Automaton/RegularExpressions/EndTokenT.cs b/Implab/src/Automaton/RegularExpressions/EndTokenT.cs rename from Implab/Automaton/RegularExpressions/EndTokenT.cs rename to Implab/src/Automaton/RegularExpressions/EndTokenT.cs diff --git a/Implab/Automaton/RegularExpressions/ITaggedDFABuilder.cs b/Implab/src/Automaton/RegularExpressions/ITaggedDFABuilder.cs rename from Implab/Automaton/RegularExpressions/ITaggedDFABuilder.cs rename to Implab/src/Automaton/RegularExpressions/ITaggedDFABuilder.cs diff --git a/Implab/Automaton/RegularExpressions/IVisitor.cs b/Implab/src/Automaton/RegularExpressions/IVisitor.cs rename from Implab/Automaton/RegularExpressions/IVisitor.cs rename to Implab/src/Automaton/RegularExpressions/IVisitor.cs diff --git a/Implab/Automaton/RegularExpressions/RegularDFA.cs b/Implab/src/Automaton/RegularExpressions/RegularDFA.cs rename from Implab/Automaton/RegularExpressions/RegularDFA.cs rename to Implab/src/Automaton/RegularExpressions/RegularDFA.cs --- a/Implab/Automaton/RegularExpressions/RegularDFA.cs +++ b/Implab/src/Automaton/RegularExpressions/RegularDFA.cs @@ -77,14 +77,14 @@ namespace Implab.Automaton.RegularExpres return states.GroupBy(x => m_tags[x] ?? new TTag[0], arrayComparer).Select(g => new HashSet(g)); } - public override string ToString() { + /*public override string ToString() { var states = new MapAlphabet(false, null); for (int i = 0; i < StateCount; i++) states.DefineSymbol(string.Format("s{0}", i), i); return string.Format("//[RegularDFA {1} x {2}]\n{0}", PrintDFA(InputAlphabet, states),StateCount, AlphabetSize); - } + }*/ } } diff --git a/Implab/Automaton/RegularExpressions/RegularExpressionVisitor.cs b/Implab/src/Automaton/RegularExpressions/RegularExpressionVisitor.cs rename from Implab/Automaton/RegularExpressions/RegularExpressionVisitor.cs rename to Implab/src/Automaton/RegularExpressions/RegularExpressionVisitor.cs --- a/Implab/Automaton/RegularExpressions/RegularExpressionVisitor.cs +++ b/Implab/src/Automaton/RegularExpressions/RegularExpressionVisitor.cs @@ -129,7 +129,7 @@ namespace Implab.Automaton.RegularExpres if (m_root == null) m_root = token; m_idx++; - m_indexes[m_idx] = AutomatonConst.UNCLASSIFIED_INPUT; + m_indexes[m_idx] = AutomatonConst.UnclassifiedInput; m_firstpos = new HashSet(new[] { m_idx }); m_lastpos = new HashSet(new[] { m_idx }); Followpos(m_idx); diff --git a/Implab/Automaton/RegularExpressions/RegularExpressionVisitorT.cs b/Implab/src/Automaton/RegularExpressions/RegularExpressionVisitorT.cs rename from Implab/Automaton/RegularExpressions/RegularExpressionVisitorT.cs rename to Implab/src/Automaton/RegularExpressions/RegularExpressionVisitorT.cs diff --git a/Implab/Automaton/RegularExpressions/StarToken.cs b/Implab/src/Automaton/RegularExpressions/StarToken.cs rename from Implab/Automaton/RegularExpressions/StarToken.cs rename to Implab/src/Automaton/RegularExpressions/StarToken.cs diff --git a/Implab/Automaton/RegularExpressions/SymbolToken.cs b/Implab/src/Automaton/RegularExpressions/SymbolToken.cs rename from Implab/Automaton/RegularExpressions/SymbolToken.cs rename to Implab/src/Automaton/RegularExpressions/SymbolToken.cs diff --git a/Implab/Automaton/RegularExpressions/Token.cs b/Implab/src/Automaton/RegularExpressions/Token.cs rename from Implab/Automaton/RegularExpressions/Token.cs rename to Implab/src/Automaton/RegularExpressions/Token.cs diff --git a/Implab/Components/Disposable.cs b/Implab/src/Components/Disposable.cs rename from Implab/Components/Disposable.cs rename to Implab/src/Components/Disposable.cs --- a/Implab/Components/Disposable.cs +++ b/Implab/src/Components/Disposable.cs @@ -1,5 +1,6 @@ using Implab.Diagnostics; using System; +using System.Diagnostics.CodeAnalysis; using System.Threading; namespace Implab.Components { @@ -7,16 +8,11 @@ namespace Implab.Components { /// Base class the objects which support disposing. /// public class Disposable : IDisposable { - - int m_disposed; public event EventHandler Disposed; public bool IsDisposed { - get { - Thread.MemoryBarrier(); - return m_disposed != 0; - } + get; private set; } /// @@ -24,43 +20,8 @@ namespace Implab.Components { /// /// The object is disposed /// - /// Успешная проверка того, что объект не освобожден еще не гарантирует, что он не - /// будет освобожден сразу после нее, поэтому методы использующие проверку должны - /// учитывать, что объект может быть освобожден из параллельного потока. - /// Данны метод служит для упрощения отладки ошибок при использовании объекта после его - /// освобождения. - /// - /// - /// // пример синхронизированного освобождения ресурсов - /// class FileStore : Disposable { - /// readonly TextWriter m_file; - /// readonly obejct m_sync = new object(); - /// - /// public FileStore(string file) { - /// m_file = new TextWriter(File.OpenWrite(file)); - /// } - /// - /// public void Write(string text) { - /// lock(m_sync) { - /// AssertNotDisposed(); - /// m_file.Write(text); - /// } - /// } - /// - /// protected override void Dispose(bool disposing) { - /// if (disposing) - /// lock(m_sync) { - /// m_file.Dipose(); - /// base.Dispose(true); - /// } - /// else - /// base.Dispose(false); - /// } - /// } - /// protected void AssertNotDisposed() { - Thread.MemoryBarrier(); - if (m_disposed != 0) + if (IsDisposed) throw new ObjectDisposedException(ToString()); } /// @@ -74,30 +35,21 @@ namespace Implab.Components { /// из нескольких потоков. /// protected virtual void Dispose(bool disposing) { - if (disposing) { - EventHandler temp = Disposed; - if (temp != null) - temp(this, EventArgs.Empty); - } + if (disposing) + Disposed.DispatchEvent(this, EventArgs.Empty); } + [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "Dipose(bool) and GC.SuppessFinalize are called")] public void Dispose() { - if (Interlocked.Increment(ref m_disposed) == 1) { + if(!IsDisposed) { + IsDisposed = true; Dispose(true); GC.SuppressFinalize(this); } } - /// - /// Записывает сообщение об утечке объекта. - /// - protected virtual void ReportObjectLeaks() { - TraceLog.TraceWarning("The object is marked as disposable but isn't disposed properly: {0}", this); - } - ~Disposable() { Dispose(false); - ReportObjectLeaks(); } } } \ No newline at end of file diff --git a/Implab/Components/DisposablePool.cs b/Implab/src/Components/DisposablePool.cs rename from Implab/Components/DisposablePool.cs rename to Implab/src/Components/DisposablePool.cs --- a/Implab/Components/DisposablePool.cs +++ b/Implab/src/Components/DisposablePool.cs @@ -6,10 +6,10 @@ using System.Diagnostics.CodeAnalysis; namespace Implab.Components { /// - /// The base class for implementing pools of disposable objects. + /// The base class for implementing thread-safe pools of disposable objects. /// /// - /// This class maintains a set of pre-created objects and which are frequently allocated and released + /// This class maintains a set of pre-created objects which are frequently allocated and released /// by clients. The pool maintains maximum number of unsued object, any object above this limit is disposed, /// if the pool is empty it will create new objects on demand. /// Instances of this class are thread-safe. diff --git a/Implab/Components/ExecutionState.cs b/Implab/src/Components/ExecutionState.cs rename from Implab/Components/ExecutionState.cs rename to Implab/src/Components/ExecutionState.cs --- a/Implab/Components/ExecutionState.cs +++ b/Implab/src/Components/ExecutionState.cs @@ -15,6 +15,8 @@ Stopping, + Stopped, + Failed, Disposed, diff --git a/Implab/src/Components/IAsyncComponent.cs b/Implab/src/Components/IAsyncComponent.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Components/IAsyncComponent.cs @@ -0,0 +1,37 @@ +using System; +using System.Threading.Tasks; + +namespace Implab.Components { + /// + /// An interface for asynchronous components. + /// + /// + /// + /// Асинхронные компоненты не предназначены для одновременного использования несколькими клиентами, + /// однако существуют внутренние процессы, изменяющее состояние компонент без участия клиента. + /// Данный интерфейс определяет протокол взаимодействия с компонентой, при которм компоненте + /// посылаются сигналы от клиента, в ответ на которые компонента меняет свойство , + /// данное свойство содержит в себе новую задачу, выполняемую компонентой и данное свойство + /// может измениться только при получении нового сигнала от клиента. + /// + /// + /// В дополнение к компонента может определять другие свойства, в + /// которых будет передаваться информация о результате выполнения операции. + /// + /// + /// Особое внимание следует уделить реализации , который по своей природе + /// синхронный, данное правило безусловно можно нарушить, но тогда могут возникнуть проблемы с + /// тем, что ресурсы еще не освободились, а ход программы продолжается, что приведет к ошибкам, + /// например при попытке получить ресуср другим объектом, либо при заврешении программы. + /// + /// + /// + public interface IAsyncComponent { + /// + /// The result of the last started operation. This property reflects + /// only the result of the last started operation and therefore should + /// change only if a new operation is initiated. + /// + Task Completion { get; } + } +} \ No newline at end of file diff --git a/Implab/Components/IFactory.cs b/Implab/src/Components/IFactory.cs rename from Implab/Components/IFactory.cs rename to Implab/src/Components/IFactory.cs diff --git a/Implab/Components/IInitializable.cs b/Implab/src/Components/IInitializable.cs rename from Implab/Components/IInitializable.cs rename to Implab/src/Components/IInitializable.cs --- a/Implab/Components/IInitializable.cs +++ b/Implab/src/Components/IInitializable.cs @@ -1,21 +1,30 @@ using System; +using System.Threading; namespace Implab.Components { /// /// Initializable components are created and initialized in two steps, first we have create the component, - /// then we have to complete it's creation by calling an method. All parameters needed - /// to complete the initialization must be passed before the calling + /// then we have to complete it's creation by calling an method. All parameters needed + /// to complete the initialization must be passed before the calling /// public interface IInitializable { /// /// Completes initialization. /// /// + /// /// Normally virtual methods shouldn't be called from the constructor, due to the incomplete object state, but /// they can be called from this method. This method is also usefull when we constructing a complex grpah /// of components where cyclic references may take place. + /// + /// + /// In asyncronous patterns can be called + /// to start initialization and the + /// property can be used to track operation completion. + /// /// - void Init(); + void Initialize(); + void Initialize(CancellationToken ct); } } diff --git a/Implab/Components/IRunnable.cs b/Implab/src/Components/IRunnable.cs rename from Implab/Components/IRunnable.cs rename to Implab/src/Components/IRunnable.cs --- a/Implab/Components/IRunnable.cs +++ b/Implab/src/Components/IRunnable.cs @@ -1,13 +1,53 @@ using System; +using System.Threading; +using System.Threading.Tasks; namespace Implab.Components { + /// + /// Interface for the component which performs a long running task. + /// + /// + /// The access to the runnable component should be sequential, the + /// componet should support asynchronous completion of the initiated + /// operation but operations itself must be initiated sequentially. + /// public interface IRunnable { - IPromise Start(); + /// + /// Starts this instance + /// + /// + /// This operation is cancellable and it's expected to move to + /// the failed state or just ignore the cancellation request, + /// + void Start(); + void Start(CancellationToken ct); - IPromise Stop(); - + /// + /// Stops this instance and releases all resources, after the + /// instance is stopped it is moved to Disposed state and + /// can't be reused. + /// + /// + /// If the componet was in the starting state the pending operation + /// will be requested to cancel. The stop operatin will be + /// performed only if the component in the running state. + /// + void Stop(); + void Stop(CancellationToken ct); + + /// + /// Current state of the componenet, dynamically reflects the current state. + /// ExecutionState State { get; } + /// + /// Event to monitor the state of the component. + /// + event EventHandler StateChanged; + + /// + /// The last error + /// Exception LastError { get; } } } diff --git a/Implab/src/Components/IServiceLocator.cs b/Implab/src/Components/IServiceLocator.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Components/IServiceLocator.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Components { + public interface IServiceLocator: IServiceProvider { + T GetService(); + bool TryGetService(out T service); + bool TryGetService (Type serviceType, out object service); + } +} diff --git a/Implab/Components/LazyAndWeak.cs b/Implab/src/Components/LazyAndWeak.cs rename from Implab/Components/LazyAndWeak.cs rename to Implab/src/Components/LazyAndWeak.cs --- a/Implab/Components/LazyAndWeak.cs +++ b/Implab/src/Components/LazyAndWeak.cs @@ -8,6 +8,7 @@ namespace Implab.Components { /// /// Usefull when dealing with memory-intensive objects which are frequently used. /// This class is similar to except it is a singleton. + /// This class can't be used to hold diposable objects. /// public class LazyAndWeak where T : class { diff --git a/Implab/Components/ObjectPool.cs b/Implab/src/Components/ObjectPool.cs rename from Implab/Components/ObjectPool.cs rename to Implab/src/Components/ObjectPool.cs --- a/Implab/Components/ObjectPool.cs +++ b/Implab/src/Components/ObjectPool.cs @@ -26,7 +26,7 @@ namespace Implab.Components { } protected ObjectPool(int size) { - Safe.ArgumentInRange(size,1,size,"size"); + Safe.ArgumentInRange(size > 0, nameof(size)); m_size = size; } diff --git a/Implab/src/Components/PollingComponent.cs b/Implab/src/Components/PollingComponent.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Components/PollingComponent.cs @@ -0,0 +1,107 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Components { + public abstract class PollingComponent : RunnableComponent { + + readonly Timer m_timer; + + readonly CancellationTokenSource m_cancellation = new CancellationTokenSource(); + + Task m_pending; + Task m_poll; + + /// + /// Poll interval in milliseconds. + /// + /// + public int Interval { get; set; } + + /// + /// Delay to the first poll after start in milliseconds + /// + /// + public int Delay { get; set; } + + /// + /// Indicates how to handle unhandled exceptions in method. + /// + /// + public bool FailOnError { get; set; } + + /// + /// Event for the unhandled exceptions in method. + /// + public event EventHandler UnhandledException; + + protected PollingComponent(bool initialized) : base(initialized) { + m_timer = new Timer(OnTimer); + } + + protected override void RunInternal() { + ScheduleNextPoll(Delay); + } + + + protected override async Task StopInternalAsync(CancellationToken ct) { + // component in Stopping state, no new polls will be scheduled + + // we do not need additional synchronization logic here + // since RunnableComponent already done this + + m_cancellation.Cancel(); + try { + // await for pending poll + if (m_poll != null) + await m_poll; + } catch (OperationCanceledException) { + // OK + } + } + + protected abstract Task Poll(CancellationToken ct); + + void ScheduleNextPoll(int timeout) { + // access and modification of the component state + // in custom methods requires a synchronization + lock (SynchronizationObject) { + + if (State == ExecutionState.Running) { + m_pending = Safe.CreateTask(m_cancellation.Token); + m_poll = m_pending.Then(() => Poll(m_cancellation.Token)); + m_timer.Change(timeout, Timeout.Infinite); + } + } + } + + async void OnTimer(object state) { + try { + // changes to m_pending and m_poll are done + // only in ScheduleNextPoll method, hence we + // can safely use them here + m_pending.Start(); + await m_poll; + + // schedule next poll + ScheduleNextPoll(Interval); + } catch (Exception e) { + // hanle error + UnhandledException.DispatchEvent(this, new UnhandledExceptionEventArgs(e, false)); + + if (FailOnError) + Fail(e); + else + ScheduleNextPoll(Interval); + } + + } + + protected override void Dispose(bool disposing) { + if (disposing) + Safe.Dispose(m_timer, m_cancellation); + base.Dispose(disposing); + } + + } +} \ No newline at end of file diff --git a/Implab/src/Components/RunnableComponent.cs b/Implab/src/Components/RunnableComponent.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Components/RunnableComponent.cs @@ -0,0 +1,350 @@ +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Components { + /// + /// Base class for implementing components which support start and stop operations, + /// such components may represent running services. + /// + /// + /// This class provides a basic lifecycle from the creation to the + /// termination of the component. + /// + public abstract class RunnableComponent : IAsyncComponent, IRunnable, IInitializable, IDisposable { + + /// + /// This class bounds lifetime to the task, + /// when the task completes the associated token source will be disposed. + /// + class AsyncOperationDescriptor { + + public static AsyncOperationDescriptor None { get; } = new AsyncOperationDescriptor(); + + readonly CancellationTokenSource m_cts; + + bool m_done; + + public CancellationToken Token { + get { return m_cts == null ? CancellationToken.None : m_cts.Token; } + } + + public Task Task { get; private set; } + + private AsyncOperationDescriptor(Task task, CancellationTokenSource cts) { + m_cts = cts; + Task = Chain(task); + } + + private AsyncOperationDescriptor() { + Task = Task.CompletedTask; + } + + public void Cancel() { + if (m_cts != null) { + lock (m_cts) { + if (!m_done) + m_cts.Cancel(); + } + } + } + + void Done() { + if (m_cts != null) { + lock (m_cts) { + m_done = true; + m_cts.Dispose(); + } + } else { + m_done = true; + } + } + + async Task Chain(Task other) { + try { + await other; + } finally { + Done(); + } + } + + public static AsyncOperationDescriptor Create(Func factory, CancellationToken ct) { + var cts = ct.CanBeCanceled ? + CancellationTokenSource.CreateLinkedTokenSource(ct) : + new CancellationTokenSource(); + + return new AsyncOperationDescriptor(factory(cts.Token), cts); + } + + } + + // this lock is used to synchronize state flow of the component during + // processing calls from a client and internal processes. + readonly object m_lock = new object(); + + // current operation cookie, used to check wheather a call to + // MoveSuccess/MoveFailed method belongs to the current + // operation, if cookies didn't match ignore completion result. + object m_cookie; + + // AsyncOperationDscriptor aggregates a task and it's cancellation token + AsyncOperationDescriptor m_current = AsyncOperationDescriptor.None; + + ExecutionState m_state; + + /// + /// Объект синхронизации используется для обеспечения совместного доступа + /// клиента компоненты и процессов, протекающих внутри компоненты, к общему + /// состоянию, т.е.true таким свойствам, как , + /// . Обработчики события + /// вызываются уже с установленной блокировкой, поэтому дополнительная + /// синхронизация не требуется. + /// + public object SynchronizationObject { get { return m_lock; } } + + protected RunnableComponent(bool initialized) { + State = initialized ? ExecutionState.Ready : ExecutionState.Created; + } + + public Task Completion { + get { return m_current.Task; } + } + + public ExecutionState State { + get { return m_state; } + private set { + if (m_state != value) { + m_state = value; + StateChanged.DispatchEvent(this, new StateChangeEventArgs { + State = value, + LastError = LastError + }); + } + } + } + + public Exception LastError { get; private set; } + + /// + /// Событие изменения состояния компоненты.see Обработчики данного события + /// вызываются внутри блокировки и должны + /// выполняться максимально быстро. + /// + public event EventHandler StateChanged; + + /// + /// Releases all resources used by the current component regardless of its + /// execution state. + /// + /// + /// Calling to this method may result unexpedted results if the component + /// isn't in the stopped state. Call this method after the component is + /// stopped if needed or if the component is in the failed state. + /// + public void Dispose() { + bool dispose = false; + lock (SynchronizationObject) { + if (m_state != ExecutionState.Disposed) { + dispose = true; + m_state = ExecutionState.Disposed; + m_cookie = new object(); + } + } + if (dispose) { + Dispose(true); + GC.SuppressFinalize(this); + } + } + + ~RunnableComponent() { + Dispose(false); + } + + /// + /// Releases all resources used by the current component regardless of its + /// execution state. + /// + /// Indicates that the component is disposed + /// during a normal disposing or during GC. + protected virtual void Dispose(bool disposing) { + } + + public void Initialize() { + Initialize(CancellationToken.None); + } + + public void Initialize(CancellationToken ct) { + var cookie = new object(); + if (MoveInitialize(cookie)) + Safe.NoWait(ScheduleTask(InitializeInternalAsync, ct, cookie)); + else + throw new InvalidOperationException(); + } + + /// + /// This method is used for initialization during a component creation. + /// + /// A cancellation token for this operation + /// + /// This method should be used for short and mostly syncronous operations, + /// other operations which require time to run shoud be placed in + /// method. + /// + protected virtual Task InitializeInternalAsync(CancellationToken ct) { + return Task.CompletedTask; + } + + public void Start() { + Start(CancellationToken.None); + } + + public void Start(CancellationToken ct) { + var cookie = new object(); + if (MoveStart(cookie)) + Safe.NoWait(ScheduleStartAndRun(ct, cookie)); + else + throw new InvalidOperationException(); + } + + async Task ScheduleStartAndRun(CancellationToken ct, object cookie) { + try { + await ScheduleTask(StartInternalAsync, ct, cookie); + RunInternal(); + } catch (Exception err) { + Fail(err); + } + } + + protected virtual Task StartInternalAsync(CancellationToken ct) { + return Task.CompletedTask; + } + + /// + /// This method is called after the component is enetered running state, + /// use this method to + /// + protected virtual void RunInternal() { + + } + + public void Stop() { + Stop(CancellationToken.None); + } + + public void Stop(CancellationToken ct) { + var cookie = new object(); + if (MoveStop(cookie)) + Safe.NoWait(ScheduleTask(StopAsync, ct, cookie)); + else + throw new InvalidOperationException(); + } + + async Task StopAsync(CancellationToken ct) { + m_current.Cancel(); + + try { + await Completion; + } catch(OperationCanceledException) { + // OK + } + + ct.ThrowIfCancellationRequested(); + + await StopInternalAsync(ct); + } + + protected virtual Task StopInternalAsync(CancellationToken ct) { + return Task.CompletedTask; + } + + protected void Fail(Exception err) { + lock(m_lock) { + if (m_state != ExecutionState.Running) + return; + m_cookie = new object(); + LastError = err; + State = ExecutionState.Failed; + } + } + + + #region state management + + bool MoveInitialize(object cookie) { + lock (m_lock) { + if (State != ExecutionState.Created) + return false; + State = ExecutionState.Initializing; + m_cookie = cookie; + return true; + } + } + + bool MoveStart(object cookie) { + lock (m_lock) { + if (State != ExecutionState.Ready) + return false; + State = ExecutionState.Starting; + m_cookie = cookie; + return true; + } + } + + bool MoveStop(object cookie) { + lock (m_lock) { + if (State != ExecutionState.Starting && State != ExecutionState.Running) + return false; + State = ExecutionState.Stopping; + m_cookie = cookie; + return true; + } + } + + void MoveSuccess(object cookie) { + lock (m_lock) { + if (m_cookie != cookie) + return; + switch (State) { + case ExecutionState.Initializing: + State = ExecutionState.Ready; + break; + case ExecutionState.Starting: + State = ExecutionState.Running; + break; + case ExecutionState.Stopping: + State = ExecutionState.Stopped; + break; + } + } + } + + bool MoveFailed(Exception err, object cookie) { + lock (m_lock) { + if (m_cookie != cookie) + return false; + LastError = err; + State = ExecutionState.Failed; + return true; + } + } + + Task ScheduleTask(Func next, CancellationToken ct, object cookie) { + + var op = AsyncOperationDescriptor.Create(async (x) => { + try { + await next(x); + MoveSuccess(cookie); + } catch (Exception e) { + MoveFailed(e, cookie); + throw; + } + }, ct); + + m_current = op; + return op.Task; + } + + #endregion + } +} \ No newline at end of file diff --git a/Implab/Components/ServiceLocator.cs b/Implab/src/Components/ServiceLocator.cs rename from Implab/Components/ServiceLocator.cs rename to Implab/src/Components/ServiceLocator.cs --- a/Implab/Components/ServiceLocator.cs +++ b/Implab/src/Components/ServiceLocator.cs @@ -7,7 +7,7 @@ namespace Implab.Components { /// public class ServiceLocator: Disposable, IServiceLocator, IServiceProvider { // запись о сервисе - struct ServiceEntry : IDisposable { + class ServiceEntry : IDisposable { public object service; // сервис public bool shared; // признак того, что сервис НЕ нужно освобождать public Func activator; // активатор сервиса при первом обращении diff --git a/Implab/src/Components/StateChangeEventArgs.cs b/Implab/src/Components/StateChangeEventArgs.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Components/StateChangeEventArgs.cs @@ -0,0 +1,16 @@ +using System; + +namespace Implab.Components +{ + public class StateChangeEventArgs : EventArgs { + /// + /// The error information if any + /// + public Exception LastError { get; set; } + + /// + /// The state of the service corresponding to this event + /// + public ExecutionState State { get; set; } + } +} diff --git a/Implab/CustomEqualityComparer.cs b/Implab/src/CustomEqualityComparer.cs rename from Implab/CustomEqualityComparer.cs rename to Implab/src/CustomEqualityComparer.cs diff --git a/Implab/src/Deferred.cs b/Implab/src/Deferred.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Deferred.cs @@ -0,0 +1,64 @@ +using System; +using System.Diagnostics; +using System.Threading.Tasks; + +namespace Implab { + /// + /// This class is responsible for the promise resolution, dispatching and chaining + /// + public class Deferred : IResolvable { + + readonly Promise m_promise; + internal Deferred() { + m_promise = new Promise(); + } + + internal Deferred(Promise promise) { + Debug.Assert(promise != null); + m_promise = promise; + } + + public IPromise Promise { + get { return m_promise; } + } + + public void Cancel() { + Reject(new OperationCanceledException()); + } + + public virtual void Reject(Exception error) { + if (error is PromiseTransientException) + error = ((PromiseTransientException)error).InnerException; + + m_promise.RejectPromise(error); + } + + public virtual void Resolve() { + m_promise.ResolvePromise(); + } + + public virtual void Resolve(IPromise thenable) { + if (thenable == null) + Reject(new Exception("The promise or task are expected")); + if (thenable == m_promise) + Reject(new Exception("The promise cannot be resolved with oneself")); + + try { + thenable.Then(this); + } catch (Exception err) { + Reject(err); + } + } + + public virtual void Resolve(Task thenable) { + if (thenable == null) + Reject(new Exception("The promise or task are expected")); + try { + thenable.Then(this); + } catch(Exception err) { + Reject(err); + } + } + + } +} \ No newline at end of file diff --git a/Implab/src/Deferred`1.cs b/Implab/src/Deferred`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Deferred`1.cs @@ -0,0 +1,61 @@ +using System; +using System.Diagnostics; +using System.Threading.Tasks; + +namespace Implab { + public class Deferred : IResolvable { + readonly Promise m_promise; + + internal Deferred() { + m_promise = new Promise(); + } + + protected Deferred(Promise promise) { + Debug.Assert(promise != null); + m_promise = promise; + } + + public IPromise Promise { + get { return m_promise; } + } + + public void Cancel() { + Reject(new OperationCanceledException()); + } + + public virtual void Reject(Exception error) { + if (error is PromiseTransientException) + error = ((PromiseTransientException)error).InnerException; + + m_promise.RejectPromise(error); + } + + public virtual void Resolve(T value) { + m_promise.ResolvePromise(value); + } + + public virtual void Resolve(IPromise thenable) { + if (thenable == null) + Reject(new Exception("The promise or task are expected")); + if (thenable == m_promise) + Reject(new Exception("The promise cannot be resolved with oneself")); + + try { + thenable.Then(this); + } catch (Exception err) { + Reject(err); + } + } + + public virtual void Resolve(Task thenable) { + if (thenable == null) + Reject(new Exception("The promise or task are expected")); + + try { + thenable.Then(this); + } catch (Exception err) { + Reject(err); + } + } + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/ActivityScope.cs b/Implab/src/Diagnostics/ActivityScope.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/ActivityScope.cs @@ -0,0 +1,29 @@ +using System; +using System.Diagnostics; + +namespace Implab.Diagnostics { + public class ActivityScope : IDisposable { + readonly TraceSource m_source; + + readonly Guid m_prevId; + + readonly string m_activity; + + readonly int m_code; + + internal ActivityScope(TraceSource source, Guid prevId, int code, string activity) { + m_source = source; + m_prevId = prevId; + m_code = code; + m_activity = activity; + } + + + public void Dispose() { + if (Trace.CorrelationManager.ActivityId != m_prevId) + m_source.TraceTransfer(m_code, "Transfer", m_prevId); + m_source.TraceEvent(TraceEventType.Stop, 0, m_activity); + Trace.CorrelationManager.ActivityId = m_prevId; + } + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/LogicalOperation.cs b/Implab/src/Diagnostics/LogicalOperation.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/LogicalOperation.cs @@ -0,0 +1,27 @@ +using System; +using Stopwatch = System.Diagnostics.Stopwatch; + +namespace Implab.Diagnostics { + public class LogicalOperation { + readonly Stopwatch m_stopwatch; + + public string Name { get; private set; } + + internal LogicalOperation(string name) { + Name = string.IsNullOrEmpty(name) ? "" : name; + m_stopwatch = Stopwatch.StartNew(); + } + + public TimeSpan Elapsed { + get { + return m_stopwatch.Elapsed; + } + } + + public void End() { + m_stopwatch.Stop(); + } + + public override string ToString() => Name; + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/LogicalOperationScope.cs b/Implab/src/Diagnostics/LogicalOperationScope.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/LogicalOperationScope.cs @@ -0,0 +1,21 @@ +using System; +using System.Diagnostics; + +namespace Implab.Diagnostics { + public class LogicalOperationScope : IDisposable { + readonly TraceSource m_source; + + readonly LogicalOperation m_operation; + + internal LogicalOperationScope(TraceSource source, LogicalOperation operation) { + m_source = source; + m_operation = operation; + } + + public void Dispose() { + m_operation.End(); + Trace.CorrelationManager.StopLogicalOperation(); + m_source.TraceData(TraceEventType.Information, TraceEventCodes.StopLogicalOperation, m_operation); + } + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/SimpleTraceListener.cs b/Implab/src/Diagnostics/SimpleTraceListener.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/SimpleTraceListener.cs @@ -0,0 +1,114 @@ +using System; +using System.Diagnostics; +using System.IO; + +namespace Implab.Diagnostics { + public class SimpleTraceListener : TextWriterTraceListener { + public SimpleTraceListener() { + } + + public SimpleTraceListener(Stream stream) : base(stream) { + } + + public SimpleTraceListener(TextWriter writer) : base(writer) { + } + + public SimpleTraceListener(string fileName) : base(fileName) { + } + + public SimpleTraceListener(Stream stream, string name) : base(stream, name) { + } + + public SimpleTraceListener(TextWriter writer, string name) : base(writer, name) { + } + + public SimpleTraceListener(string fileName, string name) : base(fileName, name) { + } + + public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { + switch (id) { + case TraceEventCodes.StartLogicalOperation: + TraceEvent(eventCache, source, eventType, id, "+{0}", data); + break; + case TraceEventCodes.StopLogicalOperation: + TraceEvent(eventCache, source, eventType, id, FormatStopLogicalOperation(data)); + break; + default: + TraceEvent(eventCache, source, eventType, id, data?.ToString()); + break; + } + } + + string FormatStopLogicalOperation(object data) { + if (data is LogicalOperation op) { + return string.Format("-{0} ({1})", op, FormatTimespan(op.Elapsed)); + } else { + return data?.ToString(); + } + } + + string FormatTimespan(TimeSpan value) { + if (value.TotalSeconds < 10) { + return value.Milliseconds.ToString() + "ms"; + } else if (value.TotalSeconds < 30) { + return string.Format("{0:0.###}s", value.TotalSeconds); + } else { + return value.ToString(); + } + } + + public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, params object[] data) { + var prev = IndentLevel; + IndentLevel += eventCache.LogicalOperationStack.Count; + try { + base.TraceData(eventCache, source, eventType, id, data); + } finally { + IndentLevel = prev; + } + } + + public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id) { + var prev = IndentLevel; + IndentLevel += eventCache.LogicalOperationStack.Count; + try { + base.TraceEvent(eventCache, source, eventType, id); + } finally { + IndentLevel = prev; + } + } + + public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { + TraceEvent(eventCache, source, eventType, id, String.Format(format, args)); + } + + public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message) { + var prev = IndentLevel; + IndentLevel += eventCache.LogicalOperationStack.Count; + try { + LogicalOperation operation = null; + if (eventCache.LogicalOperationStack.Count > 0) + operation = eventCache.LogicalOperationStack.Peek() as LogicalOperation; + + if (operation != null) { + base.TraceData(eventCache, source, eventType, id, FormatTimespan(operation.Elapsed) + ": " + message); + } else { + base.TraceData(eventCache, source, eventType, id, message); + } + } finally { + IndentLevel = prev; + } + } + + public override void TraceTransfer(TraceEventCache eventCache, string source, int id, string message, Guid relatedActivityId) { + var prev = IndentLevel; + IndentLevel += eventCache.LogicalOperationStack.Count; + try { + base.TraceTransfer(eventCache, source, id, message, relatedActivityId); + } finally { + IndentLevel = prev; + } + } + + + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/Trace.cs b/Implab/src/Diagnostics/Trace.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/Trace.cs @@ -0,0 +1,199 @@ +// enable System.Diagnostics trace methods +#define TRACE + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Diagnostics { + /// + /// Static class which creates an individual for + /// the type specified in the parameter and uses + /// it to perform logging operations. + /// + /// The type for which tracing is demanded. + public static class Trace { + + readonly static Lazy _trace = new Lazy(() => TraceSourceChannel.Default.Source); + + /// + /// The associated with the current class. + /// TraceSource is created using . + /// + public static TraceSource TraceSource { get { return _trace.Value; } } + +#if NETFX_TRACE_BUG + // AsyncLocal will store value inside the current execution context + // and will force it to be copied... not a very effective solution. + readonly static AsyncLocal m_currentOperation = new AsyncLocal(); +#endif + + /// + /// If this property is set then will produce output. + /// + public static bool TraceVerbose { + get { + return TraceSource.Switch.ShouldTrace(TraceEventType.Verbose); + } + } + + /// + /// If this property is set then will produce output. + /// + public static bool TraceInformation { + get { + return TraceSource.Switch.ShouldTrace(TraceEventType.Information); + } + } + + /// + /// If this property is set then will produce output. + /// + public static bool TraceWarnings { + get { + return TraceSource.Switch.ShouldTrace(TraceEventType.Warning); + } + } + + + + /// + /// Starts the logical operation with the specified name, this name is usefull in logs. + /// + /// Name. +#if NETFX_TRACE_BUG + public static void StartLogicalOperation(object name) { + m_currentOperation.Value = name; + Trace.CorrelationManager.StartLogicalOperation(name); + } + + /// + /// Starts the logical operation nested to the current operation nested to the current one. + /// + public static void StartLogicalOperation() { + m_currentOperation.Value = new object(); + Trace.CorrelationManager.StartLogicalOperation(); + + } +#else + public static void StartLogicalOperation(object name) { + Trace.CorrelationManager.StartLogicalOperation(name); + } + + /// + /// Starts the logical operation nested to the current operation nested to the current one. + /// + public static void StartLogicalOperation() { + Trace.CorrelationManager.StartLogicalOperation(); + + } +#endif + + /// + /// Ends the logical operation and restores the previous one. + /// + public static void StopLogicalOperation() { + Trace.CorrelationManager.StopLogicalOperation(); + } + + /// + /// Writes a debug message. + /// + /// Format. + /// Arguments. + [Conditional("DEBUG")] + public static void Debug(string format, params object[] arguments) { + TraceSource.TraceEvent(TraceEventType.Verbose, 0, format, arguments); + } + + /// + /// Writes an informational message. + /// + /// Format. + /// Arguments. + [Conditional("TRACE")] + public static void Log(string format, params object[] arguments) { + TraceSource.TraceEvent(TraceEventType.Information, 0, format, arguments); + } + + /// + /// Writes a warning message. + /// + /// Format. + /// Arguments. + public static void Warn(string format, params object[] arguments) { + TraceSource.TraceEvent(TraceEventType.Warning, 0, format, arguments); + } + + /// + /// Writes a error message. + /// + /// Format. + /// Arguments. + public static void Error(string format, params object[] arguments) { + TraceSource.TraceEvent(TraceEventType.Error, 0, format, arguments); + } + + public static void Error(Exception err) { + TraceSource.TraceData(TraceEventType.Error, 0, err); + } + + /// + /// This method save the current activity, and transfers to the specified activity, + /// emits and returns a scope of the new + /// activity. + /// + /// The name of the new activity/ + /// The identifier of the activity to which + /// the control will be transferred + /// A scope of the new activity, dispose it to transfer + /// the control back to the original activity. + public static ActivityScope TransferActivity(string activityName, Guid activityId) { + var prev = Trace.CorrelationManager.ActivityId; + + TraceSource.TraceTransfer(0, "Transfer", activityId); + Trace.CorrelationManager.ActivityId = activityId; + TraceSource.TraceEvent(TraceEventType.Start, 0, activityName); + + return new ActivityScope(TraceSource, prev, 0, activityName); + } + + /// + /// Emits and returns a scope of the + /// activity. + /// + /// The name of the activity to start + /// A scope of the new activity, dispose it to emit + /// for the current activity. + public static ActivityScope StartActivity(string activityName) { + if (Trace.CorrelationManager.ActivityId == Guid.Empty) + Trace.CorrelationManager.ActivityId = Guid.NewGuid(); + + var prev = Trace.CorrelationManager.ActivityId; + + TraceSource.TraceEvent(TraceEventType.Start, 0, activityName); + return new ActivityScope(TraceSource, prev, 0, activityName); + } + + /// + /// Creates new and calls + /// to + /// passing the created operation as identity. Calls + /// + /// to notify listeners on operation start. + /// + /// The name of the logical operation. + /// Logical operation scope, disposing it will stop + /// logical operation and notify trace listeners. + public static LogicalOperationScope LogicalOperation(string name) { + var operation = new LogicalOperation(name); + TraceSource.TraceData(TraceEventType.Information, TraceEventCodes.StartLogicalOperation, operation); + StartLogicalOperation(operation); + return new LogicalOperationScope(TraceSource, operation); + } + } +} diff --git a/Implab/src/Diagnostics/TraceChannel.cs b/Implab/src/Diagnostics/TraceChannel.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceChannel.cs @@ -0,0 +1,17 @@ +namespace Implab.Diagnostics +{ + public abstract class TraceChannel { + readonly object m_id; + + public object Id { + get { + return m_id; + } + } + + protected TraceChannel(object id) { + m_id = id ?? new object(); + } + + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/TraceEventCodes.cs b/Implab/src/Diagnostics/TraceEventCodes.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceEventCodes.cs @@ -0,0 +1,10 @@ +namespace Implab.Diagnostics { + public class TraceEventCodes { + public const int EventCodesBase = 1024; + + public const int StartLogicalOperation = EventCodesBase + 1; + + public const int StopLogicalOperation = EventCodesBase + 2; + + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/TraceRegistry.cs b/Implab/src/Diagnostics/TraceRegistry.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceRegistry.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Implab.Parallels; + +namespace Implab.Diagnostics { + public class TraceRegistry: IObservable { + + class Subscription : IDisposable { + readonly WeakReference m_registry; + + public Subscription(TraceRegistry registry) { + m_registry = new WeakReference(registry); + } + + public void Dispose() { + TraceRegistry t; + if (m_registry.TryGetTarget(out t)) + t.RemoveSubscription(this); + } + } + + /// + /// The global collection of available diagnostic channels + /// + /// + public static TraceRegistry Global { get; } = new TraceRegistry(); + + readonly object m_lock = new object(); + + readonly Dictionary> m_subscriptions = new Dictionary>(); + readonly SimpleAsyncQueue m_channels = new SimpleAsyncQueue(); + + public void Register(TraceChannel channel) { + // notifications can run in parallel + IObserver[] handlers = null; + + lock(m_lock) { + m_channels.Enqueue(channel); + if (m_subscriptions.Count > 0) { + handlers = new IObserver[m_subscriptions.Count]; + m_subscriptions.Values.CopyTo(handlers, 0); + } + } + + if (handlers != null) + foreach(var h in handlers) + h.OnNext(channel); + } + + /// + /// Subscribes the specified handler to notifications about new trace + /// channels + /// + /// + /// + public IDisposable Subscribe(IObserver handler) { + Safe.ArgumentNotNull(handler, nameof(handler)); + + var cookie = new Subscription(this); + + IEnumerable snap; + + // lock to ensure that no new channels will be added + // while the subscription is added + lock(m_lock) { + m_subscriptions.Add(cookie, handler); + snap = m_channels.Snapshot(); + } + + // announce previously declared channels if required + if (snap != null) { + foreach(var c in snap) + handler.OnNext(c); + } + + // return the subscription + return cookie; + } + + void RemoveSubscription(object cookie) { + lock(m_lock) + m_subscriptions.Remove(cookie); + } + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/TraceSourceAttribute.cs b/Implab/src/Diagnostics/TraceSourceAttribute.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceSourceAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace Implab.Diagnostics { + /// + /// Used to mark class which uses class to trace it's events + /// + [AttributeUsage(AttributeTargets.Class)] + [Obsolete("Use TraceRegistry to monitor trace sources")] + public class TraceSourceAttribute : Attribute { + } +} diff --git a/Implab/src/Diagnostics/TraceSourceChannel.cs b/Implab/src/Diagnostics/TraceSourceChannel.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceSourceChannel.cs @@ -0,0 +1,27 @@ +using TraceSource = System.Diagnostics.TraceSource; + +namespace Implab.Diagnostics { + + /// + /// Trace channel which incapsulates instance. + /// + public class TraceSourceChannel : TraceChannel { + readonly TraceSource m_trace; + + public TraceSourceChannel() : base(new object()) { + } + + public TraceSourceChannel(object id) : base(id) { + } + + public TraceSourceChannel(object id, string name) : base(id) { + m_trace = new TraceSource(name); + } + + public TraceSource Source { + get { + return m_trace; + } + } + } +} \ No newline at end of file diff --git a/Implab/src/Diagnostics/TraceSourceChannel`1.cs b/Implab/src/Diagnostics/TraceSourceChannel`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Diagnostics/TraceSourceChannel`1.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; +using TraceSource = System.Diagnostics.TraceSource; + +namespace Implab.Diagnostics { + /// + /// This class is used to provide a single + /// instance for the specified class in parameter. + /// + /// + /// The class for which is required. + /// + /// + /// The instance will be created on demand + /// and automatically registered in . + /// + public static class TraceSourceChannel { + static Lazy _traceSource = new Lazy(CreateChannel, LazyThreadSafetyMode.ExecutionAndPublication); + + /// + /// The default instance. + /// + public static TraceSourceChannel Default { get { return _traceSource.Value; } } + + static TraceSourceChannel CreateChannel() { + var channel = new TraceSourceChannel(typeof(T), typeof(T).FullName); + + TraceRegistry.Global.Register(channel); + + return channel; + } + } +} \ No newline at end of file diff --git a/Implab/src/ExceptionHelpers.cs b/Implab/src/ExceptionHelpers.cs new file mode 100644 --- /dev/null +++ b/Implab/src/ExceptionHelpers.cs @@ -0,0 +1,21 @@ +using System; +using System.Reflection; +using System.Runtime.ExceptionServices; + +namespace Implab { + static class ExceptionHelpers { + public static Exception Rethrow(this Exception that) { + ExceptionDispatchInfo.Capture(that).Throw(); + return new TargetInvocationException(that); + } + + public static Exception Wrap(this Exception that) { + if (that == null) + return new Exception(); + else if (that is OperationCanceledException) + return new OperationCanceledException("The operation has been cancelled", that); + else + return new TargetInvocationException(that); + } + } +} \ No newline at end of file diff --git a/Implab/Formats/ByteAlphabet.cs b/Implab/src/Formats/ByteAlphabet.cs rename from Implab/Formats/ByteAlphabet.cs rename to Implab/src/Formats/ByteAlphabet.cs diff --git a/Implab/Formats/CharAlphabet.cs b/Implab/src/Formats/CharAlphabet.cs rename from Implab/Formats/CharAlphabet.cs rename to Implab/src/Formats/CharAlphabet.cs --- a/Implab/Formats/CharAlphabet.cs +++ b/Implab/src/Formats/CharAlphabet.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; using System.Linq; using Implab.Automaton; +using System; namespace Implab.Formats { - public class CharAlphabet: IndexedAlphabetBase { + public class CharAlphabet : IndexedAlphabetBase { public override int GetSymbolIndex(char symbol) { return symbol; @@ -12,5 +13,24 @@ namespace Implab.Formats { public IEnumerable InputSymbols { get { return Enumerable.Range(char.MinValue, char.MaxValue).Cast(); } } + + public CharMap CreateCharMap() { + var map = new Dictionary(); + + int max = 0, min = char.MaxValue; + foreach (var p in Mappings) { + var index = GetSymbolIndex(p.Key); + max = Math.Max(max, index); + min = Math.Min(min, index); + map[index] = p.Value; + } + + var result = new int[max - min + 1]; + + for (int i = 0; i < result.Length; i++) + map.TryGetValue(min + i, out result[i]); + + return new CharMap((char)min, result); + } } } diff --git a/Implab/src/Formats/CharMap.cs b/Implab/src/Formats/CharMap.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Formats/CharMap.cs @@ -0,0 +1,42 @@ +using Implab.Automaton; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Formats { + public class CharMap : IAlphabet { + readonly char m_min; + readonly char m_max; + readonly int[] m_map; + + public CharMap(char min, int[] map) { + Safe.ArgumentNotNull(map, nameof(map)); + Count = map.Max()+1; + m_min = min; + m_map = map; + m_max = (char)(min + map.Length); + } + + public int Count { + get; private set; + } + + public bool Contains(char symbol) { + return symbol >= m_min && symbol <= m_max && m_map[symbol-m_min] != AutomatonConst.UnclassifiedInput; + } + + public IEnumerable GetSymbols(int cls) { + for (var i = 0; i < m_map.Length; i++) + if (m_map[i] == cls) + yield return (char)(i + m_min); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public int Translate(char symbol) { + return symbol >= m_min && symbol <= m_max ? m_map[symbol-m_min] : AutomatonConst.UnclassifiedInput; + } + } +} diff --git a/Implab/src/Formats/FastInpurScanner.cs b/Implab/src/Formats/FastInpurScanner.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Formats/FastInpurScanner.cs @@ -0,0 +1,128 @@ +using Implab.Automaton; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Formats { + + /// + /// Fast input scanner for max 255 states and 255 input chacters. + /// + /// + /// + /// + /// Creates a one rank array to store automa transition table, each entry in this table is byte, to make this table small enough to fit L1 cache. + /// + /// + /// Each entry is addressed as (state << 8) | input which make this quite fast to get the next state. Each input symbol below 255 is treated as 255. + /// + /// + public class FastInputScanner { + const int StateShift = 8; + const int StateMask = ~((1 << StateShift) - 1); + const int AlphabetSize = 1 << StateShift; + const int UnclassifiedInput = (1 << StateShift) - 1; + const byte UnreachableState = byte.MaxValue; + + readonly TTag[] m_tags; + readonly bool[] m_final; + + readonly byte m_initialState; + readonly byte[] m_dfa; + + int m_position; + byte m_state; + + protected FastInputScanner(byte[] table, bool[] final, TTag[] tags, byte initial) { + m_dfa = table; + m_final = final; + m_tags = tags; + m_initialState = initial; + } + + public FastInputScanner(int[,] dfaTable, bool[] finalStates, TTag[] tags, int initialState, int[] inputMap) { + var states = dfaTable.GetLength(0); + Debug.Assert(states < byte.MaxValue); + + m_dfa = new byte[states << StateShift]; + m_initialState = (byte)initialState; + + m_tags = tags; + m_final = finalStates; + + // iterate over states + for(int si = 0; si < states; si++) { + // state offset for the new table + var offset = si << StateShift; + + // iterate over alphabet + for(int a = 0; a < AlphabetSize; a++) { + var next = dfaTable[si, a < inputMap.Length ? inputMap[a] : AutomatonConst.UnclassifiedInput]; + if (next == AutomatonConst.UnreachableState) + next = UnreachableState; + + m_dfa[offset | a] = (byte)next; + } + } + } + + public TTag Tag { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_tags[m_state]; + } + } + + public int Position { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_position; + } + } + + public bool IsFinal { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_final[m_state]; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void ResetState() { + m_state = m_initialState; + } + + public FastInputScanner Clone() { + var clone = new FastInputScanner(m_dfa, m_final, m_tags, m_initialState); + clone.m_state = m_state; + clone.m_position = m_position; + return clone; + } + + public bool Scan(char[] data, int offset, int max) { + var next = m_state; + + m_position = offset; + while (m_position < max) { + var ch = data[m_position]; + + next = m_dfa[(ch >= AlphabetSize ? (next << StateShift) | UnclassifiedInput : (next << StateShift) | ch)]; + + if (next == UnreachableState) + // scanner stops at the next position after the last recognized symbol + return false; + + m_state = next; + m_position++; + } + + return true; + } + + + } +} diff --git a/Implab/Formats/Grammar.cs b/Implab/src/Formats/Grammar.cs rename from Implab/Formats/Grammar.cs rename to Implab/src/Formats/Grammar.cs --- a/Implab/Formats/Grammar.cs +++ b/Implab/src/Formats/Grammar.cs @@ -16,7 +16,7 @@ namespace Implab.Formats { } protected SymbolToken UnclassifiedToken() { - return new SymbolToken(AutomatonConst.UNCLASSIFIED_INPUT); + return new SymbolToken(AutomatonConst.UnclassifiedInput); } protected void DefineAlphabet(IEnumerable alphabet) { @@ -42,7 +42,7 @@ namespace Implab.Formats { int TranslateOrAdd(TSymbol ch) { var t = AlphabetBuilder.Translate(ch); - if (t == AutomatonConst.UNCLASSIFIED_INPUT) + if (t == AutomatonConst.UnclassifiedInput) t = AlphabetBuilder.DefineSymbol(ch); return t; } @@ -53,7 +53,7 @@ namespace Implab.Formats { int TranslateOrDie(TSymbol ch) { var t = AlphabetBuilder.Translate(ch); - if (t == AutomatonConst.UNCLASSIFIED_INPUT) + if (t == AutomatonConst.UnclassifiedInput) throw new ApplicationException(String.Format("Symbol '{0}' is UNCLASSIFIED", ch)); return t; } @@ -67,32 +67,6 @@ namespace Implab.Formats { return Token.New( Enumerable.Range(0, AlphabetBuilder.Count).Except(TranslateOrDie(symbols)).ToArray() ); } - - protected abstract IndexedAlphabetBase CreateAlphabet(); - - protected ScannerContext BuildScannerContext(Token regexp) { - - var dfa = new RegularDFA(AlphabetBuilder); - - var visitor = new RegularExpressionVisitor(dfa); - regexp.Accept(visitor); - visitor.BuildDFA(); - - if (dfa.IsFinalState(dfa.InitialState)) - throw new ApplicationException("The specified language contains empty token"); - - var ab = CreateAlphabet(); - var optimal = dfa.Optimize(ab); - - return new ScannerContext( - optimal.CreateTransitionTable(), - optimal.CreateFinalStateTable(), - optimal.CreateTagTable(), - optimal.InitialState, - ab.GetTranslationMap() - ); - } - } diff --git a/Implab/src/Formats/InputScanner.cs b/Implab/src/Formats/InputScanner.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Formats/InputScanner.cs @@ -0,0 +1,84 @@ +using Implab.Automaton; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Formats { + public class InputScanner { + readonly TTag[] m_tags; + readonly int m_initialState; + readonly int[,] m_dfa; + readonly CharMap m_alphabet; + readonly bool[] m_final; + + int m_position; + int m_state; + + public InputScanner(int[,] dfaTable, bool[] finalStates, TTag[] tags, int initialState, CharMap alphabet) { + Safe.ArgumentNotNull(dfaTable, nameof(dfaTable)); + Safe.ArgumentNotNull(finalStates, nameof(finalStates)); + Safe.ArgumentNotNull(tags, nameof(tags)); + Safe.ArgumentNotNull(alphabet, nameof(alphabet)); + + m_dfa = dfaTable; + m_final = finalStates; + m_tags = tags; + m_initialState = initialState; + m_alphabet = alphabet; + } + + public TTag Tag { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_tags[m_state]; + } + } + + public int Position { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_position; + } + } + + public bool IsFinal { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get { + return m_final[m_state]; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void ResetState() { + m_state = m_initialState; + } + + public InputScanner Clone() { + var clone = new InputScanner(m_dfa, m_final, m_tags, m_initialState, m_alphabet); + clone.m_state = m_state; + clone.m_position = m_position; + return clone; + } + + //[MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool Scan(char[] data, int offset, int max) { + var next = m_state; + + while(offset < max) { + next = m_dfa[next, m_alphabet.Translate(data[offset])]; + if (next == AutomatonConst.UnreachableState) { + // scanner stops on the next position after last recognized symbol + m_position = offset; + return false; + } + m_state = next; + offset++; + } + m_position = offset; + return true; + } + } +} diff --git a/Implab/Formats/JSON/JSONElementContext.cs b/Implab/src/Formats/Json/JsonElementContext.cs rename from Implab/Formats/JSON/JSONElementContext.cs rename to Implab/src/Formats/Json/JsonElementContext.cs --- a/Implab/Formats/JSON/JSONElementContext.cs +++ b/Implab/src/Formats/Json/JsonElementContext.cs @@ -1,8 +1,8 @@ -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// /// internal /// - enum JSONElementContext { + enum JsonElementContext { None, Object, Array, diff --git a/Implab/Formats/JSON/JSONElementType.cs b/Implab/src/Formats/Json/JsonElementType.cs rename from Implab/Formats/JSON/JSONElementType.cs rename to Implab/src/Formats/Json/JsonElementType.cs --- a/Implab/Formats/JSON/JSONElementType.cs +++ b/Implab/src/Formats/Json/JsonElementType.cs @@ -1,8 +1,8 @@ -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// /// Тип элемента на котором находится парсер /// - public enum JSONElementType { + public enum JsonElementType { None, /// /// Начало объекта diff --git a/Implab/Formats/JSON/JSONGrammar.cs b/Implab/src/Formats/Json/JsonGrammar.cs rename from Implab/Formats/JSON/JSONGrammar.cs rename to Implab/src/Formats/Json/JsonGrammar.cs --- a/Implab/Formats/JSON/JSONGrammar.cs +++ b/Implab/src/Formats/Json/JsonGrammar.cs @@ -4,8 +4,8 @@ using System; using Implab.Automaton; using Implab.Components; -namespace Implab.Formats.JSON { - class JSONGrammar : Grammar { +namespace Implab.Formats.Json { + public class JsonGrammar : Grammar { public enum TokenType { None, BeginObject, @@ -25,17 +25,19 @@ namespace Implab.Formats.JSON { EscapedUnicode } - static LazyAndWeak _instance = new LazyAndWeak(() => new JSONGrammar()); + static LazyAndWeak _instance = new LazyAndWeak(() => new JsonGrammar()); - public static JSONGrammar Instance { + public static JsonGrammar Instance { get { return _instance.Value; } } - readonly ScannerContext m_jsonExpression; - readonly ScannerContext m_stringExpression; + readonly FastInputScanner m_jsonExpression; + readonly FastInputScanner m_stringExpression; readonly CharAlphabet m_defaultAlphabet = new CharAlphabet(); - public JSONGrammar() { + public CharAlphabet DefaultAlphabet { get { return m_defaultAlphabet; } } + + public JsonGrammar() { DefineAlphabet(Enumerable.Range(0, 0x20).Select(x => (char)x)); var hexDigit = SymbolRangeToken('a','f').Or(SymbolRangeToken('A','F')).Or(SymbolRangeToken('0','9')); var digit9 = SymbolRangeToken('1', '9'); @@ -85,10 +87,16 @@ namespace Implab.Formats.JSON { .Or(unescaped.Closure().Tag(TokenType.UnescapedChar)); - m_jsonExpression = BuildScannerContext(jsonExpression); - m_stringExpression = BuildScannerContext(jsonStringExpression); + m_jsonExpression = BuildFastScanner(jsonExpression); + m_stringExpression = BuildFastScanner(jsonStringExpression); + } + public static FastInputScanner CreateJsonExpressionScanner() { + return Instance.m_jsonExpression.Clone(); + } + public static FastInputScanner CreateStringExpressionScanner() { + return Instance.m_stringExpression.Clone(); } protected override IAlphabetBuilder AlphabetBuilder { @@ -97,24 +105,43 @@ namespace Implab.Formats.JSON { } } - public ScannerContext JsonExpression { - get { - return m_jsonExpression; - } - } - - public ScannerContext JsonStringExpression { - get { - return m_stringExpression; - } - } - Token SymbolRangeToken(char start, char stop) { return SymbolToken(Enumerable.Range(start, stop - start + 1).Select(x => (char)x)); } - protected override IndexedAlphabetBase CreateAlphabet() { - return new CharAlphabet(); + public FastInputScanner BuildFastScanner(Token regexp) { + var dfa = new RegularDFA(AlphabetBuilder); + + var visitor = new RegularExpressionVisitor(dfa); + regexp.Accept(visitor); + visitor.BuildDFA(); + + if (dfa.IsFinalState(dfa.InitialState)) + throw new ApplicationException("The specified language contains empty token"); + + var ab = new CharAlphabet(); + var optimal = dfa.Optimize(ab); + + return new FastInputScanner( + optimal.CreateTransitionTable(), + optimal.CreateFinalStateTable(), + NormalizeTags(optimal.CreateTagTable()), + optimal.InitialState, + ab.GetTranslationMap() + ); + } + + static TokenType[] NormalizeTags(TokenType[][] tags) { + var result = new TokenType[tags.Length]; + for(var i = 0; i< tags.Length; i++) { + if (tags[i] == null || tags[i].Length == 0) + result[i] = default(TokenType); + else if (tags[i].Length == 1) + result[i] = tags[i][0]; + else + throw new Exception($"Ambigous state tags {string.Join(", ", tags[i])}"); + } + return result; } } diff --git a/Implab/Formats/JSON/JSONParser.cs b/Implab/src/Formats/Json/JsonReader.cs rename from Implab/Formats/JSON/JSONParser.cs rename to Implab/src/Formats/Json/JsonReader.cs --- a/Implab/Formats/JSON/JSONParser.cs +++ b/Implab/src/Formats/Json/JsonReader.cs @@ -6,8 +6,10 @@ using Implab.Automaton.RegularExpression using System.Linq; using Implab.Components; using System.Collections.Generic; +using System.Text; +using System.Globalization; -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// /// Pull парсер JSON данных. /// @@ -24,7 +26,7 @@ namespace Implab.Formats.JSON { /// } // Level = 0 /// /// - public class JSONParser : Disposable { + public class JsonReader : Disposable { enum MemberContext { MemberName, @@ -36,9 +38,9 @@ namespace Implab.Formats.JSON { readonly int[,] m_dfa; int m_state; - readonly JSONElementContext m_elementContext; + readonly JsonElementContext m_elementContext; - public ParserContext(int[,] dfa, int state, JSONElementContext context) { + public ParserContext(int[,] dfa, int state, JsonElementContext context) { m_dfa = dfa; m_state = state; m_elementContext = context; @@ -46,13 +48,13 @@ namespace Implab.Formats.JSON { public bool Move(JsonTokenType token) { var next = m_dfa[m_state, (int)token]; - if (next == AutomatonConst.UNREACHABLE_STATE) + if (next == AutomatonConst.UnreachableState) return false; m_state = next; return true; } - public JSONElementContext ElementContext { + public JsonElementContext ElementContext { get { return m_elementContext; } } } @@ -61,7 +63,7 @@ namespace Implab.Formats.JSON { static readonly ParserContext _objectContext; static readonly ParserContext _arrayContext; - static JSONParser() { + static JsonReader() { var valueExpression = MakeToken(JsonTokenType.BeginArray, JsonTokenType.BeginObject, JsonTokenType.Literal, JsonTokenType.Number, JsonTokenType.String); var memberExpression = MakeToken(JsonTokenType.String).Cat(MakeToken(JsonTokenType.NameSeparator)).Cat(valueExpression); @@ -88,16 +90,16 @@ namespace Implab.Formats.JSON { var jsonExpression = valueExpression.End(); - _jsonContext = CreateParserContext(jsonExpression, JSONElementContext.None); - _objectContext = CreateParserContext(objectExpression, JSONElementContext.Object); - _arrayContext = CreateParserContext(arrayExpression, JSONElementContext.Array); + _jsonContext = CreateParserContext(jsonExpression, JsonElementContext.None); + _objectContext = CreateParserContext(objectExpression, JsonElementContext.Object); + _arrayContext = CreateParserContext(arrayExpression, JsonElementContext.Array); } static Token MakeToken(params JsonTokenType[] input) { return Token.New( input.Select(t => (int)t).ToArray() ); } - static ParserContext CreateParserContext(Token expr, JSONElementContext context) { + static ParserContext CreateParserContext(Token expr, JsonElementContext context) { var dfa = new DFATable(); var builder = new RegularExpressionVisitor(dfa); @@ -109,11 +111,12 @@ namespace Implab.Formats.JSON { #endregion - readonly JSONScanner m_scanner; - MemberContext m_memberContext; + readonly JsonScanner m_scanner; + // json starts from the value context and may content even a single literal + MemberContext m_memberContext = MemberContext.MemberValue; - JSONElementType m_elementType; - object m_elementValue; + JsonElementType m_elementType; + string m_elementValue; string m_memberName = String.Empty; Stack m_stack = new Stack(); @@ -123,20 +126,10 @@ namespace Implab.Formats.JSON { /// Создает новый парсер на основе строки, содержащей JSON /// /// - public JSONParser(string text) { - Safe.ArgumentNotEmpty(text, "text"); - m_scanner = new JSONScanner(text); + JsonReader(JsonScanner scanner) { + m_scanner = scanner; } - - /// - /// Создает новый экземпляр парсера, на основе текстового потока. - /// - /// Текстовый поток. - public JSONParser(TextReader reader) { - Safe.ArgumentNotNull(reader, "reader"); - m_scanner = new JSONScanner(reader); - } - + public int Level { get { return m_stack.Count; } } @@ -144,7 +137,7 @@ namespace Implab.Formats.JSON { /// /// Тип текущего элемента на котором стоит парсер. /// - public JSONElementType ElementType { + public JsonElementType ElementType { get { return m_elementType; } } @@ -157,9 +150,9 @@ namespace Implab.Formats.JSON { } /// - /// Значение элемента. Только для элементов типа , для остальных null + /// Значение элемента. Только для элементов типа , для остальных null /// - public object ElementValue { + public string ElementValue { get { return m_elementValue; } } @@ -168,7 +161,7 @@ namespace Implab.Formats.JSON { /// /// true - операция чтения прошла успешно, false - конец данных public bool Read() { - object tokenValue; + string tokenValue; JsonTokenType tokenType; m_memberName = String.Empty; @@ -184,7 +177,7 @@ namespace Implab.Formats.JSON { m_elementValue = null; m_memberContext = MemberContext.MemberName; - m_elementType = JSONElementType.BeginObject; + m_elementType = JsonElementType.BeginObject; return true; case JsonTokenType.EndObject: if (m_stack.Count == 0) @@ -192,7 +185,7 @@ namespace Implab.Formats.JSON { m_context = m_stack.Pop(); m_elementValue = null; - m_elementType = JSONElementType.EndObject; + m_elementType = JsonElementType.EndObject; return true; case JsonTokenType.BeginArray: m_stack.Push(m_context); @@ -200,7 +193,7 @@ namespace Implab.Formats.JSON { m_elementValue = null; m_memberContext = MemberContext.MemberValue; - m_elementType = JSONElementType.BeginArray; + m_elementType = JsonElementType.BeginArray; return true; case JsonTokenType.EndArray: if (m_stack.Count == 0) @@ -208,39 +201,39 @@ namespace Implab.Formats.JSON { m_context = m_stack.Pop(); m_elementValue = null; - m_elementType = JSONElementType.EndArray; + m_elementType = JsonElementType.EndArray; return true; case JsonTokenType.String: if (m_memberContext == MemberContext.MemberName) { - m_memberName = (string)tokenValue; + m_memberName = tokenValue; break; } - m_elementType = JSONElementType.Value; + m_elementType = JsonElementType.Value; m_elementValue = tokenValue; return true; case JsonTokenType.Number: - m_elementType = JSONElementType.Value; + m_elementType = JsonElementType.Value; m_elementValue = tokenValue; return true; case JsonTokenType.Literal: - m_elementType = JSONElementType.Value; - m_elementValue = ParseLiteral((string)tokenValue); + m_elementType = JsonElementType.Value; + m_elementValue = tokenValue == "null" ? null : tokenValue; return true; case JsonTokenType.NameSeparator: m_memberContext = MemberContext.MemberValue; break; case JsonTokenType.ValueSeparator: - m_memberContext = m_context.ElementContext == JSONElementContext.Object ? MemberContext.MemberName : MemberContext.MemberValue; + m_memberContext = m_context.ElementContext == JsonElementContext.Object ? MemberContext.MemberName : MemberContext.MemberValue; break; default: UnexpectedToken(tokenValue, tokenType); break; } } - if (m_context.ElementContext != JSONElementContext.None) + if (m_context.ElementContext != JsonElementContext.None) throw new ParserException("Unexpedted end of data"); - EOF = true; + Eof = true; return false; } @@ -267,14 +260,14 @@ namespace Implab.Formats.JSON { /// /// Признак конца потока /// - public bool EOF { + public bool Eof { get; private set; } protected override void Dispose(bool disposing) { if (disposing) - Safe.Dispose(m_scanner); + m_scanner.Dispose(); } /// @@ -288,6 +281,38 @@ namespace Implab.Formats.JSON { while (Level != level) Read(); } + + public static JsonReader Create(string file, Encoding encoding) { + return new JsonReader(JsonTextScanner.Create(file, encoding)); + } + + public static JsonReader Create(string file) { + return new JsonReader(JsonTextScanner.Create(file)); + } + + public static JsonReader Create(Stream stream, Encoding encoding) { + return new JsonReader(JsonTextScanner.Create(stream, encoding)); + } + + public static JsonReader Create(Stream stream) { + return new JsonReader(JsonTextScanner.Create(stream)); + } + + public static JsonReader Create(TextReader reader) { + return new JsonReader(JsonTextScanner.Create(reader)); + } + + public static JsonReader ParseString(string data) { + return new JsonReader(JsonStringScanner.Create(data)); + } + + public static JsonReader ParseString(string data, int offset, int length) { + return new JsonReader(JsonStringScanner.Create(data, offset, length)); + } + + public static JsonReader ParseString(char[] data, int offset, int lenght) { + return new JsonReader(JsonStringScanner.Create(data, offset, lenght)); + } } } diff --git a/Implab/Formats/JSON/JSONScanner.cs b/Implab/src/Formats/Json/JsonScanner.cs rename from Implab/Formats/JSON/JSONScanner.cs rename to Implab/src/Formats/Json/JsonScanner.cs --- a/Implab/Formats/JSON/JSONScanner.cs +++ b/Implab/src/Formats/Json/JsonScanner.cs @@ -5,37 +5,121 @@ using System.Text; using Implab.Components; using System.IO; -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// /// Сканнер (лексер), разбивающий поток символов на токены JSON. /// - public class JSONScanner : Disposable { - readonly StringBuilder m_builder = new StringBuilder(); - - readonly ScannerContext m_jsonContext = JSONGrammar.Instance.JsonExpression; - readonly ScannerContext m_stringContext = JSONGrammar.Instance.JsonStringExpression; - + public abstract class JsonScanner : Disposable { + readonly FastInputScanner m_jsonContext = JsonGrammar.CreateJsonExpressionScanner(); + readonly FastInputScanner m_stringContext = JsonGrammar.CreateStringExpressionScanner(); - readonly TextScanner m_scanner; + readonly char[] m_unescapeBuf = new char[4]; + readonly char[] m_buffer; + int m_length; + int m_pos; + readonly StringBuilder m_tokenBuilder = new StringBuilder(); - /// - /// Создает новый экземпляр сканнера - /// - public JSONScanner(string text) { - Safe.ArgumentNotEmpty(text, "text"); - - m_scanner = new StringScanner(text); + protected JsonScanner(char[] buffer, int pos, int length) { + m_buffer = buffer; + m_pos = pos; + m_length = length; } - public JSONScanner(TextReader reader, int bufferMax, int chunkSize) { - Safe.ArgumentNotNull(reader, "reader"); + bool ReadChunk(FastInputScanner scanner, out JsonGrammar.TokenType tokenType) { + scanner.ResetState(); + + while(scanner.Scan(m_buffer, m_pos, m_length)) { + // scanner requests new data + + if (m_pos != m_length) // capture results for the future + m_tokenBuilder.Append(m_buffer, m_pos, m_length - m_pos); + + // read next data + m_length = Read(m_buffer, 0, m_buffer.Length); + + if (m_length == 0) { + // no data is read + if (scanner.Position == m_pos) { + // scanned hasn't moved, that's the end + m_pos = 0; + tokenType = JsonGrammar.TokenType.None; + return false; + } - m_scanner = new ReaderScanner(reader, bufferMax, chunkSize); + if (scanner.IsFinal) { + m_pos = 0; + tokenType = scanner.Tag; + return true; + } else { + throw new ParserException("Unexpected EOF"); + } + } + + m_pos = 0; + } + var scannerPos = scanner.Position; + + // scanner stops as scannerPos + if (!scanner.IsFinal) + throw new ParserException($"Unexpected character '{m_buffer[scannerPos + 1]}'"); + + tokenType = scanner.Tag; + if (scannerPos != m_pos && tokenType == JsonGrammar.TokenType.Number || tokenType == JsonGrammar.TokenType.Literal) + m_tokenBuilder.Append(m_buffer, m_pos, scannerPos - m_pos); + + m_pos = scannerPos; + return true; } - public JSONScanner(TextReader reader) : this(reader, 1024*1024, 1024){ + bool ReadStringChunk(FastInputScanner scanner, out JsonGrammar.TokenType tokenType) { + scanner.ResetState(); + + while (scanner.Scan(m_buffer, m_pos, m_length)) { + // scanner requests new data + + if (m_pos != m_length) // capture results for the future + m_tokenBuilder.Append(m_buffer, m_pos, m_length - m_pos); + + // read next data + m_length = Read(m_buffer, 0, m_buffer.Length); + + if (m_length == 0) { + // no data is read + if (scanner.Position == m_pos) { + // scanned hasn't moved, that's the end + m_pos = 0; + tokenType = JsonGrammar.TokenType.None; + return false; + } + + if (scanner.IsFinal) { + m_pos = 0; + tokenType = scanner.Tag; + return true; + } else { + throw new ParserException("Unexpected EOF"); + } + } + + m_pos = 0; + } + var scannerPos = scanner.Position; + + // scanner stops as scannerPos + if (!scanner.IsFinal) + throw new ParserException($"Unexpected character '{m_buffer[scannerPos]}'"); + + if (scannerPos != m_pos) { + m_tokenBuilder.Append(m_buffer, m_pos, scannerPos - m_pos); + m_pos = scannerPos; + } + tokenType = scanner.Tag; + return true; } + protected abstract int Read(char[] buffer, int offset, int size); + + /// /// Читает следующий лексический элемент из входных данных. /// @@ -44,23 +128,29 @@ namespace Implab.Formats.JSON { /// true - чтение произведено успешно. false - достигнут конец входных данных /// В случе если токен не распознается, возникает исключение. Значения токенов обрабатываются, т.е. /// в строках обрабатываются экранированные символы, числа становтся типа double. - public bool ReadToken(out object tokenValue, out JsonTokenType tokenType) { - JSONGrammar.TokenType[] tag; - while (m_jsonContext.Execute(m_scanner, out tag)) { - switch (tag[0]) { - case JSONGrammar.TokenType.StringBound: + public bool ReadToken(out string tokenValue, out JsonTokenType tokenType) { + JsonGrammar.TokenType tag; + m_tokenBuilder.Clear(); + while (ReadChunk(m_jsonContext, out tag)) { + switch (tag) { + case JsonGrammar.TokenType.StringBound: tokenValue = ReadString(); tokenType = JsonTokenType.String; break; - case JSONGrammar.TokenType.Number: - tokenValue = Double.Parse(m_scanner.GetTokenValue(), CultureInfo.InvariantCulture); + case JsonGrammar.TokenType.Number: + tokenValue = m_tokenBuilder.ToString(); tokenType = JsonTokenType.Number; break; - case JSONGrammar.TokenType.Whitespace: + case JsonGrammar.TokenType.Literal: + tokenType = JsonTokenType.Literal; + tokenValue = m_tokenBuilder.ToString(); + break; + case JsonGrammar.TokenType.Whitespace: + m_tokenBuilder.Clear(); continue; default: - tokenType = (JsonTokenType)tag[0]; - tokenValue = m_scanner.GetTokenValue(); + tokenType = (JsonTokenType)tag; + tokenValue = null; break; } return true; @@ -71,39 +161,30 @@ namespace Implab.Formats.JSON { } string ReadString() { - int pos = 0; - var buf = new char[6]; // the buffer for unescaping chars - - JSONGrammar.TokenType[] tag; - m_builder.Clear(); + JsonGrammar.TokenType tag; + m_tokenBuilder.Clear(); - while (m_stringContext.Execute(m_scanner, out tag)) { - switch (tag[0]) { - case JSONGrammar.TokenType.StringBound: - return m_builder.ToString(); - case JSONGrammar.TokenType.UnescapedChar: - m_scanner.CopyTokenTo(m_builder); + while (ReadStringChunk(m_stringContext, out tag)) { + switch (tag) { + case JsonGrammar.TokenType.StringBound: + m_tokenBuilder.Length--; + return m_tokenBuilder.ToString(); + case JsonGrammar.TokenType.UnescapedChar: break; - case JSONGrammar.TokenType.EscapedUnicode: // \xXXXX - unicode escape sequence - m_scanner.CopyTokenTo(buf, 0); - m_builder.Append(StringTranslator.TranslateHexUnicode(buf, 2)); - pos++; + case JsonGrammar.TokenType.EscapedUnicode: // \xXXXX - unicode escape sequence + m_tokenBuilder.CopyTo(m_tokenBuilder.Length - 4, m_unescapeBuf, 0, 4); + m_tokenBuilder.Length -= 6; + m_tokenBuilder.Append(StringTranslator.TranslateHexUnicode(m_unescapeBuf, 0)); break; - case JSONGrammar.TokenType.EscapedChar: // \t - escape sequence - m_scanner.CopyTokenTo(buf, 0); - m_builder.Append(StringTranslator.TranslateEscapedChar(buf[1])); + case JsonGrammar.TokenType.EscapedChar: // \t - escape sequence + var ch = m_tokenBuilder[m_tokenBuilder.Length-1]; + m_tokenBuilder.Length -= 2; + m_tokenBuilder.Append(StringTranslator.TranslateEscapedChar(ch)); break; } - } throw new ParserException("Unexpected end of data"); } - - protected override void Dispose(bool disposing) { - if (disposing) - Safe.Dispose(m_scanner); - base.Dispose(disposing); - } } } diff --git a/Implab/src/Formats/Json/JsonStringScanner.cs b/Implab/src/Formats/Json/JsonStringScanner.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Formats/Json/JsonStringScanner.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Formats.Json { + public class JsonStringScanner : JsonScanner { + const int _defaultBuffer = 64; + + readonly string m_data; + int m_offset; + + JsonStringScanner(string data, char[] buffer, int pos, int length, int offset) : base(buffer, pos, length) { + m_data = data; + m_offset = offset; + } + + protected override int Read(char[] buffer, int offset, int size) { + if (m_data == null) + return 0; + if (m_offset >= m_data.Length) + return 0; + + var count = Math.Min(size, m_data.Length - m_offset); + + m_data.CopyTo(m_offset, buffer, offset, count); + m_offset += count; + + return count; + } + + public static JsonStringScanner Create(string data) { + Safe.ArgumentNotNull(data, nameof(data)); + + if (data.Length <= _defaultBuffer) + return new JsonStringScanner(null, data.ToCharArray(), 0, data.Length, data.Length); + + var buffer = new char[_defaultBuffer]; + data.CopyTo(0, buffer, 0, _defaultBuffer); + return new JsonStringScanner(data, buffer, 0, _defaultBuffer, _defaultBuffer); + } + + public static JsonStringScanner Create(string data, int offset, int length) { + Safe.ArgumentNotNull(data, nameof(data)); + Safe.ArgumentInRange(offset >= 0 && offset < data.Length , nameof(offset)); + Safe.ArgumentInRange(length >= 0 && offset + length <= data.Length, nameof(length)); + + if (length <= _defaultBuffer) { + var buffer = new char[length]; + data.CopyTo(offset, buffer, 0, length); + + return new JsonStringScanner(null, buffer, 0, length, length); + } else { + var buffer = new char[_defaultBuffer]; + data.CopyTo(offset, buffer, 0, _defaultBuffer); + return new JsonStringScanner(data, buffer, 0, _defaultBuffer, offset + _defaultBuffer); + } + } + + public static JsonStringScanner Create(char[] data, int offset, int length) { + Safe.ArgumentNotNull(data, nameof(data)); + Safe.ArgumentInRange(offset >= 0 && offset < data.Length , nameof(offset)); + Safe.ArgumentInRange(length >= 0 && offset + length <= data.Length, nameof(length)); + + return new JsonStringScanner(null, data, offset, offset + length, offset + length); + + } + } +} diff --git a/Implab/src/Formats/Json/JsonTextScanner.cs b/Implab/src/Formats/Json/JsonTextScanner.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Formats/Json/JsonTextScanner.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Formats.Json { + public class JsonTextScanner : JsonScanner { + const int _bufferSize = 16*4096; + readonly TextReader m_reader; + + JsonTextScanner(TextReader reader, char[] buffer) : base(buffer, 0, 0) { + m_reader = reader; + } + + protected override int Read(char[] buffer, int offset, int size) { + return m_reader.Read(buffer, offset, size); + } + + public static JsonTextScanner Create(string file, Encoding encoding) { + return new JsonTextScanner(new StreamReader(file, encoding), new char[_bufferSize]); + } + + public static JsonTextScanner Create(string file) { + return new JsonTextScanner(new StreamReader(file), new char[_bufferSize]); + } + + public static JsonTextScanner Create(Stream stream, Encoding encoding) { + return new JsonTextScanner(new StreamReader(stream, encoding), new char[_bufferSize]); + } + + public static JsonTextScanner Create(Stream stream) { + return new JsonTextScanner(new StreamReader(stream), new char[_bufferSize]); + } + + public static JsonTextScanner Create(TextReader reader) { + Safe.ArgumentNotNull(reader, nameof(reader)); + return new JsonTextScanner(reader, new char[_bufferSize]); + } + + protected override void Dispose(bool disposing) { + if (disposing) + Safe.Dispose(m_reader); + + base.Dispose(disposing); + } + } +} diff --git a/Implab/Formats/JSON/JsonTokenType.cs b/Implab/src/Formats/Json/JsonTokenType.cs rename from Implab/Formats/JSON/JsonTokenType.cs rename to Implab/src/Formats/Json/JsonTokenType.cs --- a/Implab/Formats/JSON/JsonTokenType.cs +++ b/Implab/src/Formats/Json/JsonTokenType.cs @@ -1,6 +1,6 @@ -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// - /// Тип токенов, возвращаемых . + /// Тип токенов, возвращаемых . /// public enum JsonTokenType : int { None = 0, diff --git a/Implab/Formats/JSON/JSONWriter.cs b/Implab/src/Formats/Json/JsonWriter.cs rename from Implab/Formats/JSON/JSONWriter.cs rename to Implab/src/Formats/Json/JsonWriter.cs --- a/Implab/Formats/JSON/JSONWriter.cs +++ b/Implab/src/Formats/Json/JsonWriter.cs @@ -4,11 +4,11 @@ using System.IO; using System.Globalization; using System.Diagnostics; -namespace Implab.Formats.JSON { - public class JSONWriter { +namespace Implab.Formats.Json { + public class JsonWriter { struct Context { public bool needComma; - public JSONElementContext element; + public JsonElementContext element; } Stack m_contextStack = new Stack(); Context m_context; @@ -30,7 +30,7 @@ namespace Implab.Formats.JSON { _escapeBSLASH, _escapeQ; - static JSONWriter() { + static JsonWriter() { _escapeBKS = "\\b".ToCharArray(); _escapeFWD = "\\f".ToCharArray(); _escapeCR = "\\r".ToCharArray(); @@ -40,12 +40,12 @@ namespace Implab.Formats.JSON { _escapeQ = "\\\"".ToCharArray(); } - public JSONWriter(TextWriter writer) { + public JsonWriter(TextWriter writer) { Safe.ArgumentNotNull(writer, "writer"); m_writer = writer; } - public JSONWriter(TextWriter writer, bool indent) { + public JsonWriter(TextWriter writer, bool indent) { Safe.ArgumentNotNull(writer, "writer"); m_writer = writer; @@ -66,7 +66,7 @@ namespace Implab.Formats.JSON { void WriteMemberName(string name) { Safe.ArgumentNotEmpty(name, "name"); - if (m_context.element != JSONElementContext.Object) + if (m_context.element != JsonElementContext.Object) OperationNotApplicable("WriteMember"); if (m_context.needComma) m_writer.Write(","); @@ -93,7 +93,7 @@ namespace Implab.Formats.JSON { } public void WriteValue(string value) { - if (m_context.element == JSONElementContext.Array) { + if (m_context.element == JsonElementContext.Array) { if (m_context.needComma) m_writer.Write(","); @@ -101,16 +101,16 @@ namespace Implab.Formats.JSON { m_context.needComma = true; Write(value); - } else if (m_context.element == JSONElementContext.None) { + } else if (m_context.element == JsonElementContext.None) { Write(value); - m_context.element = JSONElementContext.Closed; + m_context.element = JsonElementContext.Closed; } else { OperationNotApplicable("WriteValue"); } } public void WriteValue(bool value) { - if (m_context.element == JSONElementContext.Array) { + if (m_context.element == JsonElementContext.Array) { if (m_context.needComma) m_writer.Write(","); @@ -118,16 +118,16 @@ namespace Implab.Formats.JSON { m_context.needComma = true; Write(value); - } else if (m_context.element == JSONElementContext.None) { + } else if (m_context.element == JsonElementContext.None) { Write(value); - m_context.element = JSONElementContext.Closed; + m_context.element = JsonElementContext.Closed; } else { OperationNotApplicable("WriteValue"); } } public void WriteValue(double value) { - if (m_context.element == JSONElementContext.Array) { + if (m_context.element == JsonElementContext.Array) { if (m_context.needComma) m_writer.Write(","); @@ -135,16 +135,16 @@ namespace Implab.Formats.JSON { m_context.needComma = true; Write(value); - } else if (m_context.element == JSONElementContext.None) { + } else if (m_context.element == JsonElementContext.None) { Write(value); - m_context.element = JSONElementContext.Closed; + m_context.element = JsonElementContext.Closed; } else { OperationNotApplicable("WriteValue"); } } public void BeginObject() { - if (m_context.element != JSONElementContext.None && m_context.element != JSONElementContext.Array) + if (m_context.element != JsonElementContext.None && m_context.element != JsonElementContext.Array) OperationNotApplicable("BeginObject"); if (m_context.needComma) m_writer.Write(","); @@ -155,7 +155,7 @@ namespace Implab.Formats.JSON { m_contextStack.Push(m_context); - m_context = new Context { element = JSONElementContext.Object, needComma = false }; + m_context = new Context { element = JsonElementContext.Object, needComma = false }; m_writer.Write("{"); } @@ -164,23 +164,23 @@ namespace Implab.Formats.JSON { m_contextStack.Push(m_context); - m_context = new Context { element = JSONElementContext.Object, needComma = false }; + m_context = new Context { element = JsonElementContext.Object, needComma = false }; m_writer.Write("{"); } public void EndObject() { - if (m_context.element != JSONElementContext.Object) + if (m_context.element != JsonElementContext.Object) OperationNotApplicable("EndObject"); m_context = m_contextStack.Pop(); if (m_contextStack.Count == 0) - m_context.element = JSONElementContext.Closed; + m_context.element = JsonElementContext.Closed; WriteIndent(); m_writer.Write("}"); } public void BeginArray() { - if (m_context.element != JSONElementContext.None && m_context.element != JSONElementContext.Array) + if (m_context.element != JsonElementContext.None && m_context.element != JsonElementContext.Array) throw new InvalidOperationException(); if (m_context.needComma) { m_writer.Write(","); @@ -190,7 +190,7 @@ namespace Implab.Formats.JSON { WriteIndent(); m_contextStack.Push(m_context); - m_context = new Context { element = JSONElementContext.Array, needComma = false }; + m_context = new Context { element = JsonElementContext.Array, needComma = false }; m_writer.Write("["); } @@ -199,17 +199,17 @@ namespace Implab.Formats.JSON { m_contextStack.Push(m_context); - m_context = new Context { element = JSONElementContext.Array, needComma = false }; + m_context = new Context { element = JsonElementContext.Array, needComma = false }; m_writer.Write("["); } public void EndArray() { - if (m_context.element != JSONElementContext.Array) + if (m_context.element != JsonElementContext.Array) OperationNotApplicable("EndArray"); m_context = m_contextStack.Pop(); if (m_contextStack.Count == 0) - m_context.element = JSONElementContext.Closed; + m_context.element = JsonElementContext.Closed; WriteIndent(); m_writer.Write("]"); } diff --git a/Implab/Formats/JSON/StringTranslator.cs b/Implab/src/Formats/Json/StringTranslator.cs rename from Implab/Formats/JSON/StringTranslator.cs rename to Implab/src/Formats/Json/StringTranslator.cs --- a/Implab/Formats/JSON/StringTranslator.cs +++ b/Implab/src/Formats/Json/StringTranslator.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Implab.Formats.JSON { +namespace Implab.Formats.Json { /// /// Класс для преобразования экранированной строки JSON /// @@ -16,8 +16,8 @@ namespace Implab.Formats.JSON { static readonly int[] _hexMap; static StringTranslator() { - var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/' }; - var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/' }; + var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/', '"' }; + var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/', '"' }; _escMap = new char[chars.Max() + 1]; diff --git a/Implab/src/IDispatcher.cs b/Implab/src/IDispatcher.cs new file mode 100644 --- /dev/null +++ b/Implab/src/IDispatcher.cs @@ -0,0 +1,9 @@ +using System; + +namespace Implab { + public interface IDispatcher { + void Enqueue(Action job); + + void Enqueue(Action job, T arg); + } +} \ No newline at end of file diff --git a/Implab/IPromise.cs b/Implab/src/IPromise.cs rename from Implab/IPromise.cs rename to Implab/src/IPromise.cs --- a/Implab/IPromise.cs +++ b/Implab/src/IPromise.cs @@ -4,63 +4,42 @@ using System.Linq; using System.Text; namespace Implab { - public interface IPromise: ICancellable { + public interface IPromise { /// /// Тип результата, получаемого через данное обещание. /// - Type PromiseType { get; } + Type ResultType { get; } /// /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено. /// bool IsResolved { get; } - /// - /// Обещание было отменено. - /// - bool IsCancelled { get; } + bool IsRejected { get; } + + bool IsFulfilled { get; } /// /// Исключение возникшее в результате выполнения обещания, либо причина отмены. /// - Exception Error { get; } + Exception RejectReason { get; } /// /// Adds specified listeners to the current promise. /// /// The handler called on the successful promise completion. /// The handler is called if an error while completing the promise occurred. - /// The handler is called in case of promise cancellation. /// The current promise. - IPromise On(Action success, Action error, Action cancel); - IPromise On(Action success, Action error); - IPromise On(Action success); - - /// - /// Adds specified listeners to the current promise. - /// - /// The handler called on the specified events. - /// The combination of flags denoting the events for which the - /// handler shoud be called. - /// The current promise. - IPromise On(Action handler, PromiseEventType events); + void Then(IResolvable next); /// /// Преобразует результат обещания к заданному типу и возвращает новое обещание. /// IPromise Cast(); - /// - /// Синхронизирует текущий поток с обещанием. - /// void Join(); - /// - /// Синхронизирует текущий поток с обещанием. - /// - /// Время ожидания, по его истечению возникнет исключение. - /// Превышено время ожидания. + void Join(int timeout); - } } diff --git a/Implab/IPromiseT.cs b/Implab/src/IPromiseT.cs rename from Implab/IPromiseT.cs rename to Implab/src/IPromiseT.cs --- a/Implab/IPromiseT.cs +++ b/Implab/src/IPromiseT.cs @@ -3,23 +3,10 @@ namespace Implab { public interface IPromise : IPromise { - IPromise On(Action success, Action error, Action cancel); - - IPromise On(Action success, Action error); - - IPromise On(Action success); + void Then(IResolvable next); new T Join(); new T Join(int timeout); - - new IPromise On(Action success, Action error, Action cancel); - - new IPromise On(Action success, Action error); - - new IPromise On(Action success); - - new IPromise On(Action handler, PromiseEventType events); - } } diff --git a/Implab/src/IResolvable.cs b/Implab/src/IResolvable.cs new file mode 100644 --- /dev/null +++ b/Implab/src/IResolvable.cs @@ -0,0 +1,24 @@ +using System; + +namespace Implab { + /// + /// Deferred result, usually used by asynchronous services as the service part of the promise. + /// + public interface IResolvable { + + void Resolve(); + + /// + /// Reject the promise with the specified error. + /// + /// The reason why the promise is rejected. + /// + /// Some exceptions are treated in a special case: + /// is interpreted as call to method, + /// and is always unwrapped and its + /// is used as the reason to reject promise. + /// + void Reject(Exception error); + } +} + diff --git a/Implab/src/IResolvable`1.cs b/Implab/src/IResolvable`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/IResolvable`1.cs @@ -0,0 +1,11 @@ +using System; + +namespace Implab { + + public interface IResolvable { + void Resolve(T value); + + void Reject(Exception reason); + + } +} \ No newline at end of file diff --git a/Implab/src/Messaging/IConsumer.cs b/Implab/src/Messaging/IConsumer.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Messaging/IConsumer.cs @@ -0,0 +1,12 @@ +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Messaging { + public interface IConsumer { + T Receive(CancellationToken ct); + + Task ReceiveAsync(CancellationToken ct); + + bool TryReceive(out T message); + } +} \ No newline at end of file diff --git a/Implab/src/Messaging/IProducer.cs b/Implab/src/Messaging/IProducer.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Messaging/IProducer.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Messaging { + public interface IProducer { + void PostMessage(T message, CancellationToken ct); + + Task PostMessageAsync(T message, CancellationToken ct); + + void PostMessages(IEnumerable messages, CancellationToken ct); + + Task PostMessagesAsync(IEnumerable messages, CancellationToken ct); + } +} \ No newline at end of file diff --git a/Implab/Parallels/AsyncQueue.cs b/Implab/src/Parallels/AsyncQueue.cs rename from Implab/Parallels/AsyncQueue.cs rename to Implab/src/Parallels/AsyncQueue.cs --- a/Implab/Parallels/AsyncQueue.cs +++ b/Implab/src/Parallels/AsyncQueue.cs @@ -3,15 +3,16 @@ using System.Collections.Generic; using System; using System.Collections; using System.Diagnostics; +using System.Runtime.CompilerServices; namespace Implab.Parallels { public class AsyncQueue : IEnumerable { class Chunk { - public Chunk next; + public volatile Chunk next; - int m_low; - int m_hi; - int m_alloc; + volatile int m_low; + volatile int m_hi; + volatile int m_alloc; readonly int m_size; readonly T[] m_data; @@ -28,12 +29,15 @@ namespace Implab.Parallels { m_data[0] = value; } - public Chunk(int size, T[] data, int offset, int length, int alloc) { + public Chunk(int size, int allocated) { m_size = size; - m_hi = length; - m_alloc = alloc; + m_hi = allocated; + m_alloc = allocated; m_data = new T[size]; - Array.Copy(data, offset, m_data, 0, length); + } + + public void WriteData(T[] data, int offset, int dest, int length) { + Array.Copy(data, offset, m_data, dest, length); } public int Low { @@ -48,31 +52,38 @@ namespace Implab.Parallels { get { return m_size; } } - public bool TryEnqueue(T value, out bool extend) { - var alloc = Interlocked.Increment(ref m_alloc) - 1; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + void AwaitWrites(int mark) { + if (m_hi != mark) { + SpinWait spin = new SpinWait(); + do { + spin.SpinOnce(); + } while (m_hi != mark); + } + } - if (alloc >= m_size) { - extend = alloc == m_size; - return false; - } - - extend = false; + public bool TryEnqueue(T value) { + int alloc; + do { + alloc = m_alloc; + if (alloc >= m_size) + return false; + } while(alloc != Interlocked.CompareExchange(ref m_alloc, alloc + 1, alloc)); + m_data[alloc] = value; - while (alloc != Interlocked.CompareExchange(ref m_hi, alloc + 1, alloc)) { - // spin wait for commit - } + AwaitWrites(alloc); + m_hi = alloc + 1; + return true; } /// /// Prevents from allocating new space in the chunk and waits for all write operations to complete /// - public void Commit() { - var actual = Math.Min(Interlocked.Exchange(ref m_alloc, m_size + 1), m_size); - - while (m_hi != actual) - Thread.MemoryBarrier(); + public void Seal() { + var actual = Math.Min(Interlocked.Exchange(ref m_alloc, m_size), m_size); + AwaitWrites(actual); } public bool TryDequeue(out T value, out bool recycle) { @@ -84,44 +95,34 @@ namespace Implab.Parallels { recycle = (low == m_size); return false; } - } while(low != Interlocked.CompareExchange(ref m_low, low + 1, low)); + } while (low != Interlocked.CompareExchange(ref m_low, low + 1, low)); - recycle = (low == m_size - 1); + recycle = (low + 1 == m_size); value = m_data[low]; return true; } - public bool TryEnqueueBatch(T[] batch, int offset, int length, out int enqueued, out bool extend) { - //int alloc; - //int allocSize; - - var alloc = Interlocked.Add(ref m_alloc, length) - length; - if (alloc > m_size) { - // the chunk is full and someone already - // creating the new one - enqueued = 0; // nothing was added - extend = false; // the caller shouldn't try to extend the queue - return false; // nothing was added - } - - enqueued = Math.Min(m_size - alloc, length); - extend = length > enqueued; - - if (enqueued == 0) - return false; - - + public bool TryEnqueueBatch(T[] batch, int offset, int length, out int enqueued) { + int alloc; + do { + alloc = m_alloc; + if (alloc >= m_size) { + enqueued = 0; + return false; + } else { + enqueued = Math.Min(length, m_size - alloc); + } + } while (alloc != Interlocked.CompareExchange(ref m_alloc, alloc + enqueued, alloc)); + Array.Copy(batch, offset, m_data, alloc, enqueued); - while (alloc != Interlocked.CompareExchange(ref m_hi, alloc + enqueued, alloc)) { - // spin wait for commit - } - + AwaitWrites(alloc); + m_hi = alloc + enqueued; return true; } - public bool TryDequeueBatch(T[] buffer, int offset, int length,out int dequeued, out bool recycle) { + public bool TryDequeueBatch(T[] buffer, int offset, int length, out int dequeued, out bool recycle) { int low, hi, batchSize; do { @@ -129,15 +130,14 @@ namespace Implab.Parallels { hi = m_hi; if (low >= hi) { dequeued = 0; - recycle = (low == m_size); // recycling could be restarted and we need to signal again + recycle = (low == m_size); return false; } batchSize = Math.Min(hi - low, length); - } while(low != Interlocked.CompareExchange(ref m_low, low + batchSize, low)); + } while (low != Interlocked.CompareExchange(ref m_low, low + batchSize, low)); - recycle = (low == m_size - batchSize); dequeued = batchSize; - + recycle = (low + batchSize == m_size); Array.Copy(m_data, low, buffer, offset, batchSize); return true; @@ -149,32 +149,33 @@ namespace Implab.Parallels { } public const int DEFAULT_CHUNK_SIZE = 32; - public const int MAX_CHUNK_SIZE = 262144; + public const int MAX_CHUNK_SIZE = 256; Chunk m_first; Chunk m_last; + public AsyncQueue() { + m_first = m_last = new Chunk(DEFAULT_CHUNK_SIZE); + } + /// /// Adds the specified value to the queue. /// /// Tha value which will be added to the queue. - public virtual void Enqueue(T value) { + public void Enqueue(T value) { var last = m_last; - // spin wait to the new chunk - bool extend = true; - while (last == null || !last.TryEnqueue(value, out extend)) { + SpinWait spin = new SpinWait(); + while (!last.TryEnqueue(value)) { // try to extend queue - if (extend || last == null) { - var chunk = new Chunk(DEFAULT_CHUNK_SIZE, value); - if (EnqueueChunk(last, chunk)) - break; // success! exit! - last = m_last; + var chunk = new Chunk(DEFAULT_CHUNK_SIZE, value); + var t = Interlocked.CompareExchange(ref m_last, chunk, last); + if (t == last) { + last.next = chunk; + break; } else { - while (last == m_last) { - Thread.MemoryBarrier(); - } - last = m_last; + last = t; } + spin.SpinOnce(); } } @@ -184,67 +185,54 @@ namespace Implab.Parallels { /// The buffer which contains the data to be enqueued. /// The offset of the data in the buffer. /// The size of the data to read from the buffer. - public virtual void EnqueueRange(T[] data, int offset, int length) { + public void EnqueueRange(T[] data, int offset, int length) { if (data == null) throw new ArgumentNullException("data"); - if (length == 0) - return; if (offset < 0) throw new ArgumentOutOfRangeException("offset"); if (length < 1 || offset + length > data.Length) throw new ArgumentOutOfRangeException("length"); - var last = m_last; + while (length > 0) { + var last = m_last; + int enqueued; - bool extend; - int enqueued; - - while (length > 0) { - extend = true; - if (last != null && last.TryEnqueueBatch(data, offset, length, out enqueued, out extend)) { + if (last.TryEnqueueBatch(data, offset, length, out enqueued)) { length -= enqueued; offset += enqueued; } - if (extend) { - // there was no enough space in the chunk - // or there was no chunks in the queue + if (length > 0) { + // we have something to enqueue - while (length > 0) { - - var size = Math.Min(length, MAX_CHUNK_SIZE); + var tail = length % MAX_CHUNK_SIZE; - var chunk = new Chunk( - Math.Max(size, DEFAULT_CHUNK_SIZE), - data, - offset, - size, - length // length >= size - ); + var chunk = new Chunk(Math.Max(tail, DEFAULT_CHUNK_SIZE), tail); + + if (last != Interlocked.CompareExchange(ref m_last, chunk, last)) + continue; // we wasn't able to catch the writer, roundtrip - if (!EnqueueChunk(last, chunk)) { - // looks like the queue has been updated then proceed from the beginning - last = m_last; - break; - } + // we are lucky + // we can exclusively write our batch, the other writers will continue their work + + length -= tail; - // we have successfully added the new chunk - last = chunk; - length -= size; - offset += size; - } - } else { - // we don't need to extend the queue, if we successfully enqueued data - if (length == 0) - break; - - // if we need to wait while someone is extending the queue - // spinwait - while (last == m_last) { - Thread.MemoryBarrier(); + + for(var i = 0; i < length; i+= MAX_CHUNK_SIZE) { + var node = new Chunk(MAX_CHUNK_SIZE, MAX_CHUNK_SIZE); + node.WriteData(data, offset, 0, MAX_CHUNK_SIZE); + offset += MAX_CHUNK_SIZE; + // fence last.next is volatile + last.next = node; + last = node; } - last = m_last; + if (tail > 0) + chunk.WriteData(data, offset, 0, tail); + + // fence last.next is volatile + last.next = chunk; + return; } } } @@ -256,26 +244,21 @@ namespace Implab.Parallels { /// The value of the dequeued element. public bool TryDequeue(out T value) { var chunk = m_first; - bool recycle; - while (chunk != null) { + do { + bool recycle; var result = chunk.TryDequeue(out value, out recycle); - if (recycle) // this chunk is waste - RecycleFirstChunk(chunk); - else + if (recycle && chunk.next != null) { + // this chunk is waste + chunk = Interlocked.CompareExchange(ref m_first, chunk.next, chunk); + } else { return result; // this chunk is usable and returned actual result + } if (result) // this chunk is waste but the true result is always actual return true; - - // try again - chunk = m_first; - } - - // the queue is empty - value = default(T); - return false; + } while (true); } /// @@ -295,10 +278,9 @@ namespace Implab.Parallels { throw new ArgumentOutOfRangeException("length"); var chunk = m_first; - bool recycle; dequeued = 0; - while (chunk != null) { - + do { + bool recycle; int actual; if (chunk.TryDequeueBatch(buffer, offset, length, out actual, out recycle)) { offset += actual; @@ -306,18 +288,16 @@ namespace Implab.Parallels { dequeued += actual; } - if (recycle) // this chunk is waste - RecycleFirstChunk(chunk); - else if (actual == 0) - break; // the chunk is usable, but doesn't contain any data (it's the last chunk in the queue) + if (recycle && chunk.next != null) { + // this chunk is waste + chunk = Interlocked.CompareExchange(ref m_first, chunk.next, chunk); + } else { + chunk = null; + } if (length == 0) return true; - - // we still may dequeue something - // try again - chunk = m_first; - } + } while (chunk != null); return dequeued != 0; } @@ -339,131 +319,83 @@ namespace Implab.Parallels { throw new ArgumentOutOfRangeException("length"); var chunk = m_first; - bool recycle; - dequeued = 0; - - while (chunk != null) { + do { + bool recycle; + chunk.TryDequeueBatch(buffer, offset, length, out dequeued, out recycle); - int actual; - if (chunk.TryDequeueBatch(buffer, offset, length, out actual, out recycle)) { - dequeued = actual; + if (recycle && chunk.next != null) { + // this chunk is waste + chunk = Interlocked.CompareExchange(ref m_first, chunk.next, chunk); + } else { + chunk = null; } - if (recycle) // this chunk is waste - RecycleFirstChunk(chunk); - // if we have dequeued any data, then return if (dequeued != 0) return true; - // we still may dequeue something - // try again - chunk = m_first; - } + } while (chunk != null); return false; } - - bool EnqueueChunk(Chunk last, Chunk chunk) { - if (Interlocked.CompareExchange(ref m_last, chunk, last) != last) - return false; - - if (last != null) - last.next = chunk; - else { - m_first = chunk; - } - return true; - } - - void RecycleFirstChunk(Chunk first) { - var next = first.next; - - if (first != Interlocked.CompareExchange(ref m_first, next, first)) - return; - - if (next == null) { - - if (first != Interlocked.CompareExchange(ref m_last, null, first)) { - /*while (first.next == null) - Thread.MemoryBarrier();*/ - - // race - // someone already updated the tail, restore the pointer to the queue head - m_first = first; - } - // the tail is updated - } - - // we need to update the head - //Interlocked.CompareExchange(ref m_first, next, first); - // if the head is already updated then give up - //return; - - } + public void Clear() { // start the new queue var chunk = new Chunk(DEFAULT_CHUNK_SIZE); - do { - Thread.MemoryBarrier(); var first = m_first; - var last = m_last; - - if (last == null) // nothing to clear - return; - - if (first == null || (first.next == null && first != last)) // inconcistency + if (first.next == null && first != m_last) { continue; - - // here we will create inconsistency which will force others to spin - // and prevent from fetching. chunk.next = null - if (first != Interlocked.CompareExchange(ref m_first, chunk, first)) - continue;// inconsistent - - m_last = chunk; - - return; - - } while(true); - } - - public T[] Drain() { - // start the new queue - var chunk = new Chunk(DEFAULT_CHUNK_SIZE); - - do { - Thread.MemoryBarrier(); - var first = m_first; - var last = m_last; - - if (last == null) - return new T[0]; - - if (first == null || (first.next == null && first != last)) - continue; + } // here we will create inconsistency which will force others to spin // and prevent from fetching. chunk.next = null if (first != Interlocked.CompareExchange(ref m_first, chunk, first)) continue;// inconsistent - last = Interlocked.Exchange(ref m_last, chunk); + m_last = chunk; + return; + } while (true); + } + + public List Drain() { + Chunk chunk = null; + do { + var first = m_first; + // first.next is volatile + if (first.next == null) { + if (first != m_last) + continue; + else if (first.Hi == first.Low) + return new List(); + } + + // start the new queue + if (chunk == null) + chunk = new Chunk(DEFAULT_CHUNK_SIZE); + + // here we will create inconsistency which will force others to spin + // and prevent from fetching. chunk.next = null + if (first != Interlocked.CompareExchange(ref m_first, chunk, first)) + continue;// inconsistent + + var last = Interlocked.Exchange(ref m_last, chunk); return ReadChunks(first, last); - } while(true); + } while (true); } - - static T[] ReadChunks(Chunk chunk, object last) { + + static List ReadChunks(Chunk chunk, object last) { var result = new List(); - var buffer = new T[DEFAULT_CHUNK_SIZE]; + var buffer = new T[MAX_CHUNK_SIZE]; int actual; bool recycle; + SpinWait spin = new SpinWait(); while (chunk != null) { // ensure all write operations on the chunk are complete - chunk.Commit(); + chunk.Seal(); // we need to read the chunk using this way // since some client still may completing the dequeue @@ -475,12 +407,12 @@ namespace Implab.Parallels { chunk = null; } else { while (chunk.next == null) - Thread.MemoryBarrier(); + spin.SpinOnce(); chunk = chunk.next; } } - return result.ToArray(); + return result; } struct ArraySegmentCollection : ICollection { @@ -509,7 +441,7 @@ namespace Implab.Parallels { } public void CopyTo(T[] array, int arrayIndex) { - Array.Copy(m_data,m_offset,array,arrayIndex, m_length); + Array.Copy(m_data, m_offset, array, arrayIndex, m_length); } public bool Remove(T item) { diff --git a/Implab/Parallels/BlockingQueue.cs b/Implab/src/Parallels/BlockingQueue.cs rename from Implab/Parallels/BlockingQueue.cs rename to Implab/src/Parallels/BlockingQueue.cs --- a/Implab/Parallels/BlockingQueue.cs +++ b/Implab/src/Parallels/BlockingQueue.cs @@ -5,13 +5,13 @@ namespace Implab.Parallels { public class BlockingQueue : AsyncQueue { readonly object m_lock = new object(); - public override void Enqueue(T value) { + public void EnqueuePulse(T value) { base.Enqueue(value); lock (m_lock) Monitor.Pulse(m_lock); } - public override void EnqueueRange(T[] data, int offset, int length) { + public void EnqueueRangePulse(T[] data, int offset, int length) { base.EnqueueRange(data, offset, length); if (length > 1) lock (m_lock) @@ -54,7 +54,7 @@ namespace Implab.Parallels { } public T[] GetRange(int max, int timeout) { - Safe.ArgumentInRange(max, 1, Int32.MaxValue, "max"); + Safe.ArgumentInRange(max > 0 , nameof(max)); var buffer = new T[max]; int actual; @@ -83,7 +83,7 @@ namespace Implab.Parallels { } public T[] GetRange(int max) { - Safe.ArgumentInRange(max, 1, Int32.MaxValue, "max"); + Safe.ArgumentInRange(max > 0, nameof(max)); var buffer = new T[max]; int actual; diff --git a/Implab/Parallels/DispatchPool.cs b/Implab/src/Parallels/DispatchPool.cs rename from Implab/Parallels/DispatchPool.cs rename to Implab/src/Parallels/DispatchPool.cs diff --git a/Implab/Parallels/SharedLock.cs b/Implab/src/Parallels/SharedLock.cs rename from Implab/Parallels/SharedLock.cs rename to Implab/src/Parallels/SharedLock.cs diff --git a/Implab/Parallels/Signal.cs b/Implab/src/Parallels/Signal.cs rename from Implab/Parallels/Signal.cs rename to Implab/src/Parallels/Signal.cs diff --git a/Implab/src/Parallels/SimpleAsyncQueue.cs b/Implab/src/Parallels/SimpleAsyncQueue.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Parallels/SimpleAsyncQueue.cs @@ -0,0 +1,115 @@ +using System.Threading; +using System.Collections.Generic; +using System; +using System.Collections; + +namespace Implab.Parallels { + + /// + /// Very simple thred-safe FIFO queue based on the sinle linked list. + /// + /// + /// + /// This queue uses interlocked operations to add and remove nodes, + /// each node stores a single value. The queue provides mean performance, + /// moderate overhead and situable for a small amount of elements. + /// + public class SimpleAsyncQueue : IEnumerable { + class Node { + public Node(T value) { + this.value = value; + } + public readonly T value; + public volatile Node next; + } + + // the reader and the writer are maintained completely independent, + // the reader can read next item when m_first.next is not null + // the writer creates a new node, moves m_last to this node and + // only after that restores the reference from the previous node + // making the reader able to read the new node. + + volatile Node m_first; // position on the node which is already read + volatile Node m_last; // position on the node which is already written + + public SimpleAsyncQueue() { + m_first = m_last = new Node(default(T)); + } + + public void Enqueue(T value) { + var next = new Node(value); + + // Interlocaked.CompareExchange implies Thread.MemoryBarrier(); + // to ensure that the next node is completely constructed + var last = Interlocked.Exchange(ref m_last, next); + + // release-fence + last.next = next; + + } + + public bool TryDequeue(out T value) { + Node first = m_first; + Node next = first.next; + + if (next == null) { + value = default(T); + return false; + } + + var first2 = Interlocked.CompareExchange(ref m_first, next, first); + + if (first != first2) { + // head is updated by someone else + + SpinWait spin = new SpinWait(); + do { + first = first2; + next = first.next; + if (next == null) { + value = default(T); + return false; + } + + first2 = Interlocked.CompareExchange(ref m_first, next, first); + if (first == first2) + break; + spin.SpinOnce(); + } while (true); + } + + value = next.value; + return true; + } + + /// + /// Creates a thin copy of the current linked list. + /// + /// Iterating over the snapshot is thread safe and + /// will produce repeatble results. Each snapshot stores only + /// two references one for the first and one for last elements + /// from list. + /// Enumerable collection. + public IEnumerable Snapshot() { + var first = m_first; + var last = m_last; + + var current = m_first; + while(current != m_last) { + current = current.next; + yield return current.value; + } + } + + public IEnumerator GetEnumerator() { + for (var current = m_first.next; current != null; current = current.next) { + yield return current.value; + } + } + + IEnumerator IEnumerable.GetEnumerator() { + return GetEnumerator(); + } + + } +} diff --git a/Implab/src/Parallels/SyncContextDispatcher.cs b/Implab/src/Parallels/SyncContextDispatcher.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Parallels/SyncContextDispatcher.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading; + +namespace Implab { + public class SyncContextDispatcher : IDispatcher { + SynchronizationContext m_context; + public SyncContextDispatcher(SynchronizationContext context) { + Safe.ArgumentNotNull(context, nameof(context)); + m_context = context; + } + + public void Enqueue(Action job) { + m_context.Post((o) => job(), null); + } + + public void Enqueue(Action job, T arg) { + m_context.Post((o) => job((T)o), arg); + } + } +} \ No newline at end of file diff --git a/Implab/src/Parallels/ThreadPoolDispatcher.cs b/Implab/src/Parallels/ThreadPoolDispatcher.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Parallels/ThreadPoolDispatcher.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading; + +namespace Implab.Parallels { + public class ThreadPoolDispatcher : IDispatcher { + + public static ThreadPoolDispatcher Instance { get; private set; } = new ThreadPoolDispatcher(); + + private ThreadPoolDispatcher() { + } + + public void Enqueue(Action job) { + ThreadPool.QueueUserWorkItem((o) => job(), null); + } + + public void Enqueue(Action job, T arg) { + ThreadPool.QueueUserWorkItem((o) => job((T)o), arg); + } + } +} \ No newline at end of file diff --git a/Implab/src/Promise.cs b/Implab/src/Promise.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Promise.cs @@ -0,0 +1,222 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using Implab.Parallels; + +namespace Implab { + public class Promise : AbstractEvent, IPromise { + public static IDispatcher DefaultDispatcher { + get { + return ThreadPoolDispatcher.Instance; + } + } + + class ResolvableSignal : IResolvable { + public Signal Signal { get; private set; } + public ResolvableSignal() { + Signal = new Signal(); + } + + + public void Reject(Exception error) { + Signal.Set(); + } + + public void Resolve() { + Signal.Set(); + } + } + + PromiseState m_state; + + Exception m_error; + + public bool IsRejected { + get { + return m_state == PromiseState.Rejected; + } + } + + public bool IsFulfilled { + get { + return m_state == PromiseState.Fulfilled; + } + } + + public Exception RejectReason { + get { + return m_error; + } + } + + internal Promise() { + + } + + internal void ResolvePromise() { + if (BeginTransit()) { + m_state = PromiseState.Fulfilled; + CompleteTransit(); + } + } + + internal void RejectPromise(Exception reason) { + if (BeginTransit()) { + m_error = reason; + m_state = PromiseState.Rejected; + CompleteTransit(); + } + } + + + #region implemented abstract members of AbstractPromise + + protected override void SignalHandler(IResolvable handler) { + switch (m_state) { + case PromiseState.Fulfilled: + handler.Resolve(); + break; + case PromiseState.Rejected: + handler.Reject(RejectReason); + break; + default: + throw new InvalidOperationException(String.Format("Invalid promise signal: {0}", m_state)); + } + } + + protected void WaitResult(int timeout) { + if (!(IsResolved || GetFulfillSignal().Wait(timeout))) + throw new TimeoutException(); + } + + protected Signal GetFulfillSignal() { + var next = new ResolvableSignal(); + Then(next); + return next.Signal; + } + + #endregion + + + public Type ResultType { + get { + return typeof(void); + } + } + + + protected void Rethrow() { + Debug.Assert(m_error != null); + if (m_error is OperationCanceledException) + throw new OperationCanceledException("Operation cancelled", m_error); + else + throw new TargetInvocationException(m_error); + } + + public void Then(IResolvable next) { + AddHandler(next); + } + + public IPromise Cast() { + throw new InvalidCastException(); + } + + public void Join() { + WaitResult(-1); + if (IsRejected) + Rethrow(); + } + + public void Join(int timeout) { + WaitResult(timeout); + if (IsRejected) + Rethrow(); + } + + public static ResolvedPromise Resolve() { + return new ResolvedPromise(); + } + + public static ResolvedPromise Resolve(T result) { + return new ResolvedPromise(result); + } + + public static RejectedPromise Reject(Exception reason) { + return new RejectedPromise(reason); + } + + public static RejectedPromise Reject(Exception reason) { + return new RejectedPromise(reason); + } + + public static IPromise Create(PromiseExecutor executor) { + return Create(executor, CancellationToken.None); + } + + public static IPromise Create(PromiseExecutor executor, CancellationToken ct) { + Safe.ArgumentNotNull(executor, nameof(executor)); + if (!ct.CanBeCanceled) + return Create(executor); + + var d = new Deferred(); + + ct.Register(d.Cancel); + + try { + if (!ct.IsCancellationRequested) + executor(d); + } catch(Exception e) { + d.Reject(e); + } + return d.Promise; + } + + public static IPromise Create(PromiseExecutor executor) { + return Create(executor, CancellationToken.None); + } + + public static IPromise Create(PromiseExecutor executor, CancellationToken ct) { + Safe.ArgumentNotNull(executor, nameof(executor)); + + var d = new Deferred(); + + ct.Register(d.Cancel); + + try { + if (!ct.IsCancellationRequested) + executor(d); + } catch(Exception e) { + d.Reject(e); + } + return d.Promise; + } + + public static IPromise All(IEnumerable promises) { + var d = new Deferred(); + var all = new PromiseAll(d); + foreach (var promise in promises) { + all.AddPromise(promise); + if (all.Done) + break; + } + all.Complete(); + return all.ResultPromise; + } + + public static IPromise All(IEnumerable> promises, Func cleanup = null, Action cancel = null) { + var d = new Deferred(); + var all = new PromiseAll(d, cleanup, cancel); + foreach (var promise in promises) { + all.AddPromise(promise); + if (all.Done) + break; + } + all.Complete(); + return all.ResultPromise; + } + } +} + diff --git a/Implab/src/PromiseActionReaction.cs b/Implab/src/PromiseActionReaction.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseActionReaction.cs @@ -0,0 +1,92 @@ +using System; +using System.Diagnostics; + +namespace Implab { + class PromiseActionReaction : IResolvable { + + readonly Deferred m_next; + + readonly IDispatcher m_dispatcher; + + readonly Action m_fulfilled; + + readonly Action m_rejected; + + public IPromise Promise { + get { return m_next.Promise; } + } + + public PromiseActionReaction(Action fulfilled, Action rejected, Deferred next, IDispatcher dispatcher) { + m_next = next; + m_fulfilled = fulfilled; + m_rejected = rejected; + m_dispatcher = dispatcher; + } + + public void Resolve() { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(ResolveImpl); + else + ResolveImpl(); + } else { + m_next.Resolve(); + } + } + + void ResolveImpl() { + m_fulfilled(m_next); + } + + public void Reject(Exception error) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(RejectImpl, error); + else + RejectImpl(error); + } else { + m_next.Reject(error); + } + } + + void RejectImpl(Exception error) { + m_rejected(error, m_next); + } + + public static PromiseActionReaction Create(Action fulfilled, Action rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Func fulfilled, Action rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Action fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Func fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseActionReaction`1.cs b/Implab/src/PromiseActionReaction`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseActionReaction`1.cs @@ -0,0 +1,91 @@ +using System; +using System.Diagnostics; + +namespace Implab { + class PromiseActionReaction : IResolvable { + readonly Deferred m_next; + + readonly IDispatcher m_dispatcher; + + readonly Action m_fulfilled; + + readonly Action m_rejected; + + public IPromise Promise { + get { return m_next.Promise; } + } + + public PromiseActionReaction(Action fulfilled, Action rejected, Deferred next, IDispatcher dispatcher) { + m_next = next; + m_fulfilled = fulfilled; + m_rejected = rejected; + m_dispatcher = dispatcher; + } + + public void Resolve(T result) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(ResolveImpl, result); + else + ResolveImpl(result); + } else { + m_next.Resolve(); + } + } + + void ResolveImpl (T result) { + m_fulfilled(result, m_next); + } + + public void Reject(Exception error) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(RejectImpl, error); + else + RejectImpl(error); + } else { + m_next.Reject(error); + } + } + + void RejectImpl(Exception error) { + m_rejected(error, m_next); + } + + public static PromiseActionReaction Create(Action fulfilled, Action rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Func fulfilled, Action rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Action fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseActionReaction Create(Func fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseActionReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseAll.cs b/Implab/src/PromiseAll.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseAll.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading; + +namespace Implab +{ + class PromiseAll : IResolvable { + int m_count; + + readonly Deferred m_deferred; + + public bool Done { + get { return m_deferred.Promise.IsResolved; } + } + + public IPromise ResultPromise { + get { return m_deferred.Promise; } + } + + public void AddPromise(IPromise promise) { + Interlocked.Increment(ref m_count); + } + + public PromiseAll(Deferred deferred) { + m_deferred = deferred; + } + + public void Resolve() { + if (Interlocked.Decrement(ref m_count) == 0) + m_deferred.Resolve(); + } + + public void Complete() { + Resolve(); + } + + public void Reject(Exception error) { + m_deferred.Reject(error); + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseAll`1.cs b/Implab/src/PromiseAll`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseAll`1.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace Implab { + class PromiseAll : IResolvable { + + int m_count; + + readonly List> m_promises = new List>(); + + readonly Deferred m_deferred; + + IPromise m_result; + + readonly Func m_cleanup; + + readonly Action m_cancel; + + public bool Done { + get { return m_deferred.Promise.IsResolved && m_cleanup == null; } + } + + public IPromise ResultPromise { + get { return m_result; } + } + + public void AddPromise(IPromise promise) { + Interlocked.Increment(ref m_count); + promise.Then(this); + } + + public PromiseAll(Deferred deferred, Func cleanup, Action cancel) { + m_deferred = deferred; + m_cancel = cancel; + m_cleanup = cleanup; + } + + public void Resolve() { + if (Interlocked.Decrement(ref m_count) == 0) + m_deferred.Resolve(GetResults()); + } + + public void Reject(Exception error) { + m_deferred.Reject(error); + } + + public void Complete() { + if (m_cancel != null || m_cleanup != null) + m_result = m_deferred.Promise.Catch(CleanupResults); + else + m_result = m_deferred.Promise; + } + + IPromise CleanupResults(Exception reason) { + var errors = new List(); + errors.Add(reason); + + if (m_cancel != null) + try { + m_cancel(); + } catch (Exception e) { + errors.Add(e); + } + + if (m_cleanup != null) { + return Promise.All( + m_promises.Select(p => p + .Then(m_cleanup, e => { }) + .Catch(e => { + errors.Add(e); + }) + ) + ).Then(new Func(() => { + throw new AggregateException(errors); + }), (Func)null); + } else { + return Promise.Reject(errors.Count > 1 ? new AggregateException(errors) : reason); + } + } + + T[] GetResults() { + var results = new T[m_promises.Count]; + for (var i = 0; i < results.Length; i++) + results[i] = m_promises[i].Join(); + return results; + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseAwaiter.cs b/Implab/src/PromiseAwaiter.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseAwaiter.cs @@ -0,0 +1,62 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading; +using Implab.Parallels; + +namespace Implab +{ + public struct PromiseAwaiter : INotifyCompletion { + class PromiseEvent : IResolvable { + IDispatcher m_dispatcher; + + Action m_handler; + + public PromiseEvent(Action handler, IDispatcher dispatcher) { + m_handler = handler; + m_dispatcher = dispatcher; + } + + public void Resolve() { + m_dispatcher.Enqueue(m_handler); + } + + public void Reject(Exception error) { + m_dispatcher.Enqueue(m_handler); + } + } + + readonly IPromise m_promise; + readonly IDispatcher m_dispatcher; + + public PromiseAwaiter(IPromise promise, IDispatcher dispatcher) { + m_promise = promise; + m_dispatcher = dispatcher; + } + + public PromiseAwaiter(IPromise promise) { + m_promise = promise; + m_dispatcher = GetDispatcher(); + } + + public void OnCompleted (Action continuation) { + if (m_promise != null) + m_promise.Then(new PromiseEvent(continuation, GetDispatcher())); + } + + public void GetResult() { + m_promise.Join(); + } + + static IDispatcher GetDispatcher() { + if(SynchronizationContext.Current == null) + return ThreadPoolDispatcher.Instance; + return new SyncContextDispatcher(SynchronizationContext.Current); + } + + public bool IsCompleted { + get { + return m_promise.IsResolved; + } + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseAwaiter`1.cs b/Implab/src/PromiseAwaiter`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseAwaiter`1.cs @@ -0,0 +1,62 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading; +using Implab.Parallels; + +namespace Implab { + public struct PromiseAwaiter : INotifyCompletion { + class PromiseEvent : IResolvable { + IDispatcher m_dispatcher; + + Action m_handler; + + public PromiseEvent(Action handler, IDispatcher dispatcher) { + m_handler = handler; + m_dispatcher = dispatcher; + } + + public void Resolve(T result) { + m_dispatcher.Enqueue(m_handler); + } + + public void Reject(Exception error) { + m_dispatcher.Enqueue(m_handler); + } + } + + readonly IPromise m_promise; + + readonly IDispatcher m_dispatcher; + + public PromiseAwaiter(IPromise promise) { + m_promise = promise; + m_dispatcher = GetDispatcher(); + } + + public PromiseAwaiter(IPromise promise, IDispatcher dispatcher) { + m_promise = promise; + m_dispatcher = dispatcher; + } + + public void OnCompleted(Action continuation) { + if (m_promise != null) + m_promise.Then(new PromiseEvent(continuation, GetDispatcher())); + } + + public T GetResult() { + return m_promise.Join(); + } + + static IDispatcher GetDispatcher() { + if (SynchronizationContext.Current == null) + return ThreadPoolDispatcher.Instance; + return new SyncContextDispatcher(SynchronizationContext.Current); + } + + public bool IsCompleted { + get { + return m_promise.IsResolved; + } + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseExecutor.cs b/Implab/src/PromiseExecutor.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseExecutor.cs @@ -0,0 +1,3 @@ +namespace Implab { + public delegate void PromiseExecutor(Deferred deferred); +} \ No newline at end of file diff --git a/Implab/src/PromiseExecutor`1.cs b/Implab/src/PromiseExecutor`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseExecutor`1.cs @@ -0,0 +1,3 @@ +namespace Implab { + public delegate void PromiseExecutor(Deferred d); +} \ No newline at end of file diff --git a/Implab/PromiseExtensions.cs b/Implab/src/PromiseExtensions.cs rename from Implab/PromiseExtensions.cs rename to Implab/src/PromiseExtensions.cs --- a/Implab/PromiseExtensions.cs +++ b/Implab/src/PromiseExtensions.cs @@ -2,288 +2,225 @@ using System; using Implab.Diagnostics; using System.Collections.Generic; +using System.Linq; namespace Implab { public static class PromiseExtensions { - public static IPromise DispatchToCurrentContext(this IPromise that) { - Safe.ArgumentNotNull(that, "that"); - var context = SynchronizationContext.Current; - if (context == null) - return that; + + public static IPromise Then(this IPromise that, Action fulfilled, Action rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - var p = new SyncContextPromise(context); - p.CancellationRequested(that.Cancel); + public static IPromise Then(this IPromise that, Action fulfilled) { + var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - that.On( - p.Resolve, - p.Reject, - p.CancelOperation - ); - return p; + public static IPromise Then(this IPromise that, Action fulfilled, Func rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise DispatchToContext(this IPromise that, SynchronizationContext context) { - Safe.ArgumentNotNull(that, "that"); - Safe.ArgumentNotNull(context, "context"); - - var p = new SyncContextPromise(context); - p.CancellationRequested(that.Cancel); + public static IPromise Then(this IPromise that, Func fulfilled, Action rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - that.On( - p.Resolve, - p.Reject, - p.CancelOperation - ); - return p; + public static IPromise Then(this IPromise that, Func fulfilled) { + var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - /// - /// Ensures the dispatched. - /// - /// The dispatched. - /// That. - /// Head. - /// Cleanup. - /// The 1st type parameter. - /// The 2nd type parameter. - public static TPromise EnsureDispatched(this TPromise that, IPromise head, Action cleanup) where TPromise : IPromise{ - Safe.ArgumentNotNull(that, "that"); - Safe.ArgumentNotNull(head, "head"); + public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - that.On(() => head.On(cleanup), PromiseEventType.Cancelled); + public static IPromise Then(this IPromise that, Action fulfilled, Action rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - return that; + public static IPromise Then(this IPromise that, Action fulfilled) { + var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static AsyncCallback AsyncCallback(this Promise that, Func callback) { - Safe.ArgumentNotNull(that, "that"); - Safe.ArgumentNotNull(callback, "callback"); - var op = TraceContext.Instance.CurrentOperation; - return ar => { - TraceContext.Instance.EnterLogicalOperation(op,false); - try { - that.Resolve(callback(ar)); - } catch (Exception err) { - that.Reject(err); - } finally { - TraceContext.Instance.Leave(); - } - }; + public static IPromise Then(this IPromise that, Action fulfilled, Func rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - static void CancelByTimeoutCallback(object cookie) { - ((ICancellable)cookie).Cancel(new TimeoutException()); + public static IPromise Then(this IPromise that, Func fulfilled, Action rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - /// - /// Cancells promise after the specified timeout is elapsed. - /// - /// The promise to cancel on timeout. - /// The timeout in milliseconds. - /// The 1st type parameter. - public static TPromise Timeout(this TPromise that, int milliseconds) where TPromise : IPromise { - Safe.ArgumentNotNull(that, "that"); - var timer = new Timer(CancelByTimeoutCallback, that, milliseconds, -1); - that.On(timer.Dispose, PromiseEventType.All); - return that; + public static IPromise Then(this IPromise that, Func fulfilled) { + var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } + + public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { + var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Bundle(this ICollection that) { - Safe.ArgumentNotNull(that, "that"); - - int count = that.Count; - int errors = 0; - var medium = new Promise(); + public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - if (count == 0) { - medium.Resolve(); - return medium; - } - - medium.On(() => { - foreach(var p2 in that) - p2.Cancel(); - }, PromiseEventType.ErrorOrCancel); + public static IPromise Then(this IPromise that, Func fulfilled) { + var reaction = PromiseFuncReaction.Create(fulfilled, (Func)null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - foreach (var p in that) - p.On( - () => { - if (Interlocked.Decrement(ref count) == 0) - medium.Resolve(); - }, - error => { - if (Interlocked.Increment(ref errors) == 1) - medium.Reject( - new Exception("The dependency promise is failed", error) - ); - }, - reason => { - if (Interlocked.Increment(ref errors) == 1) - medium.Cancel( - new Exception("The dependency promise is cancelled") - ); - } - ); + public static IPromise Then(this IPromise that, Func fulfilled, Func> rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - return medium; + public static IPromise Then(this IPromise that, Func> fulfilled, Func rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } + + public static IPromise Then(this IPromise that, Func> fulfilled) { + var reaction = PromiseFuncReaction.Create(fulfilled, (Func)null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Bundle(this ICollection> that) { - Safe.ArgumentNotNull(that, "that"); - - int count = that.Count; - int errors = 0; - var medium = new Promise(); - var results = new T[that.Count]; - - medium.On(() => { - foreach(var p2 in that) - p2.Cancel(); - }, PromiseEventType.ErrorOrCancel); + public static IPromise Then(this IPromise that, Func> fulfilled, Func> rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - int i = 0; - foreach (var p in that) { - var idx = i; - p.On( - x => { - results[idx] = x; - if (Interlocked.Decrement(ref count) == 0) - medium.Resolve(results); - }, - error => { - if (Interlocked.Increment(ref errors) == 1) - medium.Reject( - new Exception("The dependency promise is failed", error) - ); - }, - reason => { - if (Interlocked.Increment(ref errors) == 1) - medium.Cancel( - new Exception("The dependency promise is cancelled", reason) - ); - } - ); - i++; - } + public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } - return medium; + public static IPromise Then(this IPromise that, Func fulfilled) { + var reaction = PromiseFuncReaction.Create(fulfilled, (Func)null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; + } + + public static IPromise Then(this IPromise that, Func fulfilled, Func> rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Then(this IPromise that, Action success, Action error, Action cancel) { - Safe.ArgumentNotNull(that, "that"); - - var d = new ActionTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - d.CancellationRequested(that.Cancel); - return d; + public static IPromise Then(this IPromise that, Func> fulfilled, Func rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Then(this IPromise that, Action success, Action error) { - return Then(that, success, error, null); + public static IPromise Then(this IPromise that, Func> fulfilled) { + var reaction = PromiseFuncReaction.Create(fulfilled, (Func)null, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Then(this IPromise that, Action success) { - return Then(that, success, null, null); + public static IPromise Then(this IPromise that, Func> fulfilled, Func> rejected) { + var reaction = PromiseFuncReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher); + that.Then(reaction); + return reaction.Promise; } - public static IPromise Then(this IPromise that, Func success, Func error, Func cancel) { - Safe.ArgumentNotNull(that, "that"); - - var d = new FuncTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - d.CancellationRequested(that.Cancel); - return d; + public static IPromise Catch(this IPromise that, Action rejected) { + return Then(that, null, rejected); } - public static IPromise Then(this IPromise that, Func success, Func error) { - return Then(that, success, error, null); + public static IPromise Catch(this IPromise that, Func rejected) { + return Then(that, null, rejected); } - public static IPromise Then(this IPromise that, Func success) { - return Then(that, success, null, null); + public static IPromise Catch(this IPromise that, Func rejected) { + return Then(that, (Func)null, rejected); } - public static IPromise Then(this IPromise that, Func success, Func error, Func cancel) { - Safe.ArgumentNotNull(that, "that"); - var d = new FuncTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - d.CancellationRequested(that.Cancel); - return d; + public static IPromise Catch(this IPromise that, Func> rejected) { + return Then(that, (Func)null, rejected); } - public static IPromise Then(this IPromise that, Func success, Func error) { - return Then(that, success, error, null); + public static IPromise Catch(this IPromise that, Func rejected) { + return Then(that, (Func)null, rejected); } - public static IPromise Then(this IPromise that, Func success) { - return Then(that, success, null, null); + public static IPromise Catch(this IPromise that, Func> rejected) { + return Then(that, (Func)null, rejected); } - #region chain traits - public static IPromise Chain(this IPromise that, Func success, Func error, Func cancel) { - Safe.ArgumentNotNull(that, "that"); - - var d = new ActionChainTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - d.CancellationRequested(that.Cancel); - return d; + public static IPromise Finally(this IPromise that, Action final) { + return Then(that, final, e => { + final(); + throw e.Rethrow(); + }); } - public static IPromise Chain(this IPromise that, Func success, Func error) { - return Chain(that, success, error, null); - } - - public static IPromise Chain(this IPromise that, Func success) { - return Chain(that, success, null, null); + public static IPromise Finally(this IPromise that, Func final) { + return Then(that, final, e => { + final(); + throw e.Rethrow(); + }); } - public static IPromise Chain(this IPromise that, Func> success, Func> error, Func> cancel) { - Safe.ArgumentNotNull(that, "that"); - - var d = new FuncChainTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - if (success != null) - d.CancellationRequested(that.Cancel); - return d; - } - - public static IPromise Chain(this IPromise that, Func> success, Func> error) { - return Chain(that, success, error, null); - } - - public static IPromise Chain(this IPromise that, Func> success) { - return Chain(that, success, null, null); + public static IPromise Finally(this IPromise that, Action final) { + return Then(that, x => { + final(); + return x; + }, new Func(e => { + final(); + throw e.Rethrow(); + })); } - public static IPromise Chain(this IPromise that, Func> success, Func> error, Func> cancel) { - Safe.ArgumentNotNull(that, "that"); - var d = new FuncChainTask(success, error, cancel, false); - that.On(d.Resolve, d.Reject, d.CancelOperation); - if (success != null) - d.CancellationRequested(that.Cancel); - return d; - } - - public static IPromise Chain(this IPromise that, Func> success, Func> error) { - return Chain(that, success, error, null); + public static IPromise Finally(this IPromise that, Func final) { + return Then(that, x => { + return final() + .Then(() => x); + }, new Func>(e => { + return final() + .Then(new Func(() => { + throw e.Rethrow(); + })); + })); } - public static IPromise Chain(this IPromise that, Func> success) { - return Chain(that, success, null, null); + public static PromiseAwaiter GetAwaiter(this IPromise that) { + Safe.ArgumentNotNull(that, nameof(that)); + return new PromiseAwaiter(that); } - #endregion - - - #if NET_4_5 - public static PromiseAwaiter GetAwaiter(this IPromise that) { - Safe.ArgumentNotNull(that, "that"); - + Safe.ArgumentNotNull(that, nameof(that)); return new PromiseAwaiter(that); } - #endif } } diff --git a/Implab/src/PromiseFuncReaction`1.cs b/Implab/src/PromiseFuncReaction`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseFuncReaction`1.cs @@ -0,0 +1,91 @@ +using System; +using System.Diagnostics; + +namespace Implab { + class PromiseFuncReaction : IResolvable { + readonly Deferred m_next; + + readonly IDispatcher m_dispatcher; + + readonly Action> m_fulfilled; + + readonly Action> m_rejected; + + public IPromise Promise { + get { return m_next.Promise; } + } + + public PromiseFuncReaction(Action> fulfilled, Action> rejected, Deferred next, IDispatcher dispatcher) { + m_next = next; + m_fulfilled = fulfilled; + m_rejected = rejected; + m_dispatcher = dispatcher; + } + + public void Resolve() { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(ResolveImpl); + else + ResolveImpl(); + } else { + m_next.Resolve(default(TRet)); + } + } + + void ResolveImpl () { + m_fulfilled(m_next); + } + + public void Reject(Exception error) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(RejectImpl, error); + else + RejectImpl(error); + } else { + m_next.Reject(error); + } + } + + void RejectImpl(Exception error) { + m_rejected(error, m_next); + } + + public static PromiseFuncReaction Create(Func fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func> fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func fulfilled, Func> rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func> fulfilled, Func> rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseFuncReaction`2.cs b/Implab/src/PromiseFuncReaction`2.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseFuncReaction`2.cs @@ -0,0 +1,97 @@ +using System; +using System.Diagnostics; + +namespace Implab { + class PromiseFuncReaction : IResolvable { + readonly Deferred m_next; + + readonly IDispatcher m_dispatcher; + + readonly Action> m_fulfilled; + + readonly Action> m_rejected; + + public IPromise Promise { + get { return m_next.Promise; } + } + + public PromiseFuncReaction(Action> fulfilled, Action> rejected, Deferred next, IDispatcher dispatcher) { + m_next = next; + m_fulfilled = fulfilled; + m_rejected = rejected; + m_dispatcher = dispatcher; + } + + public void Resolve(TIn result) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(ResolveImpl, result); + else + ResolveImpl(result); + } else { + try { + m_next.Resolve((TRet)(object)result); + } catch(Exception error) { + // handle cast exceptions + m_next.Reject(error); + } + } + } + + void ResolveImpl (TIn result) { + m_fulfilled(result, m_next); + } + + public void Reject(Exception error) { + if (m_fulfilled != null) { + if (m_dispatcher != null) + m_dispatcher.Enqueue(RejectImpl, error); + else + RejectImpl(error); + } else { + m_next.Reject(error); + } + } + + void RejectImpl(Exception error) { + m_rejected(error, m_next); + } + + + public static PromiseFuncReaction Create(Func fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func> fulfilled, Func rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func fulfilled, Func> rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + + public static PromiseFuncReaction Create(Func> fulfilled, Func> rejected, IDispatcher dispatcher) { + return new PromiseFuncReaction( + fulfilled != null ? PromiseHandler.Create(fulfilled) : null, + rejected != null ? PromiseHandler.Create(rejected) : null, + new Deferred(), + dispatcher + ); + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseHandler.cs b/Implab/src/PromiseHandler.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseHandler.cs @@ -0,0 +1,102 @@ +using System; +using System.Diagnostics; + +namespace Implab { + class PromiseHandler { + public static Action Create(Action handler) { + Debug.Assert(handler != null); + + return (v, next) => { + try { + handler(v); + next.Resolve(); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action Create(Func handler) { + Debug.Assert(handler != null); + + return (v, next) => { + try { + next.Resolve(handler(v)); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action> Create(Func handler) { + Debug.Assert(handler != null); + + return (v, next) => { + try { + next.Resolve(handler(v)); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action> Create(Func> handler) { + Debug.Assert(handler != null); + return (v, next) => { + try { + next.Resolve(handler(v)); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action Create(Action handler) { + Debug.Assert(handler != null); + + return (next) => { + try { + handler(); + next.Resolve(); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action Create(Func handler) { + Debug.Assert(handler != null); + + return (next) => { + try { + next.Resolve(handler()); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action> Create(Func handler) { + Debug.Assert(handler != null); + + return (next) => { + try { + next.Resolve(handler()); + } catch (Exception err) { + next.Reject(err); + } + }; + } + + public static Action> Create(Func> handler) { + Debug.Assert(handler != null); + return (next) => { + try { + next.Resolve(handler()); + } catch (Exception err) { + next.Reject(err); + } + }; + } + } +} \ No newline at end of file diff --git a/Implab/src/PromiseState.cs b/Implab/src/PromiseState.cs new file mode 100644 --- /dev/null +++ b/Implab/src/PromiseState.cs @@ -0,0 +1,9 @@ +namespace Implab { + public enum PromiseState { + Pending, + + Fulfilled, + + Rejected + } +} \ No newline at end of file diff --git a/Implab/PromiseTransientException.cs b/Implab/src/PromiseTransientException.cs rename from Implab/PromiseTransientException.cs rename to Implab/src/PromiseTransientException.cs diff --git a/Implab/src/Promise`1.cs b/Implab/src/Promise`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Promise`1.cs @@ -0,0 +1,159 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using Implab.Parallels; + +namespace Implab { + public class Promise : AbstractEvent>, IPromise { + + class ResolvableSignal : IResolvable { + public Signal Signal { get; private set; } + public ResolvableSignal() { + Signal = new Signal(); + } + + + public void Reject(Exception error) { + Signal.Set(); + } + + public void Resolve(T result) { + Signal.Set(); + } + } + + class ResolvableWrapper : IResolvable { + readonly IResolvable m_resolvable; + public ResolvableWrapper(IResolvable resolvable) { + m_resolvable = resolvable; + } + + public void Reject(Exception reason) { + m_resolvable.Reject(reason); + } + + public void Resolve(T value) { + m_resolvable.Resolve(); + } + } + + PromiseState m_state; + + T m_result; + + Exception m_error; + + public bool IsRejected { + get { + return m_state == PromiseState.Rejected; + } + } + + public bool IsFulfilled { + get { + return m_state == PromiseState.Fulfilled; + } + } + + public Exception RejectReason { + get { + return m_error; + } + } + + + internal void ResolvePromise(T result) { + if (BeginTransit()) { + m_result = result; + m_state = PromiseState.Fulfilled; + CompleteTransit(); + } + } + + internal void RejectPromise(Exception reason) { + if (BeginTransit()) { + m_error = reason; + m_state = PromiseState.Rejected; + CompleteTransit(); + } + } + + + #region implemented abstract members of AbstractPromise + + protected override void SignalHandler(IResolvable handler) { + switch (m_state) { + case PromiseState.Fulfilled: + handler.Resolve(m_result); + break; + case PromiseState.Rejected: + handler.Reject(RejectReason); + break; + default: + throw new InvalidOperationException(String.Format("Invalid promise signal: {0}", m_state)); + } + } + + protected void WaitResult(int timeout) { + if (!(IsResolved || GetFulfillSignal().Wait(timeout))) + throw new TimeoutException(); + } + + protected Signal GetFulfillSignal() { + var next = new ResolvableSignal(); + Then(next); + return next.Signal; + } + + #endregion + + public Type ResultType { + get { + return typeof(void); + } + } + + + protected void Rethrow() { + if (m_error is OperationCanceledException) + throw new OperationCanceledException("Operation cancelled", m_error); + else + throw new TargetInvocationException(m_error); + } + + public void Then(IResolvable next) { + AddHandler(next); + } + + public void Then(IResolvable next) { + AddHandler(new ResolvableWrapper(next)); + } + + public IPromise Cast() { + return (IPromise)this; + } + + void IPromise.Join() { + Join(); + } + + void IPromise.Join(int timeout) { + Join(timeout); + } + + public T Join() { + WaitResult(-1); + if (IsRejected) + Rethrow(); + return m_result; + } + + public T Join(int timeout) { + WaitResult(timeout); + if (IsRejected) + Rethrow(); + return m_result; + } + } +} + diff --git a/Implab/src/RejectedPromise.cs b/Implab/src/RejectedPromise.cs new file mode 100644 --- /dev/null +++ b/Implab/src/RejectedPromise.cs @@ -0,0 +1,38 @@ +using System; + +namespace Implab +{ + public struct RejectedPromise : IPromise { + readonly Exception m_reason; + + public Type ResultType => typeof(void); + + public bool IsResolved => true; + + public bool IsRejected => true; + + public bool IsFulfilled => false; + + public Exception RejectReason => m_reason; + + public RejectedPromise(Exception reason) { + m_reason = reason; + } + + public IPromise Cast() { + throw new InvalidCastException(); + } + + public void Join() { + throw m_reason.Wrap(); + } + + public void Join(int timeout) { + throw m_reason.Wrap(); + } + + public void Then(IResolvable next) { + next.Reject(m_reason); + } + } +} \ No newline at end of file diff --git a/Implab/src/RejectedPromise`1.cs b/Implab/src/RejectedPromise`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/RejectedPromise`1.cs @@ -0,0 +1,50 @@ +using System; + +namespace Implab +{ + public struct RejectedPromise : IPromise { + readonly Exception m_reason; + + public Type ResultType => typeof(void); + + public bool IsResolved => true; + + public bool IsRejected => true; + + public bool IsFulfilled => false; + + public Exception RejectReason => m_reason; + + public RejectedPromise(Exception reason) { + m_reason = reason; + } + + public IPromise Cast() { + return (IPromise)(IPromise)this; + } + + void IPromise.Join() { + throw m_reason.Wrap(); + } + + void IPromise.Join(int timeout) { + throw m_reason.Wrap(); + } + + public T Join() { + throw m_reason.Wrap(); + } + + public T Join(int timeout) { + throw m_reason.Wrap(); + } + + public void Then(IResolvable next) { + next.Reject(m_reason); + } + + public void Then(IResolvable next) { + next.Reject(m_reason); + } + } +} \ No newline at end of file diff --git a/Implab/src/ResolvedPromise.cs b/Implab/src/ResolvedPromise.cs new file mode 100644 --- /dev/null +++ b/Implab/src/ResolvedPromise.cs @@ -0,0 +1,30 @@ +using System; + +namespace Implab +{ + public struct ResolvedPromise : IPromise { + public Type ResultType => typeof(void); + + public bool IsResolved => true; + + public bool IsRejected => false; + + public bool IsFulfilled => true; + + public Exception RejectReason => null; + + public IPromise Cast() { + throw new InvalidCastException(); + } + + public void Join() { + } + + public void Join(int timeout) { + } + + public void Then(IResolvable next) { + next.Resolve(); + } + } +} \ No newline at end of file diff --git a/Implab/src/ResolvedPromise`1.cs b/Implab/src/ResolvedPromise`1.cs new file mode 100644 --- /dev/null +++ b/Implab/src/ResolvedPromise`1.cs @@ -0,0 +1,47 @@ +using System; + +namespace Implab { + public struct ResolvedPromise : IPromise { + T m_result; + + public Type ResultType => typeof(T); + + public bool IsResolved => true; + + public bool IsRejected => false; + + public bool IsFulfilled => true; + + public Exception RejectReason => null; + + public ResolvedPromise(T result) { + m_result = result; + } + + public IPromise Cast() { + return (IPromise)(IPromise)this; + } + + void IPromise.Join() { + } + + void IPromise.Join(int timeout) { + } + + public T Join() { + return m_result; + } + + public T Join(int timeout) { + return m_result; + } + + public void Then(IResolvable next) { + next.Resolve(m_result); + } + + public void Then(IResolvable next) { + next.Resolve(); + } + } +} \ No newline at end of file diff --git a/Implab/Safe.cs b/Implab/src/Safe.cs rename from Implab/Safe.cs rename to Implab/src/Safe.cs --- a/Implab/Safe.cs +++ b/Implab/src/Safe.cs @@ -4,16 +4,26 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Diagnostics; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Threading; + +#if NET_4_5 +using System.Threading.Tasks; +#endif namespace Implab { public static class Safe { + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentAssert(bool condition, string paramName) { if (!condition) throw new ArgumentException("The parameter is invalid", paramName); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentMatch(string value, string paramName, Regex rx) { if (rx == null) throw new ArgumentNullException("rx"); @@ -21,108 +31,163 @@ namespace Implab throw new ArgumentException(String.Format("The prameter value must match {0}", rx), paramName); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentNotEmpty(string value, string paramName) { if (String.IsNullOrEmpty(value)) throw new ArgumentException("The parameter can't be empty", paramName); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentNotEmpty(T[] value, string paramName) { if (value == null || value.Length == 0) throw new ArgumentException("The array must be not emty", paramName); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentNotNull(object value, string paramName) { if (value == null) throw new ArgumentNullException(paramName); } - public static void ArgumentInRange(int value, int min, int max, string paramName) { - if (value < min || value > max) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void ArgumentGreaterEqThan(int value, int min, string paramName) { + if (value < min) throw new ArgumentOutOfRangeException(paramName); } + public static object CreateDefaultValue(Type type) { + if (type.IsValueType) + return Activator.CreateInstance(type); + + return null; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ArgumentInRange(bool condition, string paramName) { + if (!condition) + throw new ArgumentOutOfRangeException(paramName); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ArgumentOfType(object value, Type type, string paramName) { if (!type.IsInstanceOfType(value)) throw new ArgumentException(String.Format("The parameter must be of type {0}", type), paramName); } public static void Dispose(params IDisposable[] objects) { - foreach (var d in objects) - if (d != null) - d.Dispose(); + if (objects != null) + foreach (var d in objects) + if (d != null) + d.Dispose(); } public static void Dispose(params object[] objects) { - foreach (var obj in objects) { - var d = obj as IDisposable; - if (d != null) - d.Dispose(); - } + if (objects != null) + foreach (var obj in objects) { + var d = obj as IDisposable; + if (d != null) + d.Dispose(); + } + } + + public static void DisposeCollection(IEnumerable objects) { + if (objects != null) + foreach (var d in objects) + Dispose(d); + } + + public static void DisposeCollection(IEnumerable objects) { + if (objects != null) + foreach (var d in objects) + Dispose(d); } public static void Dispose(object obj) { - var d = obj as IDisposable; - if (d != null) - d.Dispose(); + if (obj is IDisposable) + Dispose((IDisposable)obj); + } [DebuggerStepThrough] - public static IPromise WrapPromise(Func action) { - ArgumentNotNull(action, "action"); - - var p = new Promise(); - try { - p.Resolve(action()); - } catch (Exception err) { - p.Reject(err); - } - - return p; + public static void DispatchEvent(this EventHandler handler, object sender, T args) { + if (handler != null) + handler(sender, args); } [DebuggerStepThrough] - public static IPromise WrapPromise(Action action) { - ArgumentNotNull(action, "action"); - - var p = new Promise(); - try { - action(); - p.Resolve(); - } catch (Exception err) { - p.Reject(err); - } - - return p; + public static void DispatchEvent(this EventHandler handler, object sender, EventArgs args) { + if (handler != null) + handler(sender, args); } [DebuggerStepThrough] - public static IPromise InvokePromise(Func action) { + public static IPromise Run(Func action) { ArgumentNotNull(action, "action"); try { - var p = action(); - if (p == null) { - var d = new Promise(); - d.Reject(new Exception("The action returned null")); - p = d; - } - return p; + return Promise.Resolve(action()); } catch (Exception err) { - var p = new Promise(); - p.Reject(err); - return p; + return Promise.Reject(err); } } [DebuggerStepThrough] - public static IPromise InvokePromise(Func> action) { + public static IPromise Run(Action action) { + ArgumentNotNull(action, "action"); + + try { + action(); + return Promise.Resolve(); + } catch (Exception err) { + return Promise.Reject(err); + } + } + + [DebuggerStepThrough] + public static IPromise Run(Func action) { ArgumentNotNull(action, "action"); try { - return action() ?? Promise.FromException(new Exception("The action returned null")); + return action() ?? Promise.Reject(new Exception("The action returned null")); } catch (Exception err) { - return Promise.FromException(err); + return Promise.Reject(err); } } + + public static void NoWait(IPromise promise) { + } + + public static void NoWait(Task promise) { + } + + public static void NoWait(Task promise) { + } + + public static void Noop() { + } + + public static void Noop(CancellationToken ct) { + ct.ThrowIfCancellationRequested(); + } + + public static Task CreateTask() { + return new Task(Noop); + } + + public static Task CreateTask(CancellationToken ct) { + return new Task(Noop, ct); + } + + [DebuggerStepThrough] + public static IPromise Run(Func> action) { + ArgumentNotNull(action, "action"); + + try { + return action() ?? Promise.Reject(new Exception("The action returned null")); + } catch (Exception err) { + return Promise.Reject(err); + } + } + } } diff --git a/Implab/src/TaskHelpers.cs b/Implab/src/TaskHelpers.cs new file mode 100644 --- /dev/null +++ b/Implab/src/TaskHelpers.cs @@ -0,0 +1,70 @@ +using System; +using System.Threading.Tasks; + +namespace Implab { + public static class TaskHelpers { + + public static async Task Then(this Task that, Action fulfilled, Action rejected) { + Safe.ArgumentNotNull(that, nameof(that)); + if (rejected != null) { + try { + await that; + } catch (Exception e) { + rejected(e); + return; + } + } else { + await that; + } + + if (fulfilled != null) + fulfilled(); + } + + public static async Task Then(this Task that, Action fulfilled) { + Safe.ArgumentNotNull(that, nameof(that)); + await that; + if (fulfilled != null) + fulfilled(); + } + + public static async Task Then(this Task that, Func fulfilled) { + Safe.ArgumentNotNull(that, nameof(that)); + await that; + if (fulfilled != null) + await fulfilled(); + } + + public static async Task Finally(this Task that, Action handler) { + Safe.ArgumentNotNull(that, nameof(that)); + try { + await that; + } finally { + if (handler != null) + handler(); + } + } + + public static async void Then(this Task that, IResolvable next) { + try { + await that; + } catch (Exception e) { + next.Reject(e); + return; + } + next.Resolve(); + } + + public static async void Then(this Task that, IResolvable next) { + T result; + try { + result = await that; + } catch (Exception e) { + next.Reject(e); + return; + } + next.Resolve(result); + } + + } +} \ No newline at end of file diff --git a/Implab/src/Xml/JsonXmlCaseTransform.cs b/Implab/src/Xml/JsonXmlCaseTransform.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/JsonXmlCaseTransform.cs @@ -0,0 +1,11 @@ +using System; + +namespace Implab.Xml +{ + public enum JsonXmlCaseTransform + { + None, + UcFirst, + LcFirst + } +} \ No newline at end of file diff --git a/Implab/src/Xml/JsonXmlReader.cs b/Implab/src/Xml/JsonXmlReader.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/JsonXmlReader.cs @@ -0,0 +1,664 @@ +using Implab.Formats.Json; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Xml; + +namespace Implab.Xml { + public class JsonXmlReader : XmlReader { + struct JsonContext { + public string localName; + public bool skip; + } + + JsonReader m_parser; + JsonXmlReaderOptions m_options; + JsonXmlReaderPosition m_position = JsonXmlReaderPosition.Initial; + XmlNameTable m_nameTable; + + readonly string m_jsonRootName; + readonly string m_jsonNamespace; + readonly string m_jsonPrefix; + readonly bool m_jsonFlattenArrays; + readonly string m_jsonArrayItemName; + + string m_jsonLocalName; + string m_jsonValueName; + bool m_jsonSkip; // indicates wheather to generate closing tag for objects or arrays + + readonly Stack m_jsonNameStack = new Stack(); + + XmlQualifiedName m_elementQName; + string m_elementPrefix; + int m_elementDepth; + bool m_elementIsEmpty; + + XmlQualifiedName m_qName; + string m_prefix; + int m_xmlDepth; + + XmlSimpleAttribute[] m_attributes; + string m_value; + bool m_isEmpty; + + XmlNodeType m_nodeType = XmlNodeType.None; + + bool m_isAttribute; // indicates that we are reading attribute nodes + int m_currentAttribute; + bool m_currentAttributeRead; + + + XmlNameContext m_context; + + readonly string m_xmlnsPrefix; + readonly string m_xmlnsNamespace; + readonly string m_xsiPrefix; + readonly string m_xsiNamespace; + readonly JsonXmlCaseTransform m_caseTransform; + + + public JsonXmlReader(JsonReader parser, JsonXmlReaderOptions options) { + Safe.ArgumentNotNull(parser, nameof(parser)); + m_parser = parser; + + m_options = options ?? new JsonXmlReaderOptions(); + + m_jsonFlattenArrays = m_options.FlattenArrays; + m_nameTable = m_options.NameTable ?? new NameTable(); + + m_jsonRootName = m_nameTable.Add(string.IsNullOrEmpty(m_options.RootName) ? "data" : m_options.RootName); + m_jsonArrayItemName = m_nameTable.Add(string.IsNullOrEmpty(m_options.ArrayItemName) ? "item" : m_options.ArrayItemName); + m_jsonNamespace = m_nameTable.Add(m_options.NamespaceUri ?? string.Empty); + m_jsonPrefix = m_nameTable.Add(m_options.NodesPrefix ?? string.Empty); + m_xmlnsPrefix = m_nameTable.Add(XmlNameContext.XmlnsPrefix); + m_xmlnsNamespace = m_nameTable.Add(XmlNameContext.XmlnsNamespace); + m_xsiPrefix = m_nameTable.Add(XmlNameContext.XsiPrefix); + m_xsiNamespace = m_nameTable.Add(XmlNameContext.XsiNamespace); + + m_caseTransform = m_options.CaseTransform; + + // TODO validate m_jsonRootName, m_jsonArrayItemName + + m_context = new XmlNameContext(null, 0); + } + + public override int AttributeCount { + get { + return m_attributes == null ? 0 : m_attributes.Length; + } + } + + public override string BaseURI { + get { + return string.Empty; + } + } + + public override int Depth { + get { + return m_xmlDepth; + } + } + + public override bool EOF { + get { + return m_position == JsonXmlReaderPosition.Eof; + } + } + + public override bool IsEmptyElement { + get { return m_isEmpty; } + } + + + public override string LocalName { + get { + return m_qName.Name; + } + } + + public override string NamespaceURI { + get { + return m_qName.Namespace; + } + } + + public override XmlNameTable NameTable { + get { + return m_nameTable; + } + } + + public override XmlNodeType NodeType { + get { + return m_nodeType; + } + } + + public override string Prefix { + get { + return m_prefix; + } + } + + public override ReadState ReadState { + get { + switch (m_position) { + case JsonXmlReaderPosition.Initial: + return ReadState.Initial; + case JsonXmlReaderPosition.Eof: + return ReadState.EndOfFile; + case JsonXmlReaderPosition.Closed: + return ReadState.Closed; + case JsonXmlReaderPosition.Error: + return ReadState.Error; + default: + return ReadState.Interactive; + }; + } + } + + public override string Value { + get { + return m_value; + } + } + + public override string GetAttribute(int i) { + Safe.ArgumentInRange(i >= 0 && i < AttributeCount, nameof(i)); + return m_attributes[i].Value; + } + + public override string GetAttribute(string name) { + if (m_attributes == null) + return null; + var qName = m_context.Resolve(name); + var attr = Array.Find(m_attributes, x => x.QName == qName); + var value = attr?.Value; + return value == string.Empty ? null : value; + } + + public override string GetAttribute(string name, string namespaceURI) { + if (m_attributes == null) + return null; + var qName = new XmlQualifiedName(name, namespaceURI); + var attr = Array.Find(m_attributes, x => x.QName == qName); + var value = attr?.Value; + return value == string.Empty ? null : value; + } + + public override string LookupNamespace(string prefix) { + return m_context.ResolvePrefix(prefix); + } + + public override bool MoveToAttribute(string name) { + if (m_attributes == null || m_attributes.Length == 0) + return false; + + var qName = m_context.Resolve(name); + var index = Array.FindIndex(m_attributes, x => x.QName == qName); + if (index >= 0) { + MoveToAttributeImpl(index); + return true; + } + return false; + } + + public override bool MoveToAttribute(string name, string ns) { + if (m_attributes == null || m_attributes.Length == 0) + return false; + + var qName = m_context.Resolve(name); + var index = Array.FindIndex(m_attributes, x => x.QName == qName); + if (index >= 0) { + MoveToAttributeImpl(index); + return true; + } + return false; + } + + void MoveToAttributeImpl(int i) { + if (!m_isAttribute) { + m_elementQName = m_qName; + m_elementDepth = m_xmlDepth; + m_elementPrefix = m_prefix; + m_elementIsEmpty = m_isEmpty; + m_isAttribute = true; + } + + var attr = m_attributes[i]; + + + m_currentAttribute = i; + m_currentAttributeRead = false; + m_nodeType = XmlNodeType.Attribute; + + m_xmlDepth = m_elementDepth + 1; + m_qName = attr.QName; + m_value = attr.Value; + m_prefix = attr.Prefix; + } + + public override bool MoveToElement() { + if (m_isAttribute) { + m_value = null; + m_nodeType = XmlNodeType.Element; + m_xmlDepth = m_elementDepth; + m_prefix = m_elementPrefix; + m_qName = m_elementQName; + m_isEmpty = m_elementIsEmpty; + m_isAttribute = false; + return true; + } + return false; + } + + public override bool MoveToFirstAttribute() { + if (m_attributes != null && m_attributes.Length > 0) { + MoveToAttributeImpl(0); + return true; + } + return false; + } + + public override bool MoveToNextAttribute() { + if (m_isAttribute) { + var next = m_currentAttribute + 1; + if (next < AttributeCount) { + MoveToAttributeImpl(next); + return true; + } + return false; + } else { + return MoveToFirstAttribute(); + } + + } + + public override bool ReadAttributeValue() { + if (!m_isAttribute || m_currentAttributeRead) + return false; + + ValueNode(m_attributes[m_currentAttribute].Value); + m_currentAttributeRead = true; + return true; + } + + public override void ResolveEntity() { + /* do nothing */ + } + + /// + /// Determines do we need to increase depth after the current node + /// + /// + public bool IsSibling() { + switch (m_nodeType) { + case XmlNodeType.None: // start document + case XmlNodeType.Attribute: // after attribute only it's content can be iterated with ReadAttributeValue method + return false; + case XmlNodeType.Element: + // if the elemnt is empty the next element will be it's sibling + return m_isEmpty; + default: + return true; + } + } + + void ValueNode(string value) { + if (!IsSibling()) // the node is nested + m_xmlDepth++; + + m_qName = XmlQualifiedName.Empty; + m_nodeType = XmlNodeType.Text; + m_prefix = string.Empty; + m_value = value; + m_isEmpty = false; + m_attributes = null; + } + + void ElementNode(string name, string ns, XmlSimpleAttribute[] attrs, bool empty) { + if (!IsSibling()) // the node is nested + m_xmlDepth++; + + var context = m_context; + List definedAttrs = null; + + // define new namespaces + if (attrs != null) { + foreach (var attr in attrs) { + if (attr.QName.Name == "xmlns") { + if (context == m_context) + context = new XmlNameContext(m_context, m_xmlDepth); + context.DefinePrefix(attr.Value, string.Empty); + } else if (attr.Prefix == m_xmlnsPrefix) { + if (context == m_context) + context = new XmlNameContext(m_context, m_xmlDepth); + context.DefinePrefix(attr.Value, attr.QName.Name); + } else { + string attrPrefix; + if (string.IsNullOrEmpty(attr.QName.Namespace)) + continue; + + // auto-define prefixes + if (!context.LookupNamespacePrefix(attr.QName.Namespace, out attrPrefix) || string.IsNullOrEmpty(attrPrefix)) { + // new namespace prefix added + attrPrefix = context.CreateNamespacePrefix(attr.QName.Namespace); + attr.Prefix = attrPrefix; + + if (definedAttrs == null) + definedAttrs = new List(); + + definedAttrs.Add(new XmlSimpleAttribute(attrPrefix, m_xmlnsNamespace, m_xmlnsPrefix, attr.QName.Namespace)); + } + } + } + } + + string p; + // auto-define prefixes + if (!context.LookupNamespacePrefix(ns, out p)) { + if (context == m_context) + context = new XmlNameContext(m_context, m_xmlDepth); + p = context.CreateNamespacePrefix(ns); + if (definedAttrs == null) + definedAttrs = new List(); + + definedAttrs.Add(new XmlSimpleAttribute(p, m_xmlnsNamespace, m_xmlnsPrefix, ns)); + } + + if (definedAttrs != null) { + if (attrs != null) + definedAttrs.AddRange(attrs); + attrs = definedAttrs.ToArray(); + } + + if (!empty) + m_context = context; + + m_nodeType = XmlNodeType.Element; + m_qName = new XmlQualifiedName(name, ns); + m_prefix = p; + m_value = null; + m_isEmpty = empty; + m_attributes = attrs; + } + + void EndElementNode(string name, string ns) { + if (IsSibling()) { + // closing the element which has children + m_xmlDepth--; + } + + string p; + if (!m_context.LookupNamespacePrefix(ns, out p)) + throw new Exception($"Failed to lookup namespace '{ns}'"); + + if (m_context.Depth == m_xmlDepth) + m_context = m_context.ParentContext; + + m_nodeType = XmlNodeType.EndElement; + m_prefix = p; + m_qName = new XmlQualifiedName(name, ns); + m_value = null; + m_attributes = null; + m_isEmpty = false; + } + + void XmlDeclaration() { + if (!IsSibling()) // the node is nested + m_xmlDepth++; + m_nodeType = XmlNodeType.XmlDeclaration; + m_qName = new XmlQualifiedName("xml"); + m_value = "version='1.0'"; + m_prefix = string.Empty; + m_attributes = null; + m_isEmpty = false; + } + + public override bool Read() { + try { + string elementName; + XmlSimpleAttribute[] elementAttrs = null; + MoveToElement(); + + switch (m_position) { + case JsonXmlReaderPosition.Initial: + m_jsonLocalName = m_jsonRootName; + m_jsonSkip = false; + XmlDeclaration(); + m_position = JsonXmlReaderPosition.Declaration; + return true; + case JsonXmlReaderPosition.Declaration: + elementAttrs = new[] { + new XmlSimpleAttribute(m_xsiPrefix, m_xmlnsNamespace, m_xmlnsPrefix, m_xsiNamespace), + string.IsNullOrEmpty(m_jsonPrefix) ? + new XmlSimpleAttribute(m_xmlnsPrefix, string.Empty, string.Empty, m_jsonNamespace) : + new XmlSimpleAttribute(m_jsonPrefix, m_xmlnsNamespace, m_xmlnsPrefix, m_jsonNamespace) + }; + break; + case JsonXmlReaderPosition.ValueElement: + if (!m_isEmpty) { + if (m_parser.ElementValue != null && !m_parser.ElementValue.Equals(string.Empty)) + ValueNode(m_parser.ElementValue); + else + goto case JsonXmlReaderPosition.ValueContent; + m_position = JsonXmlReaderPosition.ValueContent; + return true; + } else { + m_position = JsonXmlReaderPosition.ValueEndElement; + break; + } + case JsonXmlReaderPosition.ValueContent: + EndElementNode(m_jsonValueName, m_jsonNamespace); + m_position = JsonXmlReaderPosition.ValueEndElement; + return true; + case JsonXmlReaderPosition.Eof: + case JsonXmlReaderPosition.Closed: + case JsonXmlReaderPosition.Error: + return false; + } + + while (m_parser.Read()) { + var jsonName = m_nameTable.Add(TransformJsonName(m_parser.ElementName)); + + switch (m_parser.ElementType) { + case JsonElementType.BeginObject: + if (!EnterJsonObject(jsonName, out elementName)) + continue; + + m_position = JsonXmlReaderPosition.BeginObject; + ElementNode(elementName, m_jsonNamespace, elementAttrs, false); + break; + case JsonElementType.EndObject: + if (!LeaveJsonScope(out elementName)) + continue; + + m_position = JsonXmlReaderPosition.EndObject; + EndElementNode(elementName, m_jsonNamespace); + break; + case JsonElementType.BeginArray: + if (!EnterJsonArray(jsonName, out elementName)) + continue; + + m_position = JsonXmlReaderPosition.BeginArray; + ElementNode(elementName, m_jsonNamespace, elementAttrs, false); + break; + case JsonElementType.EndArray: + if (!LeaveJsonScope(out elementName)) + continue; + + m_position = JsonXmlReaderPosition.EndArray; + EndElementNode(elementName, m_jsonNamespace); + break; + case JsonElementType.Value: + if (!VisitJsonValue(jsonName, out m_jsonValueName)) + continue; + + m_position = JsonXmlReaderPosition.ValueElement; + if (m_parser.ElementValue == null) + // generate empty element with xsi:nil="true" attribute + ElementNode( + m_jsonValueName, + m_jsonNamespace, + new[] { + new XmlSimpleAttribute("nil", m_xsiNamespace, m_xsiPrefix, "true") + }, + true + ); + else + ElementNode(m_jsonValueName, m_jsonNamespace, elementAttrs, m_parser.ElementValue.Equals(string.Empty)); + break; + default: + throw new Exception($"Unexpected JSON element {m_parser.ElementType}: {m_parser.ElementName}"); + } + return true; + } + + m_position = JsonXmlReaderPosition.Eof; + return false; + } catch { + m_position = JsonXmlReaderPosition.Error; + throw; + } + } + + void SaveJsonName() { + m_jsonNameStack.Push(new JsonContext { + skip = m_jsonSkip, + localName = m_jsonLocalName + }); + + } + + bool EnterJsonObject(string name, out string elementName) { + SaveJsonName(); + m_jsonSkip = false; + + if (string.IsNullOrEmpty(name)) { + if (m_jsonNameStack.Count != 1 && !m_jsonFlattenArrays) + m_jsonLocalName = m_jsonArrayItemName; + } else { + m_jsonLocalName = name; + } + + elementName = m_jsonLocalName; + return true; + } + + /// + /// Called when JSON parser visits BeginArray ('[') element. + /// + /// Optional property name if the array is the member of an object + /// true if element should be emited, false otherwise + bool EnterJsonArray(string name, out string elementName) { + SaveJsonName(); + + if (string.IsNullOrEmpty(name)) { + // m_jsonNameStack.Count == 1 means the root node + if (m_jsonNameStack.Count != 1 && !m_jsonFlattenArrays) + m_jsonLocalName = m_jsonArrayItemName; + + m_jsonSkip = false; // we should not flatten arrays inside arrays or in the document root + } else { + m_jsonLocalName = name; + m_jsonSkip = m_jsonFlattenArrays; + } + elementName = m_jsonLocalName; + + return !m_jsonSkip; + } + + bool VisitJsonValue(string name, out string elementName) { + if (string.IsNullOrEmpty(name)) { + // m_jsonNameStack.Count == 0 means that JSON document consists from simple value + elementName = (m_jsonNameStack.Count == 0 || m_jsonFlattenArrays) ? m_jsonLocalName : m_jsonArrayItemName; + } else { + elementName = name; + } + return true; + } + + bool LeaveJsonScope(out string elementName) { + elementName = m_jsonLocalName; + var skip = m_jsonSkip; + + var prev = m_jsonNameStack.Pop(); + m_jsonLocalName = prev.localName; + m_jsonSkip = prev.skip; + + return !skip; + } + + private string TransformJsonName(string name) { + if (m_caseTransform == JsonXmlCaseTransform.None || string.IsNullOrEmpty(name)) { + return name; + } else if (m_caseTransform == JsonXmlCaseTransform.UcFirst) { + return JsonXmlReader.UppercaseFirst(name); + } else { + return JsonXmlReader.LowercaseFirst(name); + } + } + + protected override void Dispose(bool disposing) { + if (disposing) + Safe.Dispose(m_parser); + base.Dispose(true); + } + + public override string ToString() { + switch (NodeType) { + case XmlNodeType.Element: + return $"<{Name} {string.Join(" ", (m_attributes ?? new XmlSimpleAttribute[0]).Select(x => $"{x.Prefix}{(string.IsNullOrEmpty(x.Prefix) ? "" : ":")}{x.QName.Name}='{x.Value}'"))} {(IsEmptyElement ? "/" : "")}>"; + case XmlNodeType.Attribute: + return $"@{Name}"; + case XmlNodeType.Text: + return $"{Value}"; + case XmlNodeType.CDATA: + return $""; + case XmlNodeType.EntityReference: + return $"&{Name};"; + case XmlNodeType.EndElement: + return $""; + default: + return $".{NodeType} {Name} {Value}"; + } + } + + #region static methods + + // + // Static Methods + // + private static string LowercaseFirst(string s) { + char[] array = s.ToCharArray(); + array[0] = char.ToLower(array[0]); + return new string(array); + } + + private static string UppercaseFirst(string s) { + char[] array = s.ToCharArray(); + array[0] = char.ToUpper(array[0]); + return new string(array); + } + + public static JsonXmlReader CreateJsonXmlReader(TextReader textReader, JsonXmlReaderOptions options = null) { + var jsonReader = JsonReader.Create(textReader); + return new JsonXmlReader(jsonReader, options); + } + + public static JsonXmlReader CreateJsonXmlReader(Stream stream, JsonXmlReaderOptions options = null) { + var jsonReader = JsonReader.Create(stream); + return new JsonXmlReader(jsonReader, options); + } + + public static JsonXmlReader CreateJsonXmlReader(string file, JsonXmlReaderOptions options = null) { + var jsonReader = JsonReader.Create(file); + return new JsonXmlReader(jsonReader, options); + } + + #endregion + } +} diff --git a/Implab/src/Xml/JsonXmlReaderOptions.cs b/Implab/src/Xml/JsonXmlReaderOptions.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/JsonXmlReaderOptions.cs @@ -0,0 +1,68 @@ + +using System; +using System.Xml; + +namespace Implab.Xml { + /// + /// Набор необязательных параметров для , позволяющий управлять процессом + /// интерпретации JSON документа. + /// + public class JsonXmlReaderOptions : ICloneable { + /// + /// Пространство имен в котором будут располагаться читаемые элементы документа + /// + public string NamespaceUri { + get; + set; + } + + /// + /// Интерпретировать массивы как множественные элементы (убирает один уровень вложенности), иначе массив + /// представляется в виде узла, дочерними элементами которого являются элементы массива, имена дочерних элементов + /// определяются свойством . По умолчанию false. + /// + public bool FlattenArrays { + get; + set; + } + + /// + /// Префикс, для узлов документа + /// + public string NodesPrefix { + get; + set; + } + + /// + /// Имя корневого элемента в xml документе + /// + public string RootName { + get; + set; + } + + /// + /// Имя элемента для массивов, если не включена опция . + /// По умолчанию item. + /// + public string ArrayItemName { + get; + set; + } + + /// + /// Таблица атомизированных строк для построения документа. + /// + public XmlNameTable NameTable { + get; + set; + } + + public JsonXmlCaseTransform CaseTransform { get; set; } + + public object Clone() { + return MemberwiseClone(); + } + } +} diff --git a/Implab/src/Xml/JsonXmlReaderPosition.cs b/Implab/src/Xml/JsonXmlReaderPosition.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/JsonXmlReaderPosition.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Xml { + enum JsonXmlReaderPosition { + Initial, + Declaration, + BeginArray, + BeginObject, + EndArray, + EndObject, + ValueElement, + ValueContent, + ValueEndElement, + Eof, + Closed, + Error + } +} diff --git a/Implab/src/Xml/SerializationHelpers.cs b/Implab/src/Xml/SerializationHelpers.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/SerializationHelpers.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Implab.Xml { + public static class SerializationHelpers { + public static string SerializeAsString(T obj) { + return XmlDefaultSerializer.Instance.SerializeAsString(obj); + } + + public static void Serialize(XmlWriter writer, T obj) { + XmlDefaultSerializer.Instance.Serialize(writer, obj); + } + + public static XmlDocument SerializeAsXmlDocument(T obj) { + var doc = new XmlDocument(); + using (var writer = doc.CreateNavigator().AppendChild()) { + XmlDefaultSerializer.Instance.Serialize(writer, obj); + } + return doc; + } + + public static XDocument SerializeAsXDocument(T obj) { + var doc = new XDocument(); + using (var writer = doc.CreateWriter()) { + XmlDefaultSerializer.Instance.Serialize(writer, obj); + } + return doc; + } + + public static void SerializeToFile(string file, T obj) { + XmlDefaultSerializer.Instance.SerializeToFile(obj, file); + } + + public static void SerializeToElementChild(XmlElement element, T obj) { + XmlDefaultSerializer.Instance.Serialize(obj, element); + } + + public static T Deserialize(XmlReader reader) { + return (T)XmlDefaultSerializer.Instance.Deserialize(reader); + } + + public static T DeserializeFromFile(string file) { + return (T)XmlDefaultSerializer.Instance.DeserializeFromFile(file); + } + + public static T DeserializeFromString(string data) { + return (T)XmlDefaultSerializer.Instance.DeserializeFromString(data); + } + + public static T DeserializeFromXmlNode(XmlNode node) { + Safe.ArgumentNotNull(node, nameof(node)); + using (var reader = node.CreateNavigator().ReadSubtree()) + return (T)XmlDefaultSerializer.Instance.Deserialize(reader); + } + + public static T DeserializeJson(TextReader textReader) { + var options = new JsonXmlReaderOptions { + NamespaceUri = typeof(T).GetCustomAttribute()?.Namespace, + RootName = typeof(T).Name, + FlattenArrays = true + }; + + using (var reader = JsonXmlReader.CreateJsonXmlReader(textReader, options)) + return Deserialize(reader); + } + + public static T DeserializeJsonFromString(string data) { + using (var reader = new StringReader(data)) { + return DeserializeJson(reader); + } + } + + public static void SerializeJson(TextWriter writer, T obj) { + var doc = SerializeAsXmlDocument(obj); + XmlToJson.Default.Transform(doc, null, writer); + } + + public static string SerializeJsonAsString(T obj) { + using (var writer = new StringWriter()) { + SerializeJson(writer, obj); + return writer.ToString(); + } + } + } +} diff --git a/Implab/src/Xml/SerializersPool.cs b/Implab/src/Xml/SerializersPool.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/SerializersPool.cs @@ -0,0 +1,77 @@ +using Implab.Components; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Serialization; + +namespace Implab.Xml { + [Obsolete("this class will be removed, use XmlDefaultSerializer")] + public class SerializersPool : ObjectPool { + + static readonly SerializersPool _instance = new SerializersPool(); + + public static SerializersPool Instance { + get { return _instance; } + } + + #region implemented abstract members of ObjectPool + protected override XmlSerializer CreateInstance() { + return new XmlSerializer(typeof(T)); + } + #endregion + + public T DeserializeFromString(string data) { + using (var reader = new StringReader(data)) { + return Deserialize(reader); + } + } + + public T Deserialize(TextReader reader) { + var sr = Allocate(); + try { + return (T)sr.Deserialize(reader); + } finally { + Release(sr); + } + } + + public T Deserialize(XmlReader reader) { + var sr = Allocate(); + try { + return (T)sr.Deserialize(reader); + } finally { + Release(sr); + } + } + + public string SerializeAsString(T data) { + using (var writer = new StringWriter()) { + Serialize(writer, data); + return writer.ToString(); + } + } + + public void Serialize(TextWriter writer, T data) { + var sr = Allocate(); + try { + sr.Serialize(writer, data); + } finally { + Release(sr); + } + } + + public void Serialize(XmlWriter writer, T data) { + var sr = Allocate(); + try { + sr.Serialize(writer, data); + } finally { + Release(sr); + } + } + + } +} diff --git a/Implab/src/Xml/XmlDefaultSerializer.cs b/Implab/src/Xml/XmlDefaultSerializer.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/XmlDefaultSerializer.cs @@ -0,0 +1,14 @@ +using System.Xml.Serialization; +using Implab.Components; + +namespace Implab.Xml { + /// + /// This class used to get default serializer for the specified type . + /// + /// The type used to create + public static class XmlDefaultSerializer { + static readonly LazyAndWeak m_instance = new LazyAndWeak(() => new XmlSerializer(typeof(T))); + + public static XmlSerializer Instance { get { return m_instance.Value; } } + } +} \ No newline at end of file diff --git a/Implab/src/Xml/XmlNameContext.cs b/Implab/src/Xml/XmlNameContext.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/XmlNameContext.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Implab.Xml { + class XmlNameContext { + public const string XmlnsNamespace = "http://www.w3.org/2000/xmlns/"; + public const string XmlnsPrefix = "xmlns"; + public const string XmlNamespace = "http://www.w3.org/XML/1998/namespace"; + public const string XmlPrefix = "xml"; + public const string XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"; + public const string XsiPrefix = "xsi"; + + readonly static char[] _qNameDelim = new[] { ':' }; + + Dictionary m_ns2prefix; + Dictionary m_prefix2ns; + int m_nextPrefix = 1; + string m_lastNs; + string m_lastPrefix; + + public XmlNameContext ParentContext { get; private set; } + + public int Depth { get; private set; } + + public XmlNameContext(XmlNameContext parent, int depth) { + ParentContext = parent; + Depth = depth; + + if (parent == null) { + DefinePrefixNoCheck(XmlnsNamespace, XmlnsPrefix); + DefinePrefixNoCheck(XmlNamespace, XmlPrefix); + } else { + m_nextPrefix = parent.m_nextPrefix; + } + } + + public bool LookupNamespacePrefix(string ns, out string prefix) { + if (ns == null) + ns = string.Empty; + if (ns == m_lastNs) { + prefix = m_lastPrefix; + return true; + } + + + prefix = null; + for (var ctx = this; ctx != null; ctx = ctx.ParentContext) { + if (ctx.m_ns2prefix != null && ctx.m_ns2prefix.TryGetValue(ns, out prefix)) { + m_lastNs = ns; + m_lastPrefix = prefix; + return true; + } + } + return false; + } + + public string CreateNamespacePrefix(string ns) { + var prefix = $"p{m_nextPrefix++}"; + DefinePrefixNoCheck(ns, prefix); + return prefix; + } + + void DefinePrefixNoCheck(string ns, string prefix) { + if (ns == null) + ns = string.Empty; + if (prefix == null) + prefix = string.Empty; + + if (m_ns2prefix == null) + m_ns2prefix = new Dictionary(); + m_ns2prefix[ns] = prefix; + + if (m_prefix2ns == null) + m_prefix2ns = new Dictionary(); + m_prefix2ns[prefix] = ns; + } + + public void DefinePrefix(string ns, string prefix) { + // according to https://www.w3.org/TR/xml-names/#ns-decl + + // It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace + if (ns == XmlnsNamespace) + throw new Exception($"Attempt to define xmlns:{prefix}='{ns}'"); + + // It MAY, but need not, be declared, and MUST NOT be bound to any other namespace name + if (ns == XmlNamespace && prefix != XmlPrefix) + throw new Exception($"Attempt to define xmlns:{prefix}='{ns}'"); + + // add mapping + DefinePrefixNoCheck(ns, prefix); + } + + public string ResolvePrefix(string prefix) { + if (prefix == null) + prefix = string.Empty; + string ns = null; + for(var ctx = this; ctx != null; ctx = ctx.ParentContext) { + if (ctx.m_prefix2ns != null && ctx.m_prefix2ns.TryGetValue(prefix, out ns) == true) + return ns; + } + return null; + } + + public XmlQualifiedName Resolve(string name) { + Safe.ArgumentNotEmpty(name, nameof(name)); + var parts = name.Split(_qNameDelim, 2, StringSplitOptions.RemoveEmptyEntries); + + if (parts.Length == 2) { + return new XmlQualifiedName(parts[1], ResolvePrefix(parts[0])); + } else { + return new XmlQualifiedName(parts[0], ResolvePrefix(string.Empty)); + } + } + } +} diff --git a/Implab/src/Xml/XmlSerializerExtensions.cs b/Implab/src/Xml/XmlSerializerExtensions.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/XmlSerializerExtensions.cs @@ -0,0 +1,89 @@ +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Implab.Xml { + public static class XmlSerializerExtensions { + + public static void Serialize(this XmlSerializer that, object obj, XmlElement element) { + Safe.ArgumentNotNull(that, nameof(that)); + using (var writer = element.CreateNavigator().AppendChild()) + that.Serialize(writer, obj); + } + + public static void Serialize(this XmlSerializer that, object obj, XElement element) { + Safe.ArgumentNotNull(that, nameof(that)); + using (var writer = element.CreateWriter()) + that.Serialize(writer, obj); + } + + public static XDocument SerializeAsXDocumnet(this XmlSerializer that, object obj) { + Safe.ArgumentNotNull(that, nameof(that)); + var doc = new XDocument(); + using (var writer = doc.CreateWriter()) { + that.Serialize(writer, obj); + } + return doc; + } + + public static XmlDocument SerializeAsXmlDocument(this XmlSerializer that, object obj) { + Safe.ArgumentNotNull(that, nameof(that)); + var doc = new XmlDocument(); + using (var writer = doc.CreateNavigator().AppendChild()) { + that.Serialize(writer, obj); + } + return doc; + } + public static string SerializeAsString(this XmlSerializer that, object obj) { + Safe.ArgumentNotNull(that, nameof(that)); + using (var writer = new StringWriter()) { + that.Serialize(writer, obj); + return writer.ToString(); + } + } + + public static void SerializeToFile(this XmlSerializer that, object obj, string file, Encoding encoding) { + Safe.ArgumentNotNull(that, nameof(that)); + using (var writer = new StreamWriter(File.Create(file),encoding)) + that.Serialize(writer, obj); + } + + public static void SerializeToFile(this XmlSerializer that, object obj, string file) { + SerializeToFile(that, obj, file, Encoding.UTF8); + } + + public static object Deserialize(this XmlSerializer that, XmlElement element) { + Safe.ArgumentNotNull(that, nameof(that)); + Safe.ArgumentNotNull(element, nameof(element)); + + using (var reader = element.CreateNavigator().ReadSubtree()) + return that.Deserialize(reader); + } + + public static object Deserialize(this XmlSerializer that, XElement element) { + Safe.ArgumentNotNull(that, nameof(that)); + Safe.ArgumentNotNull(element, nameof(element)); + + using (var reader = element.CreateReader()) + return that.Deserialize(reader); + } + + public static object DeserializeFromString(this XmlSerializer that, string text) { + Safe.ArgumentNotNull(that, nameof(that)); + + using(var reader = new StringReader(text)) + return that.Deserialize(reader); + } + + public static object DeserializeFromFile(this XmlSerializer that, string file) { + Safe.ArgumentNotNull(that, nameof(that)); + + using(var reader = File.OpenRead(file)) + return that.Deserialize(reader); + } + + + } +} \ No newline at end of file diff --git a/Implab/src/Xml/XmlSimpleAttribute.cs b/Implab/src/Xml/XmlSimpleAttribute.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/XmlSimpleAttribute.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Implab.Xml { + public class XmlSimpleAttribute { + public XmlSimpleAttribute(string name, string ns, string prefix, string value) { + QName = new XmlQualifiedName(name, ns); + Prefix = prefix; + Value = value; + } + + public XmlQualifiedName QName { get; set; } + + public string Prefix { get; set; } + + public string Value { get; set; } + } +} diff --git a/Implab/src/Xml/XmlToJson.cs b/Implab/src/Xml/XmlToJson.cs new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/XmlToJson.cs @@ -0,0 +1,33 @@ +using System; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.Xsl; +using Implab.Components; +using Implab.Formats.Json; + +namespace Implab.Xml { + public class XmlToJson { + const string XmlToJsonTransformId = "Implab.Xml.json.xsl"; + + static LazyAndWeak m_default = new LazyAndWeak(CreateTransform, true); + + public static XslCompiledTransform Default { + get { return m_default.Value; } + } + + protected static XslCompiledTransform CreateTransform() { + var transform = new XslCompiledTransform(); + using(var reader = XmlReader.Create(GetDefaultTransform())) { + transform.Load(reader); + } + return transform; + } + + protected static Stream GetDefaultTransform() { + return Assembly.GetExecutingAssembly().GetManifestResourceStream(XmlToJsonTransformId); + } + + + } +} \ No newline at end of file diff --git a/Implab/src/Xml/json.xsl b/Implab/src/Xml/json.xsl new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/json.xsl @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + true + + + + false + + + + + + + + + + + + + + + + + + null + + + + + + + + + + + + + + + + : + + + + + + + + + + : + + + + + + + + + + + + : + + + + + + + , + + + + + + + " + + + + " + + + + + { + + } + + + + + + [ + + ] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Implab/src/Xml/readme.txt b/Implab/src/Xml/readme.txt new file mode 100644 --- /dev/null +++ b/Implab/src/Xml/readme.txt @@ -0,0 +1,4 @@ +XML to JSON transform is taken from the different project https://hg.implab.org/pub/ModelGenerator/ +run: + wget https://hg.implab.org/pub/ModelGenerator/raw-file/tip/xslt/json.xsl +to update it to the latest version \ No newline at end of file diff --git a/Local.testsettings b/Local.testsettings deleted file mode 100644 --- a/Local.testsettings +++ /dev/null @@ -1,10 +0,0 @@ - - - These are default test settings for a local test run. - - - - - - - \ No newline at end of file diff --git a/MonoPlay/MonoPlay.csproj b/MonoPlay/MonoPlay.csproj deleted file mode 100644 --- a/MonoPlay/MonoPlay.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {15DD7123-D504-4627-8B4F-D00C7F04D033} - Exe - MonoPlay - MonoPlay - v4.5 - 0.2 - - - true - full - false - bin\Debug - DEBUG;TRACE; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - ..\packages\System.Text.Json.2.0.0.11\lib\net40\System.Text.Json.dll - - - - - - - - - - {F550F1F8-8746-4AD0-9614-855F4C4B7F05} - Implab - - - - - - \ No newline at end of file diff --git a/MonoPlay/Program.cs b/MonoPlay/Program.cs deleted file mode 100644 --- a/MonoPlay/Program.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Implab; -using System.Threading.Tasks; -using Implab.Formats.JSON; -using System.IO; -using System.Text.Json; - -namespace MonoPlay { - class MainClass { - - - public static void Main(string[] args) { - if (args == null) - throw new ArgumentNullException("args"); - int t1, t2; - - for (int i = 0; i < 2; i++) { - t1 = Environment.TickCount; - int elements =0; - using (var reader = new JSONParser(File.OpenText("/home/sergey/temp/citylots.json"))) { - while (reader.Read()) - elements++; - } - - t2 = Environment.TickCount; - Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, Elements: {4}",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0), elements ); - } - - Console.WriteLine("Syste.Text.Json"); - var paraser = new JsonParser(); - for (int i = 0; i < 2; i++) { - t1 = Environment.TickCount; - using (var reader = File.OpenText("/home/sergey/temp/citylots.json")) { - paraser.Parse(reader); - } - - t2 = Environment.TickCount; - Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, ",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0)); - } - - - } - - } -} diff --git a/MonoPlay/Properties/AssemblyInfo.cs b/MonoPlay/Properties/AssemblyInfo.cs deleted file mode 100644 --- a/MonoPlay/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("MonoPlay")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("sergey")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/MonoPlay/packages.config b/MonoPlay/packages.config deleted file mode 100644 --- a/MonoPlay/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/TraceAndTestImpact.testsettings b/TraceAndTestImpact.testsettings deleted file mode 100644 --- a/TraceAndTestImpact.testsettings +++ /dev/null @@ -1,21 +0,0 @@ - - - These are test settings for Trace and Test Impact. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/omnisharp.json b/omnisharp.json new file mode 100644 --- /dev/null +++ b/omnisharp.json @@ -0,0 +1,54 @@ +{ + "FormattingOptions": { + "NewLine": "\n", + "UseTabs": false, + "TabSize": 4, + "IndentationSize": 4, + "SpacingAfterMethodDeclarationName": false, + "SpaceWithinMethodDeclarationParenthesis": false, + "SpaceBetweenEmptyMethodDeclarationParentheses": false, + "SpaceAfterMethodCallName": false, + "SpaceWithinMethodCallParentheses": false, + "SpaceBetweenEmptyMethodCallParentheses": false, + "SpaceAfterControlFlowStatementKeyword": true, + "SpaceWithinExpressionParentheses": false, + "SpaceWithinCastParentheses": false, + "SpaceWithinOtherParentheses": false, + "SpaceAfterCast": false, + "SpacesIgnoreAroundVariableDeclaration": false, + "SpaceBeforeOpenSquareBracket": false, + "SpaceBetweenEmptySquareBrackets": false, + "SpaceWithinSquareBrackets": false, + "SpaceAfterColonInBaseTypeDeclaration": true, + "SpaceAfterComma": true, + "SpaceAfterDot": false, + "SpaceAfterSemicolonsInForStatement": true, + "SpaceBeforeColonInBaseTypeDeclaration": true, + "SpaceBeforeComma": false, + "SpaceBeforeDot": false, + "SpaceBeforeSemicolonsInForStatement": false, + "SpacingAroundBinaryOperator": "single", + "IndentBraces": false, + "IndentBlock": true, + "IndentSwitchSection": true, + "IndentSwitchCaseSection": true, + "LabelPositioning": "oneLess", + "WrappingPreserveSingleLine": true, + "WrappingKeepStatementsOnSingleLine": true, + "NewLinesForBracesInTypes": false, + "NewLinesForBracesInMethods": false, + "NewLinesForBracesInProperties": false, + "NewLinesForBracesInAccessors": false, + "NewLinesForBracesInAnonymousMethods": false, + "NewLinesForBracesInControlBlocks": false, + "NewLinesForBracesInAnonymousTypes": false, + "NewLinesForBracesInObjectCollectionArrayInitializers": false, + "NewLinesForBracesInLambdaExpressionBody": false, + "NewLineForElse": false, + "NewLineForCatch": false, + "NewLineForFinally": false, + "NewLineForMembersInObjectInit": false, + "NewLineForMembersInAnonymousTypes": false, + "NewLineForClausesInQuery": false + } +} \ No newline at end of file diff --git a/packages/NUnit.2.6.4/NUnit.2.6.4.nupkg b/packages/NUnit.2.6.4/NUnit.2.6.4.nupkg deleted file mode 100644 index 379b15bf5cd076569cd68476cd21a17795c0587c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - nunit.framework - - - - - 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 - - - - - Delegate used by tests that execute code and - capture any thrown exception. - - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - 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 - The message to display if the condition is false - - - - 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. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - - - - 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 - - - - 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 - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint 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. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - The actual value to test - A Constraint to be applied - - - - 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. - - The actual value to test - A Constraint to be applied - The message that will be displayed on failure - - - - 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. - - The actual value to test - A Constraint expression to be applied - 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 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. - - A constraint to be satisfied by the exception - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestDelegate - - - - 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 - The message that will be displayed on failure - - - - 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 - The message that will be displayed on failure - - - - 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 - The message that will be displayed on failure - - - - 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 - The message that will be displayed on failure - - - - 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. - - 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 - The message that will be displayed on failure - - - - 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 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 - The message that will be displayed on failure - - - - 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 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two unsigned ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two unsigned ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two unsigned ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two unsigned longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two unsigned longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two unsigned longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two decimals are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two decimals are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two decimals are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two unsigned ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two unsigned ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two unsigned ints are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two unsigned longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two unsigned longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two unsigned longs are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two decimals are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two decimals are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two decimals are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two floats are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two floats are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two floats are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two doubles are not equal. If they are equal, then an - is thrown. - - The expected value - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is either null or 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 either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - - - - Assert that a string is not null or 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 null or empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not null or empty - - The string to be tested - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 tothe 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 tothe 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 - - - - Verifies that the first value is greater than or equal tothe 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 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 - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - 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 - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - 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 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 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 suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled 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 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 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 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 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 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 the same path or under an 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 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 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 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 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 whether a collection is ordered - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That. - - The actual value to test - A Constraint to be applied - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That. - - The actual value to test - A Constraint to be applied - The message to be displayed in case of failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That. - - The actual value to test - A Constraint to be applied - The message to be displayed in case of failure - Arguments to use 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 - 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 - The message to display if the condition is false - - - - 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. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - 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 - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint to be applied - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - The actual value to test - A Constraint 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 - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - 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 - - - - 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 - - - - 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 - The message to display if the condition is false - - - - 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 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. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - 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 - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to a referenced 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 - - - - Apply a constraint to a referenced 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 - - - - 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 - - - - 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 - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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 containing objects to be considered - The message that will be displayed on failure - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - - - - 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 - The message to be displayed on failure - - - - 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 - The message to be displayed on failure - - - - 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 - The message to be displayed on failure - - - - 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 - The message to be displayed on failure - - - - 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 constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Summary description for DirectoryAssert - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - 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. - - - - - Verifies that two directories are equal. Two directories 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 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 - - - - Verifies that two directories are equal. Two directories 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 directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories 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 directory containing the value that is expected - A directory containing the actual value - - - - Verifies that two directories are equal. Two directories 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 directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if 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 have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories 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 directory path string containing the value that is expected - A directory path string 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 - The message to display if directories are not equal - - - - 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 two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are 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 path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - 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. - - - - - 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 - The message to display if objects are not equal - - - - 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 - The message to display if objects are not equal - - - - 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 - The message to display if objects are not equal - - - - 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 - The message to be displayed when the Streams are the same. - - - - 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 - The message to display if objects are not equal - - - - 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 - The message to display if objects are not equal - - - - 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 - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Class used to guard against unexpected argument values - 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 - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - 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 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. - - - - - 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 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. - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - 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 suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled 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 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 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 under an 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 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 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 whether a collection is ordered - - - - - The ITestCaseData interface is implemented by a class - that is able to return complete testcases for use by - a parameterized test method. - - NOTE: This interface is used in both the framework - and the core, even though that results in two different - types. However, sharing the source code guarantees that - the various implementations will be compatible and that - the core is able to reflect successfully over the - framework implementations of ITestCaseData. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Indicates whether a result has been specified. - This is necessary because the result may be - null, so it's value cannot be checked. - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - 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 - - - - - Randomizer returns a set of random values in a repeatable - way, to allow re-running of tests if necessary. - - - - - 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. - - - - - Construct a randomizer using a random seed - - - - - Construct a randomizer using a specified seed - - - - - Return an array of random doubles between 0.0 and 1.0. - - - - - - - Return an array of random doubles with values in a specified range. - - - - - Return an array of random ints with values in a specified range. - - - - - Get a random seed for use in creating a randomizer. - - - - - 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 attribute under .NET 1.x - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 Notequal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - 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 - The message to display in case of failure - - - - 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 message to display in case of failure - - - - 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 provides a number of instance modifiers - for use in initializing the test case. - - Note: Instance modifiers are getters that return - the same instance after modifying it's state. - - - - - The argument list to be provided to the test - - - - - The expected result to be returned - - - - - Set to true if this has an expected result - - - - - The expected exception Type - - - - - The FullName of the expected exception - - - - - The name to be used for the test - - - - - The description of the test - - - - - A dictionary of properties, used to add information - to tests without requiring the class to change. - - - - - If true, indicates that the test case is to be ignored - - - - - If true, indicates that the test case is marked explicit - - - - - The reason for ignoring a 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 expected exception type for the test - - Type of the expected exception. - The modified TestCaseData instance - - - - Sets the expected exception type for the test - - FullName of the expected exception. - The modified TestCaseData instance - - - - 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 - - - - - - - - Ignores this TestCase. - - - - - - Ignores this TestCase, specifying the reason. - - The reason. - - - - - Marks this TestCase as Explicit - - - - - - Marks this TestCase as Explicit, specifying the reason. - - The reason. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Returns true if the result has been set - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Gets a list of categories associated with this test. - - - - - Gets the property dictionary for this test - - - - - Provide the context information of the current test - - - - - Constructs a TestContext using the provided context dictionary - - A context dictionary - - - - 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 TestAdapter representing the currently executing test in this context. - - - - - Gets a ResultAdapter representing the current result for the test - executing in this context. - - - - - Gets the directory containing the current test assembly. - - - - - Gets the directory to be used for outputing files created - by this test run. - - - - - TestAdapter adapts a Test for consumption by - the user test code. - - - - - Constructs a TestAdapter for this context - - The context dictionary - - - - The name of the test. - - - - - The FullName of the test - - - - - The properties of the test. - - - - - ResultAdapter adapts a TestResult for consumption by - the user test code. - - - - - Construct a ResultAdapter for a context - - The context holding the result - - - - The TestState of current test. This maps to the ResultState - used in nunit.core and is subject to change in the future. - - - - - The TestStatus of current test. This enum will be used - in future versions of NUnit and so is to be preferred - to the TestState value. - - - - - Provides details about a test - - - - - Creates an instance of TestDetails - - The fixture that the test is a member of, if available. - The method that implements the test, if available. - The full name of the test. - A string representing the type of test, e.g. "Test Case". - Indicates if the test represents a suite of tests. - - - - The fixture that the test is a member of, if available. - - - - - The method that implements the test, if available. - - - - - The full name of the test. - - - - - A string representing the type of test, e.g. "Test Case". - - - - - Indicates if the test represents a suite of tests. - - - - - The ResultState enum indicates the result of running a test - - - - - The result is inconclusive - - - - - The test was not runnable. - - - - - The test has been skipped. - - - - - The test has been ignored. - - - - - The test succeeded - - - - - The test failed - - - - - The test encountered an unexpected exception - - - - - The test was cancelled by the user - - - - - The TestStatus enum indicates the result of running a test - - - - - The test was inconclusive - - - - - The test has skipped - - - - - The test succeeded - - - - - The test failed - - - - - Helper class with static methods used to supply constraints - that operate on strings. - - - - - 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 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 fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - 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. - - - - - 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 - - - - - 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 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 locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - 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 - - - - Abstract method to get the max line length - - - - - 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. - - - - - - - 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 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 a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - 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 constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Helper class with properties and methods that supply - constraints that operate on exceptions. - - - - - 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 - - - - - 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 TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying that no exception is thrown - - - - - 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 - - - - - 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 an array as containing a set of datapoints to be used - executing a theory within the same fixture that requires an argument - of the Type of the array elements. - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - Expect a message that starts with the parameter string - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - 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 - - - - The reason test is marked explicit - - - - - 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 without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - 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 itemss 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 - - - - - 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-deliminted list of platforms - - - - 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 - - - - Marks a test to use a combinatorial join of any argument data - provided. NUnit will create a test case for every combination of - the arguments provided. This can result in a large number of test - cases and so should be used judiciously. This is the default join - type, so the attribute need not be used except as documentation. - - - - - 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 - - - - - Default constructor - - - - - Marks a test to use pairwise join of any argument data provided. - NUnit will attempt too excercise every pair of argument values at - least once, using as small a number of test cases as it can. With - only two arguments, this is the same as a combinatorial join. - - - - - Default constructor - - - - - Marks a test to use a sequential join of any argument data - provided. NUnit will use arguements for each parameter in - sequence, generating test cases up to the largest number - of argument values provided and using null for any arguments - for which it runs out of values. Normally, this should be - used with the same number of arguments for each parameter. - - - - - Default constructor - - - - - Summary description for MaxTimeAttribute. - - - - - Construct a MaxTimeAttribute, given a time in milliseconds. - - The maximum elapsed time in milliseconds - - - - RandomAttribute is used to supply a set of random values - to a single parameter of a parameterized test. - - - - - ValuesAttribute is used to provide literal arguments for - an individual parameter of a test. - - - - - Abstract base class for attributes that apply to parameters - and supply data for the parameter. - - - - - Gets the data to be provided to the specified parameter - - - - - 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. - - - - - 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 - - - - - Construct a set of doubles from 0.0 to 1.0, - specifying only the count. - - - - - - Construct a set of doubles from min to max - - - - - - - - Construct a set of ints from min to max - - - - - - - - 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 longs - - - - - - - - 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 - - - - RequiredAddinAttribute may be used to indicate the names of any addins - that must be present in order to run some or all of the tests in an - assembly. If the addin is not loaded, the entire assembly is marked - as NotRunnable. - - - - - Initializes a new instance of the class. - - The required addin. - - - - Gets the name of required addin. - - The required addin name. - - - - Summary description for SetCultureAttribute. - - - - - Construct given the name of a culture - - - - - - Summary description for SetUICultureAttribute. - - - - - Construct given the name of a culture - - - - - - SetUpAttribute is used in a TestFixture to identify a method - that is called immediately before each test is run. It is - also used in a SetUpFixture to identify the method that is - called once, before any of the subordinate tests are run. - - - - - 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 static (shared in VB) property - that returns a list of tests. - - - - - Attribute used in a TestFixture to identify a method that is - called immediately after each test is run. It is also used - in a SetUpFixture to identify the method that is called once, - after all subordinate tests have run. In either case, the method - is guaranteed to be called, even if an exception is thrown. - - - - - Provide actions to execute before and after tests. - - - - - When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. - - - - - Executed before each test is run - - Provides details about the test that is going to be run. - - - - Executed after each test is run - - Provides details about the test that has just been run. - - - - Provides the target for the action attribute - - The target for the action attribute - - - - Method called before each test - - Info about the test to be run - - - - Method called after each test - - Info about the test that was just run - - - - Gets or sets the ActionTargets for this 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")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - 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 the list of arguments to a test case - - - - - Gets or sets the expected result. Use - ExpectedResult by preference. - - The result. - - - - Gets or sets the expected result. - - The result. - - - - Gets a flag indicating whether an expected - result has been set. - - - - - Gets a list of categories associated with this test; - - - - - Gets or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - Gets or sets the expected exception. - - The expected exception. - - - - Gets or sets the name the expected exception. - - The expected name of the exception. - - - - Gets or sets the expected message of the expected exception - - The expected message of the exception. - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets or sets the description. - - The description. - - - - Gets or sets the name of the test. - - The name of the test. - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the explicit status of the test - - - - - Gets or sets the reason for not running the test - - - - - Gets or sets the reason for not running the test. - Set has the side effect of marking the test as ignored. - - The ignore reason. - - - - FactoryAttribute indicates the source to be used to - provide test cases for a test method. - - - - - Construct with the name of the data source, which must - be a property, field or method of the test class itself. - - An array of the names of the factories that will provide data - - - - Construct with a Type, which must implement IEnumerable - - The Type that will provide data - - - - Construct with a Type and name. - that don't support params arrays. - - The Type that will provide data - The name of the 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 or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - [TestFixture] - public class ExampleClass - {} - - - - - 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. - - - - - - Descriptive text for this fixture - - - - - Gets and sets the category for this fixture. - May be a comma-separated list of categories. - - - - - Gets a list of categories for this fixture - - - - - The arguments originally provided to the attribute - - - - - Gets or sets a value indicating whether this should be ignored. - - true if ignore; otherwise, false. - - - - Gets or sets the ignore reason. May set Ignored as a side effect. - - The ignore reason. - - - - Get or set the type arguments. If not set - explicitly, any leading arguments that are - Types are taken as type arguments. - - - - - 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")] - publc void TestDescriptionMethod() - {} - } - - - - - - 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 method or assembly, sets the default timeout - for all contained test methods. - - - - - Construct a TimeoutAttribute given a time in milliseconds - - The timeout value in milliseconds - - - - Marks a test that must run in the STA, causing it - to run in a separate thread if necessary. - - On methods, you may also use STAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresSTAAttribute - - - - - 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 on a separate thread. - - - - - Construct a RequiresThreadAttribute - - - - - Construct a RequiresThreadAttribute, specifying the apartment - - - - - 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 the data source to be used - - - - 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 the 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 - - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Abstract base class used for prefixes - - - - - The Constraint class is the base of all built-in constraints - within NUnit. It provides the operator overloads used to combine - constraints. - - - - - The IConstraintExpression interface is implemented by all - complete and resolvable constraints and expressions. - - - - - Return the top-level constraint for this expression - - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - The actual value being tested against a constraint - - - - - The display name of this Constraint for use by ToString() - - - - - Argument fields used by ToString(); - - - - - The builder holding this constraint - - - - - Construct a constraint with no arguments - - - - - Construct a constraint with one argument - - - - - Construct a constraint with two arguments - - - - - Sets the ConstraintBuilder holding this constraint - - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint 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 - - - - 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 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 - True for success, false for failure - - - - 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 - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - 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 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. - - - - - 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. - - - - - 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. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - AndConstraint succeeds only if both members succeed. - - - - - 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 - - - - Create an AndConstraint from two other constraints - - The first constraint - The second 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 a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - 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. - - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeConstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableToConstraint is used to test that an object - can be assigned to a given Type. - - - - - Construct an AssignableToConstraint for the type provided - - - - - - Test whether an object can be assigned to the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - 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 attriute - Type and base constraint. - - - - - - - Determines whether the Type or other provider has the - expected attribute and if its value matches the - additional constraint specified. - - - - - Writes a description of the attribute to the specified writer. - - - - - Writes the actual value supplied to the specified writer. - - - - - 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 - - - - - - Tests whether the object provides the expected attribute. - - A Type, MethodInfo, or other ICustomAttributeProvider - True if the expected attribute is present, otherwise false - - - - Writes the description of the constraint to the specified writer - - - - - BasicConstraint is the abstract base for constraints that - perform a simple comparison to a constant value. - - - - - Initializes a new instance of the class. - - The expected. - The description. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - 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. - - - - - 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 use the supplied EqualityAdapter. - NOTE: For internal use only. - - The EqualityAdapter 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 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 - - - - Flag the constraint to ignore case and return self. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionOrderedConstraint is used to test whether a collection is ordered. - - - - - Construct a CollectionOrderedConstraint - - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - Modifies the constraint to test ordering by the value of - a specified property and returns self. - - - - - Test whether the collection is ordered - - - - - - - Write a description of the constraint to a MessageWriter - - - - - - Returns the string representation of the constraint. - - - - - - If used performs a reverse comparison - - - - - 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 - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enumerations. - - - - - Construct a CollectionTally object from a comparer and a collection - - - - - 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 - - - - The number of objects remaining in the tally - - - - - ComparisonAdapter class centralizes all comparisons of - values in NUnit, adapting to the use of any provided - IComparer, IComparer<T> or Comparison<T> - - - - - Returns a ComparisonAdapter that wraps an IComparer - - - - - Returns a ComparisonAdapter that wraps an IComparer<T> - - - - - Returns a ComparisonAdapter that wraps a Comparison<T> - - - - - Compares two objects - - - - - Gets the default ComparisonAdapter, which wraps an - NUnitComparer object. - - - - - Construct a ComparisonAdapter for an IComparer - - - - - Compares two objects - - - - - - - - Construct a default ComparisonAdapter - - - - - ComparisonAdapter<T> extends ComparisonAdapter and - allows use of an IComparer<T> or Comparison<T> - to actually perform the comparison. - - - - - Construct a ComparisonAdapter for an IComparer<T> - - - - - Compare a Type T to an object - - - - - Construct a ComparisonAdapter for a Comparison<T> - - - - - 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. This class supplies the Using modifiers. - - - - - ComparisonAdapter to be used in making the comparison - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Modifies the constraint to use an IComparer and returns self - - - - - Modifies the constraint to use an IComparer<T> and returns self - - - - - Modifies the constraint to use a Comparison<T> and returns self - - - - - Delegate used to delay evaluation of the actual value - to be used in evaluating a 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 reognized. a ConstraintStack holds - input constraints as well as the results of each - operator applied. - - - - - 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 expresson 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. - - - - - OperatorStack is a type-safe stack for holding ConstraintOperators - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified operator onto the stack. - - The op. - - - - Pops the topmost operator from the stack. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost operator without modifying the stack. - - The top. - - - - ConstraintStack is a type-safe stack for holding Constraints - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified constraint. As a side effect, - the constraint's builder field is set to the - ConstraintBuilder owning this stack. - - The constraint. - - - - Pops this topmost constrait from the stack. - As a side effect, the constraint's builder - field is set to null. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost constraint without modifying the stack. - - The topmost constraint - - - - 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 - reognized. Once an actual Constraint is appended, the expression - returns a resolvable Constraint. - - - - - ConstraintExpressionBase is the abstract base class for the - ConstraintExpression class, which represents a - compound constraint in the process of being constructed - from a series of syntactic elements. - - NOTE: ConstraintExpressionBase is separate because the - ConstraintExpression class was generated in earlier - versions of NUnit. The two classes may be combined - in a future version. - - - - - 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. - - - - - 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 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 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 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 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 suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled 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 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 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 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 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 same path or under an 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 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 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. - - - - - With is currently a NOP - reserved for future use. - - - - - 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 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 whether a collection is ordered - - - - - 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. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - Flag the constraint to ignore case and return self. - - - - - Applies a delay to the match so that a match can be evaluated in the future. - - - - - Creates a new DelayedConstraint - - The inner constraint two 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 two decorate - The time interval after which the match is performed - The time interval used for polling - If the value of is less than 0 - - - - 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 - True for if the base constraint fails, false if it succeeds - - - - 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 - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - EmptyCollectionConstraint tests whether a collection is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - 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. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EmptyDirectoryConstraint is used to test that a directory is empty - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - EmptyStringConstraint tests whether a string is empty. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - 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 - - - - - Constructs a StringConstraint given an expected value - - The expected value - - - - 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 - - - - Modify the constraint to ignore case in matching. - - - - - 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. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - - If true, strings in error messages will be clipped - - - - - NUnitEqualityComparer used to test equality. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Flag the constraint to use a tolerance when determining equality. - - Tolerance value to be used - 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 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 - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - 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 enumerations, 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 - - - - 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. - - - - - 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 - - - - EqualityAdapter class handles all equality comparisons - that use an IEqualityComparer, IEqualityComparer<T> - or a ComparisonAdapter. - - - - - 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 EqualityAdapter that wraps an IComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer<T>. - - - - - Returns an EqualityAdapter that wraps an IComparer<T>. - - - - - Returns an EqualityAdapter that wraps a Comparison<T>. - - - - - EqualityAdapter that wraps an IComparer. - - - - - Returns true if the two objects can be compared by this adapter. - Generic adapter requires objects of the specified type. - - - - - EqualityAdapter that wraps an IComparer. - - - - - EqualityAdapterList represents a list of EqualityAdapters - in a common class across platforms. - - - - - 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. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - 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. - - - - Test that an object is of the exact type specified - - The actual value. - True if the tested object is of the exact type provided, otherwise false. - - - - Write the description of this constraint to a MessageWriter - - The MessageWriter to use - - - - ExceptionTypeConstraint is a special version of ExactTypeConstraint - used to provided detailed info about the exception thrown in - an error message. - - - - - Constructs an ExceptionTypeConstraint - - - - - Write the actual value for a failing constraint test to a - MessageWriter. Overriden to write additional information - in the case of an Exception. - - The MessageWriter to use - - - - 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 - - - - - FailurePointList represents a set of FailurePoints - in a cross-platform way. - - - - - FalseConstraint tests that the actual value is false - - - - - Initializes a new instance of the class. - - - - 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. - - - - - 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 - - - - 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 - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - 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 - - - - Test whether an object is of the specified type or a derived type - - The object to be tested - True if the object is of the provided type or derives from it, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - Tests whether a value is less than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - 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 enumerable, - 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 - - - - - Test that the actual value is an NaN - - - - - - - Write the constraint description to a specified writer - - - - - - NoItemConstraint applies another constraint to each - item in a collection, failing if any of them succeeds. - - - - - Construct a NoItemConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - 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 - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - NullConstraint tests that the actual value is null - - - - - Initializes a new instance of the class. - - - - - NullEmptyStringConstraint tests whether a string is either null or empty. - - - - - Constructs a new NullOrEmptyStringConstraint - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - - Compares two objects - - - - - - - - Returns the default NUnitComparer. - - - - - Generic version of NUnitComparer - - - - - - Compare two objects of the same type - - - - - NUnitEqualityComparer encapsulates NUnit's handling of - equality tests between objects. - - - - - - - - - - Compares two objects for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - - 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 occured. - - - - - RecursionDetector used to check for recursion when - evaluating self-referencing enumerables. - - - - - Compares two objects for equality within a tolerance, setting - the tolerance to the actual tolerance used if an empty - tolerance is supplied. - - - - - 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 - - - - 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. - - - - - RecursionDetector detects when a comparison - between two enumerables has reached a point - where the same objects that were previously - compared are again being compared. This allows - the caller to stop the comparison if desired. - - - - - Check whether two objects have previously - been compared, returning true if they have. - The two objects are remembered, so that a - second call will always return true. - - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second 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 - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - PathConstraint serves as the abstract base of constraints - that operate on paths and provides several helper methods. - - - - - The expected path used in the constraint - - - - - Flag indicating whether a caseInsensitive comparison should be made - - - - - Construct a PathConstraint for a give expected path - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Returns true if the expected path and actual path match - - - - - Returns the string representation of this constraint - - - - - Transform the provided path to its canonical form so that it - may be more easily be compared with other paths. - - The original path - The path in canonical form - - - - Test whether one path in canonical form is under another. - - The first path - supposed to be the parent path - The second path - supposed to be the child path - Indicates whether case should be ignored - - - - - Modifies the current instance to be case-insensitve - and returns it. - - - - - Modifies the current instance to be case-sensitve - and returns it. - - - - - Predicate constraint wraps a Predicate in a constraint, - returning success if the predicate is true. - - - - - Construct a PredicateConstraint from a predicate - - - - - Determines whether the predicate succeeds when applied - to the actual value. - - - - - Writes the description to a MessageWriter - - - - - 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 - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - 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 vaue - of the property. The two constraints are now separate. - - - - - Initializes a new instance of the class. - - The name of the property. - - - - Test whether the property exists for a given object - - The object to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. - - The writer on which the actual value is displayed - - - - 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. - To. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - - Resolve the current expression to a Constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - 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 either - of the argument constraints is 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. - - - - - Appends an And Operator to the expression - - - - - Appends an Or operator to the expression. - - - - - 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 the string representation of the constraint. - - A string representing the constraint - - - - Resolves the ReusableConstraint by returning the constraint - that it originally wrapped. - - A resolved constraint - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Summary description for SamePathConstraint. - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SamePathOrUnderConstraint tests that one path is under another - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - 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. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubPathConstraint tests that the actual path is under the expected path - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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. - - - - 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 constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - Returns the string representation of this constraint - - - - - Get the actual exception thrown - used by Assert.Throws. - - - - - ThrowsNothingConstraint tests that a delegate does not - throw an exception. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True if no exception is thrown, otherwise false - - - - Test whether the constraint is satisfied by a given delegate - - Delegate returning the value to be tested - True if no exception is thrown, otherwise false - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. Overridden in ThrowsNothingConstraint to write - information about the exception that was actually caught. - - The writer on which the actual value is displayed - - - - 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. - - - - - Constructs a linear tolerance of a specdified amount - - - - - Constructs a tolerance given an amount and ToleranceMode - - - - - Tests that the current Tolerance is linear with a - numeric value, throwing an exception if it is not. - - - - - Returns an empty Tolerance object, equivalent to - specifying no tolerance. In most cases, it results - in an exact match but for floats and doubles a - default tolerance may be used. - - - - - Returns a zero Tolerance object, equivalent to - specifying an exact match. - - - - - Gets the ToleranceMode for the current Tolerance - - - - - 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 TimeSpan as the amount, using - the current amount as a number of days. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of hours. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of minutes. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of seconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of milliseconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of clock ticks. - - - - - Returns true if the current tolerance is empty. - - - - - 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. - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - XmlSerializableConstraint tests whether - an object is serializable in XML format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - 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 - - - - Returns the string representation of this constraint - - - - - Represents a constraint that succeeds if all the - members of a collection match a base constraint. - - - - - Abstract base for operators that indicate how to - apply a constraint to items in a collection. - - - - - PrefixOperator takes a single constraint and modifies - it's action in some way. - - - - - 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. - - - - - 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. - - - - - - The syntax element preceding this operator - - - - - The syntax element folowing 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. - - - - - - Returns the constraint created by applying this - prefix to another constraint. - - - - - - - Constructs a CollectionOperator - - - - - 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 - - - - - 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. - - - - - - Abstract method that produces a constraint by applying - the operator to its left and right constraint arguments. - - - - - Gets the left precedence of the operator - - - - - Gets the right precedence of the operator - - - - - 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. - - - - - Abstract base class for operators that are able to reduce to a - constraint whether or not another syntactic element follows. - - - - - 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. - - - - - 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 - - - - - 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. - - - - - 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. - - - - - - Gets the name of the property to which the operator applies - - - - - 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 modifes the - order of evaluation because of its precedence. - - - - - Constructor for the WithOperator - - - - - Returns a constraint that wraps its 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 - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - 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 - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - - - - - - - Compares two objects of a given Type for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - diff --git a/packages/NUnit.2.6.4/license.txt b/packages/NUnit.2.6.4/license.txt deleted file mode 100644 --- a/packages/NUnit.2.6.4/license.txt +++ /dev/null @@ -1,15 +0,0 @@ -Copyright 2002-2014 Charlie Poole -Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov -Copyright 2000-2002 Philip A. Craig - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. - -Portions Copyright 2002-2014 Charlie Poole or Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright 2000-2002 Philip A. Craig - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. diff --git a/packages/NUnit.3.0.1/CHANGES.txt b/packages/NUnit.3.0.1/CHANGES.txt deleted file mode 100644 --- a/packages/NUnit.3.0.1/CHANGES.txt +++ /dev/null @@ -1,924 +0,0 @@ -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.0.1/LICENSE.txt b/packages/NUnit.3.0.1/LICENSE.txt deleted file mode 100644 --- a/packages/NUnit.3.0.1/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2015 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.0.1/NOTICES.txt b/packages/NUnit.3.0.1/NOTICES.txt deleted file mode 100644 --- a/packages/NUnit.3.0.1/NOTICES.txt +++ /dev/null @@ -1,5 +0,0 @@ -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.0.1/NUnit.3.0.1.nupkg b/packages/NUnit.3.0.1/NUnit.3.0.1.nupkg deleted file mode 100644 index 6de5d1ec099c112fca2a2652b8a55148c7f99881..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - nunit.framework - - - - - AssemblyHelper provides static methods for working - with assemblies. - - - - - 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 - - - - - 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. - - - - - 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. - - - - - 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. - - - - - 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 the ongoing run completely. - If no run is in process, the call has no effect. - - - - - 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. - - - - - 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 - - - - - 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 - - - - - 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. - - - - - 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 - - - - - 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 - - - - - 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 test-running threads - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 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. - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - - 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. - - - - - 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. - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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 - - - - - - - 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 - - - - - - - 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. - - - - - - - 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. - - - - - - - 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 - - - - 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 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 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 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. - - - - 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 - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Formatting strings used for expected and actual _values - - - - - 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 - - - - 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. - - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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.0.1/lib/net20/nunit.framework.dll b/packages/NUnit.3.0.1/lib/net20/nunit.framework.dll deleted file mode 100644 index 3151a93fa006fdb7c13596d00d66ad0bd24a46b0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - 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. - - 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. - - - - - 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 the ongoing run completely. - If no run is in process, the call has no effect. - - - - - 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 the shift without completing all work - - - - - A CompositeWorkItem represents a test suite and - encapsulates the execution of the suite as well - as all its child tests. - - - - - 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. - - - - - 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 - - - - - 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. - - - - - 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 - - - - - 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 - - - - - 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. - - - - - 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. - - - - - 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 - - - - 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 - - - - - 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 test-running threads - - - - 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 - - - - 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. - - - - 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. - - - - - - - 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. - - - - - 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. - - - - - - - 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 - - - - 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 - - - - 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 - - - - - - - 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 - - - - - - - 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. - - - - - - - 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 - - - - 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 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 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 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 - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Formatting strings used for expected and actual _values - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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. - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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. - - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - Enables compiling extension methods in .NET 2.0 - - - - diff --git a/packages/NUnit.3.0.1/lib/net40/nunit.framework.dll b/packages/NUnit.3.0.1/lib/net40/nunit.framework.dll deleted file mode 100644 index c52b02df2cd3b0417b95117a85f51cb8532d2891..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - 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. - - 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 - - - - - 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. - - - - - 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. - - - - - 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. - - - - - 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 the ongoing run completely. - If no run is in process, the call has no effect. - - - - - 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 - - - - - 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. - - - - - 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 the shift without completing all work - - - - - 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 - - - - - 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. - - - - - 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. - - - - - 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 - - - - 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 - - - - - 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 test-running threads - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 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. - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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. - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - - - 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. - - - - - 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 - - - - - - - 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 - - - - - - - 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. - - - - - - - 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. - - - - - - - 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 - - - - 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 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 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 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 - - - - 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 - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Formatting strings used for expected and actual _values - - - - - 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 - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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. - - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - diff --git a/packages/NUnit.3.0.1/lib/net45/nunit.framework.dll b/packages/NUnit.3.0.1/lib/net45/nunit.framework.dll deleted file mode 100644 index cd864b1c4205a44ccab9cd526efb6c3b1461db71..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - 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. - - 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 - - - - - 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. - - - - - 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. - - - - - 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. - - - - - 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 the ongoing run completely. - If no run is in process, the call has no effect. - - - - - 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 - - - - - 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. - - - - - 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 the shift without completing all work - - - - - 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 - - - - - 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. - - - - - 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. - - - - - 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 - - - - 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 - - - - - 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 test-running threads - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 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. - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - - 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. - - - - - 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. - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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 - - - - - - - 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 - - - - - - - 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. - - - - - - - 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. - - - - - - - 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 - - - - 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 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 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 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 - - - - 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 - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Formatting strings used for expected and actual _values - - - - - 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 - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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. - - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - diff --git a/packages/NUnit.3.0.1/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.dll b/packages/NUnit.3.0.1/lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10/nunit.framework.dll deleted file mode 100644 index e110b17367f51f64feeebff2f0647a02643f4abe..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - nunit.framework - - - - - AssemblyHelper provides static methods for working - with assemblies. - - - - - 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 - - - - - 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. - - - - - 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. - - - - - 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. - - - - - 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 the ongoing run completely. - If no run is in process, the call has no effect. - - - - - 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. - - - - - 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 - - - - - 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 - - - - - 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. - - - - - 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 - - - - - 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 - - - - - 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 test-running threads - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 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. - - - - - 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - - 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. - - - - - 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. - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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 - - - - - - - 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 - - - - - - - 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. - - - - - - - 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. - - - - - - - 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 - - - - 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 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 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 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. - - - - 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 - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Formatting strings used for expected and actual _values - - - - - 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 - - - - 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. - - - - - 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 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 AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. 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 - - - - 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. - - - - - 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/System.Text.Json.2.0.0.11/System.Text.Json.2.0.0.11.nupkg b/packages/System.Text.Json.2.0.0.11/System.Text.Json.2.0.0.11.nupkg deleted file mode 100644 index a9fd4da0c2ee6c8d260502a21c573a07cf9afd24..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - - \ No newline at end of file