Skip to content
This repository was archived by the owner on Feb 12, 2019. It is now read-only.

Commit 294c190

Browse files
committed
get test occurrences by build id
1 parent 6a0dfad commit 294c190

File tree

6 files changed

+75
-0
lines changed

6 files changed

+75
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Collections.Generic;
2+
using TeamCitySharp.DomainEntities;
3+
4+
namespace TeamCitySharp.ActionTypes
5+
{
6+
public interface ITestOccurrences
7+
{
8+
List<TestOccurrence> ByBuildId(string buildId, int count);
9+
}
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using TeamCitySharp.Connection;
6+
using TeamCitySharp.DomainEntities;
7+
8+
namespace TeamCitySharp.ActionTypes
9+
{
10+
internal class TestOccurrences : ITestOccurrences
11+
{
12+
private readonly TeamCityCaller _caller;
13+
14+
internal TestOccurrences(TeamCityCaller caller)
15+
{
16+
_caller = caller;
17+
}
18+
19+
public List<TestOccurrence> ByBuildId(string buildId, int count)
20+
{
21+
var testOccurenceWrapper = _caller.GetFormat<TestOccurrenceWrapper>("/app/rest/testOccurrences?locator=build:{0},count:{1}", buildId, count);
22+
23+
return testOccurenceWrapper.TestOccurrence;
24+
}
25+
}
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace TeamCitySharp.DomainEntities
7+
{
8+
public class TestOccurrence
9+
{
10+
public string Name { get; set; }
11+
public string Status { get; set; }
12+
public int Duration { get; set; }
13+
public bool Muted { get; set; }
14+
public bool Ignored { get; set; }
15+
public string Href { get; set; }
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace TeamCitySharp.DomainEntities
7+
{
8+
public class TestOccurrenceWrapper
9+
{
10+
public List<TestOccurrence> TestOccurrence { get; set; }
11+
}
12+
}

src/TeamCitySharp/TeamCityClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class TeamCityClient : IClientConnection, ITeamCityClient
1515
private IVcsRoots _vcsRoots;
1616
private IChanges _changes;
1717
private IBuildArtifacts _artifacts;
18+
private ITestOccurrences _testOccurrences;
1819

1920
public TeamCityClient(string hostName, bool useSsl = false)
2021
{
@@ -80,5 +81,10 @@ public IBuildArtifacts Artifacts
8081
{
8182
get { return _artifacts ?? (_artifacts = new BuildArtifacts(_caller)); }
8283
}
84+
85+
public ITestOccurrences TestOccurrences
86+
{
87+
get { return _testOccurrences ?? (_testOccurrences = new TestOccurrences(_caller)); }
88+
}
8389
}
8490
}

src/TeamCitySharp/TeamCitySharp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,15 @@
6363
<Compile Include="ActionTypes\IChanges.cs" />
6464
<Compile Include="ActionTypes\IProjects.cs" />
6565
<Compile Include="ActionTypes\IServerInformation.cs" />
66+
<Compile Include="ActionTypes\ITestOccurrences.cs" />
6667
<Compile Include="ActionTypes\IUsers.cs" />
6768
<Compile Include="ActionTypes\IVcsRoots.cs" />
6869
<Compile Include="ActionTypes\Projects.cs" />
6970
<Compile Include="ActionTypes\ServerInformation.cs" />
71+
<Compile Include="ActionTypes\TestOccurrences.cs" />
7072
<Compile Include="Connection\ITeamCityCaller.cs" />
73+
<Compile Include="DomainEntities\TestOccurrence.cs" />
74+
<Compile Include="DomainEntities\TestOccurrenceWrapper.cs" />
7175
<Compile Include="Locators\ChangeLocator.cs" />
7276
<Compile Include="TeamCityClient.cs" />
7377
<Compile Include="ActionTypes\Users.cs" />

0 commit comments

Comments
 (0)