Exemplo n.º 1
0
        void CheckInvalidPropertyPath()
        {
            var source = new SimpleClass1
            {
                Child = new SimpleClass1
                {
                    Child = new SimpleClass1
                    {
                        LastName = "A"
                    }
                }
            };

            var path = "Child.Child.LastName";

            var propertyPath = new PropertyPath(path);

            propertyPath.ParsePath(source, path);

            Assert.False(propertyPath.IsNotReadyToUpdate);


            path = "Child.LastName";

            propertyPath = new PropertyPath(path);

            propertyPath.ParsePath(source, path);

            Assert.False(propertyPath.IsNotReadyToUpdate);


            //
            path = "Child.XXX.LastName";

            propertyPath = new PropertyPath(path);

            propertyPath.ParsePath(source, path);

            Assert.True(propertyPath.IsNotReadyToUpdate);


            path = "Child.Child.LastName";

            propertyPath = new PropertyPath(path);

            propertyPath.Listen(source, () => {});

            Assert.False(propertyPath.IsNotReadyToUpdate);

            source.Child = null;

            Assert.True(propertyPath.IsNotReadyToUpdate);
        }