public async Task EnsuresArgumentsNotNull() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableEventsClient(gitHubClient); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForAnOrganization(null, "org").ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForAnOrganization("", "org").ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForAnOrganization("fake", null).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllForAnOrganization("fake", "").ToTask()); }
public void RequestsCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableEventsClient(gitHubClient); client.GetAllForAnOrganization("fake", "org"); gitHubClient.Connection.Received(1).Get <List <Activity> >(new Uri("users/fake/events/orgs/org", UriKind.Relative), Args.EmptyDictionary, null); }
public async Task ReturnsUserOrganizationEvents() { var userOrganizationEvents = await _eventsClient.GetAllForAnOrganization(_user, _organization).ToList(); Assert.NotEmpty(userOrganizationEvents); }