public void DisposableObjectIsDisposedWhenReleased()
		{
			using (var kernel = new StandardKernel())
			{
				var mock = kernel.Get<DisposableMock>();
				Assert.That(mock, Is.Not.Null);

				kernel.Release(mock);
				Assert.That(mock.Disposed, Is.True);
			}
		}
		public void SelfBoundTypesDeclaringMethodInterceptorsCanBeReleased()
		{
			var testModule = new InlineModule(m => m.Bind<ObjectWithMethodInterceptor>().ToSelf());

			using (var kernel = new StandardKernel(new DynamicProxy2Module(), testModule))
			{
				var obj = kernel.Get<ObjectWithMethodInterceptor>();
				Assert.That(obj, Is.Not.Null);

				kernel.Release(obj);
			}
		}
		public void StartableObjectIsStoppedWhenReleased()
		{
			using (var kernel = new StandardKernel())
			{
				var mock = kernel.Get<StartableMock>();
				Assert.That(mock, Is.Not.Null);
				Assert.That(mock.Started, Is.True);

				kernel.Release(mock);
				Assert.That(mock.Started, Is.False);
			}
		}
		public void DisposingObjectRemovesSubscriptionsRequestedByIt()
		{
			using (var kernel = new StandardKernel(new MessageBrokerModule()))
			{
				var pub = kernel.Get<PublisherMock>();
				Assert.That(pub, Is.Not.Null);

				var sub = kernel.Get<SubscriberMock>();
				Assert.That(sub, Is.Not.Null);

				var messageBroker = kernel.Components.Get<IMessageBroker>();
				var channel = messageBroker.GetChannel("message://PublisherMock/MessageReceived");
				Assert.That(channel.Subscriptions.Count, Is.EqualTo(1));

				kernel.Release(sub);
				Assert.That(channel.Subscriptions, Is.Empty);
			}
		}