public void NestDoubleAddError() { var egg = new TestEgg(); var nest = new Nest(); nest.Add(egg); Assert.Throws <ContainNestException>(() => nest.Add(egg)); }
public void EggEvent() { var egg = new TestEgg(); var flag = false; egg.Knock += args => flag = true; egg.InvokeTest(); Assert.True(flag); }
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>()); }