/// <summary> /// Reads the test case xml from the file. If not specified, reads the xml from Console.In. /// </summary> /// <param name="testCaseFilePath"></param> /// <returns></returns> internal bool LoadTestCase(string testCaseFilePath) { // Read the test case xml XDocument testCaseXDoc = null; if (!String.IsNullOrEmpty(testCaseFilePath)) { try { testCaseXDoc = XDocument.Load(testCaseFilePath); } catch (Exception ex) { Error = "Could not load test case description file."; ErrorEx = ex; return(false); } } else { try { testCaseXDoc = XDocument.Load(Console.In); } catch (Exception ex) { Error = "Could not load test case description from the standard input stream."; ErrorEx = ex; return(false); } } //Validate the xml try { UnitTestingSchemaUtil.ValidateTestCaseXml(testCaseXDoc); } catch (Exception ex) { Error = "Invalid test case xml: " + ex.Message; return(false); } // Create the RunningTestCase instance try { metadata = new TestCaseMetadata(testCaseXDoc.Root); testController = CreateTestController(metadata.TestTypeName); if (testController == null) { return(false); } runner = testController.CreateRunner(); if (runner == null) { Error = testController.GetType().Name + ".CreateRunner didn't return a runner instance."; return(false); } } catch (Exception ex) { Error = "Error with test case."; ErrorEx = ex; return(false); } return(Error == null); }