Ejemplo n.º 1
0
        public void GetBuild_BadRequest_ExceptionRethrown()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();

            A.CallTo(() => teamCityApiClient.Get <BuildModel>("builds/id:123")).Throws(new HttpException(HttpStatusCode.BadRequest));

            var buildService = new BuildService(teamCityApiClient, null, null);

            // Act
            Action action = () => buildService.Get(123);

            // Assert
            action.ShouldThrow <HttpException>().Which.StatusCode.Should().Be(HttpStatusCode.BadRequest);
        }
Ejemplo n.º 2
0
        public void GetBuild_Id_BuildNotFound()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();

            A.CallTo(() => teamCityApiClient.Get <BuildModel>("builds/id:123")).Throws(new HttpException(HttpStatusCode.NotFound));

            var buildService = new BuildService(teamCityApiClient, null, null);

            // Act
            var build = buildService.Get(123);

            // Assert
            build.Should().BeNull();
        }
Ejemplo n.º 3
0
        public void GetBuild_Id_BuildRetrived()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();

            A.CallTo(() => teamCityApiClient.Get <BuildModel>("builds/id:123")).Returns(new BuildModel()
            {
                Id = 123
            });

            var buildService = new BuildService(teamCityApiClient, null, null);

            // Act
            var build = buildService.Get(123);

            // Assert
            build.Should().NotBeNull();
            build.Id.Should().Be(123);
        }