public void EnsuresNonNullArguments()
            {
                var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo"));
                Assert.Throws <ArgumentException>(() => deployKeysClient.GetAll("", "repo"));
                Assert.Throws <ArgumentNullException>(() => deployKeysClient.GetAll("user", null));
                Assert.Throws <ArgumentException>(() => deployKeysClient.GetAll("user", ""));
            }
            public async Task EnsuresNonNullArguments()
            {
                var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo"));
                await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("", "repo"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", null));
                await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("user", ""));
            }
Exemplo n.º 3
0
            public void GetsAListOfDeployKeys()
            {
                var apiConnection    = Substitute.For <IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                deployKeysClient.GetAll("user", "repo");

                apiConnection.Received().GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys"));
            }
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var apiConnection = Substitute.For<IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                await deployKeysClient.GetAll(1);

                apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys"), Args.ApiOptions);
            }
            public void GetsAListOfDeployKeys()
            {
                var apiConnection = Substitute.For<IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                deployKeysClient.GetAll("user", "repo");

                apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"));
            }
Exemplo n.º 6
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var apiConnection    = Substitute.For <IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                await deployKeysClient.GetAll(1);

                apiConnection.Received().GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys"), Args.ApiOptions);
            }
Exemplo n.º 7
0
            public async Task EnsuresNonNullArguments()
            {
                var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo"));

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo", ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", null, ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", "repo", null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(1, null));

                await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("user", ""));

                await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("", "repo"));

                await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("", "repo", ApiOptions.None));

                await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("user", "", ApiOptions.None));
            }
Exemplo n.º 8
0
            public void GetsAListOfDeployKeysWithApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoryDeployKeysClient(connection);

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

                client.GetAll("user", "repo", options);

                connection.Received(1)
                .GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys"),
                                    options);
            }
            public void GetsAListOfDeployKeysWithApiOptions()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoryDeployKeysClient(connection);

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

                client.GetAll("user", "repo", options);

                connection.Received(1)
                    .GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"),
                        options);
            }
Exemplo n.º 10
0
            public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoryDeployKeysClient(connection);

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

                await client.GetAll(1, options);

                connection.Received(1)
                .GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys"),
                                    options);
            }
            public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoryDeployKeysClient(connection);

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

                await client.GetAll(1, options);

                connection.Received(1)
                    .GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys"),
                        options);
            }