public static AuthenticationResult RegisterAndLoginUserWithRole(Role role, IDataApiClient adminDataApiClient, out IDataApiClient dataApiClient) { var username = GenerateUsername(); var password = GeneratePassword(); var email = $"{username}@example.org"; var firstName = "Jamie"; var lastName = "Doe"; dataApiClient = new DataApiClient(ApiSetup.ApiConfiguration); dataApiClient.Register(username, firstName, lastName, password, email); adminDataApiClient.AddGlobalRoleToUser(username, role); return(dataApiClient.Login(username, password)); }