Skip to content

Commit 0d26673

Browse files
authored
Photon CI Tests (#11)
* run unit tests from photon * test where fix * test where fix * test where fix * update nunit * where fix * update framework * update framework * nunit fix * nunit fix * fuck nunit * update photon package; reimp nunit * photon final; initial release
1 parent a9c2a61 commit 0d26673

12 files changed

Lines changed: 58 additions & 31 deletions

File tree

Jenkins.NET.Publishing/Build_Windows.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public class Build_Windows : IBuildTask
1414
public async Task RunAsync(CancellationToken token)
1515
{
1616
await BuildSolution();
17-
18-
// TODO: Test
17+
await UnitTest();
1918
}
2019

2120
private async Task BuildSolution()
@@ -33,5 +32,14 @@ private async Task BuildSolution()
3332

3433
await msBuild.BuildAsync();
3534
}
35+
36+
private async Task UnitTest()
37+
{
38+
var nunit_exe = Context.AgentVariables["global"]["nunit_exe"];
39+
40+
await Context.RunCommandLineAsync($"\"{nunit_exe}\"",
41+
"\"Jenkins.NET.Tests\\bin\\Release\\Jenkins.NET.Tests.dll\"",
42+
"--where=\"cat == 'unit'\"");
43+
}
3644
}
3745
}

Jenkins.NET.Publishing/Jenkins.NET.Publishing.csproj

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,15 @@
6969
<Reference Include="NuGet.Versioning, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7070
<HintPath>..\packages\NuGet.Versioning.4.2.0\lib\net45\NuGet.Versioning.dll</HintPath>
7171
</Reference>
72-
<Reference Include="Photon.Framework, Version=0.0.41.0, Culture=neutral, processorArchitecture=MSIL">
73-
<HintPath>..\packages\Photon.Framework.0.0.41\lib\net46\Photon.Framework.dll</HintPath>
72+
<Reference Include="Photon.Framework, Version=0.0.46.0, Culture=neutral, processorArchitecture=MSIL">
73+
<HintPath>..\packages\Photon.Framework.0.0.46\lib\net46\Photon.Framework.dll</HintPath>
7474
</Reference>
75-
<Reference Include="Photon.NuGet, Version=0.0.6.0, Culture=neutral, processorArchitecture=MSIL">
76-
<HintPath>..\packages\Photon.NuGet.0.0.6\lib\net46\Photon.NuGet.dll</HintPath>
75+
<Reference Include="Photon.NuGet, Version=0.0.9.0, Culture=neutral, processorArchitecture=MSIL">
76+
<HintPath>..\packages\Photon.NuGet.0.0.9\lib\net46\Photon.NuGet.dll</HintPath>
7777
</Reference>
7878
<Reference Include="System" />
7979
<Reference Include="System.Core" />
80-
<Reference Include="System.IdentityModel" />
8180
<Reference Include="System.IO.Compression" />
82-
<Reference Include="System.Net.Http.WebRequest" />
83-
<Reference Include="System.Runtime.Serialization" />
84-
<Reference Include="System.Security" />
85-
<Reference Include="System.ServiceModel" />
86-
<Reference Include="System.Xml.Linq" />
87-
<Reference Include="System.Data.DataSetExtensions" />
88-
<Reference Include="Microsoft.CSharp" />
89-
<Reference Include="System.Data" />
90-
<Reference Include="System.Net.Http" />
91-
<Reference Include="System.Xml" />
9281
<Reference Include="WindowsBase" />
9382
</ItemGroup>
9483
<ItemGroup>

Jenkins.NET.Publishing/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<package id="NuGet.Protocol.Core.v2" version="3.5.0" targetFramework="net46" />
1414
<package id="NuGet.Protocol.Core.v3" version="4.2.0" targetFramework="net46" />
1515
<package id="NuGet.Versioning" version="4.2.0" targetFramework="net46" />
16-
<package id="Photon.Framework" version="0.0.41" targetFramework="net46" />
17-
<package id="Photon.NuGet" version="0.0.6" targetFramework="net46" />
16+
<package id="Photon.Framework" version="0.0.46" targetFramework="net46" />
17+
<package id="Photon.NuGet" version="0.0.9" targetFramework="net46" />
1818
</packages>

Jenkins.NET.Tests/IntegrationTests/ClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace JenkinsNET.Tests.IntegrationTests
88
{
9-
[TestFixture, Category("integration")]
9+
[IntegrationTestFixture]
1010
public class ClientTests
1111
{
1212
private const string jobName = "Test Job";

Jenkins.NET.Tests/IntegrationTests/CrumbTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace JenkinsNET.Tests.IntegrationTests
88
{
9-
[TestFixture, Explicit, Category("integration")]
9+
[IntegrationTestFixture, Explicit]
1010
public class CrumbTests
1111
{
1212
[Test]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using NUnit.Framework;
2+
3+
namespace JenkinsNET.Tests.Internal
4+
{
5+
internal class IntegrationTestFixtureAttribute : CategoryAttribute
6+
{
7+
public IntegrationTestFixtureAttribute() : base("integration") {}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using NUnit.Framework;
2+
3+
namespace JenkinsNET.Tests.Internal
4+
{
5+
internal class UnitTestFixtureAttribute : CategoryAttribute
6+
{
7+
public UnitTestFixtureAttribute() : base("unit") {}
8+
}
9+
}

Jenkins.NET.Tests/Jenkins.NET.Tests.csproj

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\NUnit.3.10.1\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,6 +13,8 @@
1213
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1314
<FileAlignment>512</FileAlignment>
1415
<TargetFrameworkProfile />
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
1518
</PropertyGroup>
1619
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1720
<DebugSymbols>true</DebugSymbols>
@@ -33,9 +36,8 @@
3336
<Prefer32Bit>false</Prefer32Bit>
3437
</PropertyGroup>
3538
<ItemGroup>
36-
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
37-
<HintPath>..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
38-
<Private>True</Private>
39+
<Reference Include="nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
40+
<HintPath>..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll</HintPath>
3941
</Reference>
4042
<Reference Include="System" />
4143
<Reference Include="System.Core" />
@@ -50,6 +52,8 @@
5052
<Compile Include="IntegrationTests\CrumbTests.cs" />
5153
<Compile Include="Internal\DefaultClient.cs" />
5254
<Compile Include="Internal\DefaultRunner.cs" />
55+
<Compile Include="Internal\IntegrationTestFixtureAttribute.cs" />
56+
<Compile Include="Internal\UnitTestFixtureAttribute.cs" />
5357
<Compile Include="Properties\AssemblyInfo.cs" />
5458
<Compile Include="UnitTests\NetPathTests.cs" />
5559
<Compile Include="UnitTests\StringCastTests.cs" />
@@ -61,12 +65,18 @@
6165
</ProjectReference>
6266
</ItemGroup>
6367
<ItemGroup>
64-
<None Include="packages.config" />
68+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
6569
</ItemGroup>
6670
<ItemGroup>
67-
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
71+
<None Include="packages.config" />
6872
</ItemGroup>
6973
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
74+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
75+
<PropertyGroup>
76+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
77+
</PropertyGroup>
78+
<Error Condition="!Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.10.1\build\NUnit.props'))" />
79+
</Target>
7080
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7181
Other similar extension points exist, see Microsoft.Common.targets.
7282
<Target Name="BeforeBuild">

Jenkins.NET.Tests/UnitTests/NetPathTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using JenkinsNET.Internal;
2+
using JenkinsNET.Tests.Internal;
23
using NUnit.Framework;
34

45
namespace JenkinsNET.Tests.UnitTests
56
{
6-
[TestFixture, Category("unit")]
7+
[UnitTestFixture]
78
public class NetPathTests
89
{
910
[Test]

Jenkins.NET.Tests/UnitTests/StringCastTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using JenkinsNET.Internal;
2+
using JenkinsNET.Tests.Internal;
23
using NUnit.Framework;
34

45
namespace JenkinsNET.Tests.UnitTests
56
{
6-
[TestFixture, Category("unit")]
7+
[UnitTestFixture]
78
public class StringCastTests
89
{
910
[Test]

0 commit comments

Comments
 (0)