Example #1
0
        static bool ValidateLibraryClass()
        {
            var validator = new Validator("First.Library");

            validator.AddMethod("ShowCustomers", typeof(void));
            validator.AddMethod("ShowTransactions", typeof(void), new Type[] { typeof(bool) });
            validator.AddMethod("IsBorrowed", typeof(bool), new Type[] { Utils.Object.GetClassType("First.Book") });
            validator.AddMethod("IsTransactionAllowed", typeof(bool), new Type[] { Utils.Object.GetClassType("First.Book"), Utils.Object.GetClassType("First.Customer") });

            return(validator.Validate());
        }
Example #2
0
        static bool ValidateTransactionClass()
        {
            var validator = new Validator("First.Transaction");

            validator.AddProperty("Book", Utils.Object.GetClassType("First.Book"));
            validator.AddProperty("Customer", Utils.Object.GetClassType("First.Customer"));
            validator.AddProperty("LoanDate", typeof(DateTime));

            validator.AddMethod("IsLoanExpired", typeof(bool));
            validator.AddMethod("Print", typeof(void));

            return(validator.Validate());
        }
Example #3
0
        static bool ValidateBookClass()
        {
            var validator = new Validator("First.Book");

            validator.AddProperty("Title", typeof(string));
            validator.AddProperty("Author", typeof(string));
            validator.AddProperty("RequiredAge", typeof(int));

            validator.AddMethod("AllowedToRead", typeof(bool), new Type[] { Utils.Object.GetClassType("First.Customer") });
            validator.AddMethod("Print", typeof(void));

            return(validator.Validate());
        }