Exemplo n.º 1
0
        public void DependOnPropertyTest()
        {
            var obj = new BaseModel();

            obj.RaisePropertyChanged("Nothing");
            obj.Validate(0, 0, 0, 0);

            obj.BaseProperty1 = 0;
            obj.Validate(1, 1, 1, 1);

            obj.BaseProperty2 = 0;
            obj.Validate(1, 2, 1, 2);

            obj.InheritProperty1 = 0;
            obj.Validate(1, 2, 2, 2);

            obj.InheritProperty2 = 0;
            obj.Validate(1, 2, 2, 3);
        }
Exemplo n.º 2
0
        public void AddPropertyChangedTest()
        {
            var obj = new BaseModel();
            var count = 0;

            var handler = new PropertyChangedEventHandler(
                (_, __) => count += 1);

            obj.AddPropertyChangedHandler("InheritProperty1", handler);
            obj.BaseProperty1 = 0;
            Assert.AreEqual(1, count);

            obj.RemovePropertyChangedHandler("InheritProperty1", handler);
            obj.BaseProperty1 = 0;
            Assert.AreEqual(1, count);
        }
Exemplo n.º 3
0
        public AggregateClass(BaseModel model)
        {
            this.model = model;

            this.AddDependModel(this.model);
        }