public void ConvertNullAPIToAPI() { apiAuthChallenge1 = null; converter = new ChallengeConverter(apiAuthChallenge1); Assert.IsNull(converter.ToAPIChallenge()); }
public OneSpanSign.API.AuthChallenge ToAPIChallenge() { if (sdkChallenge == null) { return(apiChallenge); } OneSpanSign.API.AuthChallenge result = new OneSpanSign.API.AuthChallenge(); result.Question = sdkChallenge.Question; result.Answer = sdkChallenge.Answer; switch (sdkChallenge.MaskOption) { case Challenge.MaskOptions.MaskInput: result.MaskInput = true; break; case Challenge.MaskOptions.None: result.MaskInput = false; break; default: result.MaskInput = true; break; } return(result); }
private OneSpanSign.API.AuthChallenge CreateTypicalAPIChallenge() { OneSpanSign.API.AuthChallenge result = new OneSpanSign.API.AuthChallenge(); result.Question = "What is the name of your dog?"; result.Answer = "Max"; result.MaskInput = false; return(result); }
public void ConvertAPIToAPI() { apiAuthChallenge1 = CreateTypicalAPIChallenge(); converter = new ChallengeConverter(apiAuthChallenge1); apiAuthChallenge2 = converter.ToAPIChallenge(); Assert.IsNotNull(apiAuthChallenge2); Assert.AreEqual(apiAuthChallenge2, apiAuthChallenge1); }
public void ConvertSDKToAPI() { sdkAuthChallenge1 = CreateTypicalSDKChallenge(); apiAuthChallenge1 = new ChallengeConverter(sdkAuthChallenge1).ToAPIChallenge(); Assert.IsNotNull(apiAuthChallenge1); Assert.AreEqual(apiAuthChallenge1.Question, sdkAuthChallenge1.Question); Assert.AreEqual(apiAuthChallenge1.Answer, sdkAuthChallenge1.Answer); Assert.AreEqual(apiAuthChallenge1.MaskInput, true); }
public void ConvertAPIToSDK() { apiAuthChallenge1 = CreateTypicalAPIChallenge(); sdkAuthChallenge1 = new ChallengeConverter(apiAuthChallenge1).ToSDKChallenge(); Assert.IsNotNull(sdkAuthChallenge1); Assert.AreEqual(sdkAuthChallenge1.Question, apiAuthChallenge1.Question); Assert.AreEqual(sdkAuthChallenge1.Answer, apiAuthChallenge1.Answer); Assert.AreEqual(sdkAuthChallenge1.MaskOption, Challenge.MaskOptions.None); }
private OneSpanSign.API.Auth CreateTypicalAPIAuthentication() { OneSpanSign.API.Auth result = new OneSpanSign.API.Auth(); OneSpanSign.API.AuthChallenge authChallenge = new OneSpanSign.API.AuthChallenge(); authChallenge.Question = "What is the name of your dog?"; authChallenge.Answer = "Max"; authChallenge.MaskInput = true; result.AddChallenge(authChallenge); result.Scheme = OneSpanSign.Sdk.AuthenticationMethod.CHALLENGE.getApiValue(); return(result); }
/// <summary> /// Construct with API object involved in conversion. /// </summary> /// <param name="apiChallenge">API challenge.</param> public ChallengeConverter(OneSpanSign.API.AuthChallenge apiChallenge) { this.apiChallenge = apiChallenge; }