Esempio n. 1
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new BlobsClient(connection);

                await client.Get(1, "123456ABCD");

                connection.Received().Get <Blob>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/git/blobs/123456ABCD"));
            }
Esempio n. 2
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new BlobsClient(connection);

                client.Get("fake", "repo", "123456ABCD");

                connection.Received().Get <Blob>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/git/blobs/123456ABCD"));
            }
 public GitDatabaseClient(IApiConnection apiConnection) 
     : base(apiConnection)
 {
     Blob = new BlobsClient(apiConnection);
     Tree = new TreesClient(apiConnection);
     Tag = new TagsClient(apiConnection);
     Commit = new CommitsClient(apiConnection);
     Reference = new ReferencesClient(apiConnection);
 }
Esempio n. 4
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new BlobsClient(connection);

                client.Get("fake", "repo", "123456ABCD");

                connection.Received().Get<Blob>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/git/blobs/123456ABCD"));
            }
Esempio n. 5
0
 /// <summary>
 /// Instantiates a new GitHub Git API client.
 /// </summary>
 /// <param name="apiConnection">An API connection</param>
 public GitDatabaseClient(IApiConnection apiConnection)
     : base(apiConnection)
 {
     Blob      = new BlobsClient(apiConnection);
     Tree      = new TreesClient(apiConnection);
     Tag       = new TagsClient(apiConnection);
     Commit    = new CommitsClient(apiConnection);
     Reference = new ReferencesClient(apiConnection);
 }
Esempio n. 6
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new BlobsClient(connection);

                await client.Get(1, "123456ABCD");

                connection.Received().Get<Blob>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/git/blobs/123456ABCD"));
            }
Esempio n. 7
0
            public void PostsToCorrectUrl()
            {
                var newBlob    = new NewBlob();
                var connection = Substitute.For <IApiConnection>();
                var client     = new BlobsClient(connection);

                client.Create("fake", "repo", newBlob);

                connection.Received().Post <BlobReference>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/git/blobs"), newBlob);
            }
            public void PostsToCorrectUrl()
            {
                var newBlob = new NewBlob();
                var connection = Substitute.For<IApiConnection>();
                var client = new BlobsClient(connection);

                client.Create("fake", "repo", newBlob);

                connection.Received().Post<BlobReference>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/git/blobs"), newBlob);
            }
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new BlobsClient(connection);

                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", new NewBlob()));
                await AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", new NewBlob()));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, new NewBlob()));
                await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", new NewBlob()));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", "name", null));
            }
Esempio n. 10
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new BlobsClient(Substitute.For<IApiConnection>());

                await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", "123456ABCD"));
                await AssertEx.Throws<ArgumentException>(async () => await client.Get("", "name", "123456ABCD"));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, "123456ABCD"));
                await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "", "123456ABCD"));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", "name", null));
                await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "name", ""));
            }
Esempio n. 11
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new BlobsClient(connection);

                var newBlob = new NewBlob();

                client.Create(1, newBlob);

                connection.Received().Post <BlobReference>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/git/blobs"), newBlob);
            }
Esempio n. 12
0
            public void PostsToCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new BlobsClient(connection);

                var newBlob = new NewBlob();

                client.Create(1, newBlob);

                connection.Received().Post<BlobReference>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/git/blobs"), newBlob);
            }
Esempio n. 13
0
            public async Task EnsuresArgumentsNotNull()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new BlobsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null, "name", new NewBlob()));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("", "name", new NewBlob()));

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", new NewBlob()));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", "name", null));
            }
Esempio n. 14
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new BlobsClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "name", "123456ABCD"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Get("", "name", "123456ABCD"));

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "", "123456ABCD"));

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "name", ""));
            }