title: Reading a connection string from a class library
body: <p>I am currently struggling to read a connection string from the <code>App.config</code> inside my WinForms application from my Class Library (and Unit Testing).</p>
  
  <p>I added a 'test' entry to the <code>App.config</code>;</p>
  
  <pre><code>&lt;connectionStrings&gt;
       &lt;add name="MyConnString" connectionString="Test;" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>My TestMethod looks like this;</p>
  
  <pre><code>    [TestMethod]
      public void TestConnection1()
      {
          string connString = "";
  
          if (ConfigurationManager.ConnectionStrings["MyConnString"] != null)
          {
              connString = ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString;
          }
  
          string expected = "Test;";
          string actual = connString;
  
          Assert.AreEqual(expected, actual);
      }
  </code></pre>
  
  <p>This, obviously, fails. <code>Actual</code>'s value is empty.
  What am I doing wrong?</p>
  
  <p><img src="https://i.stack.imgur.com/VWcmm.png" alt="enter image description here"></p>