public void GetQueuedBuild_Id_BuildNotFound() { // Arrange var teamCityApiClient = A.Fake <ITeamCityApiClient>(); A.CallTo(() => teamCityApiClient.Get <BuildModel>("buildQueue/id:123")).Throws(new HttpException(HttpStatusCode.NotFound)); var queuedBuildService = new QueuedBuildService(teamCityApiClient); // Act var build = queuedBuildService.Get(123); // Assert build.Should().BeNull(); }
public void GetQueuedBuild_BadRequest_ExceptionRethrown() { // Arrange var teamCityApiClient = A.Fake <ITeamCityApiClient>(); A.CallTo(() => teamCityApiClient.Get <BuildModel>("buildQueue/id:123")).Throws(new HttpException(HttpStatusCode.BadRequest)); var queuedBuildService = new QueuedBuildService(teamCityApiClient); // Act Action action = () => queuedBuildService.Get(123); // Assert action.ShouldThrow <HttpException>().Which.StatusCode.Should().Be(HttpStatusCode.BadRequest); }
public void GetQueuedBuild_Id_BuildRetrived() { // Arrange var teamCityApiClient = A.Fake <ITeamCityApiClient>(); A.CallTo(() => teamCityApiClient.Get <BuildModel>("buildQueue/id:123")).Returns(new BuildModel() { Id = 123 }); var queuedBuildService = new QueuedBuildService(teamCityApiClient); // Act var build = queuedBuildService.Get(123); // Assert build.Should().NotBeNull(); build.Id.Should().Be(123); }