Exemplo n.º 1
0
        public void TestInstanceIsReusedWithinContainer()
        {
            ContainerBuilder containerBuilder = new ContainerBuilder();

            containerBuilder.Register("bar", delegate(Container c) { return(new Bar()); }).Reused();
            Container container = containerBuilder.Create();
            //
            object bar1 = container.Resolve("bar");
            object bar2 = container.Resolve("bar");

            //
            Asserts.AssertSame(bar1, bar2);
        }