public void NestDoubleAddError() { var egg = new TestEgg(); var nest = new Nest(); nest.Add(egg); Assert.Throws <ContainNestException>(() => nest.Add(egg)); }
public INodeContent CreateContent(ILinkedNode parent) { var content = new NodeContent(); Root.Add(content); content.SetParentNode(parent); return(content); }
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); }
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); }
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>()); }
public void NestNullAddError() { var nest = new Nest(); Assert.Throws <NullRefNestException>(() => nest.Add(null)); }