Ejemplo n.º 1
0
        public void UpdatesNextSourceOnPropertyChange()
        {
            var fakeInpc = new Fake {
                Next = new Level {
                    Name = "1"
                }
            };
            var rootItem = new RootItem(fakeInpc);

            var nextName      = NameOf.Property <Fake>(x => x.Next);
            var nextProp      = typeof(Fake).GetProperty(nextName);
            var firstProperty = new PathProperty(null, nextProp);
            var first         = new NotifyingPathItem(rootItem, firstProperty);

            var isTrueName     = NameOf.Property <Level>(x => x.IsTrue);
            var isTrueProp     = typeof(Level).GetProperty(isTrueName);
            var secondProperty = new PathProperty(firstProperty, isTrueProp);
            var second         = new NotifyingPathItem(first, secondProperty);

            Assert.AreSame(fakeInpc.Next, second.Source);
            fakeInpc.Next = new Level {
                Name = "2"
            };
            Assert.AreSame(fakeInpc.Next, second.Source);
        }
Ejemplo n.º 2
0
        public void ThrowsOnNotINotifyPropertyChanged()
        {
            var propertyInfo = typeof(NotInpc).GetProperty(NameOf.Property <NotInpc>(x => x.Name));

            Assert.NotNull(propertyInfo);
            var pathItem = new PathProperty(null, propertyInfo);
            var item     = new NotifyingPathItem(null, pathItem);

            Assert.Throws <ArgumentException>(() => new NotifyingPathItem(item, pathItem));
        }
Ejemplo n.º 3
0
        public void ThrowsOnStruct()
        {
            var propertyInfo = typeof(StructLevel).GetProperty(NameOf.Property <StructLevel>(x => x.Name));

            Assert.NotNull(propertyInfo);
            var pathItem = new PathProperty(null, propertyInfo);
            var item     = new NotifyingPathItem(null, pathItem);

            Assert.Throws <ArgumentException>(() => new NotifyingPathItem(item, pathItem));
        }
Ejemplo n.º 4
0
 set => this.SetValue(PathProperty, value);
 set => SetValue(PathProperty, value);
 get => (string)GetValue(PathProperty); set => SetValue(PathProperty, value);