mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 19:00:47 +00:00
added integration tests
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user