public async Task ThenUserShouldBeAddedToTheGroup() { var userIsInTheGroup = await ActiveDirectoryUser.IsUserInAGroupAsync(_testContext.Config.TestSettings.ExistingUserId, _testContext.Config.TestSettings.NewGroups.First().DisplayName, _testContext.Tokens.GraphApiBearerToken); userIsInTheGroup.Should().BeTrue(); _testContext.Test.NewGroupId = _testContext.Config.TestSettings.NewGroups.First().GroupId; }
private static async Task RemoveGroupFromUserIfExistsAsync(TestContext testContext, Group group) { var userId = testContext.Config.TestSettings.ExistingUserId; var userIsInTheGroup = await ActiveDirectoryUser.IsUserInAGroupAsync(userId, group.DisplayName, testContext.Tokens.GraphApiBearerToken); if (userIsInTheGroup) { await ActiveDirectoryUser.RemoveTheUserFromTheGroupAsync(userId, group.GroupId, testContext.Tokens.GraphApiBearerToken); } testContext.Test.NewGroupId = null; }
private static async Task RemoveGroupFromUserIfExists(TestContext context) { var userIsInTheGroup = await ActiveDirectoryUser.IsUserInAGroupAsync(context.Config.TestSettings.ExistingUserId, context.Config.TestSettings.NewGroups.First().DisplayName, context.Tokens.GraphApiBearerToken); if (userIsInTheGroup) { await ActiveDirectoryUser.RemoveTheUserFromTheGroupAsync(context.Config.TestSettings.ExistingUserId, context.Config.TestSettings.NewGroups.First().GroupId, context.Tokens.GraphApiBearerToken); } context.Test.NewGroupId = null; }
public async Task ThenUserShouldBeAddedToTheGroup() { var userIsInTheGroup = false; var sw = new Stopwatch(); sw.Start(); while (!userIsInTheGroup && sw.ElapsedMilliseconds < TimeoutInMilliseconds) { userIsInTheGroup = await ActiveDirectoryUser.IsUserInAGroupAsync(_context.Config.TestSettings.ExistingUserId, _context.Config.TestSettings.NewGroups.First().DisplayName, _context.Tokens.GraphApiBearerToken); await Task.Delay(DelayInMilliseconds); } sw.Stop(); userIsInTheGroup.Should().BeTrue("User has been added to the group"); _context.Test.NewGroupId = _context.Config.TestSettings.NewGroups.First().GroupId; }