public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var          connection           = Substitute.For <IApiConnection>();
                var          client               = new RepositoryBranchesClient(connection);
                const string previewAcceptsHeader = "application/vnd.github.loki-preview+json";

                client.GetBranchProtection(1, "branch");

                connection.Received()
                .Get <BranchProtectionSettings>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/branches/branch/protection"), null, previewAcceptsHeader);
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoryBranchesClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetBranchProtection(null, "repo", "branch"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetBranchProtection("owner", null, "branch"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetBranchProtection("owner", "repo", null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetBranchProtection(1, null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetBranchProtection("", "repo", "branch"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetBranchProtection("owner", "", "branch"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetBranchProtection("owner", "repo", ""));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetBranchProtection(1, ""));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoryBranchesClient(Substitute.For<IApiConnection>());
                
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranchProtection(null, "repo", "branch"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranchProtection("owner", null, "branch"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranchProtection("owner", "repo", null));

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranchProtection(1, null));

                await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranchProtection("", "repo", "branch"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranchProtection("owner", "", "branch"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranchProtection("owner", "repo", ""));

                await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranchProtection(1, ""));
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoryBranchesClient(connection);
                const string previewAcceptsHeader = "application/vnd.github.loki-preview+json";

                client.GetBranchProtection(1, "branch");

                connection.Received()
                    .Get<BranchProtectionSettings>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches/branch/protection"), null, previewAcceptsHeader);
            }