├── .editorconfig
├── .gitignore
├── .travis.yml
├── .vscode
└── tasks.json
├── CHANGES.txt
├── GitVersion.yml
├── LICENSE
├── NuGet.config
├── README.md
├── appveyor.yml
├── build.cake
├── build.cmd
├── build.ps1
├── build.sh
├── choco
├── VERIFICATION.txt
├── nunit-agent-x86.exe.ignore
├── nunit-agent.exe.ignore
├── nunit.choco.addins
└── testcentric-experimental-gui.nuspec
├── experimental-gui.sln
├── src
├── CommonAssemblyInfo.cs
├── TestCentric
│ ├── components
│ │ ├── Controls
│ │ │ ├── ExpandingLabel.cs
│ │ │ ├── LongRunningOperationDisplay.cs
│ │ │ ├── TipWindow.cs
│ │ │ └── TipWindow.resx
│ │ ├── DialogResult.cs
│ │ ├── Elements
│ │ │ ├── CheckBoxElement.cs
│ │ │ ├── CheckedMenuGroup.cs
│ │ │ ├── ContextMenuElement.cs
│ │ │ ├── ControlElement.cs
│ │ │ ├── IChecked.cs
│ │ │ ├── ICommand.cs
│ │ │ ├── IControlElement.cs
│ │ │ ├── ISelection.cs
│ │ │ ├── IToolStripMenu.cs
│ │ │ ├── IToolTip.cs
│ │ │ ├── ITreeView.cs
│ │ │ ├── IViewElement.cs
│ │ │ ├── SplitButtonElement.cs
│ │ │ ├── ToolStripElement.cs
│ │ │ ├── ToolStripMenuElement.cs
│ │ │ └── TreeViewElement.cs
│ │ ├── IMessageDisplay.cs
│ │ ├── MessageButtons.cs
│ │ ├── MessageDisplay.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── TestCentric.Gui.Components.csproj
│ ├── testcentric.exe
│ │ ├── App.config
│ │ ├── Program.cs
│ │ └── TestCentric.Gui.Exe.csproj
│ ├── testcentric.gui
│ │ ├── AppEntry.cs
│ │ ├── Controls
│ │ │ └── TestCentricProgressBar.cs
│ │ ├── Images
│ │ │ ├── RunTests.png
│ │ │ └── Tree
│ │ │ │ └── Default
│ │ │ │ ├── Failure.png
│ │ │ │ ├── Inconclusive.png
│ │ │ │ ├── Skipped.png
│ │ │ │ ├── Success.png
│ │ │ │ └── Warning.png
│ │ ├── Presenters
│ │ │ ├── AddinsPresenter.cs
│ │ │ ├── CategoryGrouping.cs
│ │ │ ├── DisplayStrategy.cs
│ │ │ ├── DurationGrouping.cs
│ │ │ ├── FixtureListDisplayStrategy.cs
│ │ │ ├── GroupDisplayStrategy.cs
│ │ │ ├── MainPresenter.cs
│ │ │ ├── NUnitTreeDisplayStrategy.cs
│ │ │ ├── OutcomeGrouping.cs
│ │ │ ├── ProgressBarPresenter.cs
│ │ │ ├── StatusBarPresenter.cs
│ │ │ ├── TestGroup.cs
│ │ │ ├── TestGrouping.cs
│ │ │ ├── TestListDisplayStrategy.cs
│ │ │ ├── TestPropertiesPresenter.cs
│ │ │ ├── TreeViewPresenter.cs
│ │ │ └── XmlPresenter.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ └── Resources.resx
│ │ ├── Settings
│ │ │ ├── EngineSettings.cs
│ │ │ ├── GuiSettings.cs
│ │ │ ├── SettingsGroup.cs
│ │ │ ├── SettingsModel.cs
│ │ │ ├── TestTreeSettings.cs
│ │ │ └── TreeDisplayStyle.cs
│ │ ├── TestCentric.Gui.csproj
│ │ ├── Views
│ │ │ ├── AddinPages
│ │ │ │ ├── AddinsView.Designer.cs
│ │ │ │ ├── AddinsView.cs
│ │ │ │ ├── AddinsView.resx
│ │ │ │ ├── ExtensionNodeView.cs
│ │ │ │ └── ExtensionPointView.cs
│ │ │ ├── DialogManager.cs
│ │ │ ├── IAddinsView.cs
│ │ │ ├── IDialog.cs
│ │ │ ├── IDialogManager.cs
│ │ │ ├── IMainView.cs
│ │ │ ├── IProgressBarView.cs
│ │ │ ├── ISettingsDialog.cs
│ │ │ ├── IStatusBarView.cs
│ │ │ ├── ITestPropertiesVIew.cs
│ │ │ ├── ITestTreeView.cs
│ │ │ ├── IView.cs
│ │ │ ├── IXmlView.cs
│ │ │ ├── MainForm.Designer.cs
│ │ │ ├── MainForm.cs
│ │ │ ├── MainForm.resx
│ │ │ ├── ProgressBarView.Designer.cs
│ │ │ ├── ProgressBarView.cs
│ │ │ ├── ProgressBarView.resx
│ │ │ ├── SettingsDialog.Designer.cs
│ │ │ ├── SettingsDialog.cs
│ │ │ ├── SettingsDialog.resx
│ │ │ ├── SettingsPage.Designer.cs
│ │ │ ├── SettingsPage.cs
│ │ │ ├── SettingsPages
│ │ │ │ ├── AssemblyReloadSettingsPage.Designer.cs
│ │ │ │ ├── AssemblyReloadSettingsPage.cs
│ │ │ │ ├── AssemblyReloadSettingsPage.resx
│ │ │ │ ├── GuiSettingsPage.Designer.cs
│ │ │ │ ├── GuiSettingsPage.cs
│ │ │ │ └── GuiSettingsPage.resx
│ │ │ ├── StatusBarView.Designer.cs
│ │ │ ├── StatusBarView.cs
│ │ │ ├── StatusBarView.resx
│ │ │ ├── TestPropertiesView.Designer.cs
│ │ │ ├── TestPropertiesView.cs
│ │ │ ├── TestPropertiesView.resx
│ │ │ ├── TestTreeView.Designer.cs
│ │ │ ├── TestTreeView.cs
│ │ │ ├── TestTreeView.resx
│ │ │ ├── XmlView.Designer.cs
│ │ │ ├── XmlView.cs
│ │ │ └── XmlView.resx
│ │ ├── Xml2RtfConverter.cs
│ │ ├── XmlHelper.cs
│ │ ├── nunit.ico
│ │ └── packages.config
│ └── tests
│ │ ├── Presenters
│ │ ├── AddinsPresenterTests.cs
│ │ ├── Main
│ │ │ ├── CommandTests.cs
│ │ │ ├── MainPresenterTestBase.cs
│ │ │ ├── PackageSettingsTests.cs
│ │ │ ├── WhenPresenterIsCreated.cs
│ │ │ ├── WhenTestRunBegins.cs
│ │ │ ├── WhenTestRunCompletes.cs
│ │ │ ├── WhenTestsAreLoaded.cs
│ │ │ ├── WhenTestsAreLoading.cs
│ │ │ ├── WhenTestsAreReloaded.cs
│ │ │ └── WhenTestsAreUnloaded.cs
│ │ ├── ProgressBarPresenterTests.cs
│ │ ├── StatusBarPresenterTests.cs
│ │ ├── TestGroupTests.cs
│ │ ├── TestPropertiesPresenterTests.cs
│ │ ├── TestTree
│ │ │ ├── CommandTests.cs
│ │ │ ├── NUnitTreeDisplayStrategyTests.cs
│ │ │ ├── TestTreePresenterTestBase.cs
│ │ │ ├── WhenPresenterIsCreated.cs
│ │ │ ├── WhenTestRunBegins.cs
│ │ │ ├── WhenTestRunCompletes.cs
│ │ │ ├── WhenTestsAreLoaded.cs
│ │ │ ├── WhenTestsAreReloaded.cs
│ │ │ └── WhenTestsAreUnloaded.cs
│ │ ├── TreeViewPresenterTests.cs
│ │ └── UserSettingsFake.cs
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── TestCentric.Gui.Tests.csproj
│ │ ├── Views
│ │ ├── CommonViewTests.cs
│ │ └── MainFormTests.cs
│ │ ├── XmlRtfConverterTests.cs
│ │ └── packages.config
├── TestModel
│ ├── model
│ │ ├── CommandLineOptions.cs
│ │ ├── EnginePackageSettings.cs
│ │ ├── ITestEvents.cs
│ │ ├── ITestItem.cs
│ │ ├── ITestModel.cs
│ │ ├── ITestServices.cs
│ │ ├── Options.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── ResultNode.cs
│ │ ├── ResultState.cs
│ │ ├── ResultSummary.cs
│ │ ├── ResultSummaryCreator.cs
│ │ ├── ResultSummaryReporter.cs
│ │ ├── RunState.cs
│ │ ├── TestAction.cs
│ │ ├── TestCentric.Gui.Model.csproj
│ │ ├── TestEventArgs.cs
│ │ ├── TestEventDispatcher.cs
│ │ ├── TestModel.cs
│ │ ├── TestNode.cs
│ │ ├── TestSelection.cs
│ │ ├── TestServices.cs
│ │ ├── TestStartNotice.cs
│ │ ├── TestStatus.cs
│ │ ├── XmlHelper.cs
│ │ └── packages.config
│ └── tests
│ │ ├── AvailableRuntimesTest.cs
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── ResultNodeTests.cs
│ │ ├── ResultStateTests.cs
│ │ ├── ResultSummaryCreatorTests.cs
│ │ ├── ResultSummaryReporterTests.cs
│ │ ├── TestCentric.Gui.Model.Tests.csproj
│ │ ├── TestModelAssemblyTests.cs
│ │ ├── TestModelPackageTests.cs
│ │ ├── TestNodeTests.cs
│ │ ├── TestSelectionTests.cs
│ │ └── packages.config
└── tests
│ ├── demo-assembly
│ ├── ApartmentTests.cs
│ ├── App.config
│ ├── AsyncTests.cs
│ ├── ConfigFileTests.cs
│ ├── ExpectedOutcomeAttributes.cs
│ ├── GenericTests.cs
│ ├── InheritedTestTests.cs
│ ├── OneTimeSetUpTests.cs
│ ├── ParameterizedTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SetUpFixtureTests.cs
│ ├── SimpleTests.cs
│ ├── TextOutputTests.cs
│ ├── Theories.cs
│ ├── demo-assembly.csproj
│ └── packages.config
│ └── mock-assembly
│ ├── MockAssembly.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── mock-assembly.csproj
│ └── packages.config
└── tools
└── packages.config
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Rr]elease/
19 | x64/
20 | *_i.c
21 | *_p.c
22 | *.ilk
23 | *.meta
24 | *.obj
25 | *.pch
26 | *.pdb
27 | *.pgc
28 | *.pgd
29 | *.rsp
30 | *.sbr
31 | *.tlb
32 | *.tli
33 | *.tlh
34 | *.tmp
35 | *.log
36 | *.vspscc
37 | *.vssscc
38 | .builds
39 | .vs/
40 |
41 | # Visual C++ cache files
42 | ipch/
43 | *.aps
44 | *.ncb
45 | *.opensdf
46 | *.sdf
47 |
48 | # Visual Studio profiler
49 | *.psess
50 | *.vsp
51 | *.vspx
52 |
53 | # Guidance Automation Toolkit
54 | *.gpState
55 |
56 | # ReSharper is a .NET coding add-in
57 | _ReSharper*
58 |
59 | # NCrunch
60 | *.ncrunch*
61 | .*crunch*.local.xml
62 |
63 | # Installshield output folder
64 | [Ee]xpress
65 |
66 | # DocProject is a documentation generator add-in
67 | DocProject/buildhelp/
68 | DocProject/Help/*.HxT
69 | DocProject/Help/*.HxC
70 | DocProject/Help/*.hhc
71 | DocProject/Help/*.hhk
72 | DocProject/Help/*.hhp
73 | DocProject/Help/Html2
74 | DocProject/Help/html
75 |
76 | # Click-Once directory
77 | publish
78 |
79 | # Publish Web Output
80 | *.Publish.xml
81 |
82 | # NuGet Packages Directory
83 | packages
84 |
85 | # Windows Azure Build Output
86 | csx
87 | *.build.csdef
88 |
89 | # Windows Store app package directory
90 | AppPackages/
91 |
92 | # Others
93 | [Bb]in
94 | [Oo]bj
95 | sql
96 | TestResults
97 | [Tt]est[Rr]esult*
98 | *.Cache
99 | ClientBin
100 | [Ss]tyle[Cc]op.*
101 | ~$*
102 | *.dbmdl
103 | Generated_Code #added for RIA/Silverlight projects
104 |
105 | # Backup & report files from converting an old project file to a newer
106 | # Visual Studio version. Backup files are not needed, because we have git ;-)
107 | _UpgradeReport_Files/
108 | Backup*/
109 | UpgradeLog*.XML
110 |
111 | # VsCode
112 | .vscode
113 |
114 | # NUnit Files
115 | TestResult.xml
116 | *.VisualState.xml
117 |
118 | # Packaging Directory
119 | package
120 |
121 | # Tools pulled from nuget
122 | tools
123 | !tools/packages.config
124 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 | sudo: false
3 | mono:
4 | - latest
5 | - 5.10.1
6 | - 4.6.2
7 | script:
8 | - git fetch --unshallow
9 | - ./build.sh --target=Travis --configuration=Release
10 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "cake",
8 | "script": "Package",
9 | "problemMatcher": [
10 | "$eslint-stylish"
11 | ]
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/GitVersion.yml:
--------------------------------------------------------------------------------
1 | mode: ContinuousDelivery
2 | branches:
3 | master:
4 | tag: dev
5 | increment: Minor
6 | releases?[/-]:
7 | tag: ci
8 | increment: Minor
9 | features?[/-]:
10 | tag: ci
11 | increment: Minor
12 | issues?[/-]:
13 | tag: ci
14 | increment: Minor
15 | (pull|pull\-requests|pr)[/-]:
16 | tag: pr
17 | increment: Minor
18 | ignore:
19 | sha: []
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Charlie Poole
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | The Experimental Gui test runner for NUnit 3 has been moved to the [testcentric-gui project](https://github.com/TestCentric/testcentric-gui). Please file any issues there.
2 | =========
3 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2017
2 |
3 | build_script:
4 | - ps: .\build.ps1 -Target "Appveyor" -Configuration "Release"
5 |
6 | # disable built-in tests.
7 | test: off
8 |
9 | artifacts:
10 | - path: package\*.zip
11 | - path: package\*.nupkg
12 |
13 | # AppVeyor defaults to just its build number
14 | version: '{build}'
15 |
--------------------------------------------------------------------------------
/build.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell ./build.ps1 %CAKE_ARGS% %*
3 |
--------------------------------------------------------------------------------
/choco/VERIFICATION.txt:
--------------------------------------------------------------------------------
1 | VERIFICATION
2 | Verification is intended to assist the Chocolatey moderators and community
3 | in verifying that this package's contents are trustworthy.
4 |
5 | This package is published by the author of the software, Charlie Poole.
6 | Any binaries will be identical to other package types published by the
7 | author at https://github.com/TestCentric/testcentric-experimental-gui.
8 |
--------------------------------------------------------------------------------
/choco/nunit-agent-x86.exe.ignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/choco/nunit-agent-x86.exe.ignore
--------------------------------------------------------------------------------
/choco/nunit-agent.exe.ignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/choco/nunit-agent.exe.ignore
--------------------------------------------------------------------------------
/choco/nunit.choco.addins:
--------------------------------------------------------------------------------
1 | ../../nunit-extension-*/tools/ # find extensions installed under chocolatey
2 |
--------------------------------------------------------------------------------
/choco/testcentric-experimental-gui.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | testcentric-experimental-gui
6 | 0.0.0
7 | NUnit 3 GUI Runner
8 | GUI runner for the NUnit 3 unit-testing framework.
9 |
10 | This package includes the nunit-gui runner and test engine for version 3 of the NUnit unit-testing framework.
11 |
12 | http://nunit.org
13 | https://github.com/CharliePoole/nunit-gui
14 | https://github.com/CharliePoole/nunit-gui/wiki
15 | https://github.com/CharliePoole/nunit-gui/issues
16 | https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png
17 | https://github.com/CharliePoole/nunit-gui
18 | https://raw.githubusercontent.com/CharliePoole/nunit-gui/master/CHANGES.txt
19 | https://groups.google.com/forum/#!forum/nunit-discuss
20 | http://nunit.org/nuget/nunit3-license.txt
21 | false
22 | Charlie Poole
23 | Charlie Poole
24 | en-US
25 | nunit gui runner test testing tdd
26 | Copyright (c) 2017 Charlie Poole
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/CommonAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015-2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Reflection;
25 | using System.Runtime.InteropServices;
26 |
27 | //
28 | // Common Information for the NUnit-gui assemblies
29 | //
30 | [assembly: AssemblyCompany("NUnit Software")]
31 | [assembly: AssemblyProduct("NUnit GUI Runner")]
32 | [assembly: AssemblyCopyright("Copyright (c) 2015-2018 Charlie Poole")]
33 | [assembly: AssemblyTrademark("NUnit is a trademark of NUnit Software")]
34 | [assembly: AssemblyConfiguration("")]
35 | [assembly: AssemblyCulture("")]
36 |
37 | // Setting ComVisible to false makes the types in this assembly not visible
38 | // to COM components. If you need to access a type in this assembly from
39 | // COM, set the ComVisible attribute to true on that type.
40 | [assembly: ComVisible(false)]
41 |
42 | // Common version information for local developer builds.
43 | // Should be set to the NEXT planned version between releases.
44 | // For CI builds, this info will be updated by GitVersion.
45 | [assembly: AssemblyVersion("0.7.0.0")]
46 | [assembly: AssemblyFileVersion("0.7.0.0")]
47 |
--------------------------------------------------------------------------------
/src/TestCentric/components/DialogResult.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Elements
25 | {
26 | ///
27 | /// Results returned by dialogs and message displays. The
28 | /// values used are limited in order to be able to translate
29 | /// them for use on multiple gui frameworks.
30 | ///
31 | public enum DialogResult
32 | {
33 | None,
34 | OK,
35 | Cancel,
36 | Yes,
37 | No
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/CheckBoxElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// CheckBoxElement wraps a CheckBox as an IChecked.
30 | ///
31 | public class CheckBoxElement : ControlElement, IChecked
32 | {
33 | private CheckBox _checkBox;
34 |
35 | public event CommandHandler CheckedChanged;
36 |
37 | public CheckBoxElement(CheckBox checkBox) : base(checkBox)
38 | {
39 | _checkBox = checkBox;
40 | checkBox.CheckedChanged += (s, e) => CheckedChanged?.Invoke();
41 | }
42 |
43 | public bool Checked
44 | {
45 | get { return _checkBox.Checked; }
46 | set
47 | {
48 | if (_checkBox.Checked != value)
49 | InvokeIfRequired(() => _checkBox.Checked = value);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ContextMenuElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// MenuElement is the implementation of ToolStripItem
30 | /// used in the actual application.
31 | ///
32 | public class ContextMenuElement : ControlElement, IToolStripMenu
33 | {
34 | public ContextMenuStrip _contextMenu;
35 |
36 | public ContextMenuElement(ContextMenuStrip contextMenu)
37 | : base(contextMenu)
38 | {
39 | _contextMenu = contextMenu;
40 |
41 | contextMenu.Opening += (s, cea) =>
42 | {
43 | if (Popup != null)
44 | Popup();
45 | };
46 | }
47 |
48 | public event CommandHandler Popup;
49 |
50 | public ToolStripItemCollection Items
51 | {
52 | get { return _contextMenu.Items; }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ControlElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Drawing;
25 | using System.Windows.Forms;
26 |
27 | namespace TestCentric.Gui.Elements
28 | {
29 | ///
30 | /// ControlElement is a generic wrapper for controls.
31 | ///
32 | public class ControlElement : IControlElement
33 | {
34 | protected Control _control;
35 |
36 | public ControlElement(Control control)
37 | {
38 | _control = control;
39 | }
40 |
41 | public Point Location
42 | {
43 | get { return _control.Location; }
44 | set { InvokeIfRequired(() => { _control.Location = value; }); }
45 | }
46 |
47 | public Size Size
48 | {
49 | get { return _control.Size; }
50 | set { InvokeIfRequired(() => { _control.Size = value; }); }
51 | }
52 |
53 | public Size ClientSize
54 | {
55 | get { return _control.ClientSize; }
56 | set { InvokeIfRequired(() => { _control.ClientSize = value; }); }
57 | }
58 |
59 | public bool Enabled
60 | {
61 | get { return _control.Enabled; }
62 | set { InvokeIfRequired(() => { _control.Enabled = value; }); }
63 | }
64 |
65 | public bool Visible
66 | {
67 | get { return _control.Visible; }
68 | set { InvokeIfRequired(() => { _control.Visible = value; }); }
69 | }
70 |
71 | public string Text
72 | {
73 | get { return _control.Text; }
74 | set { InvokeIfRequired(() => { _control.Text = value; }); }
75 | }
76 |
77 | public void InvokeIfRequired(MethodInvoker del)
78 | {
79 | if (_control.InvokeRequired)
80 | _control.BeginInvoke(del, new object[0]);
81 | else
82 | del();
83 | }
84 | }
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/IChecked.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Elements
25 | {
26 | ///
27 | /// The IChecked interface is implemented by either a CheckBox
28 | /// or a MenuItem, which supports being checked or unchecked.
29 | ///
30 | public interface IChecked : IViewElement
31 | {
32 | bool Checked { get; }
33 |
34 | event CommandHandler CheckedChanged;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ICommand.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Elements
25 | {
26 | ///
27 | /// CommandHandler is used to request an action
28 | ///
29 | public delegate void CommandHandler();
30 |
31 | ///
32 | /// The ICommand interface represents any GUI item, which
33 | /// executes a command, e.g. a button or a menu item.
34 | ///
35 | public interface ICommand : IViewElement
36 | {
37 | ///
38 | /// Execute event is raised to signal the presenter
39 | /// to execute the associated command.
40 | ///
41 | event CommandHandler Execute;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/IControlElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Drawing;
25 | using System.Windows.Forms;
26 |
27 | namespace TestCentric.Gui.Elements
28 | {
29 | ///
30 | /// IControlElement is implemented by elements that wrap controls.
31 | ///
32 | public interface IControlElement : IViewElement
33 | {
34 | Point Location { get; set; }
35 | Size Size { get; set; }
36 | Size ClientSize { get; set; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ISelection.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Elements
25 | {
26 | ///
27 | /// The ISelection interface represents a single UI element
28 | /// or a group of elements that allow the user to select one
29 | /// of a set of items.
30 | ///
31 | public interface ISelection : IViewElement
32 | {
33 | ///
34 | /// Gets the index of the currently selected item
35 | ///
36 | int SelectedIndex { get; }
37 |
38 | ///
39 | /// Gets the string value of the currently selected item
40 | ///
41 | string SelectedItem { get; set; }
42 |
43 | ///
44 | /// Refresh selection if possible, otherwise noop
45 | ///
46 | void Refresh();
47 |
48 | ///
49 | /// Event raised when the selection is changed by the user
50 | ///
51 | event CommandHandler SelectionChanged;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/IToolStripMenu.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017-2018 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// IMenu is implemented by a menu item that displays subitems.
30 | ///
31 | public interface IToolStripMenu : IViewElement
32 | {
33 | ///
34 | /// Popup event is raised to signal the presenter
35 | /// that the menu items under this element are
36 | /// about to be displayed.
37 | ///
38 | event CommandHandler Popup;
39 |
40 | ToolStripItemCollection Items { get; }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/IToolTip.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2018 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Elements
25 | {
26 | ///
27 | /// IToolTip is implemented by elements, which are able to
28 | /// get and set their own tool tip text. It is a single-
29 | /// capability index and is generally used in conjunction
30 | /// with IViewElement or a derived interface.
31 | ///
32 | public interface IToolTip
33 | {
34 | string ToolTipText { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ITreeView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Collections.Generic;
25 | using System.Windows.Forms;
26 |
27 | namespace TestCentric.Gui.Elements
28 | {
29 | public delegate void TreeNodeActionHandler(TreeNode treeNode);
30 |
31 | ///
32 | /// The ITreeViewElement interface provides additional methods
33 | /// used when wrapping a TreeView.
34 | ///
35 | public interface ITreeView : IControlElement
36 | {
37 | event TreeNodeActionHandler SelectedNodeChanged;
38 |
39 | bool CheckBoxes { get; set; }
40 | int VisibleCount { get; }
41 |
42 | TreeNode SelectedNode { get; set; }
43 | TreeNodeCollection Nodes { get; }
44 | IList CheckedNodes { get; }
45 |
46 | IToolStripMenu ContextMenu { get; }
47 |
48 | void Clear();
49 | void ExpandAll();
50 | void CollapseAll();
51 | void Add(TreeNode treeNode);
52 | void Load(TreeNode treeNode);
53 | void SetImageIndex(TreeNode treeNode, int imageIndex);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/IViewElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// The IViewElement interface wraps an individual gui
30 | /// item like a control or toolstrip item. It is generally
31 | /// exposed by views and is the base of other interfaces
32 | /// in the TestCentric.Gui.Elements namespace.
33 | ///
34 | public interface IViewElement
35 | {
36 | ///
37 | /// Gets or sets the Enabled status of the element
38 | ///
39 | bool Enabled { get; set; }
40 |
41 | ///
42 | /// Gets or sets the Visible status of the element
43 | ///
44 | bool Visible { get; set; }
45 |
46 | ///
47 | /// Gets or sets the Text of an element
48 | ///
49 | string Text { get; set; }
50 |
51 | ///
52 | /// Invoke a delegate if necessary, otherwise just call it
53 | ///
54 | void InvokeIfRequired(MethodInvoker _delegate);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/SplitButtonElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// SplitButtonElement extends ToolStripElement for use with a SplitButton.
30 | ///
31 | public class SplitButtonElement : ToolStripElement, ICommand
32 | {
33 | public SplitButtonElement(ToolStripSplitButton button) : base(button)
34 | {
35 | button.ButtonClick += delegate { if (Execute != null) Execute(); };
36 | }
37 |
38 | public event CommandHandler Execute;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ToolStripElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | ///
29 | /// ToolStripItem is a generic wrapper for ToolStripItems
30 | ///
31 | public class ToolStripElement : IViewElement, IToolTip
32 | {
33 | private ToolStripItem _toolStripItem;
34 |
35 | public ToolStripElement(ToolStripItem toolStripItem)
36 | {
37 | _toolStripItem = toolStripItem;
38 | }
39 |
40 | public bool Enabled
41 | {
42 | get { return _toolStripItem.Enabled; }
43 | set { InvokeIfRequired(() => { _toolStripItem.Enabled = value; }); }
44 | }
45 |
46 | public bool Visible
47 | {
48 | get { return _toolStripItem.Visible; }
49 | set { InvokeIfRequired(() => { _toolStripItem.Visible = value; }); }
50 | }
51 |
52 | public string Text
53 | {
54 | get { return _toolStripItem.Text; }
55 | set { InvokeIfRequired(() => { _toolStripItem.Text = value; }); }
56 | }
57 |
58 | public string ToolTipText
59 | {
60 | get { return _toolStripItem.ToolTipText; }
61 | set { InvokeIfRequired(() => { _toolStripItem.ToolTipText = value; }); }
62 | }
63 |
64 | public void InvokeIfRequired(MethodInvoker del)
65 | {
66 | var toolStrip = _toolStripItem.GetCurrentParent();
67 |
68 | if (toolStrip != null && toolStrip.InvokeRequired)
69 | toolStrip.BeginInvoke(del, new object[0]);
70 | else
71 | del();
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Elements/ToolStripMenuElement.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 | using System.Collections.Generic;
26 | using System.Windows.Forms;
27 |
28 | namespace TestCentric.Gui.Elements
29 | {
30 | ///
31 | /// MenuElement is the implemented here using a ToolStripItem
32 | /// but the view exposes each element using one of the three
33 | /// key interfaces (IMenu, ICommand or IChecked) which should
34 | /// not contain any control-specific logic.
35 | ///
36 | public class ToolStripMenuElement : ToolStripElement, IToolStripMenu, ICommand, IChecked
37 | {
38 | public event CommandHandler Execute;
39 | public event CommandHandler Popup;
40 | public event CommandHandler CheckedChanged;
41 |
42 | private ToolStripMenuItem _menuItem;
43 |
44 | public ToolStripMenuElement(ToolStripMenuItem menuItem)
45 | : base(menuItem)
46 | {
47 | _menuItem = menuItem;
48 |
49 | menuItem.Click += (s, e) => Execute?.Invoke();
50 | menuItem.DropDownOpening += (s, e) => Popup?.Invoke();
51 | menuItem.CheckedChanged += (s, e) => CheckedChanged?.Invoke();
52 | }
53 |
54 | public ToolStripMenuElement(string text) : this(new ToolStripMenuItem(text)) { }
55 |
56 | public ToolStripMenuElement(string text, CommandHandler execute) : this(text)
57 | {
58 | this.Execute = execute;
59 | }
60 |
61 | public bool Checked
62 | {
63 | get { return _menuItem.Checked; }
64 | set
65 | {
66 | if (_menuItem.Checked != value)
67 | {
68 | InvokeIfRequired(() =>
69 | {
70 | _menuItem.Checked = value;
71 | });
72 | }
73 | }
74 | }
75 |
76 | public ToolStripItemCollection Items
77 | {
78 | get { return _menuItem.DropDown.Items; }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/TestCentric/components/IMessageDisplay.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 |
26 | namespace TestCentric.Gui.Elements
27 | {
28 | public interface IMessageDisplay
29 | {
30 | DialogResult Display(string message);
31 | DialogResult Display(string message, string caption);
32 | DialogResult Display(string message, MessageButtons buttons);
33 | DialogResult Display(string message, string caption, MessageButtons buttons);
34 |
35 | DialogResult Error(string message);
36 | DialogResult Error(string message, string caption);
37 | DialogResult Error(string message, MessageButtons buttons);
38 | DialogResult Error(string message, string caption, MessageButtons buttons);
39 | DialogResult Error(string message, Exception exception);
40 | DialogResult Error(string message, Exception exception, MessageButtons buttons);
41 |
42 | DialogResult Info(string message);
43 | DialogResult Info(string message, string caption);
44 | DialogResult Info(string message, MessageButtons buttons);
45 | DialogResult Info(string message, string caption, MessageButtons buttons);
46 |
47 | DialogResult Ask(string message);
48 | DialogResult Ask(string message, string caption);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/TestCentric/components/MessageButtons.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui
25 | {
26 | ///
27 | /// Enumeration indicating what buttons to display in a message display.
28 | /// The values used are limited in order to be able to translate
29 | /// them for use on multiple gui frameworks.
30 | ///
31 | public enum MessageButtons
32 | {
33 | OK,
34 | OKCancel,
35 | YesNo
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/TestCentric/components/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Reflection;
25 | using System.Runtime.InteropServices;
26 |
27 | // General Information about an assembly is controlled through the following
28 | // set of attributes. Change these attribute values to modify the information
29 | // associated with an assembly.
30 | [assembly: AssemblyTitle("TestCentric Gui Components")]
31 | [assembly: AssemblyDescription("Controls and elements used in the GUI")]
32 |
33 | // The following GUID is for the ID of the typelib if this project is exposed to COM
34 | [assembly: Guid("f3d6d602-ed44-4592-99b2-8409326917dd")]
35 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.exe/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.exe/Program.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2018 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 |
26 | namespace TestCentric.Gui
27 | {
28 | class Program
29 | {
30 | [STAThread]
31 | public static void Main(string[] args)
32 | {
33 | AppEntry.Main(args);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.exe/TestCentric.Gui.Exe.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {D5556639-F04B-4389-92C8-E110D6688BA7}
7 | WinExe
8 | TestCentric.Gui
9 | tc-next
10 | v4.5
11 |
12 |
13 | true
14 | full
15 | false
16 | ..\..\..\bin\Debug
17 | DEBUG;
18 | prompt
19 | 4
20 | true
21 | false
22 |
23 |
24 | true
25 | ..\..\..\bin\Release
26 | prompt
27 | 4
28 | true
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | CommonAssemblyInfo.cs
37 |
38 |
39 |
40 |
41 | {9E15166C-D2B7-4B24-AB1C-1C69FFCEC9D3}
42 | TestCentric.Gui
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/RunTests.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/RunTests.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/Tree/Default/Failure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/Tree/Default/Failure.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/Tree/Default/Inconclusive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/Tree/Default/Inconclusive.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/Tree/Default/Skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/Tree/Default/Skipped.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/Tree/Default/Success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/Tree/Default/Success.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Images/Tree/Default/Warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/Images/Tree/Default/Warning.png
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Presenters/AddinsPresenter.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Engine;
2 |
3 | namespace TestCentric.Gui.Presenters
4 | {
5 | using Views;
6 |
7 | public class AddinsPresenter
8 | {
9 | private readonly IAddinsView _view;
10 | private readonly IExtensionService _extensionService;
11 |
12 | public AddinsPresenter(IAddinsView view, IExtensionService extensionService)
13 | {
14 | _view = view;
15 | _extensionService = extensionService;
16 | }
17 |
18 | public void Show()
19 | {
20 | _view.SuspendLayout();
21 | foreach (var extensionPoint in _extensionService.ExtensionPoints)
22 | {
23 | _view.AddExtensionPoint(extensionPoint);
24 | }
25 | _view.ResumeLayout();
26 |
27 | _view.ShowDialog();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Presenters/TestGroup.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Text;
25 | using System.Windows.Forms;
26 | using NUnit.Engine;
27 |
28 | namespace TestCentric.Gui.Presenters
29 | {
30 | using Model;
31 |
32 | ///
33 | /// A TestGroup is essentially a TestSelection with a
34 | /// name and image index for use in the tree display.
35 | /// Its TreeNode property is externally set and updated.
36 | /// It can create a filter for running all the tests
37 | /// in the group.
38 | ///
39 | public class TestGroup : TestSelection, ITestItem
40 | {
41 | #region Constructors
42 |
43 | public TestGroup(string name) : this(name, -1) { }
44 |
45 | public TestGroup(string name, int imageIndex)
46 | {
47 | Name = name;
48 | ImageIndex = imageIndex;
49 | }
50 |
51 | #endregion
52 |
53 | #region Properties
54 |
55 | public string Name { get; private set; }
56 |
57 | public int ImageIndex { get; set; }
58 |
59 | public TreeNode TreeNode { get; set; }
60 |
61 | #endregion
62 |
63 | public TestFilter GetTestFilter()
64 | {
65 | StringBuilder sb = new StringBuilder("");
66 |
67 | foreach (TestNode test in this)
68 | if (test.RunState != RunState.Explicit)
69 | sb.AppendFormat("{0}", test.Id);
70 |
71 | sb.Append("");
72 |
73 | return new TestFilter(sb.ToString());
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Reflection;
25 | using System.Runtime.InteropServices;
26 |
27 | // General Information about an assembly is controlled through the following
28 | // set of attributes. Change these attribute values to modify the information
29 | // associated with an assembly.
30 | [assembly: AssemblyTitle("nunit-gui")]
31 | [assembly: AssemblyDescription("Main program for the GUI runner")]
32 |
33 | // The following GUID is for the Id of the typelib if this project is exposed to COM
34 | [assembly: Guid("6a34c3cc-e569-4349-a736-ad99ced6c195")]
35 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TestCentric.Gui.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestCentric.Gui.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Settings/EngineSettings.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine;
25 |
26 | namespace TestCentric.Gui.Settings
27 | {
28 | ///
29 | /// SettingsModel is the top level of a set of wrapper
30 | /// classes that provide type-safe access to settingsService.
31 | ///
32 | public class EngineSettings : SettingsGroup
33 | {
34 | public EngineSettings(ISettings settingsService) : base(settingsService, "Engine.Options") { }
35 |
36 | private const string reloadOnChangeKey = "ReloadOnChange";
37 | public bool ReloadOnChange
38 | {
39 | get { return GetSetting(reloadOnChangeKey, true); }
40 | set { SaveSetting(reloadOnChangeKey, value); }
41 | }
42 |
43 | private const string rerunOnChangeKey = "RerunOnChange";
44 | public bool RerunOnChange
45 | {
46 | get { return GetSetting(rerunOnChangeKey, false); }
47 | set { SaveSetting(rerunOnChangeKey, value); }
48 | }
49 |
50 | private const string reloadOnRunKey = "ReloadOnRun";
51 | public bool ReloadOnRun
52 | {
53 | get { return GetSetting(reloadOnRunKey, false); }
54 | set { SaveSetting(reloadOnRunKey, value); }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Settings/SettingsGroup.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine;
25 |
26 | namespace TestCentric.Gui.Settings
27 | {
28 | ///
29 | /// SettingsGroup wraps an ISettings interface and
30 | /// may also encapsulate the prefix used for a given
31 | /// group of settings.
32 | ///
33 | public class SettingsGroup
34 | {
35 | private string _prefix;
36 |
37 | ///
38 | /// Construct a settings group for a given settings service
39 | /// and with an optional prefix.
40 | ///
41 | /// The settings service to be used
42 | /// An optional prefix for all setitngs keys
43 | public SettingsGroup(ISettings settingsService, string prefix = "")
44 | {
45 | this.SettingsService = settingsService;
46 | _prefix = prefix;
47 |
48 | if (_prefix == null)
49 | _prefix = string.Empty;
50 | if (_prefix != string.Empty && !prefix.EndsWith("."))
51 | _prefix += ".";
52 | }
53 |
54 | public ISettings SettingsService { get; }
55 |
56 | public object GetSetting(string name)
57 | {
58 | return SettingsService.GetSetting(_prefix + name);
59 | }
60 |
61 | public T GetSetting(string name, T defaultValue)
62 | {
63 | return SettingsService.GetSetting(_prefix + name, defaultValue);
64 | }
65 |
66 | public void SaveSetting(string name, object value)
67 | {
68 | name = _prefix + name;
69 | if (value == null)
70 | SettingsService.RemoveSetting(name);
71 | else
72 | SettingsService.SaveSetting(name, value);
73 | }
74 |
75 | public void RemoveSetting(string name)
76 | {
77 | SettingsService.RemoveSetting(_prefix + name);
78 | }
79 |
80 | public SettingsGroup GetSubKey(string subkey)
81 | {
82 | return new SettingsGroup(SettingsService, _prefix + subkey);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Settings/SettingsModel.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine;
25 |
26 | namespace TestCentric.Gui.Settings
27 | {
28 | ///
29 | /// SettingsModel is the top level of a set of wrapper
30 | /// classes that provide type-safe access to user settings.
31 | ///
32 | public class SettingsModel : SettingsGroup
33 | {
34 | public SettingsModel(ISettings settings) : base(settings, null) { }
35 |
36 | public GuiSettings Gui
37 | {
38 | get { return new GuiSettings(SettingsService); }
39 | }
40 |
41 | public EngineSettings Engine
42 | {
43 | get { return new EngineSettings(SettingsService); }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Settings/TreeDisplayStyle.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Settings
25 | {
26 | ///
27 | /// Indicates how a tree should be displayed
28 | ///
29 | public enum TreeDisplayStyle
30 | {
31 | Auto, // Select based on space available
32 | Expand, // Expand fully
33 | Collapse, // Collapse fully
34 | HideTests // Expand all but the fixtures, leaving
35 | // leaf nodes hidden
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/AddinPages/AddinsView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TestCentric.Gui.Views.AddinPages
2 | {
3 | partial class AddinsView
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.availablePoints = new System.Windows.Forms.Panel();
32 | this.SuspendLayout();
33 | //
34 | // availablePoints
35 | //
36 | this.availablePoints.AutoScroll = true;
37 | this.availablePoints.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
38 | this.availablePoints.Dock = System.Windows.Forms.DockStyle.Fill;
39 | this.availablePoints.Margin = new System.Windows.Forms.Padding(0);
40 | //
41 | // AddinsView
42 | //
43 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
44 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
45 | this.ClientSize = new System.Drawing.Size(484, 362);
46 | this.Controls.Add(this.availablePoints);
47 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
48 | this.Name = "AddinsView";
49 | this.Padding = new System.Windows.Forms.Padding(3);
50 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
51 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
52 | this.Text = "AddinsView";
53 | this.ResumeLayout(false);
54 | }
55 |
56 | #endregion
57 |
58 | private System.Windows.Forms.Panel availablePoints;
59 | }
60 | }
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/AddinPages/AddinsView.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using NUnit.Engine.Extensibility;
4 |
5 | namespace TestCentric.Gui.Views.AddinPages
6 | {
7 | public partial class AddinsView : Form, IAddinsView
8 | {
9 | public AddinsView()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | void IDialog.ShowDialog()
15 | {
16 | ShowDialog();
17 | }
18 |
19 | public void AddExtensionPoint(IExtensionPoint extensionPoint)
20 | {
21 | var extensionPointView = new ExtensionPointView(extensionPoint);
22 | availablePoints.Controls.Add(extensionPointView);
23 | availablePoints.Controls.Add(new Panel
24 | {
25 | Dock = DockStyle.Top,
26 | Size = new Size(0, 10),
27 | });
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/AddinPages/ExtensionPointView.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Windows.Forms;
3 | using NUnit.Engine.Extensibility;
4 |
5 | namespace TestCentric.Gui.Views.AddinPages
6 | {
7 | using System.Drawing;
8 |
9 | internal class ExtensionPointView : GroupBox
10 | {
11 | private readonly IExtensionPoint _extensionPoint;
12 | private readonly ToolTip descriptionTooltip;
13 | private readonly IContainer components;
14 |
15 | public ExtensionPointView(IExtensionPoint point)
16 | {
17 | SuspendLayout();
18 | _extensionPoint = point;
19 | components = new Container();
20 | AutoSize = true;
21 | descriptionTooltip = new ToolTip(components)
22 | {
23 | InitialDelay = 100,
24 | ReshowDelay = 100,
25 | };
26 | descriptionTooltip.SetToolTip(this, point.Description);
27 | Text = point.Path;
28 | Dock = DockStyle.Top;
29 | AddExtensionNodes(this);
30 | Controls.Add(new Panel
31 | {
32 | Dock = DockStyle.Left,
33 | Size = new Size(20, 0),
34 | });
35 | ResumeLayout();
36 | }
37 |
38 | private void AddExtensionNodes(Control control)
39 | {
40 | bool addedAnyExtensionNodes = false;
41 | foreach (var node in _extensionPoint.Extensions)
42 | {
43 | control.Controls.Add(new ExtensionNodeView(node));
44 | addedAnyExtensionNodes = true;
45 | }
46 |
47 | if (!addedAnyExtensionNodes)
48 | control.Controls.Add(new Label { Text = "Has No Extensions", Dock = DockStyle.Top });
49 | }
50 |
51 | protected override void Dispose(bool disposing)
52 | {
53 | if (disposing)
54 | components.Dispose();
55 |
56 | base.Dispose(disposing);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IAddinsView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine.Extensibility;
25 |
26 | namespace TestCentric.Gui.Views
27 | {
28 | public interface IAddinsView : IDialog
29 | {
30 | void AddExtensionPoint(IExtensionPoint extensionPoint);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IDialog.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | ///
27 | /// Common interface implemented by all modal dialog views used in
28 | /// the ProjectEditor application
29 | ///
30 | public interface IDialog : IView
31 | {
32 | void ShowDialog();
33 | void Close();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IDialogManager.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | public interface IDialogManager
27 | {
28 | string[] GetFilesToOpen();
29 |
30 | string GetFileOpenPath(string filter);
31 |
32 | string GetSaveAsPath(string filter);
33 |
34 | string GetFolderPath(string message, string initialPath);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IProgressBarView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | using Controls;
27 |
28 | public interface IProgressBarView
29 | {
30 | int Progress { get; set; }
31 | ProgressBarStatus Status { get; set; }
32 |
33 | void Initialize(int max);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/ISettingsDialog.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | using Elements;
27 |
28 | public interface ISettingsDialog
29 | {
30 | DialogResult Display();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IStatusBarView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | // Interface is used by presenter and tests
27 | public interface IStatusBarView : IView
28 | {
29 | void OnTestLoaded(int testCount);
30 | void OnTestUnloaded();
31 | void OnRunStarting(int testCount);
32 | void OnRunFinished(double elapsedTime);
33 | void OnTestStarting(string name);
34 | void OnTestPassed();
35 | void OnTestFailed();
36 | void OnTestWarning();
37 | void OnTestInconclusive();
38 | void OnTestRunSummaryCompiled(string testRunSummary);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/ITestPropertiesVIew.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | using Elements;
27 |
28 | public interface ITestPropertiesView : IView
29 | {
30 | event CommandHandler DisplayHiddenPropertiesChanged;
31 |
32 | bool Visible { get; set; }
33 | string Header { get; set; }
34 | IViewElement TestPanel { get; }
35 | IViewElement ResultPanel { get; }
36 |
37 | string TestType { get; set; }
38 | string FullName { get; set; }
39 | string Description { get; set; }
40 | string Categories { get; set; }
41 | string TestCount { get; set; }
42 | string RunState { get; set; }
43 | string SkipReason { get; set; }
44 | bool DisplayHiddenProperties { get; }
45 | string Properties { get; set; }
46 | string Outcome { get; set; }
47 | string ElapsedTime { get; set; }
48 | string AssertCount { get; set; }
49 | string Assertions { get; set; }
50 | string Output { get; set; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/ITestTreeView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Views
25 | {
26 | using Elements;
27 |
28 | // Interface used for testing
29 | public interface ITestTreeView : IView
30 | {
31 | ICommand RunButton { get; }
32 | ICommand RunAllCommand { get; }
33 | ICommand RunSelectedCommand { get; }
34 | ICommand RunFailedCommand { get; }
35 | ICommand StopRunCommand { get; }
36 |
37 | IToolTip FormatButton { get; }
38 | ISelection DisplayFormat { get; }
39 | ISelection GroupBy { get; }
40 |
41 | ICommand RunContextCommand { get; }
42 | ICommand RunCheckedCommand { get; }
43 | IChecked ShowCheckBoxes { get; }
44 | ICommand ExpandAllCommand { get; }
45 | ICommand CollapseAllCommand { get; }
46 | ICommand CollapseToFixturesCommand { get; }
47 |
48 | void ExpandAll();
49 | void CollapseAll();
50 |
51 | ITreeView Tree { get; }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 |
26 | namespace TestCentric.Gui.Views
27 | {
28 | public interface IView
29 | {
30 | event EventHandler Load;
31 |
32 | void SuspendLayout();
33 | void ResumeLayout();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/IXmlView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 | using System.Xml;
26 |
27 | namespace TestCentric.Gui.Views
28 | {
29 | using Elements;
30 |
31 | public interface IXmlView : IView
32 | {
33 | bool Visible { get; set; }
34 | bool WordWrap { get; set; }
35 |
36 | string Header { get; set; }
37 | IViewElement XmlPanel { get; }
38 |
39 | ICommand CopyToolStripMenuItem { get; }
40 | IChecked WordWrapToolStripMenuItem { get; }
41 |
42 | XmlNode TestXml { get; set; }
43 |
44 | string SelectedText { get; set; }
45 |
46 | void SelectAll();
47 | void Copy();
48 |
49 | event CommandHandler SelectAllCommand;
50 | event CommandHandler SelectionChanged;
51 | event CommandHandler CopyCommand;
52 | event CommandHandler WordWrapChanged;
53 | event CommandHandler ViewGotFocus;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/ProgressBarView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TestCentric.Gui.Views
2 | {
3 | partial class ProgressBarView
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.testProgressBar = new TestCentric.Gui.Controls.TestCentricProgressBar();
32 | this.SuspendLayout();
33 | //
34 | // testProgressBar
35 | //
36 | this.testProgressBar.Dock = System.Windows.Forms.DockStyle.Top;
37 | this.testProgressBar.Location = new System.Drawing.Point(0, 13);
38 | this.testProgressBar.Name = "testProgressBar";
39 | this.testProgressBar.Size = new System.Drawing.Size(239, 14);
40 | this.testProgressBar.Status = TestCentric.Gui.Controls.ProgressBarStatus.Success;
41 | this.testProgressBar.TabIndex = 0;
42 | //
43 | // ProgressBarView
44 | //
45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47 | this.Controls.Add(this.testProgressBar);
48 | this.Name = "ProgressBarView";
49 | this.Size = new System.Drawing.Size(239, 61);
50 | this.ResumeLayout(false);
51 | this.PerformLayout();
52 |
53 | }
54 |
55 | #endregion
56 |
57 | private TestCentric.Gui.Controls.TestCentricProgressBar testProgressBar;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/ProgressBarView.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Diagnostics;
25 | using System.Windows.Forms;
26 |
27 | namespace TestCentric.Gui.Views
28 | {
29 | using Controls;
30 |
31 | public partial class ProgressBarView : UserControl, IProgressBarView
32 | {
33 | private int _maximum;
34 |
35 | public ProgressBarView()
36 | {
37 | InitializeComponent();
38 | }
39 |
40 | public void Initialize(int max)
41 | {
42 | Debug.Assert(max > 0, "Maximum value must be > 0");
43 |
44 | _maximum = max;
45 | _progress = 0;
46 | _status = ProgressBarStatus.Success;
47 |
48 | InvokeIfRequired(() =>
49 | {
50 | testProgressBar.Maximum = _maximum;
51 | testProgressBar.Value = _progress;
52 | testProgressBar.Status = _status;
53 | });
54 | }
55 |
56 | private int _progress;
57 | public int Progress
58 | {
59 | get { return _progress; }
60 | set
61 | {
62 | Debug.Assert(value <= _maximum, "Value must be <= maximum");
63 |
64 | _progress = value;
65 | InvokeIfRequired(() => { testProgressBar.Value = _progress; });
66 | }
67 | }
68 |
69 | private ProgressBarStatus _status;
70 | public ProgressBarStatus Status
71 | {
72 | get { return _status; }
73 | set
74 | {
75 | _status = value;
76 | InvokeIfRequired(() => { testProgressBar.Status = _status; });
77 | }
78 | }
79 |
80 | private void InvokeIfRequired(MethodInvoker _delegate)
81 | {
82 | if (testProgressBar.InvokeRequired)
83 | testProgressBar.BeginInvoke(_delegate);
84 | else
85 | _delegate();
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/SettingsPage.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TestCentric.Gui.Views
2 | {
3 | partial class SettingsPage
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
33 | }
34 |
35 | #endregion
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/SettingsPage.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 | using System.Windows.Forms;
26 | using TestCentric.Gui;
27 |
28 | namespace TestCentric.Gui.Views
29 | {
30 | using Settings;
31 | using Elements;
32 |
33 | public partial class SettingsPage : UserControl
34 | {
35 | // Constructor used by the Windows.Forms Designer.
36 | // For some reason, this must be present for any
37 | // UserControl used as a base for another user control.
38 | public SettingsPage()
39 | {
40 | InitializeComponent();
41 | }
42 |
43 | // Constructor we use in creating page for SettingsDialog
44 | public SettingsPage(string key, SettingsModel settings)
45 | {
46 | InitializeComponent();
47 |
48 | this.Key = key;
49 | this.Settings = settings;
50 | this.MessageDisplay = new MessageDisplay("NUnit Settings");
51 | }
52 |
53 | #region Properties
54 |
55 | protected SettingsModel Settings { get; private set; }
56 |
57 | protected IMessageDisplay MessageDisplay { get; private set; }
58 |
59 | public string Key { get; private set; }
60 |
61 | public bool SettingsLoaded { get; private set; }
62 |
63 | public virtual bool HasChangesRequiringReload
64 | {
65 | get { return false; }
66 | }
67 |
68 | #endregion
69 |
70 | #region Public Methods
71 |
72 | public virtual void LoadSettings()
73 | {
74 | }
75 |
76 | public virtual void ApplySettings()
77 | {
78 | }
79 |
80 | #endregion
81 |
82 | protected override void OnLoad(EventArgs e)
83 | {
84 | base.OnLoad(e);
85 |
86 | if (!DesignMode)
87 | {
88 | this.LoadSettings();
89 | SettingsLoaded = true;
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/Views/SettingsPages/AssemblyReloadSettingsPage.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 |
26 | namespace TestCentric.Gui.Views.SettingsPages
27 | {
28 | using Settings;
29 |
30 | public partial class AssemblyReloadSettingsPage : SettingsPage
31 | {
32 | public AssemblyReloadSettingsPage(SettingsModel settings) : base("Engine.Assembly Reload", settings)
33 | {
34 | InitializeComponent();
35 | }
36 |
37 | public override void LoadSettings()
38 | {
39 | reloadOnChangeCheckBox.Checked = Settings.Engine.ReloadOnChange;
40 | rerunOnChangeCheckBox.Checked = Settings.Engine.RerunOnChange;
41 | reloadOnRunCheckBox.Checked = Settings.Engine.ReloadOnRun;
42 | }
43 |
44 | public override void ApplySettings()
45 | {
46 | Settings.Engine.ReloadOnChange = reloadOnChangeCheckBox.Checked;
47 | Settings.Engine.RerunOnChange = rerunOnChangeCheckBox.Checked;
48 | Settings.Engine.ReloadOnRun = reloadOnRunCheckBox.Checked;
49 | }
50 |
51 |
52 |
53 | private void reloadOnChangeCheckBox_CheckedChanged(object sender, System.EventArgs e)
54 | {
55 | rerunOnChangeCheckBox.Enabled = reloadOnChangeCheckBox.Checked;
56 | }
57 |
58 | protected override void OnHelpRequested(HelpEventArgs hevent)
59 | {
60 | System.Diagnostics.Process.Start("http://nunit.com/?p=optionsDialog&r=2.4.5");
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/nunit.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TestCentric/testcentric-experimental-gui/837ed3b29fa50ef4d09866adf271484878e4d9f9/src/TestCentric/testcentric.gui/nunit.ico
--------------------------------------------------------------------------------
/src/TestCentric/testcentric.gui/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/AddinsPresenterTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using NUnit.Engine;
5 | using NUnit.Engine.Extensibility;
6 | using NUnit.Framework;
7 | using NSubstitute;
8 |
9 | namespace TestCentric.Gui.Presenters
10 | {
11 | using Views;
12 |
13 | [TestFixture]
14 | public class AddinsPresenterTests
15 | {
16 | private AddinViewFake _view;
17 | private AddinsPresenter _presenter;
18 | private IExtensionService _extensionService;
19 | private IExtensionPoint _extensionPoint;
20 | private List _extensionNodes;
21 |
22 | [SetUp]
23 | public void Setup()
24 | {
25 | _view = new AddinViewFake();
26 | _extensionService = Substitute.For();
27 | _extensionPoint = Substitute.For();
28 |
29 | _extensionNodes = new List();
30 | _extensionPoint.Extensions.Returns(_extensionNodes);
31 | _extensionService.ExtensionPoints.Returns(new[] { _extensionPoint });
32 | _presenter = new AddinsPresenter(_view, _extensionService);
33 | }
34 |
35 | [TearDown]
36 | public void TearDown()
37 | {
38 | _presenter = null;
39 | _view = null;
40 | _extensionService = null;
41 | }
42 |
43 | [Test]
44 | public void WhenExtensionPointHasNoExtensions_ItIsStillDisplayed()
45 | {
46 | _extensionNodes.Clear();
47 |
48 | _presenter.Show();
49 |
50 | Assert.That(_view.AddedExtensionPoints.Count, Is.EqualTo(_extensionService.ExtensionPoints.Count()));
51 | }
52 |
53 | private class AddinViewFake : IAddinsView
54 | {
55 | public readonly List AddedExtensionNodes = new List();
56 | public readonly List AddedExtensionPoints = new List();
57 |
58 | public void SuspendLayout() { }
59 |
60 | public void ResumeLayout() { }
61 |
62 | public void ShowDialog() { }
63 |
64 | public void Close() { }
65 |
66 | public void AddExtensionPoint(IExtensionPoint extensionPoint)
67 | {
68 | AddedExtensionPoints.Add(extensionPoint);
69 | }
70 |
71 | public event EventHandler Load = delegate { };
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/Main/MainPresenterTestBase.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 | using NSubstitute;
26 |
27 | namespace TestCentric.Gui.Presenters.Main
28 | {
29 | using Model;
30 | using Views;
31 |
32 | public class MainPresenterTestBase
33 | {
34 | protected IMainView View;
35 | protected ITestModel Model;
36 | protected MainPresenter Presenter;
37 |
38 | [SetUp]
39 | public void CreatePresenter()
40 | {
41 | View = Substitute.For();
42 | Model = Substitute.For();
43 |
44 | Presenter = new MainPresenter(View, Model, null);
45 | }
46 |
47 | [TearDown]
48 | public void RemovePresenter()
49 | {
50 | if (Presenter != null)
51 | Presenter.Dispose();
52 |
53 | Presenter = null;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/Main/WhenPresenterIsCreated.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.Main
28 | {
29 | public class WhenPresenterIsCreated : MainPresenterTestBase
30 | {
31 | #if NYI
32 | [Test]
33 | public void NewProject_IsEnabled()
34 | {
35 | View.NewProjectCommand.Received(1).Enabled = true;
36 | }
37 | #endif
38 |
39 | [Test]
40 | public void OpenProject_IsEnabled()
41 | {
42 | View.OpenProjectCommand.Received(1).Enabled = true;
43 | }
44 |
45 | [Test]
46 | public void CloseCommand_IsDisabled()
47 | {
48 | View.CloseCommand.Received(1).Enabled = false;
49 | }
50 |
51 | [Test]
52 | public void SaveCommand_IsDisabled()
53 | {
54 | View.SaveCommand.Received(1).Enabled = false;
55 | }
56 |
57 | [Test]
58 | public void SaveAsCommand_IsDisabled()
59 | {
60 | View.SaveAsCommand.Received(1).Enabled = false;
61 | }
62 |
63 | [Test]
64 | public void SaveResults_IsDisabled()
65 | {
66 | View.SaveResultsCommand.Received(1).Enabled = false;
67 | }
68 |
69 | [Test]
70 | public void ReloadTests_IsDisabled()
71 | {
72 | View.ReloadTestsCommand.Received(1).Enabled = false;
73 | }
74 |
75 | [Test]
76 | public void RecentProjects_IsEnabled()
77 | {
78 | View.RecentProjectsMenu.Received(1).Enabled = true;
79 | }
80 |
81 | [Test]
82 | public void ExitCommand_IsEnabled()
83 | {
84 | View.ExitCommand.Received(1).Enabled = true;
85 | }
86 |
87 | [Test]
88 | public void ProjectMenu_IsDisabled()
89 | {
90 | View.ProjectMenu.Received(1).Enabled = false;
91 | }
92 |
93 | [Test]
94 | public void ProjectMenu_IsInvisible()
95 | {
96 | View.ProjectMenu.Received(1).Visible = false;
97 | }
98 |
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/Main/WhenTestsAreLoading.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 | using NSubstitute;
26 |
27 | namespace TestCentric.Gui.Presenters.Main
28 | {
29 | using Model;
30 |
31 | public class WhenTestsAreLoading : MainPresenterTestBase
32 | {
33 | [Test]
34 | public void View_Receives_FileNameOfSingleAssembly()
35 | {
36 | string path = "C:\\git\\projects\\pull-request\\SomeAssembly.AcceptanceTests.dll";
37 | var arguments = new TestFilesLoadingEventArgs(new[] { path });
38 |
39 | Model.Events.TestsLoading += Raise.Event(arguments);
40 |
41 | View.Received().OnTestAssembliesLoading($"Loading Assembly: {path}");
42 | }
43 |
44 | [Test]
45 | public void View_Receives_CountOfMultipleAssemblies()
46 | {
47 | var arguments = new TestFilesLoadingEventArgs(new[]
48 | {
49 | "C:\\git\\projects\\pull-request\\SomeAssembly.Tests.dll",
50 | "C:\\git\\projects\\pull-request\\SomeAssembly.IntegrationTests.dll",
51 | "C:\\git\\projects\\pull-request\\SomeAssembly.AcceptanceTests.dll"
52 | });
53 | Model.Events.TestsLoading += Raise.Event(arguments);
54 |
55 | View.Received().OnTestAssembliesLoading("Loading 3 Assemblies...");
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestGroupTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Collections.Generic;
25 | using System.Xml;
26 | using NUnit.Framework;
27 |
28 | namespace TestCentric.Gui.Presenters
29 | {
30 | using Model;
31 |
32 | public class TestGroupTests
33 | {
34 | private TestGroup _group;
35 |
36 | [SetUp]
37 | public void CreateTestGroup()
38 | {
39 | _group = new TestGroup("NAME", 7);
40 | _group.Add(MakeTestNode("1", "Tom", "Runnable"));
41 | _group.Add(MakeTestNode("2", "Dick", "Explicit"));
42 | _group.Add(MakeTestNode("3", "Harry", "Runnable"));
43 | }
44 |
45 | [Test]
46 | public void GroupName()
47 | {
48 | Assert.That(_group.Name, Is.EqualTo("NAME"));
49 | }
50 |
51 | [Test]
52 | public void ImageIndex()
53 | {
54 | Assert.That(_group.ImageIndex, Is.EqualTo(7));
55 | }
56 |
57 | [Test]
58 | public void TestFilter()
59 | {
60 | var filter = XmlHelper.CreateXmlNode(_group.GetTestFilter().Text);
61 | Assert.That(filter.Name, Is.EqualTo("filter"));
62 | Assert.That(filter.ChildNodes.Count, Is.EqualTo(1));
63 |
64 | filter = filter.ChildNodes[0];
65 | Assert.That(filter.Name, Is.EqualTo("or"));
66 | Assert.That(filter.ChildNodes.Count, Is.EqualTo(2));
67 |
68 | var ids = new List();
69 | foreach (XmlNode child in filter.ChildNodes)
70 | ids.Add(child.InnerText);
71 | Assert.That(ids, Is.EqualTo(new string[] { "1", "3" }));
72 | }
73 |
74 | private TestNode MakeTestNode(string id, string name, string runState)
75 | {
76 | return new TestNode(string.Format("", id, name, runState));
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/NUnitTreeDisplayStrategyTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Windows.Forms;
25 | using NUnit.Engine;
26 | using NUnit.Framework;
27 | using NSubstitute;
28 |
29 | namespace TestCentric.Gui.Presenters.TestTree
30 | {
31 | using Model;
32 | using Views;
33 | using Settings;
34 |
35 | public abstract class DisplayStrategyTests
36 | {
37 | protected ITestTreeView _view;
38 | protected ITestModel _model;
39 | protected DisplayStrategy _strategy;
40 |
41 | [SetUp]
42 | public void CreateDisplayStrategy()
43 | {
44 | _view = Substitute.For();
45 | _model = Substitute.For();
46 |
47 | _strategy = GetDisplayStrategy();
48 | }
49 |
50 | protected abstract DisplayStrategy GetDisplayStrategy();
51 |
52 | [Test]
53 | public void WhenTestsAreLoaded_TreeViewIsLoaded()
54 | {
55 | _strategy.OnTestLoaded(
56 | new TestNode(""));
57 |
58 | _view.Tree.Received().Clear();
59 | _view.Tree.Received().Add(Arg.Is((tn) => ((TestNode)tn.Tag).Id == "42"));
60 | _view.Tree.Received().Add(Arg.Is((tn) => ((TestNode)tn.Tag).Id == "99"));
61 | }
62 |
63 | [Test]
64 | public void WhenTestsAreUnloaded_TreeViewIsCleared()
65 | {
66 | _strategy.OnTestUnloaded();
67 |
68 | _view.Tree.Received().Clear();
69 | }
70 | }
71 |
72 | public class NUnitTreeDisplayStrategyTests : DisplayStrategyTests
73 | {
74 | protected override DisplayStrategy GetDisplayStrategy()
75 | {
76 | return new NUnitTreeDisplayStrategy(_view, _model);
77 | }
78 | }
79 |
80 | //public class NUnitTestListStrategyTests : DisplayStrategyTests
81 | //{
82 | // protected override DisplayStrategy GetDisplayStrategy()
83 | // {
84 | // return new TestListDisplayStrategy(_view, _model);
85 | // }
86 | //}
87 | }
88 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/TestTreePresenterTestBase.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 | using NSubstitute;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 | using Views;
31 |
32 | public class TestTreePresenterTestBase
33 | {
34 | protected ITestTreeView _view;
35 | protected ITestModel _model;
36 |
37 | [SetUp]
38 | public void CreatePresenter()
39 | {
40 | _view = Substitute.For();
41 | _model = Substitute.For();
42 |
43 | new TreeViewPresenter(_view, _model);
44 |
45 | // Make it look like the view loaded
46 | _view.Load += Raise.Event(null, new System.EventArgs());
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenPresenterIsCreated.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | public class WhenPresenterIsCreated : TestTreePresenterTestBase
30 | {
31 | [Test]
32 | public void RunAllCommand_IsDisabled()
33 | {
34 | _view.RunAllCommand.Received(1).Enabled = false;
35 | }
36 |
37 | [Test]
38 | public void RunSelectedCommand_IsDisabled()
39 | {
40 | _view.RunSelectedCommand.Received(1).Enabled = false;
41 | }
42 |
43 | [Test]
44 | public void RunFailedCommand_IsDisabled()
45 | {
46 | _view.RunFailedCommand.Received(1).Enabled = false;
47 | }
48 |
49 | [Test]
50 | public void StopRunCommand_IsDisabled()
51 | {
52 | _view.StopRunCommand.Received(1).Enabled = false;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenTestRunBegins.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 |
31 | public class WhenTestRunBegins : TestTreePresenterTestBase
32 | {
33 | [SetUp]
34 | protected void SimulateTestRunStarting()
35 | {
36 | _model.IsPackageLoaded.Returns(true);
37 | _model.HasTests.Returns(true);
38 | _model.IsTestRunning.Returns(true);
39 | _model.Events.RunStarting += Raise.Event(new RunStartingEventArgs(1234));
40 | }
41 |
42 | [Test]
43 | public void RunAllCommand_IsDisabled()
44 | {
45 | _view.RunAllCommand.Received().Enabled = false;
46 | }
47 |
48 | [Test]
49 | public void RunSelectedCommand_IsDisabled()
50 | {
51 | _view.RunSelectedCommand.Received().Enabled = false;
52 | }
53 |
54 | [Test]
55 | public void RunFailedCommand_IsDisabled()
56 | {
57 | _view.RunFailedCommand.Received().Enabled = false;
58 | }
59 |
60 | [Test]
61 | public void StopRunCommand_IsEnabled()
62 | {
63 | _view.StopRunCommand.Received().Enabled = true;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenTestRunCompletes.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 | using Elements;
31 |
32 | public class WhenTestRunCompletes : TestTreePresenterTestBase
33 | {
34 | [SetUp]
35 | public void SimulateTestRunFinish()
36 | {
37 | _model.IsPackageLoaded.Returns(true);
38 | _model.HasTests.Returns(true);
39 | _model.IsTestRunning.Returns(false);
40 |
41 | var resultNode = new ResultNode("");
42 |
43 | _model.Events.RunFinished += Raise.Event(new TestResultEventArgs(TestAction.RunFinished, resultNode));
44 | }
45 |
46 |
47 | [Test]
48 | public void RunAllCommand_IsEnabled()
49 | {
50 | _view.RunAllCommand.Received().Enabled = true;
51 | }
52 |
53 | [Test]
54 | public void RunSelectedCommand_IsEnabled()
55 | {
56 | _view.RunSelectedCommand.Received().Enabled = true;
57 | }
58 |
59 | [Test]
60 | public void RunFailedCommand_IsEnabled()
61 | {
62 | _view.RunFailedCommand.Received().Enabled = true;
63 | }
64 |
65 | [Test]
66 | public void StopRunCommand_IsDisabled()
67 | {
68 | _view.StopRunCommand.Received().Enabled = false;
69 | }
70 |
71 | [Test]
72 | public void RunAllMenuItemRunsAllTests()
73 | {
74 | _view.RunAllCommand.Execute += Raise.Event();
75 | _model.Received().RunAllTests();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenTestsAreLoaded.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 | using Views;
31 |
32 | public class WhenTestsAreLoaded : TestTreePresenterTestBase
33 | {
34 | [SetUp]
35 | public void SimulateTestLoad()
36 | {
37 | _model.IsPackageLoaded.Returns(true);
38 | _model.HasTests.Returns(true);
39 | _model.IsTestRunning.Returns(false);
40 |
41 | _model.Events.TestLoaded += Raise.Event(new TestNodeEventArgs(TestAction.TestLoaded, new TestNode("")));
42 | }
43 |
44 | [Test]
45 | public void RunAllCommand_IsEnabled()
46 | {
47 | _view.RunAllCommand.Received().Enabled = true;
48 | }
49 |
50 | [Test]
51 | public void RunSelectedCommand_IsEnabled()
52 | {
53 | _view.RunSelectedCommand.Received().Enabled = true;
54 | }
55 |
56 | [Test]
57 | public void RunFailedCommand_IsEnabled()
58 | {
59 | _view.RunFailedCommand.Received().Enabled = true;
60 | }
61 |
62 | [Test]
63 | public void StopRunCommand_IsDisabled()
64 | {
65 | _view.StopRunCommand.Received().Enabled = false;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenTestsAreReloaded.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 | using Views;
31 |
32 | public class WhenTestsAreReloaded : TestTreePresenterTestBase
33 | {
34 | [SetUp]
35 | public void SimulateTestReload()
36 | {
37 | _model.IsPackageLoaded.Returns(true);
38 | _model.HasTests.Returns(true);
39 | _model.IsTestRunning.Returns(false);
40 |
41 | _model.Events.TestLoaded += Raise.Event(new TestNodeEventArgs(TestAction.TestReloaded, new TestNode("")));
42 | }
43 |
44 | [Test]
45 | public void RunAllCommand_IsEnabled()
46 | {
47 | _view.RunAllCommand.Received().Enabled = true;
48 | }
49 |
50 | [Test]
51 | public void RunSelectedCommand_IsEnabled()
52 | {
53 | _view.RunSelectedCommand.Received().Enabled = true;
54 | }
55 |
56 | [Test]
57 | public void RunFailedCommand_IsEnabled()
58 | {
59 | _view.RunFailedCommand.Received().Enabled = true;
60 | }
61 |
62 | [Test]
63 | public void StopRunCommand_IsDisabled()
64 | {
65 | _view.StopRunCommand.Received().Enabled = false;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/TestTree/WhenTestsAreUnloaded.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NSubstitute;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Presenters.TestTree
28 | {
29 | using Model;
30 |
31 | public class WhenTestsAreUnloaded : TestTreePresenterTestBase
32 | {
33 | [SetUp]
34 | public void SimulateTestUnload()
35 | {
36 | _model.IsPackageLoaded.Returns(true);
37 | _model.HasTests.Returns(false);
38 | _model.IsTestRunning.Returns(false);
39 | _model.Events.TestUnloaded += Raise.Event(new TestEventArgs(TestAction.TestUnloaded));
40 | }
41 |
42 | [Test]
43 | public void RunAllCommand_IsDisabled()
44 | {
45 | _view.RunAllCommand.Received().Enabled = false;
46 | }
47 |
48 | [Test]
49 | public void RunSelectedCommand_IsDisabled()
50 | {
51 | _view.RunSelectedCommand.Received().Enabled = false;
52 | }
53 |
54 | [Test]
55 | public void RunFailedCommand_IsDisabled()
56 | {
57 | _view.RunFailedCommand.Received().Enabled = false;
58 | }
59 |
60 | [Test]
61 | public void StopRunCommand_IsDisabled()
62 | {
63 | _view.StopRunCommand.Received().Enabled = false;
64 | }
65 |
66 | [Test]
67 | public void TreeControl_IsCleared()
68 | {
69 | _view.Tree.Received().Clear();
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Presenters/UserSettingsFake.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 | using System.Collections.Generic;
26 | using System.ComponentModel;
27 | using NUnit.Engine;
28 |
29 | namespace NUnit.Gui.Presenters
30 | {
31 | // TODO: With latest changes, this is no longer used.
32 | // Keeping it for a while, as we may end up wanting
33 | // to write more tests that use it.
34 | class UserSettingsFake : ISettings
35 | {
36 | private Dictionary _settings = new Dictionary();
37 |
38 | public event SettingsEventHandler Changed;
39 |
40 | public object GetSetting(string settingName)
41 | {
42 | if (_settings.ContainsKey(settingName))
43 | return _settings[settingName];
44 |
45 | return null;
46 | }
47 |
48 | public T GetSetting(string settingName, T defaultValue)
49 | {
50 | object result = GetSetting(settingName);
51 |
52 | if (result == null)
53 | return defaultValue;
54 |
55 | if (result is T)
56 | return (T)result;
57 |
58 | try
59 | {
60 | TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
61 | if (converter == null)
62 | return defaultValue;
63 |
64 | return (T)converter.ConvertFrom(result);
65 | }
66 | catch (Exception)
67 | {
68 | return defaultValue;
69 | }
70 | }
71 |
72 | public void RemoveSetting(string settingName)
73 | {
74 | _settings.Remove(settingName);
75 |
76 | if (Changed != null)
77 | Changed(this, new SettingsEventArgs(settingName));
78 | }
79 |
80 | public void RemoveGroup(string groupName)
81 | {
82 | throw new NotImplementedException();
83 | }
84 |
85 | public void SaveSetting(string settingName, object settingValue)
86 | {
87 | _settings[settingName] = settingValue;
88 |
89 | Changed?.Invoke(this, new SettingsEventArgs(settingName));
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Reflection;
25 | using System.Runtime.CompilerServices;
26 | using System.Runtime.InteropServices;
27 |
28 | // General Information about an assembly is controlled through the following
29 | // set of attributes. Change these attribute values to modify the information
30 | // associated with an assembly.
31 | [assembly: AssemblyTitle("nunit-gui.tests")]
32 | [assembly: AssemblyDescription("Tests of nunit-gui")]
33 |
34 | // The following GUID is for the Id of the typelib if this project is exposed to COM
35 | [assembly: Guid("f4cd970f-292b-442c-af02-1db35bb4467e")]
36 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Views/CommonViewTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Collections.Generic;
25 | using System.Reflection;
26 | using NUnit.Framework;
27 |
28 | namespace TestCentric.Gui.Views
29 | {
30 | using Elements;
31 |
32 | [TestFixture(typeof(MainForm))]
33 | [TestFixture(typeof(TestTreeView))]
34 | [Platform(Exclude = "Linux", Reason = "Uninitialized form causes an error in Travis-CI")]
35 | public class CommonViewTests where T : new()
36 | {
37 | protected T View { get; private set; }
38 |
39 | [SetUp]
40 | public void CreateView()
41 | {
42 | this.View = new T();
43 | }
44 |
45 | [TestCaseSource("GetViewElementProperties")]
46 | public void ViewElementsAreInitialized(PropertyInfo prop)
47 | {
48 | if (prop.GetValue(View, new object[0]) == null)
49 | Assert.Fail("{0} was not initialized", prop.Name);
50 | }
51 |
52 | static protected IEnumerable GetViewElementProperties()
53 | {
54 | foreach (PropertyInfo prop in typeof(T).GetProperties())
55 | {
56 | if (typeof(IViewElement).IsAssignableFrom(prop.PropertyType))
57 | yield return prop;
58 | }
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/Views/MainFormTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.-
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Linq;
25 | using NUnit.Framework;
26 |
27 | namespace TestCentric.Gui.Views
28 | {
29 | using Elements;
30 |
31 | [Platform(Exclude = "Linux", Reason = "Uninitialized form causes an error in Travis-CI")]
32 | public class MainFormTests
33 | {
34 | private IMainView _view;
35 |
36 | [SetUp]
37 | public void CreateView()
38 | {
39 | _view = new MainForm();
40 | }
41 |
42 | [Test]
43 | public void SelectedRuntimeTest()
44 | {
45 | var selectedRuntime = _view.SelectedRuntime as CheckedMenuGroup;
46 |
47 | Assert.NotNull(selectedRuntime, "SelectedRuntime not set properly");
48 | Assert.NotNull(selectedRuntime.TopMenu, "TopMenu is not set");
49 | Assert.That(selectedRuntime.MenuItems.Select((p) => p.Text), Is.EqualTo(new string[] { "Default" }));
50 | Assert.That(selectedRuntime.MenuItems.Select((p) => p.Tag), Is.EqualTo(new string[] { "DEFAULT" }));
51 | }
52 |
53 | [Test]
54 | public void ProcessModelTest()
55 | {
56 | var processModel = _view.ProcessModel as CheckedMenuGroup;
57 |
58 | Assert.NotNull(processModel, "ProcessModel not set properly");
59 | Assert.That(processModel.MenuItems.Select((p) => p.Text),
60 | Is.EqualTo(new string[] { "Default", "InProcess", "Single", "Multiple" }));
61 | Assert.That(processModel.MenuItems.Select((p) => p.Tag),
62 | Is.EqualTo(new string[] { "DEFAULT", "InProcess", "Single", "Multiple" }));
63 | }
64 |
65 | [Test]
66 | public void DomainUsageTest()
67 | {
68 | var domainUsage = _view.DomainUsage as CheckedMenuGroup;
69 |
70 | Assert.NotNull(domainUsage, "DomainUsage not set properly");
71 | Assert.That(domainUsage.MenuItems.Select((p) => p.Text),
72 | Is.EqualTo(new string[] { "Default", "Single", "Multiple" }));
73 | Assert.That(domainUsage.MenuItems.Select((p) => p.Tag),
74 | Is.EqualTo(new string[] { "DEFAULT", "Single", "Multiple" }));
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/XmlRtfConverterTests.cs:
--------------------------------------------------------------------------------
1 | // LEGAL INFORMATION:
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Drawing;
6 | using System.Windows.Forms;
7 | using System.Xml;
8 |
9 | using NUnit.Framework;
10 |
11 | namespace TestCentric.Gui
12 | {
13 | public class XmlRtfConverterTests
14 | {
15 | [Test]
16 | public void SimpleXmlTest()
17 | {
18 | var xml = @"
19 |
20 |
21 |
22 | C content
23 |
24 |
26 | ]]>
27 |
28 | ";
29 | //We use an empty color table - all colors will be black.
30 | var converter = new Xml2RtfConverter(2, new Dictionary());
31 | var doc = new XmlDocument();
32 | doc.LoadXml(xml);
33 | var rtf = converter.Convert(doc.FirstChild);
34 | //Check the header
35 | int headerLength = 259 + 3 * Environment.NewLine.Length;
36 | Assert.That(rtf.Substring(0, headerLength), Is.EqualTo("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}" + Environment.NewLine +
37 | @"{{\colortbl ;\red0\green0\blue0;\red0\green0\blue0;\red0\green0\blue0;\red0\green0\blue0;\red0\green0\blue0;\red0\green0\blue0;\red0\green0\blue0;}}" + Environment.NewLine +
38 | @"\viewkind4\uc1\pard\f0\fs20" + Environment.NewLine));
39 | //CHeck the content
40 | Assert.That(rtf.Substring(headerLength), Is.EqualTo(
41 | @"\cf5<\cf1A \cf3a=\cf4'1' \cf3b=\cf4'2'\cf5>\par" +
42 | @" \cf5<\cf1B \cf5/>\par" +
43 | @" \cf6\par" +
44 | @" \cf5<\cf1C\cf5>\cf2C content\cf5\cf1C\cf5>\par" +
45 | @" \cf5<\cf1D\cf5>\par" +
46 | @"\cf7\par" +
49 | @" \cf5\cf1D\cf5>\par" +
50 | @"\cf5\cf1A\cf5>\par"));
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/TestCentric/tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/TestModel/model/ITestEvents.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Model
25 | {
26 | ///
27 | /// Delegates for all events related to the model
28 | ///
29 | public delegate void TestEventHandler(TestEventArgs args);
30 | public delegate void RunStartingEventHandler(RunStartingEventArgs args);
31 | public delegate void TestNodeEventHandler(TestNodeEventArgs args);
32 | public delegate void TestResultEventHandler(TestResultEventArgs args);
33 | public delegate void TestItemEventHandler(TestItemEventArgs args);
34 | public delegate void TestOutputEventHandler(TestOutputEventArgs args);
35 | public delegate void TestFilesLoadingEventHandler(TestFilesLoadingEventArgs args);
36 |
37 | ///
38 | /// ITestEvents provides events for all actions in the model, both those
39 | /// caused by an engine action like a test completion and those originated
40 | /// in the model itself like starting a test run.
41 | ///
42 | public interface ITestEvents
43 | {
44 | // Events related to loading and unloading tests.
45 | event TestFilesLoadingEventHandler TestsLoading;
46 | event TestEventHandler TestsReloading;
47 | event TestEventHandler TestsUnloading;
48 |
49 | event TestNodeEventHandler TestLoaded;
50 | event TestNodeEventHandler TestReloaded;
51 | event TestEventHandler TestUnloaded;
52 |
53 | // Events related to running tests
54 | event RunStartingEventHandler RunStarting;
55 | event TestNodeEventHandler SuiteStarting;
56 | event TestNodeEventHandler TestStarting;
57 |
58 | event TestResultEventHandler RunFinished;
59 | event TestResultEventHandler SuiteFinished;
60 | event TestResultEventHandler TestFinished;
61 |
62 | event TestOutputEventHandler TestOutput;
63 |
64 | // Event used to broadcast a change in the selected
65 | // item, so that all presenters may be notified.
66 | event TestItemEventHandler SelectedItemChanged;
67 |
68 | event TestEventHandler CategorySelectionChanged;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/TestModel/model/ITestItem.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | ///
29 | /// ITestItem is the common interface shared by TestNodes
30 | /// and TestGroups and allows either to be selected in
31 | /// the tree.
32 | ///
33 | public interface ITestItem
34 | {
35 | ///
36 | /// The name of this item
37 | ///
38 | string Name { get; }
39 |
40 | ///
41 | /// Get a TestFilter for use in selecting this item
42 | /// to be run by the engine.
43 | ///
44 | ///
45 | TestFilter GetTestFilter();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/TestModel/model/ITestServices.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2018 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Engine;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | ///
29 | /// ITestServices extends IServiceLocator in order to
30 | /// conveniently cache commonly used services.
31 | ///
32 | public interface ITestServices : IServiceLocator
33 | {
34 | ISettings UserSettings { get; }
35 | IRecentFiles RecentFiles { get; }
36 | IExtensionService ExtensionService { get; }
37 | IResultService ResultService { get; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/TestModel/model/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("nunit.gui.core")]
8 | [assembly: AssemblyDescription("Model interfaces and implementation and view interface definitions")]
9 |
10 | // The following GUID is for the ID of the typelib if this project is exposed to COM
11 | [assembly: Guid("e978a8d7-e4a4-4de9-94df-d82bd764936b")]
12 |
--------------------------------------------------------------------------------
/src/TestModel/model/ResultNode.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Globalization;
25 | using System.Xml;
26 |
27 | namespace TestCentric.Gui.Model
28 | {
29 | ///
30 | /// TestNode represents a single NUnit test result in the test model.
31 | ///
32 | public class ResultNode : TestNode
33 | {
34 | #region Constructors
35 |
36 | public ResultNode(XmlNode xmlNode) : base(xmlNode)
37 | {
38 | Status = GetStatus();
39 | Label = GetAttribute("label");
40 | Outcome = new ResultState(Status, Label);
41 | AssertCount = GetAttribute("asserts", 0);
42 | var duration = GetAttribute("duration");
43 | Duration = duration != null
44 | ? double.Parse(duration, CultureInfo.InvariantCulture)
45 | : 0.0;
46 | }
47 |
48 | public ResultNode(string xmlText) : this(XmlHelper.CreateXmlNode(xmlText)) { }
49 |
50 | #endregion
51 |
52 | #region Public Properties
53 |
54 | public TestStatus Status { get; }
55 | public string Label { get; }
56 | public ResultState Outcome { get; }
57 | public int AssertCount { get; }
58 | public double Duration { get; }
59 |
60 | #endregion
61 |
62 | #region Helper Methods
63 |
64 | private TestStatus GetStatus()
65 | {
66 | string status = GetAttribute("result");
67 | switch (status)
68 | {
69 | case "Passed":
70 | default:
71 | return TestStatus.Passed;
72 | case "Inconclusive":
73 | return TestStatus.Inconclusive;
74 | case "Failed":
75 | return TestStatus.Failed;
76 | case "Warning":
77 | return TestStatus.Warning;
78 | case "Skipped":
79 | return TestStatus.Skipped;
80 | }
81 | }
82 |
83 | #endregion
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/TestModel/model/RunState.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Model
25 | {
26 | ///
27 | /// The RunState enum indicates whether a test can be executed.
28 | ///
29 | public enum RunState
30 | {
31 | ///
32 | /// We don't know the RunState
33 | ///
34 | Unknown,
35 |
36 | ///
37 | /// The test is not runnable.
38 | ///
39 | NotRunnable,
40 |
41 | ///
42 | /// The test is runnable.
43 | ///
44 | Runnable,
45 |
46 | ///
47 | /// The test can only be run explicitly
48 | ///
49 | Explicit,
50 |
51 | ///
52 | /// The test has been skipped. This val may
53 | /// appear on a Test when certain attributes
54 | /// are used to skip the test.
55 | ///
56 | Skipped,
57 |
58 | ///
59 | /// The test has been ignored. May appear on
60 | /// a Test, when the IgnoreAttribute is used.
61 | ///
62 | Ignored
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/TestModel/model/TestAction.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Model
25 | {
26 | ///
27 | /// The TestAction enumeration is used to distinguish events
28 | /// that are fired during the execution of a test run.
29 | ///
30 | public enum TestAction
31 | {
32 | TestLoaded,
33 | TestUnloaded,
34 | TestReloaded,
35 |
36 | ///
37 | /// The test run is starting.
38 | ///
39 | RunStarting,
40 |
41 | ///
42 | /// The test run has completed.
43 | ///
44 | RunFinished,
45 |
46 | // TODO: DO we need this or is an exception sufficient?
47 | ///
48 | /// The test run failed to complete due to a catastrophic error.
49 | ///
50 | RunFailed,
51 |
52 | ///
53 | /// A suite of tests is about to execute.
54 | ///
55 | SuiteStarting,
56 |
57 | ///
58 | /// A suite of tests has completed execution.
59 | ///
60 | SuiteFinished,
61 |
62 | ///
63 | /// A single test case is about to execute.
64 | ///
65 | TestStarting,
66 |
67 | ///
68 | /// A single test case has completed execution.
69 | ///
70 | TestFinished,
71 |
72 | ///
73 | /// An unhandled exception was fired during the execution
74 | /// of a test run and it isn't possible to determine which
75 | /// teset caused it.
76 | ///
77 | TestException,
78 |
79 | ///
80 | /// A test has created some text output.
81 | ///
82 | TestOutput
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/TestModel/model/TestServices.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2018 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 | using NUnit.Engine;
26 |
27 | namespace TestCentric.Gui.Model
28 | {
29 | ///
30 | /// TestServices caches commonly used services.
31 | ///
32 | public class TestServices : ITestServices
33 | {
34 | private IServiceLocator _services;
35 | private ITestEngine _testEngine;
36 |
37 | public TestServices(ITestEngine testEngine)
38 | {
39 | _testEngine = testEngine;
40 | _services = testEngine.Services;
41 |
42 | UserSettings = GetService();
43 | RecentFiles = GetService();
44 | ExtensionService = GetService();
45 | ResultService = GetService();
46 | }
47 |
48 | #region ITestServices Implementation
49 |
50 | public ISettings UserSettings { get; }
51 |
52 | public IRecentFiles RecentFiles { get; }
53 |
54 | public IExtensionService ExtensionService { get; }
55 |
56 | public IResultService ResultService { get; }
57 |
58 | #endregion
59 |
60 | #region IServiceLocator Implementation
61 |
62 | public T GetService() where T : class
63 | {
64 | return _services.GetService();
65 | }
66 |
67 | public object GetService(Type serviceType)
68 | {
69 | return _services.GetService(serviceType);
70 | }
71 |
72 | #endregion
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/TestModel/model/TestStartNotice.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Xml;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | public class TestStartNotice
29 | {
30 | public TestStartNotice(XmlNode xmlNode)
31 | {
32 | Id = xmlNode.GetAttribute("id");
33 | Name = xmlNode.GetAttribute("name");
34 | FullName = xmlNode.GetAttribute("fullname");
35 | }
36 |
37 | public string Id { get; private set; }
38 | public string Name { get; private set; }
39 | public string FullName { get; private set; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/TestModel/model/TestStatus.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | namespace TestCentric.Gui.Model
25 | {
26 | ///
27 | /// The TestStatus enum indicates the suiteResult of running a test
28 | ///
29 | public enum TestStatus
30 | {
31 | ///
32 | /// The test was inconclusive
33 | ///
34 | Inconclusive,
35 |
36 | ///
37 | /// The test has skipped
38 | ///
39 | Skipped,
40 |
41 | ///
42 | /// The test succeeded
43 | ///
44 | Passed,
45 |
46 | ///
47 | /// There was a warning
48 | ///
49 | Warning,
50 |
51 | ///
52 | /// The test failed
53 | ///
54 | Failed
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/TestModel/model/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/TestModel/tests/AvailableRuntimesTest.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System;
25 | using System.Collections.Generic;
26 | using System.Linq;
27 | using System.Text;
28 | using NUnit.Engine;
29 | using NUnit.Framework;
30 |
31 | namespace TestCentric.Gui.Model
32 | {
33 | public class AvailableRuntimesTest
34 | {
35 | private IList _availableRuntimes;
36 |
37 | [OneTimeSetUp]
38 | public void CreateTestModel()
39 | {
40 | var engine = TestEngineActivator.CreateInstance();
41 | Assert.NotNull(engine, "Unable to create engine instance for testing");
42 |
43 | var model = new TestModel(engine);
44 | _availableRuntimes = model.AvailableRuntimes;
45 | Assert.NotNull(_availableRuntimes);
46 | }
47 |
48 | [Test]
49 | public void AtLeastOneRuntimeIsAvailable()
50 | {
51 | Assert.That(_availableRuntimes.Count, Is.GreaterThan(0));
52 | foreach (var runtime in _availableRuntimes)
53 | Console.WriteLine("Available: " + runtime.DisplayName);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/TestModel/tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TesstCentric.Gui.Model.Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("TesstCentric.Gui.Model.Tests")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("594fc8f2-8979-4a0a-9f57-f3efd0939e1c")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/TestModel/tests/ResultNodeTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | [TestFixture]
29 | public class ResultNodeTests
30 | {
31 | [Test]
32 | [SetCulture("fr-FR")]
33 | public void CreateResultNode_CurrentCultureWithDifferentDelimiter_DoesNotThrowException()
34 | {
35 | TestDelegate newResultNode = () =>
36 | {
37 | var resultNode = new ResultNode("");
38 | };
39 | Assert.DoesNotThrow(newResultNode);
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/src/TestModel/tests/TestModelPackageTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2017 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Linq;
25 | using NSubstitute;
26 | using NUnit.Engine;
27 | using NUnit.Framework;
28 |
29 | namespace TestCentric.Gui.Model
30 | {
31 | public class TestModelPackageTests
32 | {
33 | private TestModel _model;
34 |
35 | [SetUp]
36 | public void CreateModel()
37 | {
38 | var engine = Substitute.For();
39 | _model = new TestModel(engine);
40 | }
41 |
42 | [TestCase("my.test.assembly.dll")]
43 | [TestCase("one.dll", "two.dll", "three.dll")]
44 | public void PackageContainsOneSubPackagePerAssembly(params string[] assemblies)
45 | {
46 | TestPackage package = _model.MakeTestPackage(assemblies);
47 |
48 | Assert.That(package.SubPackages.Select(p => p.Name), Is.EqualTo(assemblies));
49 | }
50 |
51 | [TestCase("ProjectModel", "Single")]
52 | [TestCase("DomainUsage", "Multiple")]
53 | [TestCase("RuntimeFramework", "net-2.0")]
54 | public void PackageReflectsPackageSettings(string key, object value)
55 | {
56 | _model.PackageSettings[key] = value;
57 | TestPackage package = _model.MakeTestPackage(new[] { "my.dll" });
58 |
59 | Assert.That(package.Settings.ContainsKey(key));
60 | Assert.That(package.Settings[key], Is.EqualTo(value));
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/TestModel/tests/TestNodeTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | public class TestNodeTests
29 | {
30 | [Test]
31 | public void CreateTestCase()
32 | {
33 | var testNode = new TestNode("");
34 |
35 | Assert.That(testNode.Id, Is.EqualTo("123"));
36 | Assert.That(testNode.Name, Is.EqualTo("SomeTest"));
37 | Assert.That(testNode.FullName, Is.EqualTo("A.B.C.SomeTest"));
38 | Assert.That(testNode.Type, Is.EqualTo("TestCase"));
39 | Assert.That(testNode.TestCount, Is.EqualTo(1));
40 | Assert.That(testNode.RunState, Is.EqualTo(RunState.Ignored));
41 | Assert.False(testNode.IsSuite);
42 | }
43 |
44 | [Test]
45 | public void CreateTestSuite()
46 | {
47 | var testNode = new TestNode("");
48 |
49 | Assert.That(testNode.Id, Is.EqualTo("123"));
50 | Assert.That(testNode.Name, Is.EqualTo("mytest.dll"));
51 | Assert.That(testNode.FullName, Is.EqualTo("/A/B/C/mytest.dll"));
52 | Assert.That(testNode.Type, Is.EqualTo("Assembly"));
53 | Assert.That(testNode.TestCount, Is.EqualTo(42));
54 | Assert.That(testNode.RunState, Is.EqualTo(RunState.Runnable));
55 | Assert.That(testNode.IsSuite);
56 | }
57 |
58 | [Test]
59 | public void CreateTestRun()
60 | {
61 | var testNode = new TestNode("");
62 |
63 | Assert.That(testNode.Id, Is.EqualTo("123"));
64 | Assert.That(testNode.Name, Is.EqualTo("mytest.dll"));
65 | Assert.That(testNode.FullName, Is.EqualTo("/A/B/C/mytest.dll"));
66 | Assert.That(testNode.TestCount, Is.EqualTo(99));
67 | Assert.That(testNode.IsSuite);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/TestModel/tests/TestSelectionTests.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2016 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using NUnit.Framework;
25 |
26 | namespace TestCentric.Gui.Model
27 | {
28 | public class TestSelectionTests
29 | {
30 | private TestSelection selection;
31 |
32 | [SetUp]
33 | public void CreateSelection()
34 | {
35 | selection = new TestSelection();
36 | selection.Add(MakeTestNode("1", "Tom", "Passed"));
37 | selection.Add(MakeTestNode("2", "Dick", "Failed"));
38 | selection.Add(MakeTestNode("3", "Harry", "Passed"));
39 | }
40 |
41 | [Test]
42 | public void SortByNameTest()
43 | {
44 | var sorted = selection.SortBy((x, y) => x.Name.CompareTo(y.Name));
45 |
46 | Assert.That(sorted, Is.SameAs(selection));
47 | Assert.That(sorted[0].Name, Is.EqualTo("Dick"));
48 | Assert.That(sorted[1].Name, Is.EqualTo("Harry"));
49 | Assert.That(sorted[2].Name, Is.EqualTo("Tom"));
50 | }
51 |
52 | [Test]
53 | public void RemoveTestNode()
54 | {
55 | selection.RemoveId("2");
56 | Assert.That(selection.Count, Is.EqualTo(2));
57 | }
58 |
59 | private TestNode MakeTestNode(string id, string name, string result)
60 | {
61 | return new TestNode(XmlHelper.CreateXmlNode(string.Format("", id, name, result)));
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/TestModel/tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/ApartmentTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using NUnit.Framework;
4 |
5 | namespace NUnitTestDemo
6 | {
7 | [Apartment(ApartmentState.STA)]
8 | public class FixtureWithApartmentAttributeOnClass
9 | {
10 | [Test]
11 | public void TestMethodInSTAFixture()
12 | {
13 | Assert.That(Thread.CurrentThread.GetApartmentState(), Is.EqualTo(ApartmentState.STA));
14 | }
15 | }
16 |
17 | public class FixtureWithApartmentAttributeOnMethod
18 | {
19 | [Test, Apartment(ApartmentState.STA)]
20 | public void TestMethodInSTA()
21 | {
22 | Assert.That(Thread.CurrentThread.GetApartmentState(), Is.EqualTo(ApartmentState.STA));
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/AsyncTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using NUnit.Framework;
5 |
6 | namespace NUnitTestDemo
7 | {
8 | public class AsyncTests
9 | {
10 | [Test, ExpectError]
11 | public async void AsyncVoidTestIsInvalid()
12 | {
13 | var result = await ReturnOne();
14 |
15 | Assert.AreEqual(1, result);
16 | }
17 |
18 | [Test, ExpectPass]
19 | public async Task AsyncTaskTestSucceeds()
20 | {
21 | var result = await ReturnOne();
22 |
23 | Assert.AreEqual(1, result);
24 | }
25 |
26 | [Test, ExpectFailure]
27 | public async Task AsyncTaskTestFails()
28 | {
29 | var result = await ReturnOne();
30 |
31 | Assert.AreEqual(2, result);
32 | }
33 |
34 | [Test, ExpectError]
35 | public async Task AsyncTaskTestThrowsException()
36 | {
37 | await ThrowException();
38 |
39 | Assert.Fail("Should never get here");
40 | }
41 |
42 | [TestCase(ExpectedResult = 1), ExpectPass]
43 | public async Task AsyncTaskWithResultSucceeds()
44 | {
45 | return await ReturnOne();
46 | }
47 |
48 | [TestCase(ExpectedResult = 2), ExpectFailure]
49 | public async Task AsyncTaskWithResultFails()
50 | {
51 | return await ReturnOne();
52 | }
53 |
54 | [TestCase(ExpectedResult = 0), ExpectError]
55 | public async Task AsyncTaskWithResultThrowsException()
56 | {
57 | return await ThrowException();
58 | }
59 |
60 | private static Task ReturnOne()
61 | {
62 | return Task.Run(() => 1);
63 | }
64 |
65 | private static Task ThrowException()
66 | {
67 | return Task.Run(() =>
68 | {
69 | throw new InvalidOperationException();
70 | #pragma warning disable 162
71 | return 1;
72 | #pragma warning restore 162
73 | });
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/ConfigFileTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.IO;
4 | using NUnit.Framework;
5 |
6 | namespace NUnitTestDemo
7 | {
8 | [ExpectPass]
9 | public class ConfigFileTests
10 | {
11 | [Test]
12 | public static void ProperConfigFileIsUsed()
13 | {
14 | var expectedPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "NUnit3TestDemo.dll.config");
15 | Assert.That(expectedPath, Is.EqualTo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));
16 | }
17 |
18 | [Test]
19 | public static void CanReadConfigFile()
20 | {
21 | Assert.That(ConfigurationManager.AppSettings.Get("test.setting"), Is.EqualTo("54321"));
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/ExpectedOutcomeAttributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using NUnit.Framework;
7 |
8 | namespace NUnitTestDemo
9 | {
10 | public class ExpectPassAttribute : PropertyAttribute
11 | {
12 | public ExpectPassAttribute() : base("Expect", "Pass") { }
13 | }
14 |
15 |
16 | public class ExpectFailureAttribute : PropertyAttribute
17 | {
18 | public ExpectFailureAttribute() : base("Expect", "Failure") { }
19 | }
20 |
21 | public class ExpectWarningAttribute : PropertyAttribute
22 | {
23 | public ExpectWarningAttribute() : base("Expect", "Warning") { }
24 | }
25 |
26 | public class ExpectIgnoreAttribute : PropertyAttribute
27 | {
28 | public ExpectIgnoreAttribute() : base("Expect", "Ignore") { }
29 | }
30 |
31 | public class ExpectSkipAttribute : PropertyAttribute
32 | {
33 | public ExpectSkipAttribute() : base("Expect", "Skipped") { }
34 | }
35 |
36 | public class ExpectErrorAttribute : PropertyAttribute
37 | {
38 | public ExpectErrorAttribute() : base("Expect", "Error") { }
39 | }
40 |
41 | public class ExpectInconclusiveAttribute : PropertyAttribute
42 | {
43 | public ExpectInconclusiveAttribute() : base("Expect", "Inconclusive") { }
44 | }
45 |
46 | public class ExpectMixedAttribute : PropertyAttribute
47 | {
48 | public ExpectMixedAttribute() : base("Expect", "Mixed") { }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/GenericTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using NUnit.Framework;
6 |
7 | namespace NUnitTestDemo
8 | {
9 | [TestFixture(typeof(int))]
10 | public class GenericTests
11 | {
12 | [Test, ExpectPass]
13 | public void TestIt() { }
14 | }
15 |
16 | [ExpectPass]
17 | [TestFixture(typeof(ArrayList))]
18 | [TestFixture(typeof(List))]
19 | public class GenericTests_IList where TList : IList, new()
20 | {
21 | private IList list;
22 |
23 | [SetUp]
24 | public void CreateList()
25 | {
26 | this.list = new TList();
27 | }
28 |
29 | [Test]
30 | public void CanAddToList()
31 | {
32 | list.Add(1); list.Add(2); list.Add(3);
33 | Assert.AreEqual(3, list.Count);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/InheritedTestTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 |
4 | namespace NUnitTestDemo
5 | {
6 | public abstract class InheritedTestBaseClass
7 | {
8 | [Test]
9 | public void TestInBaseClass()
10 | {
11 | }
12 | }
13 |
14 | public class InheritedTestDerivedClass : InheritedTestBaseClass
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/OneTimeSetUpTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using NUnit.Framework;
5 |
6 | namespace NUnitTestDemo
7 | {
8 | [TestFixture, ExpectPass]
9 | public class OneTimeSetUpTests
10 | {
11 | int SetUpCount;
12 | int TearDownCount;
13 |
14 | [OneTimeSetUp]
15 | public void BeforeTests()
16 | {
17 | Assert.That(SetUpCount, Is.EqualTo(0));
18 | Assert.That(TearDownCount, Is.EqualTo(0));
19 | SetUpCount++;
20 | }
21 |
22 | [OneTimeTearDown]
23 | public void AfterTests()
24 | {
25 | Assert.That(SetUpCount, Is.EqualTo(1), "Unexpected error");
26 | Assert.That(TearDownCount, Is.EqualTo(0));
27 | TearDownCount++;
28 | }
29 |
30 | [Test]
31 | public void Test1()
32 | {
33 | Assert.That(SetUpCount, Is.EqualTo(1));
34 | Assert.That(TearDownCount, Is.EqualTo(0));
35 | }
36 |
37 | [Test]
38 | public void Test2()
39 | {
40 | Assert.That(SetUpCount, Is.EqualTo(1));
41 | Assert.That(TearDownCount, Is.EqualTo(0));
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NUnitTestDemo")]
9 | [assembly: AssemblyDescription("Demo program used for nunit-gui integration testing")]
10 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/SetUpFixtureTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using NUnit.Framework;
5 |
6 | namespace NUnitTestDemo.SetUpFixture
7 | {
8 | [SetUpFixture]
9 | public class SetUpFixture
10 | {
11 | public static int SetUpCount;
12 | public static int TearDownCount;
13 |
14 | [OneTimeSetUp]
15 | public void BeforeTests()
16 | {
17 | Assert.That(SetUpCount, Is.EqualTo(0));
18 | SetUpCount++;
19 | }
20 |
21 | [OneTimeTearDown]
22 | public void AfterTests()
23 | {
24 | Assert.That(TearDownCount, Is.EqualTo(0));
25 | TearDownCount++;
26 | }
27 | }
28 |
29 | [TestFixture, ExpectPass]
30 | public class TestFixture1
31 | {
32 | [Test]
33 | public void Test1()
34 | {
35 | Assert.That(SetUpFixture.SetUpCount, Is.EqualTo(1));
36 | Assert.That(SetUpFixture.TearDownCount, Is.EqualTo(0));
37 | }
38 | }
39 |
40 | [TestFixture, ExpectPass]
41 | public class TestFixture2
42 | {
43 | [Test]
44 | public void Test2()
45 | {
46 | Assert.That(SetUpFixture.SetUpCount, Is.EqualTo(1));
47 | Assert.That(SetUpFixture.TearDownCount, Is.EqualTo(0));
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/TextOutputTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using NUnit.Framework;
5 | using System.Diagnostics;
6 |
7 | namespace NUnitTestDemo
8 | {
9 | [ExpectPass]
10 | public class TextOutputTests
11 | {
12 | [Test]
13 | public void WriteToConsole()
14 | {
15 | Console.WriteLine("This is Console line 1");
16 | Console.WriteLine("This is Console line 2\nThis is Console line 3");
17 | }
18 |
19 | [Test]
20 | public void WriteToError()
21 | {
22 | Console.Error.WriteLine("This is Error line 1");
23 | Console.Error.WriteLine("This is Error line 2\nThis is Error line 3");
24 | }
25 |
26 | [Test]
27 | public void WriteToTestContext()
28 | {
29 | TestContext.WriteLine("Line 1 to TestContext");
30 | TestContext.WriteLine("Line 2 to TestContext\nLine 3 to TestContext");
31 | }
32 |
33 | [Test]
34 | public void WriteToTestContextOut()
35 | {
36 | TestContext.Out.WriteLine("Line 1 to TestContext.Out");
37 | TestContext.Out.WriteLine("Line 2 to TestContext.Out\nLine 3 to TestContext.Out");
38 | }
39 |
40 | [Test]
41 | public void WriteToTestContextError()
42 | {
43 | TestContext.Error.WriteLine("Line 1 to TestContext.Error");
44 | TestContext.Error.WriteLine("Line 2 to TestContext.Error\nLine 3 to TestContext.Error");
45 | }
46 |
47 | [Test]
48 | public void WriteToTestContextProgress()
49 | {
50 | TestContext.Progress.WriteLine("Line 1 to TestContext.Progress");
51 | TestContext.Progress.WriteLine("Line 2 to TestContext.Progress\nLine 3 to TestContext.Progress");
52 | }
53 |
54 | [Test]
55 | public void WriteToTrace()
56 | {
57 | Trace.Write("This is Trace line 1");
58 | Trace.Write("This is Trace line 2");
59 | Trace.Write("This is Trace line 3");
60 | }
61 |
62 | [Test, Description("Displays various settings for verification")]
63 | public void DisplayTestSettings()
64 | {
65 | Console.WriteLine("CurrentDirectory={0}", Environment.CurrentDirectory);
66 | Console.WriteLine("BasePath={0}", AppDomain.CurrentDomain.BaseDirectory);
67 | Console.WriteLine("PrivateBinPath={0}", AppDomain.CurrentDomain.SetupInformation.PrivateBinPath);
68 | Console.WriteLine("WorkDirectory={0}", TestContext.CurrentContext.WorkDirectory);
69 | Console.WriteLine("DefaultTimeout={0}", NUnit.Framework.Internal.TestExecutionContext.CurrentContext.TestCaseTimeout);
70 | }
71 |
72 | [Test]
73 | public void DisplayTestParameters()
74 | {
75 | if (TestContext.Parameters.Count == 0)
76 | Console.WriteLine("No TestParameters were passed");
77 | else
78 | foreach (var name in TestContext.Parameters.Names)
79 | Console.WriteLine("Parameter: {0} = {1}", name, TestContext.Parameters.Get(name));
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/Theories.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using NUnit.Framework;
5 |
6 | namespace NUnitTestDemo
7 | {
8 | public class Theories
9 | {
10 | [Datapoints]
11 | int[] data = new int[] { 0, 1, 42 };
12 |
13 | [Theory, ExpectPass]
14 | public void Theory_AllCasesSucceed(int a, int b)
15 | {
16 | Assert.That(a + b, Is.EqualTo(b + a));
17 | }
18 |
19 | [Theory, ExpectMixed]
20 | public void Theory_SomeCasesAreInconclusive(int a, int b)
21 | {
22 | Assume.That(b != 0);
23 | }
24 |
25 | [Theory, ExpectMixed]
26 | public void Theory_SomeCasesFail(int a, int b)
27 | {
28 | Assert.That(b != 0);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/tests/demo-assembly/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/tests/mock-assembly/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ***********************************************************************
2 | // Copyright (c) 2015 Charlie Poole
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining
5 | // a copy of this software and associated documentation files (the
6 | // "Software"), to deal in the Software without restriction, including
7 | // without limitation the rights to use, copy, modify, merge, publish,
8 | // distribute, sublicense, and/or sell copies of the Software, and to
9 | // permit persons to whom the Software is furnished to do so, subject to
10 | // the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be
13 | // included in all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | // ***********************************************************************
23 |
24 | using System.Reflection;
25 |
26 | // Information about this assembly is defined by the following attributes.
27 | // Change them to the _values specific to your project.
28 |
29 | [assembly: AssemblyTitle("mock-assembly")]
30 | [assembly: AssemblyDescription("Mock assembly used to test loading of assemblies in GUI")]
31 |
--------------------------------------------------------------------------------
/src/tests/mock-assembly/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tools/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------