Delete() public method

Deletes (permanently) specified user and all associated data objects. The user_id/user_name parameter means that one can use either one of them - user_id or user_name. User API key usage permitted. In this case, it can only be used to update currently associated user. User_id is automatically filled with current user's id.
public Delete ( string userId = null, string userName = null ) : Task
userId string User id defining user to delete. User_id is automatically filled when used with User API key.
userName string User name defining user to delete.
return Task
        public async Task Update_DeleteAvatar_UpdatesUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";
            var user = await client.New(name, password, avatar: TestData.ImageToBase64("smallSampleImage.png"));

            //when
            var updatedUser = await client.Update(user.Id, avatar: "", currentPassword: password);

            //then
            updatedUser.ShouldNotBeNull();
            updatedUser.Id.ShouldEqual(user.Id);
            updatedUser.Avatar.ShouldBeNull();

            //cleanup
            await client.Delete(user.Id);
        }
        public async Task New_WithAvatar_CreatesNewUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            string avatar = TestData.ImageToBase64("smallSampleImage.png");

            //when
            var user = await client.New(name, avatar: avatar);

            //then
            user.ShouldNotBeNull();
            user.Name.ShouldEqual(name);
            user.Avatar.ShouldNotBeNull();

            //cleanup
            await client.Delete(user.Id);
        }
        public async Task Update_NewPassword_UpdatesUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";
            const string newPassword = "******";
            var user = await client.New(name, password);

            //when
            var updatedUser = await client.Update(user.Id, newPassword: newPassword, currentPassword: password);

            //then
            updatedUser.ShouldNotBeNull();
            updatedUser.Id.ShouldEqual(user.Id);

            //cleanup
            await client.Delete(user.Id);
        }
        public async Task New_WithPassword_CreatesNewUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";

            //when
            var user = await client.New(name, password);

            //then
            user.ShouldNotBeNull();
            user.Name.ShouldEqual(name);

            //cleanup
            await client.Delete(user.Id);
        }
        public async Task New_WithNick_CreatesNewUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string nick = "newUserNick";

            //when
            var user = await client.New(name, nick: nick);

            //then
            user.ShouldNotBeNull();
            user.Name.ShouldEqual(name);
            user.Nick.ShouldEqual(nick);

            //cleanup
            await client.Delete(user.Id);
        }
 public async Task Delete_WithNullUserIdAndName_ThrowsException(UserSyncanoClient client)
 {
     try
     {
         //when
         await client.Delete();
         throw new Exception("Delete should throw an exception.");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
        public async Task Delete_ByUserName_WithAvatar_CreatesNewUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";
            var avatar = TestData.ImageToBase64("smallSampleImage.png");
            var user = await client.New(name, password, avatar: avatar);

            //cleanup
            var result = await client.Delete(userName: user.Name);

            //then
            result.ShouldBeTrue();
        }
        public async Task Delete_ByUserName_WithPassword_DeletesUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";
            var user = await client.New(name, password);

            //when
            var result = await client.Delete(userName: user.Name);

            //then
            result.ShouldBeTrue();
        }