public async Task RequestsCorrectUrlWithRepositoryId()
        {
            var connection  = Substitute.For <IApiConnection>();
            var client      = new DeploymentsClient(connection);
            var expectedUrl = string.Format("repositories/{0}/deployments", repositoryId);

            await client.GetAll(repositoryId);

            connection.Received(1)
            .GetAll <Deployment>(Arg.Is <Uri>(u => u.ToString() == expectedUrl),
                                 Args.ApiOptions);
        }
Пример #2
0
        public async Task RequestsCorrectUrl()
        {
            var connection  = Substitute.For <IApiConnection>();
            var client      = new DeploymentsClient(connection);
            var expectedUrl = string.Format("repos/{0}/{1}/deployments", owner, name);

            await client.GetAll(owner, name);

            connection.Received(1)
            .GetAll <Deployment>(Arg.Is <Uri>(u => u.ToString() == expectedUrl), null,
                                 "application/vnd.github.ant-man-preview+json",
                                 Args.ApiOptions);
        }
Пример #3
0
        public void RequestsCorrectUrlWithPreviewAcceptHeaders()
        {
            var connection  = Substitute.For <IApiConnection>();
            var client      = new DeploymentsClient(connection);
            var expectedUrl = string.Format("repos/{0}/{1}/deployments", owner, name);

            client.GetAll(owner, name);
            connection.Received(1)
            .GetAll <Deployment>(Arg.Is <Uri>(u => u.ToString() == expectedUrl),
                                 Arg.Any <IDictionary <string, string> >(),
                                 Arg.Is <string>(s => s == AcceptHeaders.DeploymentApiPreview),
                                 Args.ApiOptions);
        }
        public void RequestsCorrectUrlWithApiOptions()
        {
            var connection  = Substitute.For <IApiConnection>();
            var client      = new DeploymentsClient(connection);
            var expectedUrl = string.Format("repos/{0}/{1}/deployments", owner, name);

            var options = new ApiOptions
            {
                PageSize  = 1,
                PageCount = 1,
                StartPage = 1
            };

            client.GetAll(owner, name, options);
            connection.Received(1)
            .GetAll <Deployment>(Arg.Is <Uri>(u => u.ToString() == expectedUrl), options);
        }
Пример #5
0
        public async Task RequestsCorrectUrlWithRepostoryIdWithApiOptions()
        {
            var connection  = Substitute.For <IApiConnection>();
            var client      = new DeploymentsClient(connection);
            var expectedUrl = string.Format("repositories/{0}/deployments", repositoryId);

            var options = new ApiOptions
            {
                PageSize  = 1,
                PageCount = 1,
                StartPage = 1
            };

            await client.GetAll(repositoryId, options);

            connection.Received(1)
            .GetAll <Deployment>(Arg.Is <Uri>(u => u.ToString() == expectedUrl),
                                 options);
        }