public async Task EnsuresNonNullArguments() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableAssigneesClient(github); Assert.Throws <ArgumentNullException>(() => client.GetAllForRepository(null, name)); Assert.Throws <ArgumentNullException>(() => client.GetAllForRepository(owner, null)); Assert.Throws <ArgumentNullException>(() => client.GetAllForRepository(owner, name, null)); }
public void RequestsCorrectUrl() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableAssigneesClient(github); client.GetAllForRepository(owner, name); github.Connection.Received(1).Get <List <User> >(_expectedUri, Arg.Is <Dictionary <string, string> >(dictionary => dictionary.Count == 0), null); }
public void RequestsCorrectUrlWithApiOption() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableAssigneesClient(gitHubClient); var options = new ApiOptions { PageSize = 1, StartPage = 1, PageCount = 1 }; client.GetAllForRepository(owner, name, new ApiOptions { PageSize = 1, StartPage = 1 }); client.GetAllForRepository(owner, name, options); gitHubClient.Connection.Received(2).Get <List <User> >(_expectedUri, Arg.Is <Dictionary <string, string> >(dictionary => dictionary.Count == 2), null); }
public async Task ReturnsAssignees() { var assignees = await _assigneesClient.GetAllForRepository(owner, name).ToList(); Assert.NotEmpty(assignees); }