Пример #1
0
        public void NestDoubleAddError()
        {
            var egg  = new TestEgg();
            var nest = new Nest();

            nest.Add(egg);
            Assert.Throws <ContainNestException>(() => nest.Add(egg));
        }
Пример #2
0
        public INodeContent CreateContent(ILinkedNode parent)
        {
            var content = new NodeContent();

            Root.Add(content);
            content.SetParentNode(parent);
            return(content);
        }
Пример #3
0
        public void EggAddEvent()
        {
            var nest = new Nest();
            var egg  = new TestEgg();
            var flag = false;

            egg.Knock += args => flag = args.Type == NestEggEventType.Added;
            nest.Add(egg);
            Assert.True(flag);
        }
Пример #4
0
        public void EggBubleEvent()
        {
            var nest = new Nest();
            var egg  = new TestEgg();
            var flag = false;

            nest.Knock += args => flag = args.Type == NestEggEventType.Custom && args.Self == egg;
            nest.Add(egg);
            egg.InvokeTest();
            Assert.True(flag);
        }
Пример #5
0
        public void EggMoveEvent()
        {
            var nest  = new Nest();
            var nest2 = new Nest();
            var egg   = new TestEgg();
            var flag  = false;

            egg.Knock += args => flag = args.Type == NestEggEventType.Moved && args.From == nest && args.To == nest2;
            nest.Add(egg);
            nest.MoveTo(egg, nest2);
            Assert.True(flag);
            Assert.IsNotNull(nest2.GetNested <TestEgg>());
        }
Пример #6
0
        public void NestNullAddError()
        {
            var nest = new Nest();

            Assert.Throws <NullRefNestException>(() => nest.Add(null));
        }