This repository was archived by the owner on May 17, 2021. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathNUnitActionEditor.cs
More file actions
106 lines (93 loc) · 4.05 KB
/
Copy pathNUnitActionEditor.cs
File metadata and controls
106 lines (93 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System.Linq;
using System.Web.UI.WebControls;
using Inedo.BuildMaster.Data;
using Inedo.BuildMaster.Extensibility.Actions;
using Inedo.BuildMaster.Web.Controls.Extensions;
using Inedo.Web;
using Inedo.Web.Controls;
namespace Inedo.BuildMasterExtensions.NUnit
{
internal sealed class NUnitActionEditor : ActionEditorBase
{
private FileBrowserTextBox txtExePath;
private ValidatingTextBox txtTestFile;
private ValidatingTextBox txtGroupName;
private ValidatingTextBox txtAdditionalArguments;
private ValidatingTextBox txtCustomXmlOutputPath;
private CheckBox chkTreatInconclusiveTestsAsFailure;
public override bool DisplaySourceDirectory => true;
protected override void CreateChildControls()
{
Tables.Deployables_Extended deployable = null;
if (this.DeployableId > 0)
{
deployable = DB.Applications_GetDeployable(this.DeployableId).FirstOrDefault();
}
this.txtExePath = new FileBrowserTextBox
{
IncludeFiles = true,
ServerId = this.ServerId,
DefaultText = "default for selected configuration"
};
this.txtGroupName = new ValidatingTextBox
{
Text = deployable != null ? deployable.Deployable_Name : string.Empty,
Required = true
};
this.txtTestFile = new ValidatingTextBox
{
Required = true
};
this.txtAdditionalArguments = new ValidatingTextBox
{
DefaultText = "none"
};
this.txtCustomXmlOutputPath = new ValidatingTextBox
{
DefaultText = "managed by BuildMaster"
};
this.chkTreatInconclusiveTestsAsFailure = new CheckBox
{
Text = "Treat inconclusive tests as failures",
Checked = true
};
this.Controls.Add(
new SlimFormField("Unit test group:", this.txtGroupName),
new SlimFormField("NUnit-console.exe path:", this.txtExePath)
{
HelpText = "The path to (and including) nunit-console.exe if using a different version of NUnit than the one specified "
+ "in the NUnit extension configuration."
},
new SlimFormField("Test file:", this.txtTestFile)
{
HelpText = "This should normally be a .dll or project file."
},
new SlimFormField("XML output path:", this.txtCustomXmlOutputPath),
new SlimFormField("Additional NUnit arguments:", this.txtAdditionalArguments),
new SlimFormField("Options:", this.chkTreatInconclusiveTestsAsFailure)
);
}
public override void BindToForm(ActionBase extension)
{
var nunitAction = (NUnitAppAction)extension;
this.txtExePath.Text = nunitAction.ExePath;
this.txtTestFile.Text = nunitAction.TestFile;
this.txtGroupName.Text = nunitAction.GroupName;
this.txtAdditionalArguments.Text = nunitAction.AdditionalArguments;
this.txtCustomXmlOutputPath.Text = nunitAction.CustomXmlOutputPath;
this.chkTreatInconclusiveTestsAsFailure.Checked = nunitAction.TreatInconclusiveAsFailure;
}
public override ActionBase CreateFromForm()
{
return new NUnitAppAction
{
ExePath = this.txtExePath.Text,
TestFile = this.txtTestFile.Text,
GroupName = this.txtGroupName.Text,
AdditionalArguments = this.txtAdditionalArguments.Text,
CustomXmlOutputPath = this.txtCustomXmlOutputPath.Text,
TreatInconclusiveAsFailure = this.chkTreatInconclusiveTestsAsFailure.Checked
};
}
}
}