-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43f35f7
commit f3902c0
Showing
143 changed files
with
2,858 additions
and
223 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// <copyright file="FactorScenarios.cs" company="Okta, Inc"> | ||
// Copyright (c) 2014-2017 Okta, Inc. All rights reserved. | ||
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Okta.Sdk.IntegrationTests | ||
{ | ||
[Collection(nameof(ScenariosCollection))] | ||
public class FactorScenarios : ScenarioGroup | ||
{ | ||
[Fact] | ||
public async Task CreateSecurityQuestionFactor() | ||
{ | ||
var client = GetClient("factor-securityquestion-create"); | ||
|
||
var profile = new UserProfile | ||
{ | ||
FirstName = "Jill", | ||
LastName = "Factor-SecurityQuestion", | ||
Email = "[email protected]", | ||
Login = "[email protected]", | ||
}; | ||
profile["nickName"] = "jill-factor-securityquestion"; | ||
|
||
var createdUser = await client.Users.CreateUserAsync(new CreateUserWithPasswordOptions | ||
{ | ||
Profile = profile, | ||
Password = "Abcd1234", | ||
}); | ||
|
||
try | ||
{ | ||
await createdUser.AddFactorAsync(new AddSecurityQuestionFactorOptions | ||
{ | ||
Question = "disliked_food", | ||
Answer = "mayonnaise", | ||
}); | ||
|
||
var factors = await createdUser.ListFactors().ToArray(); | ||
factors.Count().Should().Be(1); | ||
|
||
var securityQuestionFactor = await createdUser.ListFactors().OfType<ISecurityQuestionFactor>().FirstOrDefault(); | ||
securityQuestionFactor.Should().NotBeNull(); | ||
securityQuestionFactor.Profile.Question.Should().Be("disliked_food"); | ||
securityQuestionFactor.Profile.QuestionText.Should().NotBeNullOrEmpty(); | ||
} | ||
finally | ||
{ | ||
await createdUser.DeactivateAsync(); | ||
await createdUser.DeactivateOrDeleteAsync(); | ||
} | ||
} | ||
|
||
[Fact] | ||
public async Task ListFactorsForNewUser() | ||
{ | ||
var client = GetClient("list-factors"); | ||
|
||
var profile = new UserProfile | ||
{ | ||
FirstName = "Jack", | ||
LastName = "List-Factors", | ||
Email = "[email protected]", | ||
Login = "[email protected]", | ||
}; | ||
profile["nickName"] = "jack-list-users"; | ||
|
||
var createdUser = await client.Users.CreateUserAsync(new CreateUserWithPasswordOptions | ||
{ | ||
Profile = profile, | ||
Password = "Abcd1234", | ||
}); | ||
|
||
try | ||
{ | ||
var factors = await createdUser.Factors.ToArray(); | ||
factors.Count().Should().Be(0); | ||
} | ||
finally | ||
{ | ||
await createdUser.DeactivateAsync(); | ||
await createdUser.DeactivateOrDeleteAsync(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.