Ejemplo n.º 1
0
        public void AunnCoo_One_For_NotInToken_And_ShouldBeInvalid()
        {
            var model = new AunnCoo
            {
                Name = "N"
            };

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

            var token = new ValueNotInToken(contract, new List <object> {
                "Nice", "Duo", "Long", "N"
            });

            token.Valid(context).IsSuccess.ShouldBeFalse();
            token.Valid(member).IsSuccess.ShouldBeFalse();
        }
Ejemplo n.º 2
0
        public void AunnCoo_List_For_GenericNotInToken_And_ShouldBeValid()
        {
            var model = new AunnCoo
            {
                Tags = new List <string> {
                    "Nice", "Normal", "New"
                }
            };

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

            var token = new ValueNotInToken <List <string>, string>(contract, new List <string> {
                "Bad", "Duo", "Long"
            });

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