Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 public void Initialize()
 {
     bindable = new TestBindable();
 }