public async Task EnsuresNonNullArguments() { var client = new ObservableNotificationsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository(null, "name")); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository("owner", null)); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository(null, "name", new MarkAsReadRequest())); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository("owner", null, new MarkAsReadRequest())); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository("owner", "name", null)); Assert.Throws <ArgumentNullException>(() => client.MarkAsReadForRepository(1, null)); Assert.Throws <ArgumentException>(() => client.MarkAsReadForRepository("", "name")); Assert.Throws <ArgumentException>(() => client.MarkAsReadForRepository("owner", "")); Assert.Throws <ArgumentException>(() => client.MarkAsReadForRepository("", "name", new MarkAsReadRequest())); Assert.Throws <ArgumentException>(() => client.MarkAsReadForRepository("owner", "", new MarkAsReadRequest())); }
public void RequestsCorrectUrl() { var endpoint = new Uri("repos/banana/split/notifications", UriKind.Relative); var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableNotificationsClient(gitHubClient); client.MarkAsReadForRepository("banana", "split"); connection.Received().Put(endpoint); }
public void RequestsCorrectUrlWithRepositoryId() { var endpoint = new Uri("repositories/1/notifications", UriKind.Relative); var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableNotificationsClient(gitHubClient); client.MarkAsReadForRepository(1); connection.Received().Put <object>(endpoint, Args.Object); }