public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", new NewTree())); AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", new NewTree())); AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, new NewTree())); AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", new NewTree())); AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", "name", null)); }
public void CreatesFromClientIssueIssue() { var newTree = new NewTree(); var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableTreesClient(gitHubClient); client.Create("fake", "repo", newTree); gitHubClient.Git.Tree.Received().Create("fake", "repo", newTree); }
public async Task EnsuresNonNullArguments() { var client = new ObservableTreesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewTree())); Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewTree())); Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null)); Assert.Throws<ArgumentNullException>(() => client.Create(1, null)); Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewTree())); Assert.Throws<ArgumentException>(() => client.Create("owner", "", new 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); }