Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2942 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
17 changed files with 632 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="UnitTestingOptionsPanel" /> |
||||
<ClientSize value="{Width=450, Height=281}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox" /> |
||||
<Location value="10, 13" /> |
||||
<UseCompatibleTextRendering value="True" /> |
||||
<Text value="${res:ICSharpCode.NUnitPad.NUnitPadContent.PadName}" /> |
||||
<Size value="432, 241" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="threadCheckBox" /> |
||||
<Location value="6, 149" /> |
||||
<Text value="${res:ICSharpCode.UnitTesting.OptionsPanel.Thread}" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="420, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="shadowCopyCheckBox" /> |
||||
<Location value="6, 119" /> |
||||
<Text value="${res:ICSharpCode.UnitTesting.OptionsPanel.ShadowCopy}" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="420, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showProgressCheckBox" /> |
||||
<Location value="6, 89" /> |
||||
<Text value="${res:ICSharpCode.UnitTesting.OptionsPanel.ShowProgress}" /> |
||||
<TabIndex value="3" /> |
||||
<Size value="420, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="labelsCheckBox" /> |
||||
<Location value="6, 29" /> |
||||
<Text value="${res:ICSharpCode.UnitTesting.OptionsPanel.LabelEachTest}" /> |
||||
<TabIndex value="2" /> |
||||
<Size value="420, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showLogoCheckBox" /> |
||||
<Location value="6, 59" /> |
||||
<Text value="${res:ICSharpCode.UnitTesting.OptionsPanel.ShowLogo}" /> |
||||
<TabIndex value="1" /> |
||||
<Size value="420, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.UnitTesting |
||||
{ |
||||
public class UnitTestingOptions |
||||
{ |
||||
/// <summary>
|
||||
/// The name of the options as read from the PropertyService.
|
||||
/// </summary>
|
||||
public static readonly string AddInOptionsName = "UnitTesting.Options"; |
||||
|
||||
/// <summary>
|
||||
/// The name of the noshadow property stored in SharpDevelop's options.
|
||||
/// </summary>
|
||||
public static readonly string NoShadowProperty = "NoShadow"; |
||||
|
||||
/// <summary>
|
||||
/// The name of the nothread property stored in SharpDevelop's options.
|
||||
/// </summary>
|
||||
public static readonly string NoThreadProperty = "NoThread"; |
||||
|
||||
/// <summary>
|
||||
/// The name of the nologo property stored in SharpDevelop's options.
|
||||
/// </summary>
|
||||
public static readonly string NoLogoProperty = "NoLogo"; |
||||
|
||||
/// <summary>
|
||||
/// The name of the nodots property stored in SharpDevelop's options.
|
||||
/// </summary>
|
||||
public static readonly string NoDotsProperty = "NoDots"; |
||||
|
||||
/// <summary>
|
||||
/// The name of the labels property stored in SharpDevelop's options.
|
||||
/// </summary>
|
||||
public static readonly string LabelsProperty = "Labels"; |
||||
|
||||
Properties properties; |
||||
|
||||
public UnitTestingOptions() |
||||
: this(PropertyService.Get(AddInOptionsName, new Properties())) |
||||
{ |
||||
} |
||||
|
||||
public UnitTestingOptions(Properties properties) |
||||
{ |
||||
this.properties = properties; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disables the use of a separate thread for running tests.
|
||||
/// </summary>
|
||||
public bool NoThread { |
||||
get { return properties.Get<bool>(NoThreadProperty, false); } |
||||
set { properties.Set<bool>(NoThreadProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disables shadow copying of the assemblies being tested.
|
||||
/// </summary>
|
||||
public bool NoShadow { |
||||
get { return properties.Get<bool>(NoShadowProperty, false); } |
||||
set { properties.Set<bool>(NoShadowProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disables the display of the NUnit logo when running NUnit-Console.
|
||||
/// </summary>
|
||||
public bool NoLogo { |
||||
get { return properties.Get<bool>(NoLogoProperty, false); } |
||||
set { properties.Set<bool>(NoLogoProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disables the display of progress when running the unit tests.
|
||||
/// </summary>
|
||||
public bool NoDots { |
||||
get { return properties.Get<bool>(NoDotsProperty, false); } |
||||
set { properties.Set<bool>(NoDotsProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Labels each test in the console output.
|
||||
/// </summary>
|
||||
public bool Labels { |
||||
get { return properties.Get<bool>(LabelsProperty, false); } |
||||
set { properties.Set<bool>(LabelsProperty, value); } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.UnitTesting |
||||
{ |
||||
public class UnitTestingOptionsPanel : AbstractOptionPanel |
||||
{ |
||||
UnitTestingOptions options; |
||||
CheckBox labelsCheckBox; |
||||
CheckBox showLogoCheckBox; |
||||
CheckBox showProgressCheckBox; |
||||
CheckBox threadCheckBox; |
||||
CheckBox shadowCopyCheckBox; |
||||
|
||||
public UnitTestingOptionsPanel() : this(new UnitTestingOptions()) |
||||
{ |
||||
} |
||||
|
||||
public UnitTestingOptionsPanel(UnitTestingOptions options) |
||||
{ |
||||
this.options = options; |
||||
} |
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromManifestResource("ICSharpCode.UnitTesting.Resources.UnitTestingOptionsPanel.xfrm"); |
||||
|
||||
labelsCheckBox = (CheckBox)ControlDictionary["labelsCheckBox"]; |
||||
labelsCheckBox.Checked = options.Labels; |
||||
|
||||
showLogoCheckBox = (CheckBox)ControlDictionary["showLogoCheckBox"]; |
||||
showLogoCheckBox.Checked = !options.NoLogo; |
||||
|
||||
showProgressCheckBox = (CheckBox)ControlDictionary["showProgressCheckBox"]; |
||||
showProgressCheckBox.Checked = !options.NoDots; |
||||
|
||||
shadowCopyCheckBox = (CheckBox)ControlDictionary["shadowCopyCheckBox"]; |
||||
shadowCopyCheckBox.Checked = !options.NoShadow; |
||||
|
||||
threadCheckBox = (CheckBox)ControlDictionary["threadCheckBox"]; |
||||
threadCheckBox.Checked = !options.NoThread; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
options.Labels = labelsCheckBox.Checked; |
||||
options.NoLogo = !showLogoCheckBox.Checked; |
||||
options.NoDots = !showProgressCheckBox.Checked; |
||||
options.NoShadow = !shadowCopyCheckBox.Checked; |
||||
options.NoThread = !threadCheckBox.Checked; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Calls SetupFromXmlStream after creating a stream from the current
|
||||
/// assembly using the specified manifest resource name.
|
||||
/// </summary>
|
||||
/// <param name="resource">The manifest resource name used to create the stream.</param>
|
||||
protected virtual void SetupFromManifestResource(string resource) |
||||
{ |
||||
SetupFromXmlStream(typeof(UnitTestingOptionsPanel).Assembly.GetManifestResourceStream(resource)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace UnitTesting.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the UnitTestingOptionsPanel.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class UnitTestingOptionsPanelTestFixture |
||||
{ |
||||
DerivedUnitTestingOptionsPanel panel; |
||||
UnitTestingOptions options; |
||||
CheckBox labelsCheckBox; |
||||
CheckBox showLogoCheckBox; |
||||
CheckBox showProgressCheckBox; |
||||
CheckBox threadCheckBox; |
||||
CheckBox shadowCopyCheckBox; |
||||
|
||||
[SetUp] |
||||
public void SetUp() |
||||
{ |
||||
Properties p = new Properties(); |
||||
options = new UnitTestingOptions(p); |
||||
options.Labels = true; |
||||
options.NoDots = false; |
||||
options.NoShadow = false; |
||||
options.NoThread = false; |
||||
|
||||
panel = new DerivedUnitTestingOptionsPanel(options); |
||||
panel.LoadPanelContents(); |
||||
|
||||
labelsCheckBox = (CheckBox)panel.ControlDictionary["labelsCheckBox"]; |
||||
showLogoCheckBox = (CheckBox)panel.ControlDictionary["showLogoCheckBox"]; |
||||
showProgressCheckBox = (CheckBox)panel.ControlDictionary["showProgressCheckBox"]; |
||||
threadCheckBox = (CheckBox)panel.ControlDictionary["threadCheckBox"]; |
||||
shadowCopyCheckBox = (CheckBox)panel.ControlDictionary["shadowCopyCheckBox"]; |
||||
} |
||||
|
||||
[TearDown] |
||||
public void TearDown() |
||||
{ |
||||
panel.Dispose(); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsAbstractOptionPanel() |
||||
{ |
||||
Assert.IsInstanceOfType(typeof(AbstractOptionPanel), panel); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetupFromManifestStreamResourceName() |
||||
{ |
||||
Assert.AreEqual("ICSharpCode.UnitTesting.Resources.UnitTestingOptionsPanel.xfrm", panel.SetupFromManifestResourceName); |
||||
} |
||||
|
||||
[Test] |
||||
public void LabelsCheckBoxIsChecked() |
||||
{ |
||||
Assert.IsTrue(labelsCheckBox.Checked); |
||||
} |
||||
|
||||
[Test] |
||||
public void LabelsSettingSaved() |
||||
{ |
||||
labelsCheckBox.Checked = false; |
||||
panel.StorePanelContents(); |
||||
Assert.IsFalse(options.Labels); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowLogoCheckBoxIsChecked() |
||||
{ |
||||
Assert.IsTrue(showLogoCheckBox.Checked); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowLogoSettingSaved() |
||||
{ |
||||
showLogoCheckBox.Checked = false; |
||||
panel.StorePanelContents(); |
||||
Assert.IsTrue(options.NoLogo); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowProgressCheckBoxIsChecked() |
||||
{ |
||||
Assert.IsTrue(showProgressCheckBox.Checked); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowProgressSettingSaved() |
||||
{ |
||||
showProgressCheckBox.Checked = false; |
||||
panel.StorePanelContents(); |
||||
Assert.IsTrue(options.NoDots); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShadowCopyCheckBoxIsChecked() |
||||
{ |
||||
Assert.IsTrue(shadowCopyCheckBox.Checked); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShadowCopySettingSaved() |
||||
{ |
||||
shadowCopyCheckBox.Checked = false; |
||||
panel.StorePanelContents(); |
||||
Assert.IsTrue(options.NoShadow); |
||||
} |
||||
|
||||
[Test] |
||||
public void ThreadCheckBoxIsChecked() |
||||
{ |
||||
Assert.IsTrue(threadCheckBox.Checked); |
||||
} |
||||
|
||||
[Test] |
||||
public void ThreadSettingSaved() |
||||
{ |
||||
threadCheckBox.Checked = false; |
||||
panel.StorePanelContents(); |
||||
Assert.IsTrue(options.NoThread); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,146 @@
@@ -0,0 +1,146 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
|
||||
namespace UnitTesting.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the UnitTestingOptions class.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class UnitTestingOptionsTestFixture |
||||
{ |
||||
UnitTestingOptions defaultOptions; |
||||
Properties p; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
p = new Properties(); |
||||
defaultOptions = new UnitTestingOptions(p); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefaultNoShadow() |
||||
{ |
||||
Assert.IsFalse(defaultOptions.NoShadow); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetNoShadow() |
||||
{ |
||||
defaultOptions.NoShadow = true; |
||||
Assert.IsTrue(p.Get<bool>(UnitTestingOptions.NoShadowProperty, false)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoShadowSetToTrueInProperties() |
||||
{ |
||||
Properties newProperties = new Properties(); |
||||
newProperties.Set<bool>(UnitTestingOptions.NoShadowProperty, true); |
||||
UnitTestingOptions options = new UnitTestingOptions(newProperties); |
||||
|
||||
Assert.IsTrue(options.NoShadow); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefaultNoThread() |
||||
{ |
||||
Assert.IsFalse(defaultOptions.NoThread); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetNoThread() |
||||
{ |
||||
defaultOptions.NoThread = true; |
||||
Assert.IsTrue(p.Get<bool>(UnitTestingOptions.NoThreadProperty, false)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoThreadSetToTrueInProperties() |
||||
{ |
||||
Properties newProperties = new Properties(); |
||||
newProperties.Set<bool>(UnitTestingOptions.NoThreadProperty, true); |
||||
UnitTestingOptions options = new UnitTestingOptions(newProperties); |
||||
|
||||
Assert.IsTrue(options.NoThread); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefaultNoLogo() |
||||
{ |
||||
Assert.IsFalse(defaultOptions.NoLogo); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetNoLogo() |
||||
{ |
||||
defaultOptions.NoLogo = true; |
||||
Assert.IsTrue(p.Get<bool>(UnitTestingOptions.NoLogoProperty, false)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoLogoSetToTrueInProperties() |
||||
{ |
||||
Properties newProperties = new Properties(); |
||||
newProperties.Set<bool>(UnitTestingOptions.NoLogoProperty, true); |
||||
UnitTestingOptions options = new UnitTestingOptions(newProperties); |
||||
|
||||
Assert.IsTrue(options.NoLogo); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefaultNoDots() |
||||
{ |
||||
Assert.IsFalse(defaultOptions.NoDots); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetNoDots() |
||||
{ |
||||
defaultOptions.NoDots = true; |
||||
Assert.IsTrue(p.Get<bool>(UnitTestingOptions.NoDotsProperty, false)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoDotsSetToTrueInProperties() |
||||
{ |
||||
Properties newProperties = new Properties(); |
||||
newProperties.Set<bool>(UnitTestingOptions.NoDotsProperty, true); |
||||
UnitTestingOptions options = new UnitTestingOptions(newProperties); |
||||
|
||||
Assert.IsTrue(options.NoDots); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefaultLabels() |
||||
{ |
||||
Assert.IsFalse(defaultOptions.Labels); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetLabels() |
||||
{ |
||||
defaultOptions.Labels = true; |
||||
Assert.IsTrue(p.Get<bool>(UnitTestingOptions.LabelsProperty, false)); |
||||
} |
||||
|
||||
[Test] |
||||
public void LabelsSetToTrueInProperties() |
||||
{ |
||||
Properties newProperties = new Properties(); |
||||
newProperties.Set<bool>(UnitTestingOptions.LabelsProperty, true); |
||||
UnitTestingOptions options = new UnitTestingOptions(newProperties); |
||||
|
||||
Assert.IsTrue(options.Labels); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace UnitTesting.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Utility class used to test the UnitTestingOptionsPanel class.
|
||||
/// </summary>
|
||||
public class DerivedUnitTestingOptionsPanel : UnitTestingOptionsPanel |
||||
{ |
||||
string setupFromManifestResourceName = String.Empty; |
||||
|
||||
public DerivedUnitTestingOptionsPanel(UnitTestingOptions options) : base(options) |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the resource name used to create the stream when
|
||||
/// initialising the XmlUserControl.
|
||||
/// </summary>
|
||||
public string SetupFromManifestResourceName { |
||||
get { return setupFromManifestResourceName; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Called in CompilingOptionsPanel.LoadPanelContents when
|
||||
/// initialising the XmlUserControl.
|
||||
/// </summary>
|
||||
protected override void SetupFromManifestResource(string resource) |
||||
{ |
||||
setupFromManifestResourceName = resource; |
||||
base.SetupFromManifestResource(resource); |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Loading…
Reference in new issue