public void TestMethod1() { var t = new Test { FirstName = "John", LastName = "Doe" }; PersonView v = new PersonView(); WpfTestHelper.SetupDataContext(v, t); //v._firstName.DataContext = t; //v._lastName.DataContext = t; v._firstName.SetBinding(TextBox.TextProperty, new Binding("FirstName") { Mode = BindingMode.TwoWay }); v._lastName.SetBinding(TextBox.TextProperty, "LastName"); Assert.AreEqual("John", v._firstName.Text); Assert.AreEqual("Doe", v._lastName.Text); //v._firstName.SelectAll(); //v._firstName.SelectedText = "Karl"; v._firstName.Text = "Karl"; WpfTestHelper.UpdateSource(v, TextBox.TextProperty); Assert.AreEqual("Karl", t.FirstName); //t.FirstName = "Daniel"; //t.LastName = "Berghold"; //Assert.AreEqual("Daniel", v._firstName.Text); //Assert.AreEqual("Berghold", v._lastName.Text); }
public void Setup() { _view = new PersonView(); _vm = SampleDataFactory.CreatePersonVM(); WpfTestHelper.SetupDataContext(_view, _vm); SetupBinding(); }