From 25b57756df686a65ff88e6e3d571c0f4965c995f Mon Sep 17 00:00:00 2001 From: Derek Gates Date: Tue, 12 Aug 2014 16:39:58 -0500 Subject: [PATCH 1/5] Add system.web reference to fix compilation. --- packages/repositories.config | 1 + src/TeamCitySharp/TeamCitySharp.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/repositories.config b/packages/repositories.config index bcd17bb0..3468aa5e 100644 --- a/packages/repositories.config +++ b/packages/repositories.config @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/src/TeamCitySharp/TeamCitySharp.csproj b/src/TeamCitySharp/TeamCitySharp.csproj index 2e7df5aa..1a71295e 100644 --- a/src/TeamCitySharp/TeamCitySharp.csproj +++ b/src/TeamCitySharp/TeamCitySharp.csproj @@ -42,6 +42,7 @@ + From 3de747aa7656c270d81a866477c0bebc6704ba5b Mon Sep 17 00:00:00 2001 From: Derek Gates Date: Tue, 12 Aug 2014 17:10:19 -0500 Subject: [PATCH 2/5] Adding ByBuildConfigIdSinceChangeId() - Allows to pull changes since a change id. Useful to obtain changes since the last successful. --- src/TeamCitySharp/ActionTypes/Changes.cs | 11 +++++++++-- src/TeamCitySharp/ActionTypes/IChanges.cs | 1 + src/Tests/IntegrationTests/SampleChangeUsage.cs | 8 ++++++++ .../TeamCitySharp.IntegrationTests.csproj | 3 +++ src/Tests/UnitTests/TeamCitySharp.UnitTests.csproj | 3 +++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/TeamCitySharp/ActionTypes/Changes.cs b/src/TeamCitySharp/ActionTypes/Changes.cs index 5218b4aa..3185c05c 100644 --- a/src/TeamCitySharp/ActionTypes/Changes.cs +++ b/src/TeamCitySharp/ActionTypes/Changes.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using TeamCitySharp.Connection; using TeamCitySharp.DomainEntities; @@ -35,12 +36,18 @@ public List ByBuildConfigId(string buildConfigId) return changeWrapper.Change; } + public List ByBuildConfigIdSinceChangeId(string buildConfigId, string sinceChangeId) + { + var changeWrapper = _caller.GetFormat("/app/rest/changes?buildType={0}&sinceChange=id:{1}", buildConfigId, sinceChangeId); + + return changeWrapper.Change; + } + public Change LastChangeDetailByBuildConfigId(string buildConfigId) { var changes = ByBuildConfigId(buildConfigId); return changes.FirstOrDefault(); } - } } \ No newline at end of file diff --git a/src/TeamCitySharp/ActionTypes/IChanges.cs b/src/TeamCitySharp/ActionTypes/IChanges.cs index 1ae51cd5..54796afd 100644 --- a/src/TeamCitySharp/ActionTypes/IChanges.cs +++ b/src/TeamCitySharp/ActionTypes/IChanges.cs @@ -9,5 +9,6 @@ public interface IChanges Change ByChangeId(string id); Change LastChangeDetailByBuildConfigId(string buildConfigId); List ByBuildConfigId(string buildConfigId); + List ByBuildConfigIdSinceChangeId(string buildConfigId, string sinceChangeId); } } \ No newline at end of file diff --git a/src/Tests/IntegrationTests/SampleChangeUsage.cs b/src/Tests/IntegrationTests/SampleChangeUsage.cs index fa8eca06..60239790 100644 --- a/src/Tests/IntegrationTests/SampleChangeUsage.cs +++ b/src/Tests/IntegrationTests/SampleChangeUsage.cs @@ -74,5 +74,13 @@ public void it_returns_change_details_for_build_config(string buildConfigId) Assert.That(changeDetails != null, "Cannot find details of that specified change"); } + + [TestCase("bt113", "42843")] + public void it_returns_change_details_since_build_id(string buildConfigId, string changeId) + { + List changes = _client.Changes.ByBuildConfigIdSinceChangeId(buildConfigId, changeId); + + Assert.That(changes.Any(), "Cannot find any changes since the change id specified"); + } } } \ No newline at end of file diff --git a/src/Tests/IntegrationTests/TeamCitySharp.IntegrationTests.csproj b/src/Tests/IntegrationTests/TeamCitySharp.IntegrationTests.csproj index 95e8426c..4326f56f 100644 --- a/src/Tests/IntegrationTests/TeamCitySharp.IntegrationTests.csproj +++ b/src/Tests/IntegrationTests/TeamCitySharp.IntegrationTests.csproj @@ -78,6 +78,9 @@ TeamCitySharp + + +