示例#1
0
    static void Main(string[] args)
    {
      Console.Write("\n  Testing TestRequest");
      Console.Write("\n =====================");

      string savePath = "../../test/";
      string fileName = "TestRequest1.xml";

      if (!System.IO.Directory.Exists(savePath))
        System.IO.Directory.CreateDirectory(savePath);
      string fileSpec = System.IO.Path.Combine(savePath, fileName);
      fileSpec = System.IO.Path.GetFullPath(fileSpec);

      TestRequest tr = new TestRequest();
      tr.author = "Nishant Agrawal";

        TestDriver td1 = new TestDriver();
        td1.driverName = "td1.cs";
        td1.testedFiles.Add("tf1.cs");
        td1.testedFiles.Add("tf2.cs");
        tr.testDrivers.Add(td1);

      tr.makeRequest();
      Console.Write("\n{0}", tr.doc.ToString());

      Console.Write("\n  saving to \"{0}\"", fileSpec);
      tr.saveXml(fileSpec);

      Console.Write("\n  reading from \"{0}\"", fileSpec);

      TestRequest tr2 = new TestRequest();
      tr2.loadXml(fileSpec);
      Console.Write("\n{0}", tr2.doc.ToString());
      Console.Write("\n");

      tr2.parse("author");
      Console.Write("\n  author is \"{0}\"", tr2.author);

      tr2.parse("dateTime");
      Console.Write("\n  dateTime is \"{0}\"", tr2.dateTime);

      tr2.parseDr("test");
      Console.Write("\n  testedFiles are:");
      foreach(TestDriver td in tr2.testDrivers)
      {
                Console.Write("\n  testDriver is \"{0}\"", td.driverName);
                foreach (string file in td.testedFiles)
            {
                Console.Write("\n    \"{0}\"", file);
            }
           
      }
      Console.Write("\n\n");
    }
示例#2
0
        //parse a request using the TestRequest package
        public void parseRequest(string bfileSpec)
        {
            TestRequest tr2 = new TestRequest();

            tr2.loadXml(bfileSpec);
            tr2.parse("author");
            tr2.parse("dateTime");
            tr2.parseDr("test");

            testRequests.Add(tr2);
        }