Esempio n. 1
0
        public async Task UserManagementService_CreateUsersAsync_CreateNonExistentUsersSuccess()
        {
            // Arrange: Create a list of users.
            List <UserRecord> users = new List <UserRecord>();

            UserRecord user1 = new UserRecord("username", "mr.DROP TABLE", "*****@*****.**", "5622224456", "password", Constants.EnabledStatus, Constants.CustomerUserType,
                                              "12345678", Constants.NoValueLong, Constants.NoValueString, Constants.NoValueLong, Constants.NoValueInt, Constants.NoValueLong, Constants.NoValueInt, Constants.NoValueInt);
            UserRecord user2 = new UserRecord("username1", "mr.DROP TABLE1", "*****@*****.**", "5622222456", "password", Constants.EnabledStatus, Constants.CustomerUserType,
                                              "12345678", Constants.NoValueLong, Constants.NoValueString, Constants.NoValueLong, Constants.NoValueInt, Constants.NoValueLong, Constants.NoValueInt, Constants.NoValueInt);

            users.Add(user1);
            users.Add(user2);

            // Act: Create the users.
            bool createResult = await _userManagementService.BulkCreateUsersAsync(users).ConfigureAwait(false);

            // Assert: that the create was successfull
            Assert.IsTrue(createResult);

            // Cleanup: Delete the users.
            List <string> usersToDelete = new List <string> {
                (string)user1.GetData()["username"], (string)user2.GetData()["username"]
            };
            bool deleteResult = await _userManagementService.BulkDeleteUsersAsync(usersToDelete).ConfigureAwait(false);

            Assert.IsTrue(deleteResult);
        }