public void MultipleTransientReferences() { MyHandler handler = new MyHandler( model ); handler.Init( kernel ); object instance1 = handler.Resolve(); object instance2 = handler.Resolve(); object instance3 = handler.Resolve(); AssertNotNull( instance1 ); AssertNotNull( instance2 ); AssertNotNull( instance3 ); Assert( handler.IsOwner( instance1 ) ); Assert( handler.IsOwner( instance2 ) ); Assert( handler.IsOwner( instance3 ) ); Assert( !handler.IsOwner( new object() ) ); handler.Release( instance3 ); Assert( !handler.IsOwner( instance3 ) ); handler.Release( instance2 ); Assert( !handler.IsOwner( instance2 ) ); handler.Release( instance1 ); Assert( !handler.IsOwner( instance1 ) ); }
public void TransientReferences() { MyHandler handler = new MyHandler( model ); handler.Init( kernel ); object instance = handler.Resolve(); AssertNotNull( instance ); Assert( handler.IsOwner( instance ) ); handler.Release( instance ); Assert( !handler.IsOwner( instance ) ); }