public ConstructableBean Pop() { ConstructableBean constructableBean = _beanStack.Pop(); Assert(_beans.Contains(constructableBean)); _beans.Remove(constructableBean); return(constructableBean); }
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)); }
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)); }
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)); }
public bool IsPresent(ConstructableBean constructableBean) => _beans.Contains(constructableBean);
public void Push(ConstructableBean constructableBean) { Assert(!_beans.Contains(constructableBean)); _beanStack.Push(constructableBean); _beans.Add(constructableBean); }