protected void AddChild(CTestBase child) { //Setup the parent child.Parent = this; //Inheritance of attributes child.Attribute.Parent = this.Attribute; //Adjust the Id (if not set) if (child.id <= 0) { child.id = Children.Count + 1; } //Only add implemented items //Note: we still increment id counts, to save the 'spot' once they are implemented if (child.Implemented || CModInfo.IncludeNotImplemented) { //Determine any children of this node (before adding it) //Note: We don't call 'determinechildren' from within the (testcase) constructor //since none of the attributes/properties are setup until now. So as soon as we //setup that information then we call determinechildren which when implemented //for dynamic tests can now look at those properties (otherwise they wouldn't be setup //until after the constructor returns). child.DetermineChildren(); //Add it to our list... Children.Add(child); } }
static public bool Equals(bool equal, string message) { try { //Equals is identical to Compare, except that Equals doesn't throw. //This way if We still want to throw the exception so we get the logging and comapre block //but the test wants to continue to do other things. return(CError.Compare(equal, message)); } catch (Exception e) { CTestBase.HandleException(e); return(false); } }
static public bool Warning(object actual, object expected, string message, Exception inner) { //See if these are equal bool equal = InternalEquals(actual, expected); if (equal) { return(true); } try { //Throw a warning exception throw new CTestException(CTestBase.TEST_WARNING, message, actual, expected, inner); } catch (Exception e) { //Warning should continue - not halt test progress CTestBase.HandleException(e); return(false); } }
private static void RunTestCase(CTestBase testCase) { var module = new XmlConvertTests(); module.Init(null); module.AddChild(testCase); module.Execute(); Assert.Equal(0, module.FailCount); }
protected void AddChild(CTestBase child) { //Setup the parent child.Parent = this; //Inheritance of attributes child.Attribute.Parent = this.Attribute; //Adjust the Id (if not set) if (child.id <= 0) child.id = Children.Count + 1; //Only add implemented items //Note: we still increment id counts, to save the 'spot' once they are implemented if (child.Implemented || CModInfo.IncludeNotImplemented) { //Determine any children of this node (before adding it) //Note: We don't call 'determinechildren' from within the (testcase) constructor //since none of the attributes/properties are setup until now. So as soon as we //setup that information then we call determinechildren which when implemented //for dynamic tests can now look at those properties (otherwise they wouldn't be setup //until after the constructor returns). child.DetermineChildren(); //Add it to our list... Children.Add(child); } }