public async Task UpdateStatus_ValidParameters_SetsCorrectResourceAndMethod()
        {
            var sut = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, "commitSha", BuildStatus.Pending);

            _requestFactory.Received().Create("projects/{projectId}/statuses/{commitSha}", Method.Post);
        }
        public async Task UpdateStatus_ValidParameters_AddsProjectIdUrlSegment()
        {
            const uint expected = 0;
            var        sut      = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(expected, "commitSha", BuildStatus.Pending);

            _request.Received().AddUrlSegment("projectId", expected);
        }
        public async Task UpdateStatus_ValidParameters_AddsCommitShaUrlSegment()
        {
            const string expected = "commitSha";
            var          sut      = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, expected, BuildStatus.Pending);

            _request.Received().AddUrlSegment("commitSha", expected);
        }
        public async Task UpdateStatus_TargetUrlIsSet_AddsTargetUrlParameter()
        {
            const string expected = "targetUrl";
            var          sut      = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, "commitSha", BuildStatus.Pending, targetUrl : expected);

            _request.Received().AddParameterIfNotNull("target_url", expected);
        }
        public async Task UpdateStatus_RefNameIsSet_AddsRefNameParameter()
        {
            const string expected = "refName";
            var          sut      = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, "commitSha", BuildStatus.Pending, expected);

            _request.Received().AddParameterIfNotNull("ref", expected);
        }
        public async Task UpdateStatus_DescriptionIsSet_AddsDescriptionParameter()
        {
            const string expected = "description";
            var          sut      = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, "commitSha", BuildStatus.Pending, description : expected);

            _request.Received().AddParameterIfNotNull("description", expected);
        }
        public async Task UpdateStatus_ValidParameters_AddsStateParameter()
        {
            const string      expected = "pending";
            const BuildStatus state    = BuildStatus.Pending;
            var sut = new CommitRepository(_requestFactory);

            await sut.UpdateStatus(0, "commitSha", state);

            _request.Received().AddParameter("state", expected);
        }
        public async Task UpdateStatus_CommitShaIsNull_ThrowsArgumentNullException()
        {
            var sut = new CommitRepository(_requestFactory);

            await Assert.ThrowsAsync <ArgumentNullException>(() => sut.UpdateStatus(0, null, BuildStatus.Pending));
        }