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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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