title: C# Methods not printing proper values
body: <p>I have two methods General and SearchTab below. When I look at my report file, I see that the values for the General Methods as:</p>
  
  <p>TestName:</p>
  
  <p>TestMachine: Maya</p>
  
  <p>TestUser: Administrator</p>
  
  <p>TestTime: 6/13/2011 12:02</p>
  
  <p>TestStatus: FAIL</p>
  
  <p>TestExpectedResult:</p>
  
  <p>TestActualResult:</p>
  
  <p>TestComments: </p>
  
  <p>TestName, TestExpectedResult, TestActualResult, and TestComments are blank whereas they should have values:</p>
  
  <p>TestName: Test 1: General, </p>
  
  <p>TestExpectedResult: 'Home' tab should be present, </p>
  
  <p>TestActualResult: Home tab found</p>
  
  <p>TestComments: Home tab found</p>
  
  <p>Also, the TestStatus should have been PASS instead of FAIL.</p>
  
  <p>It looks like even though I reassigned the values of these variables in the method General, they are still printing the values that were assigned to them inside the constructor.</p>
  
  <p>The problem is the same for the second method SearchTab.</p>
  
  <p>Please help me figure out the problem.</p>
  
  <pre><code>namespace Automation
  {
  [TestClass]
  public class FunctionalTest
  {
      public ISelenium Sel;
      public StringBuilder Err;
      public string Report = "C:\Report.XLS";
      public string[] arrTestResults = new string[8];
      public string TestName;
      public string TestMachine;
      public string TestUser;
      public string TestTime;
      public string TestStatus;
      public string TestExpectedResult;
      public string TestActualResult;
      public string TestComments;
  
      // Constructor
      public FunctionalTest()
      {
  
          TestName = arrTestResults[0];
          TestMachine = arrTestResults[1] = System.Environment.MachineName.ToString();
          TestUser = arrTestResults[2] = System.Environment.UserName.ToString();
          TestTime = arrTestResults[3] = System.DateTime.Now.ToString();
          TestStatus = arrTestResults[4] = "FAIL";
          TestExpectedResult = arrTestResults[5];
          TestActualResult = arrTestResults[6];
          TestComments = arrTestResults[7];
      }
  
      public void WriteReport(string[] arrResults)
      {
          int iLastRow, iCnt1;
  
          if (File.Exists(Report))
          {
              Excel.Application xlApp;
              Excel.Workbook xlWorkBook;
              Excel.Worksheet xlWorkSheet;
              Excel.Range range;
  
              Object misValue = System.Reflection.Missing.Value;
              xlApp = new Excel.Application();
              xlWorkBook = xlApp.Workbooks.Add(misValue);
              xlWorkBook = xlApp.Workbooks.Open(Report, 0, false, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
              xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
  
              range = xlWorkSheet.UsedRange;
              iLastRow = range.Rows.Count;
              for (iCnt1 = 1; iCnt1 &lt; 9; iCnt1++)
              {
                  xlWorkSheet.Cells[iLastRow + 1, iCnt1] = arrResults[iCnt1 - 1];
              }
              xlWorkBook.Save();
              xlApp.Quit();
              releaseObject(xlWorkSheet);
              releaseObject(xlWorkBook);
              releaseObject(xlApp);
          }
          else
          {
              Console.WriteLine("Report File " + Report + " does not exist");
          }
      }
  
      [TestMethod]
      public void General()
      {
          TestName = "Test 1: General";
          TestExpectedResult = "'Home' tab should be present";
          if (Sel.IsElementPresent("TAB_Home")))
          {
  
                  TestStatus = "PASS";
                  TestActualResult = "Home tab found";
                  TestComments = TestActualResult;
          }
              else
              {
                  TestActualResult = "Home tab not found";
                  TestComments = TestActualResult;
  
              }
  
              //Write to report
              WriteReport(arrTestResults);
          }
      }
  
      [TestMethod]
      public void SearchTab()
      {
          TestName = "Test 2: Search Tab";
          TestExpectedResult = "Search tab should be present";
          // Assigning TestStatus to FAIL because TestStatus is PASS right now from the previous test method
          TestStatus = "FAIL";
  
          if (Sel.IsElementPresent("TAB_Search"))
          {
              sActual = "Search Tab found";
              arrTestResults[7] = sActual;
              TestComments = TestActualResult;
              TestStatus = "PASS";
          }
          else
          {
              TestActualResult = "Search tab not found";
              TestComments = TestActualResult;
          }
  
          //Write to report
          WriteReport(arrTestResults);
      }
  
  
  }
  }
  </code></pre>