Add extra testcase

This commit is contained in:
Mike Bierlee 2016-08-23 21:20:54 +02:00
parent 44c41b1579
commit c0553967c9

View file

@ -191,6 +191,14 @@ version(unittest) {
} }
} }
class Wallpaper {
public Color color;
this(Color color) {
this.color = color;
}
}
// Test register concrete type // Test register concrete type
unittest { unittest {
auto container = new shared DependencyContainer(); auto container = new shared DependencyContainer();
@ -676,4 +684,15 @@ version(unittest) {
assert(instance.moolah is container.resolve!Moolah); assert(instance.moolah is container.resolve!Moolah);
assert(instance.red is container.resolve!Red); assert(instance.red is container.resolve!Red);
} }
// Test injecting constructor with super-type parameter
unittest {
auto container = new shared DependencyContainer();
container.register!Wallpaper;
container.register!(Color, Blue);
auto instance = container.resolve!Wallpaper;
assert(instance !is null);
assert(instance.color is container.resolve!Blue);
}
} }