Example #1
0
 public Problem(Doap.Tests.TestResult res, string title, string desc,
                string detail, string testname)
 {
     this.Severity    = res.Severity;
     this.Title       = title;
     this.Description = desc;
     if (res.Error != null)
     {
         this.Detail = res.Error;
     }
     else
     {
         this.Detail = detail;
     }
     this.Test = testname;
 }
Example #2
0
        private ArrayList RunTests(string basetype)
        {
            ArrayList results  = new ArrayList();
            Assembly  assembly = Assembly.GetExecutingAssembly();

            Module [] modules = assembly.GetModules(false);

            Type [] tests = modules [0].FindTypes(
                new TypeFilter(IsValidatorTest),
                basetype);

            foreach (Type test in tests)
            {
                ConstructorInfo cinf = test.GetConstructor(
                    new Type [] { });
                Tests.ValidatorTest vt = (Tests.ValidatorTest)cinf.Invoke(
                    new object[] { });
                vt.Validator = this;
                Util.Inform(String.Format("Running {0}", test.FullName));
                Doap.Tests.TestResult rc = vt.Run();
                if (rc.Severity == Doap.Tests.Severity.Success)
                {
                    Util.Inform(String.Format("{0}: Success.", test.FullName));
                }
                else
                {
                    Util.Inform(String.Format("{0}: Failed.", test.FullName));
                    string desc = ((Tests.Description)
                                   Attribute.GetCustomAttribute(
                                       test, typeof(Tests.Description))).Content;
                    string detail = ((Tests.Detail)
                                     Attribute.GetCustomAttribute(
                                         test, typeof(Tests.Detail))).Content;

                    results.Add(new Problem(rc, desc, detail,
                                            rc.Error == null ? "" : rc.Error,
                                            test.FullName));
                }
            }

            return(results);
        }