2014-11-30 12:22:03 -08:00
|
|
|
|
using Castle.Windsor;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrappers.Tests
|
|
|
|
|
{
|
|
|
|
|
public class MyCastleWindsorBootstrapper : CastleWindsorBootstrapper<TestRootViewModel>, ITestBootstrapper
|
|
|
|
|
{
|
|
|
|
|
public List<string> ConfigureLog { get; set; }
|
|
|
|
|
|
2016-11-25 09:04:50 -08:00
|
|
|
|
public int DisposeCount { get; private set; }
|
|
|
|
|
|
2014-11-30 12:22:03 -08:00
|
|
|
|
public MyCastleWindsorBootstrapper()
|
|
|
|
|
{
|
|
|
|
|
this.ConfigureLog = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Configure()
|
|
|
|
|
{
|
|
|
|
|
base.Configure();
|
|
|
|
|
this.ConfigureLog.Add("Configure");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void DefaultConfigureIoC(IWindsorContainer container)
|
|
|
|
|
{
|
|
|
|
|
base.DefaultConfigureIoC(container);
|
|
|
|
|
this.ConfigureLog.Add("DefaultConfigureIoC");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ConfigureIoC(IWindsorContainer container)
|
|
|
|
|
{
|
|
|
|
|
base.ConfigureIoC(container);
|
|
|
|
|
this.ConfigureLog.Add("ConfigureIoC");
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-02 04:52:58 -08:00
|
|
|
|
public new object GetInstance(Type type)
|
2014-11-30 12:22:03 -08:00
|
|
|
|
{
|
2014-12-02 04:52:58 -08:00
|
|
|
|
return base.GetInstance(type);
|
2014-11-30 12:22:03 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public new void ConfigureBootstrapper()
|
|
|
|
|
{
|
|
|
|
|
base.ConfigureBootstrapper();
|
|
|
|
|
}
|
2016-11-25 09:04:50 -08:00
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
{
|
|
|
|
|
base.Dispose();
|
|
|
|
|
this.DisposeCount++;
|
|
|
|
|
}
|
2014-11-30 12:22:03 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestFixture(Category = "Castle Windsor")]
|
|
|
|
|
public class CastleWindsorTests : BootstrapperTests<MyCastleWindsorBootstrapper>
|
|
|
|
|
{
|
|
|
|
|
public CastleWindsorTests()
|
|
|
|
|
{
|
|
|
|
|
this.Autobinds = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override MyCastleWindsorBootstrapper CreateBootstrapper()
|
|
|
|
|
{
|
|
|
|
|
return new MyCastleWindsorBootstrapper();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|