mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 12:42:32 +00:00
* Add "transfer repository" accept header * Create RepositoryTransfer class This will be used to send the POST request to initiate the transfer. * Create Ensure method to check for empty or null arrays * Change arg name in Ensure for nonempty arrays array -> value * Add xmldoc for ArgumentNotNullOrEmptyArray * Create Transfer method in IRepositoriesClient * Implement Transfer method in RepositoriesClient * Fix typo in xmldoc for Transfer * Add <returns> to Transfer xmldoc * Create Transfer method in IObservableRepositoriesClient * Implement Transfer in ObservableRepositoriesClient * Add DebuggerDIsplayAttribute do RepositoryTransfer * Add unit tests for RepositoryTransfer constructors * Change TeamId property type to IReadOnlyList<int> * Rewrite DebuggerDisplay property into something more succint * Make new Ensure method into an IEnumerable<T> checker * Add XmlDoc to RepositoryTransfer * Tweaks to first ctor XmlDoc * Create basic unit tests for Transfer * Create ApiUrls.RepositoryTransfer * Use ApiUrls.RepositoryTransfer to get URI in Transfer Previous implementation used wrong URI * Start implementing RepositoriesClientTests.TheTransferMethod * Implement org -> user transfer integration test * Implement user -> org transfer integration test * [WIP] Implement user -> org transfer with teams Implementation doesn't work, API usage seems correct. * Mark transfer user -> org w/ teams integration test with FIXME * Add second end point URI to ApiUrls * Add other Transfer overload to RepositoriesClient for other end point * Create unit tests for other Transfer endpoint * Add overload to IRepositoriesClient * Add integration tests for overload * Reorganize unit tests for TheTransferMethod * Rename id to repositoryId * Reorganize unit tests for RepositoriesClientTests.Transfer * Add second endpoint to IObservableRepositoriesClient * Add XmlDoc to second Transfer endpoint * Add XmlDoc to second Transfer endpoint in RepositoriesClient * Reimplement "with teams" integration tests using TeamContext * Rename integration test for consistency * Add asserts to actual ownership transfer * Rename RepositoryTransfer.TeamId property to TeamIds * Add awaiit to ThrowsAsync in RepositoriesClientTests * Put await in right places for unit tests * Add Ensures for Transfer method in RepositoriesClient * Add XmlDoc to ApiUrls.RepositoryTransfer with repo id * Update XmlDoc for RepositoryTransfer constructor and teamIds property * Rename currentOwner to owner * Add Ensure guards to ObservableRepositoriesClient.Transfer methods * Add unit tests for ObservableRepositoriesClient
This commit is contained in:
committed by
Ryan Gribble
parent
fb928f68d5
commit
74dc51a6f5
@@ -0,0 +1,86 @@
|
||||
using Xunit;
|
||||
using System;
|
||||
|
||||
namespace Octokit.Tests.Models
|
||||
{
|
||||
public class RepositoryTransferTest
|
||||
{
|
||||
public static readonly string emptyName = "";
|
||||
public static readonly string nonemptyName = "name";
|
||||
public static readonly int[] emptyTeamId = new int[] {};
|
||||
public static readonly int[] nonemptyTeamId = new int[] {1, 2, 3};
|
||||
|
||||
public class TheSingleArgumentConstructor
|
||||
{
|
||||
[Fact]
|
||||
public void ChecksForEmptyName()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => {new RepositoryTransfer(emptyName);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChecksForNullName()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => {new RepositoryTransfer(null);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StoresGivenName()
|
||||
{
|
||||
string testName = nonemptyName;
|
||||
RepositoryTransfer repositoryTransfer = new RepositoryTransfer(testName);
|
||||
Assert.Equal(repositoryTransfer.NewOwner, testName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetsTeamIdToNull()
|
||||
{
|
||||
RepositoryTransfer repositoryTransfer = new RepositoryTransfer(nonemptyName);
|
||||
Assert.Null(repositoryTransfer.TeamIds);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheFullConstructor
|
||||
{
|
||||
[Fact]
|
||||
public void ChecksForEmptyName()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => {new RepositoryTransfer(emptyName, nonemptyTeamId);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChecksForNullName()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => {new RepositoryTransfer(null, nonemptyTeamId);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChecksForEmptyTeamId()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => {new RepositoryTransfer(nonemptyName, emptyTeamId);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChecksForNullTeamId()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => {new RepositoryTransfer(nonemptyName, null);});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StoresGivenName()
|
||||
{
|
||||
string testName = nonemptyName;
|
||||
RepositoryTransfer repositoryTransfer = new RepositoryTransfer(testName, nonemptyTeamId);
|
||||
Assert.Equal(repositoryTransfer.NewOwner, testName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StoresGivenTeamId()
|
||||
{
|
||||
int[] testTeamId = nonemptyTeamId;
|
||||
RepositoryTransfer repositoryTransfer = new RepositoryTransfer(nonemptyName, testTeamId);
|
||||
Assert.Equal(repositoryTransfer.TeamIds, testTeamId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user