private static SandboxAttribute CreateAttribute(string name, string value, List <SandboxAnchor> anchors) { return(SandboxAttribute.Builder() .WithName(name) .WithValue(value) .WithAnchors(anchors) .Build()); }
public SandboxAttribute ToAttribute() { return(SandboxAttribute.Builder() .WithName(UserProfile.DateOfBirthAttribute) .WithValue(_dateOfBirth.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)) .WithDerivation(_supportedAgeDerivation) .WithAnchors(_anchors) .Build()); }
public YotiTokenRequestBuilder WithDocumentDetails(string value, List <SandboxAnchor> anchors) { SandboxAttribute sandboxAttribute = SandboxAttribute.Builder() .WithName(UserProfile.DocumentDetailsAttribute) .WithValue(value) .WithAnchors(anchors) .Build(); return(WithAttribute(sandboxAttribute)); }
public static void ShouldNotBeOptionalByDefault() { SandboxAttribute result = SandboxAttribute.Builder() .WithName(_someName) .WithDerivation(_someDerivation) .WithValue(_someValue) .Build(); Assert.Equal(_someName, result.Name); Assert.Equal(_someDerivation, result.Derivation); Assert.Equal(_someValue, result.Value); #pragma warning disable 0618 Assert.Equal("False", result.Optional); //NOSONAR #pragma warning restore 0618 }
public static void ShouldAddAttributes() { SandboxAttribute otherAttribute = SandboxAttribute.Builder() .WithName("otherAttributeName") .Build(); YotiTokenRequest yotiTokenRequest = YotiTokenRequest.Builder() .WithAttribute(SOME_ATTRIBUTE) .WithAttribute(otherAttribute) .Build(); Assert.True(yotiTokenRequest.SandboxAttributes.Count == 2); Assert.Contains(SOME_ATTRIBUTE, yotiTokenRequest.SandboxAttributes); Assert.Contains(otherAttribute, yotiTokenRequest.SandboxAttributes); }
public static void ShouldAllowSameAttributeWithDifferingDerivationNames() { SandboxAttribute derivationAttribute = SandboxAttribute.Builder() .WithName(_someAttributeName) .WithDerivation("derivation1") .Build(); YotiTokenRequest yotiTokenRequest = YotiTokenRequest.Builder() .WithAttribute(SOME_ATTRIBUTE) .WithAttribute(derivationAttribute) .Build(); Assert.True(yotiTokenRequest.SandboxAttributes.Count == 2); Assert.Contains(SOME_ATTRIBUTE, yotiTokenRequest.SandboxAttributes); Assert.Contains(derivationAttribute, yotiTokenRequest.SandboxAttributes); }
public static void ShouldBeOptionalWhenSpecified() { #pragma warning disable 0618 SandboxAttribute result = SandboxAttribute.Builder() .WithName(_someName) .WithDerivation(_someDerivation) .WithValue(_someValue) .WithOptional(true) //NOSONAR #pragma warning restore 0618 .Build(); Assert.Equal(_someName, result.Name); Assert.Equal(_someDerivation, result.Derivation); Assert.Equal(_someValue, result.Value); #pragma warning disable 0618 Assert.Equal("True", result.Optional); //NOSONAR #pragma warning restore 0618 }