Ejemplo n.º 1
0
        public ConstructableBean Pop()
        {
            ConstructableBean constructableBean = _beanStack.Pop();

            Assert(_beans.Contains(constructableBean));
            _beans.Remove(constructableBean);
            return(constructableBean);
        }
Ejemplo n.º 2
0
        public void ShouldNotConfuseConstructedGenerics()
        {
            var constructableBean = new ConstructableBean(typeof(List <int>), PureDI.Common.Constants.DefaultBeanName);

            cycleGuard.Push(constructableBean);
            Assert.IsFalse(cycleGuard.IsPresent(new ConstructableBean(typeof(List <string>), PureDI.Common.Constants.DefaultBeanName)));
            Assert.IsTrue(cycleGuard.IsPresent(constructableBean));
            cycleGuard.Pop();
            Assert.IsFalse(cycleGuard.IsPresent(constructableBean));
        }
Ejemplo n.º 3
0
        public void ConstructedGenericCycleGuardTest()
        {
            var constructableBean = new ConstructableBean(typeof(List <int>), PureDI.Common.Constants.DefaultBeanName);

            Assert.IsFalse(cycleGuard.IsPresent(constructableBean));
            cycleGuard.Push(constructableBean);
            Assert.IsTrue(cycleGuard.IsPresent(constructableBean));
            cycleGuard.Pop();
            Assert.IsFalse(cycleGuard.IsPresent(constructableBean));
        }
Ejemplo n.º 4
0
        public void SimpleCycleGuardTest()
        {
            var constructableBean = new ConstructableBean(typeof(string), PureDI.Common.Constants.DefaultBeanName);

            Assert.IsFalse(cycleGuard.IsPresent(constructableBean));
            cycleGuard.Push(constructableBean);
            Assert.IsTrue(cycleGuard.IsPresent(constructableBean));
            cycleGuard.Pop();
            Assert.IsFalse(cycleGuard.IsPresent(constructableBean));
        }
Ejemplo n.º 5
0
 public bool IsPresent(ConstructableBean constructableBean) => _beans.Contains(constructableBean);
Ejemplo n.º 6
0
 public void Push(ConstructableBean constructableBean)
 {
     Assert(!_beans.Contains(constructableBean));
     _beanStack.Push(constructableBean);
     _beans.Add(constructableBean);
 }