Mock get wrong connection String
<p>I am writing some tests. I am mocking entity framework. Yesterday worked everything correctly and I am almost sure I have not modified anything from yesterday.
In the app.config of my test project I have this connection string</p>

<pre><code>&lt;connectionStrings&gt;
  &lt;add name="PublicAreaContext"
      providerName="System.Data.SqlClient" connectionString="Server=.\SQLSERVER; ..." /&gt;
&lt;/connectionStrings&gt;
</code></pre>

<p>Now I mock my entity framework context:</p>

<pre><code>var mockContext = new Mock&lt;PublicAreaContext&gt;() { CallBase = true };
... // all my entities mocked
mockContext.Setup(x =&gt; x.SaveChanges()).Returns(1);
</code></pre>

<p>Now when I start my test something goes wrong, and the context seems to be created using the wrong connection string</p>

<p><a href="https://i.stack.imgur.com/JZ6Fr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JZ6Fr.png" alt="enter image description here"></a></p>

<p>I do not understand where it takes that connection string... I looked for it in the solution SQLEXPRESS and I do not find anything. In my server (SQLSERVER) I can find a database called Castle.Proxy.PublicAreaContext. I think is the database created yesterday when everything worked.</p>

<p>Can you tell me what can be the problem or how can I set correctly the connection string?</p>

<p>Thank you</p>