New() public method

Adds a new administrator to current instance (sends an invitation). Only Admin permission role can add new administrators.
public New ( string adminEmail, string roleId, string message ) : Task
adminEmail string Email of administrator to add.
roleId string Initial role for current instance (see role.get()).
message string Message that will be sent along with invitation to instance.
return Task
コード例 #1
0
 public async Task New_WithNullMessage_ThrowsException(AdministratorSyncanoClient client)
 {
     try
     {
         //when
         await client.New("*****@*****.**", TestData.RoleId, null);
         throw new Exception("New should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
コード例 #2
0
 public async Task New_WithNullAdminEmail_ThrowsException(AdministratorSyncanoClient client)
 {
     try
     {
         //when
         await client.New(null, TestData.RoleId, "invitation message");
         throw new Exception("New should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
コード例 #3
0
        public async Task New_CreatesNewAdmin(AdministratorSyncanoClient client)
        {
            //given
            var email = "*****@*****.**";

            //when
            var result = await client.New(email, "4", "Invite message");

            //then
            result.ShouldBeTrue();

            //cleanup

            //there is no api for canceling invitations.
           /* var admin = await client.GetOne(adminEmail: email);
            await client.Delete(adminId: admin.Id);*/
        }
コード例 #4
0
 public async Task New_WithInvalidRoleId_ThrowsException(AdministratorSyncanoClient client)
 {
     try
     {
         //when
         await client.New("*****@*****.**", "99", "invitation message");
         throw new Exception("New should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<SyncanoException>();
     }
 }
コード例 #5
0
        public async Task Delete_DeletesAdmin(AdministratorSyncanoClient client)
        {
            //given
            var email = "*****@*****.**";
            await client.New(email, "4", "Invite message");

            //when
            var result = await client.Delete(adminEmail: email);

            //then
            result.ShouldBeTrue();
        }