public void When_Event_DataTemplate() { var SUT = new Binding_Event_DataTemplate(); var rootData = new Binding_Event_DataTemplate_Model(); SUT.root.Content = rootData; SUT.ForceLoaded(); var checkBox = SUT.root.FindName("myCheckBox") as CheckBox; Assert.AreEqual(0, rootData.CheckedRaised); Assert.AreEqual(0, rootData.UncheckedRaised); checkBox.IsChecked = true; Assert.AreEqual(1, rootData.CheckedRaised); Assert.AreEqual(0, rootData.UncheckedRaised); checkBox.IsChecked = false; Assert.AreEqual(1, rootData.CheckedRaised); Assert.AreEqual(1, rootData.UncheckedRaised); }
public void When_Event_DataTemplate() { var SUT = new Binding_Event_DataTemplate(); SUT.ForceLoaded(); var root = SUT.FindName("root") as FrameworkElement; var dc = new Binding_Event_DataTemplate_Model(); root.DataContext = dc; var checkBox = SUT.FindName("myCheckBox") as CheckBox; Assert.AreEqual(0, dc.CheckedRaised); Assert.AreEqual(0, dc.UncheckedRaised); checkBox.IsChecked = true; Assert.AreEqual(1, dc.CheckedRaised); Assert.AreEqual(0, dc.UncheckedRaised); checkBox.IsChecked = false; Assert.AreEqual(1, dc.CheckedRaised); Assert.AreEqual(1, dc.UncheckedRaised); }