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

                Assert.Throws <ArgumentNullException>(() => deployKeysClient.Delete(null, "repo", 1));
                Assert.Throws <ArgumentException>(() => deployKeysClient.Delete("", "repo", 1));
                Assert.Throws <ArgumentNullException>(() => deployKeysClient.Delete("user", null, 1));
                Assert.Throws <ArgumentException>(() => deployKeysClient.Delete("user", "", 1));
            }
Exemple #2
0
            public void DeletesCorrectUrl()
            {
                var apiConnection    = Substitute.For <IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                deployKeysClient.Delete("user", "repo", 42);

                apiConnection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys/42"));
            }
Exemple #3
0
            public async Task DeletesCorrectUrlWithRepositoryId()
            {
                var apiConnection    = Substitute.For <IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                await deployKeysClient.Delete(1, 42);

                apiConnection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys/42"));
            }
            public async Task EnsuresNonNullArguments()
            {
                var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>());

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

                await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Delete("", "repo", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Delete("user", "", 1));
            }
            public async Task DeletesCorrectUrlWithRepositoryId()
            {
                var apiConnection = Substitute.For<IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                await deployKeysClient.Delete(1, 42);

                apiConnection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys/42"));
            }
            public void DeletesCorrectUrl()
            {
                var apiConnection = Substitute.For<IApiConnection>();
                var deployKeysClient = new RepositoryDeployKeysClient(apiConnection);

                deployKeysClient.Delete("user", "repo", 42);

                apiConnection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys/42"));
            }