public async Task TearDown() { if (_createdAccount != null) { TestContext.WriteLine($"Attempting to delete account {_createdAccount.UserId}"); await ActiveDirectoryUser.DeleteTheUserFromAdAsync(_createdAccount.UserId, _graphApiSettings.AccessToken); } }
public static async Task NewUserClearUp(TestContext context) { if (string.IsNullOrWhiteSpace(context.Test.NewUserId)) { return; } await ActiveDirectoryUser.DeleteTheUserFromAdAsync(context.Test.NewUserId, context.Tokens.GraphApiBearerToken); context.Test.NewUserId = null; }
public async Task should_create_user() { const string firstName = "Automatically"; const string lastName = "Created"; var unique = DateTime.Now.ToString("yyyyMMddhmmss"); var recoveryEmail = $"{firstName}.{lastName}.{unique}@{TestConfig.Instance.Settings.ReformEmail}"; var createdAccount = await _service.CreateUserAsync(firstName, lastName, recoveryEmail, false); var username = createdAccount.Username; username.ToLower().Should().Contain(firstName.ToLower()); username.ToLower().Should().Contain(lastName.ToLower()); await ActiveDirectoryUser.DeleteTheUserFromAdAsync(username, _graphApiSettings.AccessToken); }