Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kharnagy committed Jun 10, 2013
0 parents commit 61537d5
Show file tree
Hide file tree
Showing 8 changed files with 488 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages/*
bin/*
obj/*
*.suo
135 changes: 135 additions & 0 deletions NUnit.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{34B976CF-D676-42F4-80DF-8515D45E1B62}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Inedo.BuildMasterExtensions.NUnit</RootNamespace>
<AssemblyName>NUnit</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<IsWebBootstrapper>true</IsWebBootstrapper>
<StartupObject>
</StartupObject>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<PublishUrl>http://localhost/NUnit/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="BuildMaster.Web.Controls">
<HintPath>packages\Inedo.BuildMaster.SDK.3.5\lib\net20\BuildMaster.Web.Controls.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BuildMasterCore">
<HintPath>packages\Inedo.BuildMaster.SDK.3.5\lib\net20\BuildMasterCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="InedoLib">
<HintPath>packages\Inedo.BuildMaster.SDK.3.5\lib\net20\InedoLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NUnitActionEditor.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="NUnitAppAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions NUnit.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnit", "NUnit.csproj", "{34B976CF-D676-42F4-80DF-8515D45E1B62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{34B976CF-D676-42F4-80DF-8515D45E1B62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34B976CF-D676-42F4-80DF-8515D45E1B62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34B976CF-D676-42F4-80DF-8515D45E1B62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34B976CF-D676-42F4-80DF-8515D45E1B62}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
154 changes: 154 additions & 0 deletions NUnitActionEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
using System.Web.UI.WebControls;
using Inedo.BuildMaster.Data;
using Inedo.BuildMaster.Extensibility.Actions;
using Inedo.BuildMaster.Web.Controls;
using Inedo.BuildMaster.Web.Controls.Extensions;
using Inedo.Linq;
using Inedo.Web.Controls;

namespace Inedo.BuildMasterExtensions.NUnit
{
/// <summary>
/// Custom editor for the NUnit action.
/// </summary>
internal sealed class NUnitActionEditor : ActionEditorBase
{
private SourceControlFileFolderPicker txtExePath;
private ValidatingTextBox txtTestFile, txtGroupName;
private DropDownList ddlFrameworkVersion;
private ValidatingTextBox txtAdditionalArguments;

/// <summary>
/// Initializes a new instance of the <see cref="NUnitActionEditor"/> class.
/// </summary>
public NUnitActionEditor()
{
this.ValidateBeforeCreate += this.NUnitActionEditor_ValidateBeforeCreate;
}

/// <summary>
/// Gets a value indicating whether a textbox to edit the source directory should be displayed.
/// </summary>
/// <value>
/// <c>true</c> if a textbox to edit the source directory should be displayed; otherwise, <c>false</c>.
/// </value>
public override bool DisplaySourceDirectory { get { return true; } }

/// <summary>
/// Handles the ValidateBeforeCreate event of the NUnitActionEditor control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Inedo.BuildMaster.Web.Controls.Extensions.ValidationEventArgs&lt;Inedo.BuildMaster.Extensibility.Actions.ActionBase&gt;"/> instance containing the event data.</param>
private void NUnitActionEditor_ValidateBeforeCreate(object sender, ValidationEventArgs<ActionBase> e)
{
if (this.DeployableId == 0)
{
e.ValidLevel = ValidationLevels.Error;
e.Message =
"In order to create a unit testing action, you must use an action group " +
"that has a default deployable selected. To do so, return to the Deployment " +
"Plans section and choose \"Create New Action Group,\" and select a default " +
"deployable for the new group.";
return;
}

e.ValidLevel = ValidationLevels.Valid;
}

protected override void CreateChildControls()
{
var deployable = StoredProcs
.Applications_GetDeployable(this.DeployableId)
.Execute()
.FirstOrDefault();

this.txtExePath = new SourceControlFileFolderPicker
{
Required = true,
DisplayMode = SourceControlBrowser.DisplayModes.FoldersAndFiles,
ServerId = this.ServerId
};

this.txtGroupName = new ValidatingTextBox
{
Text = deployable != null ? deployable.Deployable_Name : string.Empty,
Width= 300,
Required = true
};

this.txtTestFile = new ValidatingTextBox
{
Required = true,
Width = 300
};

this.ddlFrameworkVersion = new DropDownList();
this.ddlFrameworkVersion.Items.Add(new ListItem("2.0.50727", "2.0.50727"));
this.ddlFrameworkVersion.Items.Add(new ListItem("4.0.30319", "4.0.30319"));
this.ddlFrameworkVersion.Items.Add(new ListItem("unspecified", ""));
this.ddlFrameworkVersion.SelectedValue = "";

this.txtAdditionalArguments = new ValidatingTextBox
{
Required = false,
Width = 300
};

this.Controls.Add(
new FormFieldGroup(
"NUnit Executable Path",
"The path to (and including) nunit-console.exe.",
false,
new StandardFormField("NUnit Exe Path:", this.txtExePath)
),
new FormFieldGroup(
".NET Framework Version",
"The version of .NET which will host the unit test runner.",
false,
new StandardFormField(".NET Framework Version:", this.ddlFrameworkVersion)
),
new FormFieldGroup(
"Test File",
"The path relative to the source directory of the DLL, project file, or NUnit file to test against.",
false,
new StandardFormField("Test File:", this.txtTestFile)
),
new FormFieldGroup(
"Group Name",
"The Group name allows you to easily identify the unit test.",
false,
new StandardFormField("Group Name:", this.txtGroupName)
),
new FormFieldGroup(
"Additional Arguments",
"The additional arguments to pass to the NUnit executable.",
true,
new StandardFormField("Additional Arguments:", this.txtAdditionalArguments)
)
);
}

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.ddlFrameworkVersion.SelectedValue = nunitAction.FrameworkVersion ?? "";
this.txtAdditionalArguments.Text = nunitAction.AdditionalArguments;
}

public override ActionBase CreateFromForm()
{
return new NUnitAppAction
{
ExePath = this.txtExePath.Text,
TestFile = this.txtTestFile.Text,
GroupName = this.txtGroupName.Text,
FrameworkVersion = this.ddlFrameworkVersion.SelectedValue,
AdditionalArguments = this.txtAdditionalArguments.Text
};
}
}
}
Loading

0 comments on commit 61537d5

Please sign in to comment.