public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableBlobClient(gitHubClient); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewBlob()).ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewBlob()).ToTask()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewBlob()).ToTask()); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewBlob()).ToTask()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", null).ToTask()); }
public void PostsToCorrectUrl() { var newBlob = new NewBlob(); var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableBlobClient(gitHubClient); client.Create("fake", "repo", newBlob); gitHubClient.GitDatabase.Blob.Received().Create("fake", "repo", newBlob); }
public void PostsToCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableBlobClient(gitHubClient); var newBlob = new NewBlob(); client.Create(1, newBlob); gitHubClient.Git.Blob.Received().Create(1, newBlob); }