New() public method

Creates a new user. User API key usage permitted if add_user permission is added through apikey.authorize().
public New ( string userName, string password = null, string nick = null, string avatar = null ) : Task
userName string User name.
password string User's password.
nick string User's nickname.
avatar string User's avatar in Base64 format.
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_WithNullName_ThrowsException(UserSyncanoClient client)
 {
     try
     {
         //when
         await client.New(null);
         throw new Exception("New should throw an exception.");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
        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_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 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_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();
        }