Good morning. I am setting up a test project to test a webapi (for now only the controllers). This uses Unity for the dependency injection.
For this, in my test project I have included the Unity 4.0.1 library and I have made the following changes.
In the app.config I have included the following block.
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration, Version=4.0.0.0" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<unity configSource="Unity.config" />
And I have copied the Unity.config file that I have in the webapi. This file is correct and valid because it is the same one that the webapi uses and works correctly.
In the initialization function of the test I do the following:
UnityContainer container = new UnityContainer();
container.LoadConfiguration();
When I launch the debugging test, the second line throws me the following error.
No se puede abrir el archivo configSource 'Unity.config'.
(C:\Proyecto\UnitTestProject\bin\Debug\UnitTestProject.dll.config line 8)
I've been reviewing documentation and apparently I have everything right. Does anyone know what may be happening?