public void InternalObservableObjectDependencyTest()
        {
            var changed_properties = new List<string>();
            var base_obj = new InternalObservableObjectDependencyBaseObject();
            var obj = new InternalObservableObjectDependencyObject(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 InternalObservableObjectDependencyBaseObject();
            obj.BaseObject = base_obj;
            base_obj.BaseProp1 = 23;

            Assert.AreEqual(2, changed_properties.Count, "2 property changed event expected");
            Assert.IsTrue(changed_properties.Contains("BaseObject"), "BaseObject property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
        }
Exemple #2
0
        public void InternalObservableObjectDependencyTest()
        {
            var changed_properties = new List <string>();
            var base_obj           = new InternalObservableObjectDependencyBaseObject();
            var obj = new InternalObservableObjectDependencyObject(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 InternalObservableObjectDependencyBaseObject();
            obj.BaseObject     = base_obj;
            base_obj.BaseProp1 = 23;

            Assert.AreEqual(2, changed_properties.Count, "2 property changed event expected");
            Assert.IsTrue(changed_properties.Contains("BaseObject"), "BaseObject property changed event expected");
            Assert.IsTrue(changed_properties.Contains("Prop1"), "Prop1 property changed event expected");
        }
        public InternalObservableObjectDependencyObject(InternalObservableObjectDependencyBaseObject base_object)
        {
            BaseObject = base_object;

            AddDependency(() => BaseObject, () => Prop1);
        }
Exemple #4
0
        public InternalObservableObjectDependencyObject(InternalObservableObjectDependencyBaseObject base_object)
        {
            BaseObject = base_object;

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