コード例 #1
0
            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());
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            public async Task ReturnsUserOrganizationEvents()
            {
                var userOrganizationEvents = await _eventsClient.GetAllForAnOrganization(_user, _organization).ToList();

                Assert.NotEmpty(userOrganizationEvents);
            }