Пример #1
0
		public void DisposingActivationScopeReleasesAllInstancesCreatedTherein()
		{
			DisposableMock obj1;
			DisposableMock obj2;

			using (var kernel = new StandardKernel())
			{
				obj1 = kernel.Get<DisposableMock>();

				Assert.That(obj1, Is.Not.Null);

				using (var scope = kernel.CreateScope())
				{
					obj2 = scope.Get<DisposableMock>();
					Assert.That(obj2, Is.Not.Null);
				}

				Assert.That(obj1.Disposed, Is.False);
				Assert.That(obj2.Disposed, Is.True);
			}
		}