title: How to Run parallel Test Method in single class using Nunit, C# -ThreadSafe Driver
body: <p>I am new to C#, i am not able to make driver thread safe. I am able to open the two browser as soon as second browser opens, first driver lose its references.</p>
  
  <p>below is my code i have three class</p>
  
  <pre><code>namespace TestAutomation{
  [TestFixture]
  [Parallelizable(ParallelScope.Children)]
  public class UnitTest1 : Setup
  {
      [Test, Property("TestCaseID","123")]
      public void TestMethod1(this IWebDriver driver1)
      {
          driver1.Navigate().GoToUrl("https://www.google.com");
          driver1.FindElement(By.Name("q")).SendKeys("test1");
          Thread.Sleep(10000);
      }
  
  
      [Test, Property("TestCaseID", "234")]
      public void TestMethod2()
      {
          driver.Navigate().GoToUrl("https://www.google.com");
          driver.FindElement(By.Name("q")).SendKeys("test2");
          Thread.Sleep(15000);
  
      }
  }}
  </code></pre>
  
  <p>Setup Class</p>
  
  <pre><code>namespace TestAutomation{
  public class Setup:WebDriverManager
  {
  
  
      [SetUp]
      public void  setupBrowser()
      {
  
          driver = new ChromeDriver("C:\\Users\\Downloads\\chromedriver_win32");
  
  
      }
  
      [TearDown]
      public  void CloseBrowser()
      {
          driver.Close();
          driver.Quit();
         // driver.Close();
          //driver.Quit;
      }
  }}
  </code></pre>
  
  <p>Webdrivermanager</p>
  
  <pre><code>namespace TestAutomation{
   public class WebDriverManager
  {
      public  IWebDriver driver { get; set; }
  }
  }
  </code></pre>
  
  <p>i am looking for a solution like ThreadLocal injava where i can get and set the driver for each thread in the setup method</p>