public void CreateWindowSetsUpTitleBindingIfViewModelIsIHaveDisplayName() { var model = new Screen(); var window = new Window(); this.viewManager.Setup(x => x.CreateAndBindViewForModelIfNecessary(model)).Returns(window); this.windowManager.CreateWindow(model, false); var e = window.GetBindingExpression(Window.TitleProperty); Assert.NotNull(e); Assert.AreEqual(BindingMode.TwoWay, e.ParentBinding.Mode); Assert.AreEqual("DisplayName", e.ParentBinding.Path.Path); }
public void CreateWindowDoesNotSetUpTitleBindingIfTitleHasABindingAlready() { var model = new Screen(); var window = new Window(); var binding = new Binding("Test") { Mode = BindingMode.TwoWay }; window.SetBinding(Window.TitleProperty, binding); this.viewManager.Setup(x => x.CreateAndBindViewForModelIfNecessary(model)).Returns(window); this.windowManager.CreateWindow(model, false); var e = window.GetBindingExpression(Window.TitleProperty); Assert.AreEqual("Test", e.ParentBinding.Path.Path); }
public void CreateWindowDoesSetUpTitleBindingIfTitleIsNameOfTheClass() { var model = new Screen(); var window = new Window(); window.Title = "Window"; this.viewManager.Setup(x => x.CreateAndBindViewForModelIfNecessary(model)).Returns(window); this.windowManager.CreateWindow(model, false); var e = window.GetBindingExpression(Window.TitleProperty); Assert.AreEqual("DisplayName", e.ParentBinding.Path.Path); }
public void CreateWindowDoesNotSetUpTitleBindingIfTitleHasAValueAlready() { var model = new Screen(); var window = new Window(); window.Title = "Foo"; this.viewManager.Setup(x => x.CreateAndBindViewForModelIfNecessary(model)).Returns(window); this.windowManager.CreateWindow(model, false); var e = window.GetBindingExpression(Window.TitleProperty); Assert.IsNull(e); Assert.AreEqual("Foo", window.Title); }