Unit Testing Sitecore LicenseManager
===

I'm trying to unit test with the Sitecore api.
I got a unit test project (MSTest) in my solution in Visual Studio. I copied the configSections, connectionStrings, appSettings, sitecore, log4net elements from my web.config to my app.config.

The test I'm trying to run is:

    Sitecore.Context.Database = Factory.GetDatabase("master");
    Item a = Sitecore.Context.Database.GetItem("/sitecore/content/Home");
    Assert.IsFalse(a.HasChildren);

I defined my datafolder in the app.config file and the connectionstrings to my core, master and web databases are also set in the app.config.

The exception that is thrown is:

    Test method foo.Bar.Framework.Tests.Core.UnitTest1.TestMethod1 threw exception: 
    System.TypeInitializationException: The type initializer for 'Sitecore.SecurityModel.License.LicenseManager' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///c:\inetpub\bin\Sitecore.Nexus.dll' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

The strange thing is, when i run it with "Run Test in Current Context" I don't get an exception. When I run it in TeamCity or with "Run All Tests in Solution" I get the exception.

Can anyone tell me what I did wrong?