public async Task EnsureNonNullArgumentsWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableProjectsClient(gitHubClient); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForRepository(1, (ApiOptions)null).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForRepository(1, (ProjectRequest)null).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForRepository(1, new ProjectRequest(ItemStateFilter.All), null).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForRepository(1, null, ApiOptions.None).ToTask()); }
public void RequestCorrectUrlWithRequestParameterWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableProjectsClient(gitHubClient); client.GetAllForRepository(1, new ProjectRequest(ItemStateFilter.All)); connection.Received().Get <List <Project> >( Arg.Is <Uri>(u => u.ToString() == "repositories/1/projects"), Arg.Is <Dictionary <string, string> >(d => d.ContainsKey("state")), "application/vnd.github.inertia-preview+json"); }
public void RequestCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableProjectsClient(gitHubClient); client.GetAllForRepository(1); connection.Received().Get <List <Project> >( Arg.Is <Uri>(u => u.ToString() == "repositories/1/projects"), Args.EmptyDictionary, "application/vnd.github.inertia-preview+json"); }