mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add extra testcase
This commit is contained in:
parent
44c41b1579
commit
c0553967c9
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue