public void ButtonWithTextBlockRender_AllEventsAreCalledInCorrectOrder()
                {
                    var textBlock = new Props.TextBlock();
                    var button    = new Props.Button {
                        Content = textBlock
                    };

                    renderer = CreateRenderer(() => button);
                    renderer.Render(NewState.Empty);

                    var textBlockComponent = textBlock.Component;
                    var buttonComponent    = button.Component;

                    int index = 0;

                    Assert.That(buttonComponent.WillMountCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(buttonComponent.DidMountCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(buttonComponent.ShouldUpdateCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(buttonComponent.WillReceivePropsCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(textBlockComponent.WillMountCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(textBlockComponent.DidMountCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(textBlockComponent.ShouldUpdateCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(textBlockComponent.WillReceivePropsCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(textBlockComponent.DidUpdateCounter(), Is.EqualTo(new int[] { index++ }));
                    Assert.That(buttonComponent.DidUpdateCounter(), Is.EqualTo(new int[] { index++ }));
                }
                public void InitialSimpleButtonRender_ComponentEventsAreCalledInCorrectOrder()
                {
                    var button = new Props.Button();

                    renderer = CreateRenderer(() => button);
                    renderer.Render(NewState.Empty);

                    var component = button.Component;

                    Assert.That(component.WillMountCounter(), Is.EqualTo(new int[] { 0 }));
                    Assert.That(component.DidMountCounter(), Is.EqualTo(new int[] { 1 }));
                    Assert.That(component.ShouldUpdateCounter(), Is.EqualTo(new int[] { 2 }));
                    Assert.That(component.WillReceivePropsCounter(), Is.EqualTo(new int[] { 3 }));
                    Assert.That(component.DidUpdateCounter(), Is.EqualTo(new int[] { 4 }));
                }
                public void AfterSecondPassForSimpleButtonThatYieldsNull_WillUnmountWasCalledOnce()
                {
                    int pass   = 0;
                    var button = new Props.Button();

                    renderer = CreateRenderer(() =>
                    {
                        return(pass == 0 ? button : null);
                    }
                                              );

                    renderer.Render(NewState.Empty);
                    pass++;
                    renderer.Render(NewState.Empty);

                    var component = button.Component;

                    Assert.That(component.WillUnmountCounter().Count, Is.EqualTo(1));
                }
                public void AfterSecondPassForButtonThatYieldsNull_ContentWillUnmountWasCalledOnce()
                {
                    int pass   = 0;
                    var button = new Props.Button {
                        Content = new Props.TextBlock()
                    };

                    renderer = CreateRenderer(() =>
                    {
                        return(pass == 0 ? button : null);
                    }
                                              );

                    renderer.Render(NewState.Empty);
                    pass++;
                    renderer.Render(NewState.Empty);

                    var component = (Components.ISharpWpfTestComponent)button.Content.Component;

                    Assert.That(component.WillUnmountCounter.Count, Is.EqualTo(1));
                }