2014-11-30 12:22:03 -08:00
|
|
|
|
using Microsoft.Practices.Unity;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrappers.Tests
|
|
|
|
|
{
|
|
|
|
|
public class MyUnityBootstrapper : UnityBootstrapper<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 MyUnityBootstrapper()
|
|
|
|
|
{
|
|
|
|
|
this.ConfigureLog = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Configure()
|
|
|
|
|
{
|
|
|
|
|
base.Configure();
|
|
|
|
|
this.ConfigureLog.Add("Configure");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void DefaultConfigureIoC(IUnityContainer container)
|
|
|
|
|
{
|
|
|
|
|
base.DefaultConfigureIoC(container);
|
|
|
|
|
this.ConfigureLog.Add("DefaultConfigureIoC");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ConfigureIoC(IUnityContainer 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 = "Unity")]
|
|
|
|
|
public class UnityTests : BootstrapperTests<MyUnityBootstrapper>
|
|
|
|
|
{
|
|
|
|
|
public UnityTests()
|
|
|
|
|
{
|
|
|
|
|
this.Autobinds = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override MyUnityBootstrapper CreateBootstrapper()
|
|
|
|
|
{
|
|
|
|
|
return new MyUnityBootstrapper();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|