public async Task EnsureNonNullArguments() { var client = new OrganizationMembersClient(Substitute.For <IApiConnection>()); var orgMembershipUpdate = new OrganizationMembershipUpdate(); await Assert.ThrowsAsync <ArgumentNullException>(() => client.AddOrUpdateOrganizationMembership(null, "username", orgMembershipUpdate)); await Assert.ThrowsAsync <ArgumentException>(() => client.AddOrUpdateOrganizationMembership("", "username", orgMembershipUpdate)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.AddOrUpdateOrganizationMembership("org", null, orgMembershipUpdate)); await Assert.ThrowsAsync <ArgumentException>(() => client.AddOrUpdateOrganizationMembership("org", "", orgMembershipUpdate)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.AddOrUpdateOrganizationMembership("org", "username", null)); }
public void PostsToTheCorrectUrl() { var orgMembershipUpdate = new OrganizationMembershipUpdate(); var connection = Substitute.For <IApiConnection>(); var client = new OrganizationMembersClient(connection); client.AddOrUpdateOrganizationMembership("org", "username", orgMembershipUpdate); connection.Received().Put <OrganizationMembership>(Arg.Is <Uri>(u => u.ToString() == "orgs/org/memberships/username"), Arg.Any <object>()); }