public void WhenTwoChildrenAndFirstIsRemoved_SingleElementRemains() { int pass = 0; var panel1 = new Props.StackPanel { Children = { new Props.TextBlock { Key = 0 }, new Props.Button { Key = 1 } } }; var panel2 = new Props.StackPanel { Children = { new Props.TextBlock { Key = 0 } } }; renderer = CreateRenderer(() => pass == 0 ? panel1: panel2); renderer.Render(NewState.Empty); pass++; renderer.Render(NewState.Empty); var actual = (Elements.StackPanel)root.Content; Assert.That(actual.Children.Count, Is.EqualTo(1)); }
public void WhenTwoChildrenAndSecondIsRemoved_RemainingElementIsButton() { int pass = 0; var panel1 = new Props.StackPanel { Children = { new Props.TextBlock { Key = 0 }, new Props.Button { Key = 1 } } }; var panel2 = new Props.StackPanel { Children = { new Props.Button { Key = 1 } } }; renderer = CreateRenderer(() => pass == 0 ? panel1 : panel2); renderer.Render(NewState.Empty); pass++; renderer.Render(NewState.Empty); var actual = (Elements.StackPanel)root.Content; Assert.That(actual.Children[0], Is.TypeOf <Elements.Button>()); }
public void WhenHasASingleChild_ChildIsCreated() { var content = new Props.StackPanel { Children = { new Props.TextBlock() } }; renderer = CreateRenderer(() => new Props.StackPanel { Children = { new Props.TextBlock() } }); renderer.Render(NewState.Empty); var actual = (Elements.StackPanel)root.Content; Assert.That(actual.Children.Count, Is.EqualTo(1)); Assert.That(actual.Children[0], Is.TypeOf <Elements.TextBlock>()); }