BoDi.Tests.NamedRegistrationTests.ShouldNotReuseObjectsWithTheSameTypeButResolvedWithDifferentName C# (CSharp) Метод

ShouldNotReuseObjectsWithTheSameTypeButResolvedWithDifferentName() приватный Метод

private ShouldNotReuseObjectsWithTheSameTypeButResolvedWithDifferentName ( ) : void
Результат void
        public void ShouldNotReuseObjectsWithTheSameTypeButResolvedWithDifferentName()
        {
            var container = new ObjectContainer();
            container.RegisterTypeAs<VerySimpleClass, IInterface1>("a_name");
            container.RegisterTypeAs<VerySimpleClass, IInterface1>("another_name");

            // when

            var obj = container.Resolve<IInterface1>("a_name");
            var otherObj = container.Resolve<IInterface1>("another_name");

            // then

            obj.ShouldNotBeSameAs(otherObj);
        }