public void IsNotifiedTest() { var bindable = new TestBindable(); bool isNotified = false; bindable.PropertyChanged += (sender, args) => { if (args.PropertyName == "Property") { isNotified = true; } }; bindable.Property = "Hello, World."; Assert.IsTrue(isNotified); Assert.AreEqual("Hello, World.", bindable.property); }
public void IsNotNotifiedTest() { var bindable = new TestBindable(); bool isNotified = false; bindable.PropertyChanged += (sender, args) => { if (args.PropertyName == "Property") { isNotified = true; } }; bindable.Property = null; Assert.IsFalse(isNotified); Assert.IsNull(bindable.property); }
public async Task TestOutputBindingLifecycle() { var bindables = new Dictionary <string, IBindable>(); IBindable bindableWithTwo = new TestBindable(new Mock <IBinding>(), new Mock <IBinding>()); IBindable bindableWithThree = new TestBindable(new Mock <IBinding>(), new Mock <IBinding>(), new Mock <IBinding>()); IBindable bindableEmpty = new TestBindable(); bindables.Add("two", bindableWithTwo); bindables.Add("empty", bindableEmpty); bindables.Add("three", bindableWithThree); var lifecycle = new OutputBindingLifecycle(new Mock <IBindingService>().Object, bindables.Values); await lifecycle.Start(); Assert.Equal(5, lifecycle._outputBindings.Count); await lifecycle.Stop(); }
public void Initialize() { bindable = new TestBindable(); }