I have the following code:
namespace ConectorV2
{
[assembly:InternalsVisibleTo("Pruebas")]
internal static class Utilidades
{
internal static string extraerCadenaDeConexion()
{
return extraerCadenaDeConexion(new XElement());
}
internal static string extraerCadenaDeConexion(XElement documento)
{
throw new NotImplementedException();
}
}
}
and then in the Pruebas project:
namespace Pruebas.ConectorV2.Cliente
{
[TestFixture]
class ModuloExtraerCadenaDeConexion
{
[Test]
public void devuelveCadenaSolicitada()
{
var mock = new MockRepository();
var appSettings =
XElement.Parse(
@"<appSettings>
<setting key='dbtype' value='SQLSERVER' />
<setting key='SQLSERVER' value='prueba' />
</appSettings>");
Assert.That(ConectorV2.Utilidades.extraerCadenaDeConexion(appSettings), Is.EqualTo("prueba"));
}
}
}
I get the following error on compile:
The type or namespace name ‘Utilidades’ does not exist in the namespace Pruebas.ConectorV2′ (are you missing an assembly reference?)
The assembly is correctly referenced in my pruebas project and I read on msdn that the default assembly name for a project is the project name… what am I missing?
You shouldn’t use assembly level attributes on classes! Just do so:
it should work