public void TestUpdateUser() { var newEmailAddress = $"updated+{m_timestampSuffix}@cloudinary.com"; const string newName = "updated"; var updateUserParams = new UpdateUserParams(m_userId1) { Email = newEmailAddress, Name = newName }; var updateUserResult = AccountProvisioning.UpdateUser(updateUserParams); Assert.AreEqual(newName, updateUserResult.Name); Assert.AreEqual(newEmailAddress, updateUserResult.Email); var getUserResult = AccountProvisioning.User(m_userId1); Assert.AreEqual(m_userId1, getUserResult.Id); Assert.AreEqual(newEmailAddress, getUserResult.Email); var listUsersResult = AccountProvisioning.Users(new ListUsersParams()); var foundUser = listUsersResult.Users.FirstOrDefault(user => user.Id == m_userId1); Assert.NotNull(foundUser); Assert.AreEqual(newEmailAddress, foundUser.Email); }
public void TestGetUsersInAListOfUserIds() { var listUsersParams = new ListUsersParams { UserIds = new List <string> { m_userId1 } }; var result = AccountProvisioning.Users(listUsersParams); Assert.AreEqual(1, result.Users.Length); }
public void TestGetUsersByNonexistentSubAccountIdError() { var randomId = new Random().Next(100000).ToString(); var listUsersParams = new ListUsersParams { Pending = true, SubAccountId = randomId }; var result = AccountProvisioning.Users(listUsersParams); Assert.True(result.Error.Message.StartsWith("Cannot find sub account")); }
public void TestGetUsersBySubAccountId() { var listUsersParams = new ListUsersParams { Pending = true, Prefix = m_userName2, SubAccountId = m_cloudId1 }; var result = AccountProvisioning.Users(listUsersParams); Assert.AreEqual(1, result.Users.Length); }
public void TestGetPendingAndNonPendingUsers() { var listUsersParams = new ListUsersParams { Pending = null, UserIds = new List <string> { m_userId1 } }; var result = AccountProvisioning.Users(listUsersParams); Assert.AreEqual(1, result.Users.Length); }
public void TestGetUsersByPrefix() { var listUsersParams1 = new ListUsersParams { Pending = true, Prefix = m_userName2.Substring(0, m_userName2.Length - 1) }; var result1 = AccountProvisioning.Users(listUsersParams1); Assert.AreEqual(1, result1.Users.Length); var listUsersParams2 = new ListUsersParams { Pending = true, Prefix = $"{m_userName2}zzz" }; var result2 = AccountProvisioning.Users(listUsersParams2); Assert.AreEqual(0, result2.Users.Length); }