Beispiel #1
0
        public async Task <IEnumerable <ChangeDto> > GetBuildChanges(string projectIdentifier, int fromBuildId, int toBuildId, string organization = default, CancellationToken cancellationToken = default)
        {
            var request = new GetChangesBetweenBuilds(organization ?? _options.Value.DefaultOrganization, projectIdentifier, fromBuildId, toBuildId);

            request.Headers.Authorization = GetAuthZHeader();

            var response = await SendAsync(request, cancellationToken);

            var changeDtos = await response.Content.ReadFromJsonAsync <VstsListResult <List <ChangeDto> > >(null, cancellationToken);

            return(changeDtos.Value);
        }
Beispiel #2
0
        public void CanBeConstructed()
        {
            //Arrange
            GetChangesBetweenBuilds sut;

            //Act
            sut = new GetChangesBetweenBuilds("my-org", "my-project", 1, 2);

            //Assert
            Assert.NotNull(sut);
            Assert.Equal("6.1-preview.2", sut.ApiVersion);
            Assert.Equal(HttpMethod.Get, sut.Method);

            Assert.Equal("https://dev.azure.com/my-org/my-project/_apis/build/changes?api-version=6.1-preview.2&fromBuildId=1&toBuildId=2", sut.RequestUri.AbsoluteUri);
        }