He escrito la siguiente prueba simple para tratar de aprender la interfaz fluida de Castle Windsor:
using NUnit.Framework;
using Castle.Windsor;
using System.Collections;
using Castle.MicroKernel.Registration;
namespace WindsorSample {
public class MyComponent : IMyComponent {
public MyComponent(int start_at) {
this.Value = start_at;
}
public int Value { get; private set; }
}
public interface IMyComponent {
int Value { get; }
}
[TestFixture]
public class ConcreteImplFixture {
[Test]
public void ResolvingConcreteImplShouldInitialiseValue() {
IWindsorContainer container = new WindsorContainer();
container.Register(Component.For<IMyComponent>().ImplementedBy<MyComponent>().Parameters(Parameter.ForKey("start_at").Eq("1")));
IMyComponent resolvedComp = container.Resolve<IMyComponent>();
Assert.AreEqual(resolvedComp.Value, 1);
}
}
}
Cuando ejecuto la prueba a través de TestDriven.NET obtengo el siguiente error:
System.TypeLoadException : Could not load type 'Castle.MicroKernel.Registration.IRegistration' from assembly 'Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
at WindsorSample.ConcreteImplFixture.ResolvingConcreteImplShouldInitialiseValue()
Cuando ejecuto la prueba a través de la GUI de NUnit obtengo:
WindsorSample.ConcreteImplFixture.ResolvingConcreteImplShouldInitialiseValue:
System.IO.FileNotFoundException : Could not load file or assembly 'Castle.Windsor, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.
Si abro la Asamblea que estoy haciendo referencia en Reflector, puedo ver que su información es:
Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc
y que definitivamente contiene Castle.MicroKernel.Registration.IRegistration
¿Qué podría estar pasando?
Debo mencionar que los binarios se tomaron de la última versión de Castle, aunque nunca he trabajado con nant, así que no me molesté en volver a compilar desde la fuente y simplemente tomé los archivos en el directorio bin. También debo señalar que mi proyecto se compila sin problemas.
