Exemplo n.º 1
0
        public void ExternalSimpleDependencyTest()
        {
            var changed_properties = new List<string>();
            var base_obj = new ExternalSimpleDependencyBaseObject();
            var obj = new ExternalSimpleDependencyObject(base_obj);
            obj.PropertyChanged += (sender, args) => changed_properties.Add(args.PropertyName);

            base_obj.BaseProp1 = 42;

            Assert.AreEqual(1, changed_properties.Count, "1 property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
            changed_properties.Clear();

            base_obj = new ExternalSimpleDependencyBaseObject();
            obj.BaseObject = base_obj;
            base_obj.BaseProp1 = 42;

            Assert.AreEqual(2, changed_properties.Count, "2 property changed events expected");
            Assert.IsTrue(changed_properties.Contains("BaseObject"), "BaseObject property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
        }
Exemplo n.º 2
0
        public void ExternalSimpleDependencyTest()
        {
            var changed_properties = new List <string>();
            var base_obj           = new ExternalSimpleDependencyBaseObject();
            var obj = new ExternalSimpleDependencyObject(base_obj);

            obj.PropertyChanged += (sender, args) => changed_properties.Add(args.PropertyName);

            base_obj.BaseProp1 = 42;

            Assert.AreEqual(1, changed_properties.Count, "1 property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
            changed_properties.Clear();

            base_obj           = new ExternalSimpleDependencyBaseObject();
            obj.BaseObject     = base_obj;
            base_obj.BaseProp1 = 42;

            Assert.AreEqual(2, changed_properties.Count, "2 property changed events expected");
            Assert.IsTrue(changed_properties.Contains("BaseObject"), "BaseObject property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
        }
Exemplo n.º 3
0
        public ExternalSimpleDependencyObject(ExternalSimpleDependencyBaseObject base_object)
        {
            BaseObject = base_object;

            AddDependency(() => BaseObject.BaseProp1, () => Prop1);
        }
Exemplo n.º 4
0
        public ExternalSimpleDependencyObject(ExternalSimpleDependencyBaseObject base_object)
        {
            BaseObject = base_object;

            AddDependency(() => BaseObject.BaseProp1, () => Prop1);
        }