public void EnsuresNonNullArgument()
            {
                var client = new ObservableOrganizationOutsideCollaboratorsClient(Substitute.For <IGitHubClient>());

                Assert.Throws <ArgumentNullException>(() => client.ConvertFromMember(null, "user"));
                Assert.Throws <ArgumentNullException>(() => client.ConvertFromMember("org", null));

                Assert.Throws <ArgumentException>(() => client.ConvertFromMember("", "user"));
                Assert.Throws <ArgumentException>(() => client.ConvertFromMember("org", ""));
            }
            public void RequestsTheCorrectUrl()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableOrganizationOutsideCollaboratorsClient(gitHubClient);

                client.ConvertFromMember("org", "user");

                gitHubClient.Organization.OutsideCollaborator.Received().ConvertFromMember(
                    Arg.Is("org"),
                    Arg.Is("user"));
            }
Example #3
0
            public async Task CanConvertOrgMemberToOutsideCollaborator()
            {
                var result = await _client.ConvertFromMember(Helper.Organization, _fixtureCollaborator);

                Assert.True(result);

                var outsideCollaborators = await _client
                                           .GetAll(Helper.Organization).ToList();

                Assert.Equal(1, outsideCollaborators.Count);
                Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
            }