Exemple #1
0
        /*============================================================================*/
        /* Private Functions                                                          */
        /*============================================================================*/

        private void RemoveAllHandlers(bool includeFallback)
        {
            if (includeFallback && _fallbackContainer != null)
            {
                _registry.RemoveContainer(_fallbackContainer);
            }

            foreach (object container in _containers)
            {
                ContainerBinding binding = _registry.GetBinding(container);
                RemoveHandlers(binding);
            }
        }
        public void binding_returns_with_correct_interested_parent_chain_after_removal()
        {
            List <TreeContainerSupport> searchTrees = CreateTrees(5, 4);

            registry.AddContainer(searchTrees[0]);
            registry.AddContainer(searchTrees[1]);
            registry.AddContainer(searchTrees[1].children[3].children[2].children[3]);
            registry.AddContainer(searchTrees[1].children[3].children[2]);
            registry.AddContainer(searchTrees[1].children[3]);

            registry.RemoveContainer(searchTrees[1].children[3].children[2]);

            SupportContainer searchItem = searchTrees[1].children[3].children[2].children[3].children[3];

            ContainerBinding result = registry.FindParentBinding(searchItem);

            Assert.That(searchTrees[1].children[3].children[2].children[3], Is.EqualTo(result.Container), "Binding returns with correct container view");
            Assert.That(searchTrees[1].children[3], Is.EqualTo(result.Parent.Container), "Binding returns with correct container parent view");
            Assert.That(searchTrees[1], Is.EqualTo(result.Parent.Parent.Container), "Binding returns with correct container parent parent view");
            Assert.That(result.Parent.Parent.Parent, Is.Null, "Further parents are null");
        }