mirror of https://github.com/AMT-Cheif/Stylet.git
Improve test coverage slightly
This commit is contained in:
parent
ccc55dc800
commit
9ab3655c5f
|
@ -338,7 +338,7 @@ namespace StyletIoC.Internal
|
|||
}
|
||||
else
|
||||
{
|
||||
// This will throw a StyletIoCRegistrationException is GetSingle is requested
|
||||
// This will throw a StyletIoCRegistrationException if GetSingle is requested
|
||||
registrations = new EmptyRegistrationCollection(typeKey.Type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,15 @@ namespace StyletUnitTests
|
|||
this.C1Func = c1Func;
|
||||
}
|
||||
}
|
||||
private interface I1 { }
|
||||
public interface I1 { }
|
||||
private class C11 : I1 { }
|
||||
private class C12 : I1 { }
|
||||
|
||||
public interface I1Factory
|
||||
{
|
||||
I1 GetI1();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FuncFactoryWorksForGetNoKey()
|
||||
{
|
||||
|
@ -101,5 +106,19 @@ namespace StyletUnitTests
|
|||
Assert.IsInstanceOf<C11>(funcCollection[0]());
|
||||
Assert.IsInstanceOf<C12>(funcCollection[1]());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FuncFactoryOfAbstractFactoryWorksAsExpected()
|
||||
{
|
||||
var builder = new StyletIoCBuilder();
|
||||
builder.Bind<I1>().To<C11>();
|
||||
builder.Bind<I1Factory>().ToAbstractFactory();
|
||||
var ioc = builder.BuildContainer();
|
||||
|
||||
var func = ioc.Get<Func<I1Factory>>();
|
||||
Assert.IsNotNull(func);
|
||||
var i1 = func().GetI1();
|
||||
Assert.IsInstanceOf<C11>(i1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue