public void AunnCoo_Regex_RegexExprToken_ShouldBeInvalid()
        {
            var model = new AunnCoo {
                Name = "AlicE"
            };

            var context  = VerifiableObjectContractManager.Resolve <AunnCoo>().WithInstance(model);
            var member   = context.GetValue("Name");
            var contract = member.ExposeContract();

            var token = new ValueRegularExpressionToken(contract, new Regex(@"^(Al)\w+(e)$"));

            token.Valid(context).IsSuccess.ShouldBeFalse();
            token.Valid(member).IsSuccess.ShouldBeFalse();
        }
        public void AunnCoo_RegexFunc_GenericRegexExprToken_ShouldBeValid()
        {
            var model = new AunnCoo {
                Name = "Alice", AunnRegexExpression = @"^(Al)\w+(e)$"
            };

            var context  = VerifiableObjectContractManager.Resolve <AunnCoo>().WithInstance(model);
            var member   = context.GetValue("Name");
            var contract = member.ExposeContract();
            Func <AunnCoo, Regex> expression = obj => new Regex(obj.AunnRegexExpression);

            var token = new ValueRegularExpressionToken <AunnCoo>(contract, expression);

            token.Valid(context).IsSuccess.ShouldBeTrue();
            token.Valid(member).IsSuccess.ShouldBeTrue();
        }
        public void AunnCoo_StringExprFunc_RegexExprToken_ShouldBeValid()
        {
            var model = new AunnCoo {
                Name = "Alice", AunnRegexExpression = @"^(Al)\w+(e)$"
            };

            var context  = VerifiableObjectContractManager.Resolve <AunnCoo>().WithInstance(model);
            var member   = context.GetValue("Name");
            var contract = member.ExposeContract();
            Func <object, string> expression = obj =>
            {
                if (obj is AunnCoo aunnCoo)
                {
                    return(aunnCoo.AunnRegexExpression);
                }

                return(string.Empty);
            };

            var token = new ValueRegularExpressionToken(contract, expression);

            token.Valid(context).IsSuccess.ShouldBeTrue();
            token.Valid(member).IsSuccess.ShouldBeTrue();
        }