public void WhenContentControl_CreatesComponents() { var element = new Elements.ContentControl { Content = new Elements.TextBlock() }; var props = new Props.ContentControl { Content = new Props.TextBlock() }; renderer.UpdateExistingElement(element, props); Assert.That(props.Component, Is.Not.Null); Assert.That(props.Content.Component, Is.Not.Null); }
public void WhenContentControl_UpdatesProperties() { var element = new Elements.ContentControl { Content = new Elements.TextBlock() }; var content = new Props.TextBlock { Text = "test", IsEnabled = true, Focusable = true }; var props = new Props.ContentControl { Content = content }; renderer.UpdateExistingElement(element, props); var actual = (Elements.TextBlock)element.Content; Assert.That(actual.Text, Is.EqualTo(content.Text)); Assert.That(actual.IsEnabled, Is.True); Assert.That(actual.Focusable, Is.True); }
public void WhenContentControl_PreviousElementsAreRemoved() { var element = new Elements.ContentControl { Content = new Elements.TextBlock() }; var content = new Props.TextBlock { Text = "test", IsEnabled = true, Focusable = true }; var props = new Props.ContentControl { Content = content }; renderer.UpdateExistingElement(element, props); renderer.UpdateExistingElement(new Elements.ContentControl { Content = new Elements.TextBlock() }, props); var actual = (Elements.TextBlock)element.Content; Assert.That(props.Component.Element, Is.Not.SameAs(element)); Assert.That(content.Component.Element, Is.Not.SameAs(element.Content)); }