public void should_parse_responses()
        {
            // Arrange
            var stringBuilder = new StringBuilder();
            var httpLogWriter = new HttpLogWriter(new StringWriter(stringBuilder));
            var httpClient = new HttpClient(httpLogWriter, new RestClient());

            var config = new Config();

            string xml = TestHelpers.ReadEmbeddedFile("parseresponses.xml", XmlExamplesFolder);
            var stringReader = new StringReader(xml);
            var reader = new TestCaseReader();
            var caseCollection = reader.Read(stringReader);
            var runner = new TestSessionRunner(config, httpClient, new ConsoleResultWriter());

            // Act
            TestCaseSession result = runner.Run(caseCollection);

            // Assert
            DumpAsYaml(result);
        }
        public void should_post()
        {
            // Arrange
            //_streamWriter = new StreamWriter(new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write));
            var stringBuilder = new StringBuilder();
            var stringWriter = new StringWriter(stringBuilder);

            var config = new Config();
            config.GlobalHttpLog = LogType.All;
            var httpClient = new HttpClient(new HttpLogWriter(stringWriter), new RestClient());

            var resultWriter = new TextResultWriter(stringWriter);

            string xml = TestHelpers.ReadEmbeddedFile("roadkill-login.xml", XmlExamplesFolder);
            var stringReader = new StringReader(xml);
            var reader = new TestCaseReader();

            var runner = new TestSessionRunner(config, httpClient, resultWriter);
            var caseCollection = reader.Read(stringReader);

            // Act
            TestCaseSession session = runner.Run(caseCollection);

            // Assert
            DumpAsXml(session);
            DumpAsYaml(session);

            Console.WriteLine(stringBuilder);
        }
        /// <summary>
        /// Starts the test case XML file run.
        /// </summary>
        internal void StartSession(SessionRunnerTaskInfo item)
        {
            try
            {
                // TODO: this run could be for a user run only, not the entire team (read the XML from their folder?)
                string username = item.Username;
                string teamName = item.TeamName;

                // Read in the XML file from the team folder, e.g. "c:\testcases\myteam\test1.xml"
                string fullPath = Path.Combine(_appConfig.TestCasesBaseDirectory, teamName, item.Request.Filename);
                string xml = File.ReadAllText(fullPath);

                using (var stringReader = new StringReader(xml))
                {
                    var testCaseReader = new TestCaseReader();
                    CaseCollection caseCollection = testCaseReader.Read(stringReader);
                    var config = new Config();
                    var logStringBuilder = new StringBuilder();
                    var httpLogWriter = new HttpLogWriter(new StringWriter(logStringBuilder));
                    var httpClient = new HttpClient(httpLogWriter, new RestClient());

                    var runner = new TestSessionRunner(config, httpClient, new TextFileResultWriter());
                    item.Runner = runner;
                    runner.Run(caseCollection);
                }
            }
            catch (Exception e)
            {
                item.Errors = e.ToString();
            }
        }