Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Started playing around with building some meta-structures for vNext (…

…proof of concept only).
  • Loading branch information...
commit 7cddd2590345f2fb182fda7231f45aa2a36528d8 1 parent 5e43fce
@csut017 csut017 authored
Showing with 1,373 additions and 1 deletion.
  1. +16 −0 Playground/CCNet-Playground.sln
  2. +157 −0 Playground/CruiseControl.Core.Tests/Configuration/ExampleTests.cs
  3. +10 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/PipelineWithGates.xaml
  4. +12 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/QueueOfQueues.xaml
  5. +12 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/RoundRobinOfQueues.xaml
  6. +6 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimpleGate.xaml
  7. +6 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimplePipeline.xaml
  8. +6 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimpleQueue.xaml
  9. +7 −0 Playground/CruiseControl.Core.Tests/Configuration/Examples/SingleProject.xaml
  10. +102 −0 Playground/CruiseControl.Core.Tests/CruiseControl.Core.Tests.csproj
  11. +87 −0 Playground/CruiseControl.Core.Tests/IntegrationContextTests.cs
  12. +93 −0 Playground/CruiseControl.Core.Tests/ProjectTests.cs
  13. +36 −0 Playground/CruiseControl.Core.Tests/Properties/AssemblyInfo.cs
  14. +68 −0 Playground/CruiseControl.Core/CruiseControl.Core.csproj
  15. +112 −0 Playground/CruiseControl.Core/IntegrationContext.cs
  16. +99 −0 Playground/CruiseControl.Core/Project.cs
  17. +21 −0 Playground/CruiseControl.Core/Properties/AssemblyInfo.cs
  18. +41 −0 Playground/CruiseControl.Core/Server.cs
  19. +46 −0 Playground/CruiseControl.Core/ServerItem.cs
  20. +17 −0 Playground/CruiseControl.Core/ServerItemContainer.cs
  21. +43 −0 Playground/CruiseControl.Core/Structure/Gate.cs
  22. +43 −0 Playground/CruiseControl.Core/Structure/Pipeline.cs
  23. +53 −0 Playground/CruiseControl.Core/Structure/Queue.cs
  24. +53 −0 Playground/CruiseControl.Core/Structure/RoundRobin.cs
  25. +41 −0 Playground/CruiseControl.Core/Structure/ServerItemContainerBase.cs
  26. +61 −0 Playground/CruiseControl.Core/Task.cs
  27. +63 −0 Playground/CruiseControl.Core/Tasks/Comment.cs
  28. +60 −0 Playground/CruiseControl.Core/VersionTypeConverter.cs
  29. +1 −1  Playground/CruiseControl.Web.Tests/CruiseControl.Web.Tests.csproj
  30. +1 −0  Playground/CruiseControl.nunit
View
16 Playground/CCNet-Playground.sln
@@ -5,6 +5,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CruiseControl.Web", "Cruise
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CruiseControl.Web.Tests", "CruiseControl.Web.Tests\CruiseControl.Web.Tests.csproj", "{D48E9C6A-8BD8-4A8B-8916-A526642F7C98}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CruiseControl.Core", "CruiseControl.Core\CruiseControl.Core.csproj", "{74405CD5-BD3D-4912-A465-F929FA20220B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CruiseControl.Core.Tests", "CruiseControl.Core.Tests\CruiseControl.Core.Tests.csproj", "{94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +31,18 @@ Global
{D48E9C6A-8BD8-4A8B-8916-A526642F7C98}.Release|Any CPU.ActiveCfg = Release|x86
{D48E9C6A-8BD8-4A8B-8916-A526642F7C98}.Release|x86.ActiveCfg = Release|x86
{D48E9C6A-8BD8-4A8B-8916-A526642F7C98}.Release|x86.Build.0 = Release|x86
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {74405CD5-BD3D-4912-A465-F929FA20220B}.Release|x86.ActiveCfg = Release|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
157 Playground/CruiseControl.Core.Tests/Configuration/ExampleTests.cs
@@ -0,0 +1,157 @@
+namespace CruiseControl.Core.Tests.Configuration
+{
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Xaml;
+ using CruiseControl.Core;
+ using CruiseControl.Core.Structure;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class ExampleTests
+ {
+ [Test]
+ public void SingleProject()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("SingleProject"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ this.VerifyChildren(
+ configuration.Children,
+ new Project("TestProject"));
+ }
+
+ [Test]
+ public void SimpleQueue()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("SimpleQueue"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ this.VerifyChildren(
+ configuration.Children,
+ new Queue("Queue1", new Project("Project1"), new Project("Project2")));
+ }
+
+ [Test]
+ public void SimpleGate()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("SimpleGate"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ this.VerifyChildren(
+ configuration.Children,
+ new Gate("Gate1", new Project("Project1"), new Project("Project2")));
+ }
+
+ [Test]
+ public void SimplePipeline()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("SimplePipeline"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ this.VerifyChildren(
+ configuration.Children,
+ new Pipeline("Pipeline1", new Project("Project1"), new Project("Project2")));
+ }
+
+ [Test]
+ public void PipelineWithGates()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("PipelineWithGates"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ var gate = new Gate("Gate1", new Project("Project2"), new Project("Project3"));
+ this.VerifyChildren(
+ configuration.Children,
+ new Pipeline("Pipeline1", new Project("Project1"), gate, new Project("Project4")));
+ }
+
+ [Test]
+ public void QueueOfQueues()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("QueueOfQueues"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ var queue1 = new Queue("Queue1", new Project("Project1"), new Project("Project2"));
+ var queue2 = new Queue("Queue2", new Project("Project3"), new Project("Project4"));
+ this.VerifyChildren(
+ configuration.Children,
+ new Queue("Queue3", queue1, queue2));
+ }
+
+ [Test]
+ public void RoundRobinOfQueues()
+ {
+ Server configuration;
+ using (var stream = this.RetrieveExampleFile("RoundRobinOfQueues"))
+ {
+ configuration = XamlServices.Load(stream) as Server;
+ }
+
+ Assert.IsNotNull(configuration);
+ Assert.AreEqual("2.0", configuration.Version.ToString(2));
+ var queue1 = new Queue("Queue1", new Project("Project1"), new Project("Project2"));
+ var queue2 = new Queue("Queue2", new Project("Project3"), new Project("Project4"));
+ this.VerifyChildren(
+ configuration.Children,
+ new RoundRobin("RoundRobin", queue1, queue2));
+ }
+
+ private Stream RetrieveExampleFile(string exampleName)
+ {
+ var assembly = typeof(ExampleTests).Assembly;
+ var streamName = "CruiseControl.Core.Tests.Configuration.Examples." +
+ exampleName +
+ ".xaml";
+ var stream = assembly.GetManifestResourceStream(streamName);
+ return stream;
+ }
+
+ private void VerifyChildren(IList<ServerItem> actual, params ServerItem[] expected)
+ {
+ Assert.AreEqual(expected.Length, actual.Count);
+ for (var loop = 0; loop < actual.Count && loop < expected.Length; loop++)
+ {
+ Assert.AreEqual(expected[loop].Name, actual[loop].Name, "Names do not match for item #" + loop);
+ var container = expected[loop] as IServerItemContainer;
+ if (container != null)
+ {
+ this.VerifyChildren(
+ (actual[loop] as IServerItemContainer).Children,
+ container.Children.ToArray());
+ }
+ }
+ }
+ }
+}
View
10 Playground/CruiseControl.Core.Tests/Configuration/Examples/PipelineWithGates.xaml
@@ -0,0 +1,10 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <Pipeline Name="Pipeline1">
+ <Project Name="Project1" />
+ <Gate Name="Gate1">
+ <Project Name="Project2" />
+ <Project Name="Project3" />
+ </Gate>
+ <Project Name="Project4" />
+ </Pipeline>
+</Server>
View
12 Playground/CruiseControl.Core.Tests/Configuration/Examples/QueueOfQueues.xaml
@@ -0,0 +1,12 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <Queue Name="Queue3" AllowedActive="2">
+ <Queue Name="Queue1">
+ <Project Name="Project1" />
+ <Project Name="Project2" />
+ </Queue>
+ <Queue Name="Queue2">
+ <Project Name="Project3" />
+ <Project Name="Project4" />
+ </Queue>
+ </Queue>
+</Server>
View
12 Playground/CruiseControl.Core.Tests/Configuration/Examples/RoundRobinOfQueues.xaml
@@ -0,0 +1,12 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <RoundRobin Name="RoundRobin" AllowedActive="2">
+ <Queue Name="Queue1">
+ <Project Name="Project1" />
+ <Project Name="Project2" />
+ </Queue>
+ <Queue Name="Queue2">
+ <Project Name="Project3" />
+ <Project Name="Project4" />
+ </Queue>
+ </RoundRobin>
+</Server>
View
6 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimpleGate.xaml
@@ -0,0 +1,6 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <Gate Name="Gate1">
+ <Project Name="Project1" />
+ <Project Name="Project2" />
+ </Gate>
+</Server>
View
6 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimplePipeline.xaml
@@ -0,0 +1,6 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <Pipeline Name="Pipeline1">
+ <Project Name="Project1" />
+ <Project Name="Project2" />
+ </Pipeline>
+</Server>
View
6 Playground/CruiseControl.Core.Tests/Configuration/Examples/SimpleQueue.xaml
@@ -0,0 +1,6 @@
+<Server xmlns="urn:cruisecontrol:server" Version="2.0">
+ <Queue Name="Queue1">
+ <Project Name="Project1" />
+ <Project Name="Project2" />
+ </Queue>
+</Server>
View
7 Playground/CruiseControl.Core.Tests/Configuration/Examples/SingleProject.xaml
@@ -0,0 +1,7 @@
+<Server Version="2.0"
+ xmlns="urn:cruisecontrol:server"
+ xmlns:tasks="urn:cruisecontrol:server:tasks">
+ <Project Name="TestProject">
+ <tasks:Comment>A Test Comment</tasks:Comment>
+ </Project>
+</Server>
View
102 Playground/CruiseControl.Core.Tests/CruiseControl.Core.Tests.csproj
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{94D3A1D1-6368-4BFD-9D2B-8AA93FE6C7CB}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CruiseControl.Core.Tests</RootNamespace>
+ <AssemblyName>CruiseControl.Core.Tests</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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>
+ </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>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Moq">
+ <HintPath>..\Lib\Testing\Moq.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.5.8.10295, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xaml" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Configuration\ExampleTests.cs" />
+ <Compile Include="IntegrationContextTests.cs" />
+ <Compile Include="ProjectTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CruiseControl.Core\CruiseControl.Core.csproj">
+ <Project>{74405CD5-BD3D-4912-A465-F929FA20220B}</Project>
+ <Name>CruiseControl.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\SingleProject.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\SimpleQueue.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\QueueOfQueues.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\RoundRobinOfQueues.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\SimplePipeline.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\SimpleGate.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Configuration\Examples\PipelineWithGates.xaml">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\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>
+ -->
+</Project>
View
87 Playground/CruiseControl.Core.Tests/IntegrationContextTests.cs
@@ -0,0 +1,87 @@
+namespace CruiseControl.Core.Tests
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using NUnit.Framework;
+ using System.Threading;
+
+ [TestFixture]
+ public class IntegrationContextTests
+ {
+ #region Tests
+ [Test]
+ public void ConstructorSetsProject()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ Assert.AreSame(project, context.Item);
+ }
+
+ [Test]
+ public void WaitWillTimeoutIfNotReleased()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ context.Lock();
+ var released = context.Wait(TimeSpan.FromMilliseconds(5));
+ Assert.IsFalse(released);
+ Assert.IsFalse(context.WasCancelled);
+ }
+
+ [Test]
+ public void WaitWillContinueIfNotLocked()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ var released = context.Wait(TimeSpan.FromMilliseconds(5));
+ Assert.IsTrue(released);
+ }
+
+ [Test]
+ public void WaitWillContinueWhenReleased()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ var releaseThread = new Thread(o =>
+ {
+ Thread.Sleep(TimeSpan.FromSeconds(1));
+ context.Release();
+ });
+ releaseThread.Start();
+ context.Lock();
+ var released = context.Wait(TimeSpan.FromSeconds(5));
+ Assert.IsTrue(released);
+ }
+
+ [Test]
+ public void CompletedIsFiredOnComplete()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ var wasFired = false;
+ context.Completed += (o, e) => wasFired = true;
+ context.Complete();
+ Assert.IsTrue(wasFired);
+ }
+
+ [Test]
+ public void CancelWillReleaseALock()
+ {
+ var project = new Project();
+ var context = new IntegrationContext(project);
+ var releaseThread = new Thread(o =>
+ {
+ Thread.Sleep(TimeSpan.FromSeconds(1));
+ context.Cancel();
+ });
+ releaseThread.Start();
+ context.Lock();
+ var released = context.Wait(TimeSpan.FromSeconds(5));
+ Assert.IsFalse(released);
+ Assert.IsTrue(context.WasCancelled);
+ }
+ #endregion
+ }
+}
View
93 Playground/CruiseControl.Core.Tests/ProjectTests.cs
@@ -0,0 +1,93 @@
+namespace CruiseControl.Core.Tests
+{
+ using CruiseControl.Core.Tasks;
+ using NUnit.Framework;
+ using Moq;
+ using System.Diagnostics;
+using System;
+
+ public class ProjectTests
+ {
+ #region Tests
+ [Test]
+ public void ConstructorSetsNameAndTasks()
+ {
+ var name = "TestProject";
+ var task = new Comment();
+ var project = new Project(name, task);
+ Assert.AreEqual(name, project.Name);
+ Assert.AreEqual(1, project.Tasks.Count);
+ Assert.AreSame(task, project.Tasks[0]);
+ }
+
+ [Test]
+ public void TriggerWillStartAnIntegrationWithNoHost()
+ {
+ var wasStarted = false;
+ var project = new ProjectStub
+ {
+ OnIntegration = ic => wasStarted = true
+ };
+ project.Trigger();
+
+ Assert.IsTrue(wasStarted);
+ }
+
+ [Test]
+ public void TriggerWillAskHostToStartAnIntegration()
+ {
+ var hostMock = new Mock<ServerItem>(MockBehavior.Strict);
+ hostMock.Setup(h => h.AskToIntegrate(It.IsAny<IntegrationContext>()))
+ .Verifiable();
+ var wasStarted = false;
+ var project = new ProjectStub
+ {
+ OnIntegration = ic => wasStarted = true,
+ Host = hostMock.Object
+ };
+ project.Trigger();
+
+ Assert.IsTrue(wasStarted);
+ hostMock.Verify();
+ }
+
+ [Test]
+ public void TriggerWillNotIntegrateIfHostCancels()
+ {
+ var hostMock = new Mock<ServerItem>(MockBehavior.Strict);
+ hostMock.Setup(h => h.AskToIntegrate(It.IsAny<IntegrationContext>()))
+ .Callback((IntegrationContext ic) => ic.Cancel())
+ .Verifiable();
+ var wasStarted = false;
+ var project = new ProjectStub
+ {
+ OnIntegration = ic => wasStarted = true,
+ Host = hostMock.Object
+ };
+ project.Trigger();
+
+ Assert.IsFalse(wasStarted);
+ hostMock.Verify();
+ }
+ #endregion
+
+ #region Private classes
+ private class ProjectStub
+ : Project
+ {
+ public Action<IntegrationContext> OnIntegration { get; set; }
+ public override void Integrate(IntegrationContext context)
+ {
+ if (this.OnIntegration != null)
+ {
+ this.OnIntegration(context);
+ }
+ else
+ {
+ base.Integrate(context);
+ }
+ }
+ }
+ #endregion
+ }
+}
View
36 Playground/CruiseControl.Core.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("CruiseControl.Core.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("CruiseControl.Core.Tests")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6f2d9d64-50ed-4e49-a2c1-4b20d7c61dc2")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
68 Playground/CruiseControl.Core/CruiseControl.Core.csproj
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{74405CD5-BD3D-4912-A465-F929FA20220B}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CruiseControl.Core</RootNamespace>
+ <AssemblyName>CruiseControl.Core</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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>
+ </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>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xaml" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IntegrationContext.cs" />
+ <Compile Include="Project.cs" />
+ <Compile Include="Server.cs" />
+ <Compile Include="ServerItem.cs" />
+ <Compile Include="ServerItemContainer.cs" />
+ <Compile Include="Structure\Gate.cs" />
+ <Compile Include="Task.cs" />
+ <Compile Include="VersionTypeConverter.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Structure\Pipeline.cs" />
+ <Compile Include="Structure\Queue.cs" />
+ <Compile Include="Structure\RoundRobin.cs" />
+ <Compile Include="Structure\ServerItemContainerBase.cs" />
+ <Compile Include="Tasks\Comment.cs" />
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildToolsPath)\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>
+ -->
+</Project>
View
112 Playground/CruiseControl.Core/IntegrationContext.cs
@@ -0,0 +1,112 @@
+namespace CruiseControl.Core
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+using System.Threading;
+
+ public class IntegrationContext
+ {
+ #region Private fields
+ private readonly ManualResetEvent eventHandle = new ManualResetEvent(true);
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="IntegrationContext"/> class.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ public IntegrationContext(ServerItem item)
+ {
+ this.Item = item;
+ }
+ #endregion
+
+ #region Public properties
+ #region Item
+ /// <summary>
+ /// Gets or sets the item.
+ /// </summary>
+ /// <value>The item.</value>
+ public ServerItem Item { get; private set; }
+ #endregion
+
+ #region WasCancelled
+ /// <summary>
+ /// Gets or sets a value indicating whether this context was cancelled.
+ /// </summary>
+ /// <value><c>true</c> if context was cancelled; otherwise, <c>false</c>.</value>
+ public bool WasCancelled { get; private set; }
+ #endregion
+ #endregion
+
+ #region Public events
+ #region Completed
+ /// <summary>
+ /// Occurs when this context has been completed.
+ /// </summary>
+ public event EventHandler Completed;
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region Lock()
+ /// <summary>
+ /// Locks this context to prevent a thread from continuing.
+ /// </summary>
+ public void Lock()
+ {
+ this.eventHandle.Reset();
+ }
+ #endregion
+
+ #region Release()
+ /// <summary>
+ /// Releases any locks.
+ /// </summary>
+ public void Release()
+ {
+ this.eventHandle.Set();
+ }
+ #endregion
+
+ #region Wait()
+ /// <summary>
+ /// Waits for the context to be unlocked.
+ /// </summary>
+ /// <param name="timeout">A timeout period.</param>
+ /// <returns><c>true</c> if the context was unlocked; <c>false</c> otherwise.</returns>
+ public bool Wait(TimeSpan timeout)
+ {
+ var wasSignaled = this.eventHandle.WaitOne(timeout);
+ return wasSignaled && !this.WasCancelled;
+ }
+ #endregion
+
+ #region Cancel()
+ /// <summary>
+ /// Cancels this instance.
+ /// </summary>
+ public void Cancel()
+ {
+ this.WasCancelled = true;
+ this.Release();
+ }
+ #endregion
+
+ #region Complete()
+ /// <summary>
+ /// Marks this context as completed.
+ /// </summary>
+ public void Complete()
+ {
+ if (this.Completed != null)
+ {
+ this.Completed(this, EventArgs.Empty);
+ }
+ }
+ #endregion
+ #endregion
+ }
+}
View
99 Playground/CruiseControl.Core/Project.cs
@@ -0,0 +1,99 @@
+namespace CruiseControl.Core
+{
+ using System.Windows.Markup;
+ using System.Collections.Generic;
+ using System;
+
+ /// <summary>
+ /// A project.
+ /// </summary>
+ [ContentProperty("Tasks")]
+ public class Project
+ : ServerItem
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Project"/> class.
+ /// </summary>
+ public Project()
+ {
+ this.Tasks = new List<Task>();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Project"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ public Project(string name, params Task[] tasks)
+ : base(name)
+ {
+ this.Tasks = new List<Task>(tasks);
+ }
+ #endregion
+
+ #region Public properties
+ #region Tasks
+ /// <summary>
+ /// Gets or sets the tasks.
+ /// </summary>
+ /// <value>The tasks.</value>
+ public IList<Task> Tasks { get; private set; }
+ #endregion
+
+ #region Host
+ /// <summary>
+ /// Gets or sets the host for the project.
+ /// </summary>
+ /// <value>The host.</value>
+ public ServerItem Host { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region Trigger()
+ /// <summary>
+ /// Triggers an integration.
+ /// </summary>
+ public virtual void Trigger()
+ {
+ var integrate = this.Host == null;
+ var context = new IntegrationContext(this);
+ if (!integrate)
+ {
+ this.Host.AskToIntegrate(context);
+
+ // TODO: Make the timeout period configurable
+ integrate = context.Wait(TimeSpan.FromDays(1));
+ }
+
+ if (integrate)
+ {
+ this.Integrate(context);
+ }
+ }
+ #endregion
+
+ #region Integrate()
+ /// <summary>
+ /// Performs an integration.
+ /// </summary>
+ /// <param name="context">The context.</param>
+ public virtual void Integrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public override void AskToIntegrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ #endregion
+ }
+}
View
21 Playground/CruiseControl.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows.Markup;
+
+[assembly: AssemblyTitle("CruiseControl.Core")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("CruiseControl.Core")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("4fc131f0-73aa-4661-97a2-6faa3fab134b")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: XmlnsDefinition("urn:cruisecontrol:server", "CruiseControl.Core")]
+[assembly: XmlnsDefinition("urn:cruisecontrol:server", "CruiseControl.Core.Structure")]
+[assembly: XmlnsDefinition("urn:cruisecontrol:server:tasks", "CruiseControl.Core.Tasks")]
+[assembly: XmlnsPrefix("urn:cruisecontrol:server:tasks", "tasks")]
View
41 Playground/CruiseControl.Core/Server.cs
@@ -0,0 +1,41 @@
+namespace CruiseControl.Core
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+ using System;
+ using System.ComponentModel;
+
+ [ContentProperty("Children")]
+ public class Server
+ : IServerItemContainer
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Server"/> class.
+ /// </summary>
+ public Server()
+ {
+ this.Children = new List<ServerItem>();
+ }
+ #endregion
+
+ #region Public properties
+ #region Version
+ /// <summary>
+ /// Gets or sets the configuration version.
+ /// </summary>
+ /// <value>The version.</value>
+ [TypeConverter(typeof(VersionTypeConverter))]
+ public Version Version { get; set; }
+ #endregion
+
+ #region Children
+ /// <summary>
+ /// Gets or sets the children.
+ /// </summary>
+ /// <value>The children.</value>
+ public IList<ServerItem> Children { get; private set; }
+ #endregion
+ #endregion
+ }
+}
View
46 Playground/CruiseControl.Core/ServerItem.cs
@@ -0,0 +1,46 @@
+namespace CruiseControl.Core
+{
+ /// <summary>
+ /// An item for the server.
+ /// </summary>
+ public abstract class ServerItem
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ServerItem"/> class.
+ /// </summary>
+ protected ServerItem()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ServerItem"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ protected ServerItem(string name)
+ {
+ this.Name = name;
+ }
+ #endregion
+
+ #region Public properties
+ #region Name
+ /// <summary>
+ /// Gets or sets the name of the item.
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public abstract void AskToIntegrate(IntegrationContext context);
+ #endregion
+ #endregion
+ }
+}
View
17 Playground/CruiseControl.Core/ServerItemContainer.cs
@@ -0,0 +1,17 @@
+namespace CruiseControl.Core
+{
+ using System.Collections.Generic;
+
+ public interface IServerItemContainer
+ {
+ #region Public properties
+ #region Children
+ /// <summary>
+ /// Gets the children.
+ /// </summary>
+ /// <value>The children.</value>
+ IList<ServerItem> Children { get; }
+ #endregion
+ #endregion
+ }
+}
View
43 Playground/CruiseControl.Core/Structure/Gate.cs
@@ -0,0 +1,43 @@
+namespace CruiseControl.Core.Structure
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+ using System;
+
+ public class Gate
+ : ServerItemContainerBase
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Gate"/> class.
+ /// </summary>
+ public Gate()
+ : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Gate"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="children">The children.</param>
+ public Gate(string name, params ServerItem[] children)
+ : base(name, children)
+ {
+ }
+ #endregion
+
+ #region Public methods
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public override void AskToIntegrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ #endregion
+ }
+}
View
43 Playground/CruiseControl.Core/Structure/Pipeline.cs
@@ -0,0 +1,43 @@
+namespace CruiseControl.Core.Structure
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+ using System;
+
+ public class Pipeline
+ : ServerItemContainerBase
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Pipeline"/> class.
+ /// </summary>
+ public Pipeline()
+ : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Pipeline"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="children">The children.</param>
+ public Pipeline(string name, params ServerItem[] children)
+ : base(name, children)
+ {
+ }
+ #endregion
+
+ #region Public methods
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public override void AskToIntegrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ #endregion
+ }
+}
View
53 Playground/CruiseControl.Core/Structure/Queue.cs
@@ -0,0 +1,53 @@
+namespace CruiseControl.Core.Structure
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+ using System;
+
+ public class Queue
+ : ServerItemContainerBase
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Queue"/> class.
+ /// </summary>
+ public Queue()
+ : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Queue"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="children">The children.</param>
+ public Queue(string name, params ServerItem[] children)
+ : base(name, children)
+ {
+ }
+ #endregion
+
+ #region Public properties
+ #region AllowedActive
+ /// <summary>
+ /// Gets or sets the number of allowed active children.
+ /// </summary>
+ /// <value>The allowed active.</value>
+ public int? AllowedActive { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public override void AskToIntegrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ #endregion
+ }
+}
View
53 Playground/CruiseControl.Core/Structure/RoundRobin.cs
@@ -0,0 +1,53 @@
+namespace CruiseControl.Core.Structure
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+ using System;
+
+ public class RoundRobin
+ : ServerItemContainerBase
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RoundRobin"/> class.
+ /// </summary>
+ public RoundRobin()
+ : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RoundRobin"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="children">The children.</param>
+ public RoundRobin(string name, params ServerItem[] children)
+ : base(name, children)
+ {
+ }
+ #endregion
+
+ #region Public properties
+ #region AllowedActive
+ /// <summary>
+ /// Gets or sets the number of allowed active children.
+ /// </summary>
+ /// <value>The allowed active.</value>
+ public int? AllowedActive { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region AskToIntegrate()
+ /// <summary>
+ /// Asks if an item can integrate.
+ /// </summary>
+ /// <param name="context">The context to use.</param>
+ public override void AskToIntegrate(IntegrationContext context)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ #endregion
+ }
+}
View
41 Playground/CruiseControl.Core/Structure/ServerItemContainerBase.cs
@@ -0,0 +1,41 @@
+namespace CruiseControl.Core.Structure
+{
+ using System.Collections.Generic;
+ using System.Windows.Markup;
+
+ [ContentProperty("Children")]
+ public abstract class ServerItemContainerBase
+ : ServerItem, IServerItemContainer
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ServerItemContainerBase"/> class.
+ /// </summary>
+ protected ServerItemContainerBase()
+ {
+ this.Children = new List<ServerItem>();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ServerItemContainerBase"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="children">The children.</param>
+ protected ServerItemContainerBase(string name, params ServerItem[] children)
+ : base(name)
+ {
+ this.Children = new List<ServerItem>(children);
+ }
+ #endregion
+
+ #region Public properties
+ #region Children
+ /// <summary>
+ /// Gets or sets the children.
+ /// </summary>
+ /// <value>The children.</value>
+ public IList<ServerItem> Children { get; private set; }
+ #endregion
+ #endregion
+ }
+}
View
61 Playground/CruiseControl.Core/Task.cs
@@ -0,0 +1,61 @@
+namespace CruiseControl.Core
+{
+ using System.Collections.Generic;
+
+ public abstract class Task
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Task"/> class.
+ /// </summary>
+ public Task()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Task"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ public Task(string name)
+ {
+ this.Name = name;
+ }
+ #endregion
+
+ #region Public properties
+ #region Name
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+ #endregion
+
+ #region Parent
+ /// <summary>
+ /// Gets or sets the parent task.
+ /// </summary>
+ /// <value>The parent.</value>
+ public Task Parent { get; set; }
+ #endregion
+
+ #region Project
+ /// <summary>
+ /// Gets or sets the owning project.
+ /// </summary>
+ /// <value>The project.</value>
+ public Project Project { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region Execute()
+ /// <summary>
+ /// Executes this task.
+ /// </summary>
+ /// <returns>The child tasks to execute.</returns>
+ public abstract IEnumerable<Task> Execute();
+ #endregion
+ #endregion
+ }
+}
View
63 Playground/CruiseControl.Core/Tasks/Comment.cs
@@ -0,0 +1,63 @@
+namespace CruiseControl.Core.Tasks
+{
+ using System.Windows.Markup;
+ using System.Collections.Generic;
+
+ [ContentProperty("Text")]
+ public class Comment
+ : Task
+ {
+ #region Constructors
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Comment"/> class.
+ /// </summary>
+ public Comment()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Comment"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ public Comment(string name)
+ : base(name)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Comment"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="text">The text.</param>
+ public Comment(string name, string text)
+ : base(name)
+ {
+ this.Text = text;
+ }
+ #endregion
+
+ #region Public properties
+ #region Text
+ /// <summary>
+ /// Gets or sets the text.
+ /// </summary>
+ /// <value>The text.</value>
+ public string Text { get; set; }
+ #endregion
+ #endregion
+
+ #region Public methods
+ #region Execute()
+ /// <summary>
+ /// Executes this task.
+ /// </summary>
+ /// <returns>The child tasks to execute.</returns>
+ public override IEnumerable<Task> Execute()
+ {
+ // TODO: Implement this task
+ yield break;
+ }
+ #endregion
+ #endregion
+ }
+}
View
60 Playground/CruiseControl.Core/VersionTypeConverter.cs
@@ -0,0 +1,60 @@
+namespace CruiseControl.Core
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.ComponentModel;
+ using System.Globalization;
+
+ public class VersionTypeConverter
+ : TypeConverter
+ {
+ #region Public methods
+ #region CanConvertFrom()
+ /// <summary>
+ /// Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
+ /// </summary>
+ /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param>
+ /// <param name="sourceType">A <see cref="T:System.Type"/> that represents the type you want to convert from.</param>
+ /// <returns>
+ /// true if this converter can perform the conversion; otherwise, false.
+ /// </returns>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ var canConvert = sourceType == typeof(string) ?
+ true :
+ base.CanConvertFrom(context, sourceType);
+ return canConvert;
+ }
+ #endregion
+
+ #region ConvertFrom()
+ /// <summary>
+ /// Converts the given object to the type of this converter, using the specified context and culture information.
+ /// </summary>
+ /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param>
+ /// <param name="culture">The <see cref="T:System.Globalization.CultureInfo"/> to use as the current culture.</param>
+ /// <param name="value">The <see cref="T:System.Object"/> to convert.</param>
+ /// <returns>
+ /// An <see cref="T:System.Object"/> that represents the converted value.
+ /// </returns>
+ /// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception>
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if (value == null)
+ {
+ return new Version();
+ }
+
+ if (value is string)
+ {
+ return new Version((string)value);
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+ #endregion
+ #endregion
+ }
+}
View
2  Playground/CruiseControl.Web.Tests/CruiseControl.Web.Tests.csproj
@@ -89,6 +89,7 @@
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Routing" />
+ <Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -110,7 +111,6 @@
<Name>CruiseControl.Web</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
<Import Project="$(MSBuildToolsPath)\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.
View
1  Playground/CruiseControl.nunit
@@ -2,6 +2,7 @@
<Settings activeconfig="Debug" />
<Config name="Debug" binpathtype="Auto">
<assembly path="CruiseControl.Web.Tests\bin\Debug\CruiseControl.Web.Tests.dll" />
+ <assembly path="CruiseControl.Core.Tests\bin\Debug\CruiseControl.Core.Tests.dll" />
</Config>
<Config name="Release" binpathtype="Auto" />
</NUnitProject>
Please sign in to comment.
Something went wrong with that request. Please try again.