Example #1
0
        private static void ReadVariableIO(StreamReader instream, TCFTestCase testCase, ref int lineNum)
        {
            TCFIOVariable variable = new TCFIOVariable();
            variable.LineNumber = lineNum;
            string line;

            while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.VariableEnd))
            {
                lineNum++;
                if (line.StartsWith(TCFProperties.Name))
                {
                    variable.Name = line.Substring(TCFProperties.Name.Length);
                }
                else if (line.StartsWith(TCFProperties.Type))
                {
                    variable.Type = line.Substring(TCFProperties.Type.Length);
                }
                else if (line.StartsWith(TCFProperties.Usage))
                {
                    variable.Usage = line.Substring(TCFProperties.Usage.Length);
                }
                else if (line.StartsWith(TCFProperties.Value))
                {
                    variable.Value = line.Substring(TCFProperties.Value.Length);
                }
            }
            lineNum++;
            testCase.Variables.Add(variable);
        }
Example #2
0
 private static void ReadTestCase(StreamReader instream, TCFContent tcf, ref int lineNum)
 {
     TCFTestCase testCase = new TCFTestCase();
     testCase.LineNumber = lineNum;
     string line;
     while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.TestCaseEnd))
     {
         lineNum++;
         if (line.StartsWith(TCFProperties.Procedure))
         {
             testCase.ProcedureName = line.Substring(TCFProperties.Procedure.Length);
         }
         else if (line.StartsWith(TCFProperties.Description))
         {
             testCase.Description.LineNumber = lineNum;
             testCase.Description.Text = line.Substring(TCFProperties.Description.Length);
         }
         else if (line.StartsWith(TCFTags.TestCaseDocumentBegin))
         {
             testCase.Documentation.LineNumber = lineNum;
             ReadTestCaseDocument(instream, testCase, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.StubBegin))
         {
             ReadStub(instream, testCase, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.VariableBegin))
         {
             ReadVariableIO(instream, testCase, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.DeclarationBegin))
         {
             testCase.Declarations.LineNumber = lineNum;
             testCase.Declarations.Text = GetContextBlock(instream,
                 TCFTags.DeclarationEnd, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.GlobalDeclarationsBegin))
         {
             testCase.GlobalDeclarations.LineNumber = lineNum;
             testCase.GlobalDeclarations.Text = GetContextBlock(instream,
                 TCFTags.GlobalDeclarationsEnd, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.InitCodeBegin))
         {
             testCase.InitializationCode.LineNumber = lineNum;
             testCase.InitializationCode.Text = GetContextBlock(instream,
                 TCFTags.InitCodeEnd, ref lineNum);
         }
         else if (line.StartsWith(TCFTags.CleanupCodeBegin))
         {
             testCase.CleanupCode.LineNumber = lineNum;
             testCase.CleanupCode.Text = GetContextBlock(instream,
                 TCFTags.CleanupCodeEnd, ref lineNum);
         }
     }
     lineNum++;
     tcf.TestCases.Add(testCase);
 }
Example #3
0
 private static void ReadTestCaseDocument(StreamReader instream, TCFTestCase testCase, ref int lineNum)
 {
     string line;
     while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.TestCaseDocumentEnd))
     {
         lineNum++;
         testCase.Documentation.Text += (line + "\n");
     }
     lineNum++;
 }
Example #4
0
 private static void ReadStub(StreamReader instream, TCFTestCase testCase, ref int lineNum)
 {
     TCFStub stub = new TCFStub();
     stub.LineNumber = lineNum;
     string line;
     while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.StubEnd))
     {
         lineNum++;
         if (line.StartsWith(TCFProperties.Procedure))
         {
             stub.Name = line.Substring(TCFProperties.Procedure.Length);
         }
         else if (line.StartsWith(TCFProperties.TerminateCount))
         {
             stub.TerminateCount = line.Substring(TCFProperties.TerminateCount.Length);
         }
         else if (line.StartsWith(TCFTags.HitCountBegin))
         {
             string setting = "";
             string specified = "";
             while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.HitCountEnd))
             {
                 lineNum++;
                 if (line.StartsWith(TCFProperties.Setting))
                     setting = line.Substring(TCFProperties.Setting.Length);
                 else if (line.StartsWith(TCFProperties.Specified))
                     specified = line.Substring(TCFProperties.Specified.Length);
             }
             lineNum++;
             if (setting == "1")
                 stub.HitCount = "0";
             else
                 stub.HitCount = specified;
         }
         else if (line.StartsWith(TCFTags.StubReturnValueBegin))
         {
             while (!(line = instream.ReadLine().Trim()).StartsWith(TCFTags.StubReturnValueEnd))
             {
                 lineNum++;
                 if (line.StartsWith(TCFProperties.StubReturnType))
                 {
                     stub.ReturnType = line.Substring(TCFProperties.StubReturnType.Length);
                 }
                 else if (line.StartsWith(TCFProperties.Value))
                 {
                     stub.ReturnValue = line.Substring(TCFProperties.Value.Length);
                 }
             }
             lineNum++;
         }
     }
     lineNum++;
     testCase.Stubs.Add(stub);
 }