public ObservableGitDatabaseClient(IGitHubClient client) { Blob = new ObservableBlobClient(client); Tag = new ObservableTagsClient(client); Tree = new ObservableTreesClient(client); Commit = new ObservableCommitsClient(client); Reference = new ObservableReferencesClient(client); }
public void GetsFromClientIssueIssue() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.GetRecursive("fake", "repo", "123456ABCD"); gitHubClient.GitDatabase.Tree.Received().GetRecursive("fake", "repo", "123456ABCD"); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.GetRecursive(1, "123456ABCD"); gitHubClient.Git.Tree.Received().GetRecursive(1, "123456ABCD"); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.Get("fake", "repo", "123456ABCD"); gitHubClient.Git.Tree.Received().Get("fake", "repo", "123456ABCD"); }
public void CreatesFromClientIssueIssue() { var newTree = new NewTree(); var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.Create("fake", "repo", newTree); gitHubClient.GitDatabase.Tree.Received().Create("fake", "repo", newTree); }
public void RequestsCorrectUrlWithRepositoryId() { var newTree = new NewTree(); var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.Create(1, newTree); gitHubClient.Git.Tree.Received().Create(1, newTree); }
public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); Assert.Throws <ArgumentNullException>(() => client.Create(null, "name", new NewTree())); Assert.Throws <ArgumentException>(() => client.Create("", "name", new NewTree())); Assert.Throws <ArgumentNullException>(() => client.Create("owner", null, new NewTree())); Assert.Throws <ArgumentException>(() => client.Create("owner", "", new NewTree())); Assert.Throws <ArgumentNullException>(() => client.Create("owner", "name", null)); }
public async Task EnsuresNonNullArguments() { var client = new ObservableTreesClient(Substitute.For <IGitHubClient>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetRecursive(null, "name", "123456ABCD").ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetRecursive("", "name", "123456ABCD").ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetRecursive("owner", null, "123456ABCD").ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetRecursive("owner", "", "123456ABCD").ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetRecursive("owner", "name", null).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetRecursive("owner", "name", "").ToTask()); }
public async Task EnsuresNonNullArguments() { var client = new ObservableTreesClient(Substitute.For <IGitHubClient>()); 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", "")); }