From aed449e5655be4a539779e3e29742850b13c7ec5 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Tue, 20 May 2014 23:07:42 +0200 Subject: [PATCH] Add test for registering class with single instance scope --- test/poodinis/containertest.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/poodinis/containertest.d b/test/poodinis/containertest.d index 457553e..a1fb291 100644 --- a/test/poodinis/containertest.d +++ b/test/poodinis/containertest.d @@ -94,4 +94,13 @@ version(unittest) { } } + // Test resolve single instance for type + unittest { + auto container = new Container(); + container.register!(TestClass)().singleInstance(); + auto instance1 = container.resolve!(TestClass); + auto instance2 = container.resolve!(TestClass); + assert(instance1 is instance2); + } + } \ No newline at end of file