Пример #1
0
        public void TransientDoesNotRegisterAsSingleton_ButManagesSingletonWithinIt()
        {
            IContainer container = new InfuseContainer();

            container.Register <IChat, Chatroom>(LifecycleType.Singleton);
            container.RegisterTransient <IPerson, PersonA>();

            string talkMsg = "Hello";

            var a = container.Resolve <IPerson>();
            var b = container.Resolve <IPerson>();

            Assert.NotSame(a, b);

            a.Say(talkMsg);
            Assert.Equal(talkMsg, b.Listen());
        }