From b13422f64bd8f4fd9157fcc5906e5bb894f9712d Mon Sep 17 00:00:00 2001 From: Alexander Efremov Date: Sun, 12 Jun 2016 15:25:35 +0700 Subject: [PATCH] added integration tests --- .../Clients/TreeClientTests.cs | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/TreeClientTests.cs b/Octokit.Tests.Integration/Clients/TreeClientTests.cs index 4522efc5..ea7d2b7e 100644 --- a/Octokit.Tests.Integration/Clients/TreeClientTests.cs +++ b/Octokit.Tests.Integration/Clients/TreeClientTests.cs @@ -2,8 +2,8 @@ using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration; -using Xunit; using Octokit.Tests.Integration.Helpers; +using Xunit; public class TreeClientTests : IDisposable { @@ -45,6 +45,31 @@ public class TreeClientTests : IDisposable Assert.NotNull(result); } + [IntegrationTest] + public async Task CanCreateATreeWithRepositoryId() + { + var blob = new NewBlob + { + Content = "Hello World!", + Encoding = EncodingType.Utf8 + }; + + var createdBlob = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob); + + var newTree = new NewTree(); + newTree.Tree.Add(new NewTreeItem + { + Type = TreeType.Blob, + Path = "README.md", + Sha = createdBlob.Sha, + Mode = FileMode.File + }); + + var result = await _fixture.Create(_context.Repository.Id, newTree); + + Assert.NotNull(result); + } + [IntegrationTest] public async Task CanGetATree() { @@ -54,6 +79,15 @@ public class TreeClientTests : IDisposable Assert.NotEmpty(result.Tree); } + [IntegrationTest] + public async Task CanGetATreeWithRepositoryId() + { + var result = await _fixture.Get(1, "master"); + + Assert.NotNull(result); + Assert.NotEmpty(result.Tree); + } + [IntegrationTest] public async Task CanGetACreatedTree() { @@ -82,6 +116,34 @@ public class TreeClientTests : IDisposable Assert.Equal(1, result.Tree.Count); } + [IntegrationTest] + public async Task CanGetACreatedTreeWithRepositoryId() + { + var blob = new NewBlob + { + Content = "Hello World!", + Encoding = EncodingType.Utf8 + }; + + var blobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob); + + var newTree = new NewTree(); + newTree.Tree.Add(new NewTreeItem + { + Type = TreeType.Blob, + Path = "README.md", + Sha = blobResult.Sha, + Mode = FileMode.File + }); + + var tree = await _fixture.Create(_context.Repository.Id, newTree); + + var result = await _fixture.Get(_context.Repository.Id, tree.Sha); + + Assert.NotNull(result); + Assert.Equal(1, result.Tree.Count); + } + public void Dispose() { _context.Dispose();