コード例 #1
0
 private static SandboxAttribute CreateAttribute(string name, string value, List <SandboxAnchor> anchors)
 {
     return(SandboxAttribute.Builder()
            .WithName(name)
            .WithValue(value)
            .WithAnchors(anchors)
            .Build());
 }
コード例 #2
0
 public SandboxAttribute ToAttribute()
 {
     return(SandboxAttribute.Builder()
            .WithName(UserProfile.DateOfBirthAttribute)
            .WithValue(_dateOfBirth.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture))
            .WithDerivation(_supportedAgeDerivation)
            .WithAnchors(_anchors)
            .Build());
 }
コード例 #3
0
        public YotiTokenRequestBuilder WithDocumentDetails(string value, List <SandboxAnchor> anchors)
        {
            SandboxAttribute sandboxAttribute = SandboxAttribute.Builder()
                                                .WithName(UserProfile.DocumentDetailsAttribute)
                                                .WithValue(value)
                                                .WithAnchors(anchors)
                                                .Build();

            return(WithAttribute(sandboxAttribute));
        }
コード例 #4
0
        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
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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
        }