public void EnsuresNonNullArguments()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableTeamsClient(github);

                Assert.Throws <ArgumentNullException>(() => client.GetAllMembers(1, (TeamMembersRequest)null));

                Assert.Throws <ArgumentNullException>(() => client.GetAllMembers(1, (ApiOptions)null));

                Assert.Throws <ArgumentNullException>(() => client.GetAllMembers(1, null, ApiOptions.None));
                Assert.Throws <ArgumentNullException>(() => client.GetAllMembers(1, new TeamMembersRequest(TeamRoleFilter.All), null));
            }
Example #2
0
        public async Task GetsAllMembersWhenAuthenticated()
        {
            var github = Helper.GetAuthenticatedClient();

            var client = new ObservableTeamsClient(github);

            var member = await client.GetAllMembers(team.Id);

            Assert.Equal(Helper.UserName, member.Login);
        }
        public async Task GetsAllMembersWhenAuthenticated()
        {
            var github = Helper.GetAuthenticatedClient();
            var client = new ObservableTeamsClient(github);

            var observable = client.GetAllMembers(_team.Id, ApiOptions.None);
            var members    = await observable.ToList();

            Assert.True(members.Count > 0);
            Assert.True(members.Any(x => x.Login == Helper.UserName));
        }
            public void RequestsTheCorrectUrlWithRequest()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableTeamsClient(github);

                client.GetAllMembers(1, new TeamMembersRequest(TeamRoleFilter.Maintainer));

                github.Connection.Received().Get <List <User> >(
                    Arg.Is <Uri>(u => u.ToString() == "teams/1/members"),
                    Arg.Is <Dictionary <string, string> >(d => d["role"] == "maintainer"),
                    "application/vnd.github.hellcat-preview+json");
            }
            public void RequestsTheCorrectUrl()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableTeamsClient(github);

                client.GetAllMembers(1);

                github.Connection.Received().Get <List <User> >(
                    Arg.Is <Uri>(u => u.ToString() == "teams/1/members"),
                    Args.EmptyDictionary,
                    "application/vnd.github.hellcat-preview+json");
            }
Example #6
0
            public void RequestsTheCorrectUrl()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableTeamsClient(github);

                client.GetAllMembers(1);

                github.Connection.Received().Get <List <User> >(
                    Arg.Is <Uri>(u => u.ToString() == "teams/1/members"),
                    Arg.Any <Dictionary <string, string> >(),
                    null);
            }