Exemple #1
0
            public void EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => client.GetAllTags(null, "repo"));
                Assert.Throws <ArgumentNullException>(() => client.GetAllTags("owner", null));
                Assert.Throws <ArgumentException>(() => client.GetAllTags("", "repo"));
                Assert.Throws <ArgumentException>(() => client.GetAllTags("owner", ""));
            }
Exemple #2
0
            public void GetsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoriesClient(connection);

                client.GetAllTags("owner", "name");

                connection.Received()
                .GetAll <RepositoryTag>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/name/tags"));
            }
Exemple #3
0
            public async Task RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoriesClient(connection);

                await client.GetAllTags(1);

                connection.Received()
                .GetAll <RepositoryTag>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/tags"), Args.ApiOptions);
            }
Exemple #4
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For <IApiConnection>());

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

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

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

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllTags("owner", null, ApiOptions.None));

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

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

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

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

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllTags("owner", "", ApiOptions.None));
            }
Exemple #5
0
            public async Task RequestsTheCorrectUrlWithApiOptionsWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoriesClient(connection);

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

                await client.GetAllTags(1, options);

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

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

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

                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTags("", "repo"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTags("owner", ""));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTags("", "repo", ApiOptions.None));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllTags("owner", "", ApiOptions.None));
            }
            public async Task RequestsTheCorrectUrlWithApiOptionsWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoriesClient(connection);

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

                await client.GetAllTags(1, options);

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

                await client.GetAllTags(1);

                connection.Received()
                    .GetAll<RepositoryTag>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/tags"), Args.ApiOptions);
            }
Exemple #9
0
            public void GetsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoriesClient(connection);

                client.GetAllTags("owner", "name");

                connection.Received()
                    .GetAll<RepositoryTag>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/tags"));
            }