public void ValueTypeChain_WithOneLevel_ValueIsAccessed()
        {
            var root = new MyStruct {
                Text = "Hello"
            };
            var sut = new ValueTypePropertyChain(root, "Text");

            Assert.Equal("Hello", sut.Value);
        }
Exemplo n.º 2
0
        public ValueTypePropertyChain(object instance, string path) : base(path)
        {
            Property = new Property(instance, PropertyName);

            if (SubPath.Length > 0)
            {
                Child = new ValueTypePropertyChain(Value, SubPath);
            }
        }
        public void ValueTypeChain_WithTwoLevels_ValueIsAccessed()
        {
            var root = new MyStruct {
                Child = new ChildStruct {
                    Text = "Some text"
                }
            };
            var sut = new ValueTypePropertyChain(root, "Child.Text");

            Assert.Equal("Some text", sut.Value);
        }
        public void ValueTypeChain_WithTwoLevels_ValueIsAccessed()
        {
            var root = new MyStruct { Child = new ChildStruct { Text = "Some text" } };
            var sut = new ValueTypePropertyChain(root, "Child.Text");

            Assert.Equal("Some text", sut.Value);
        }
        public void ValueTypeChain_WithOneLevel_ValueIsAccessed()
        {
            var root = new MyStruct { Text = "Hello" };
            var sut = new ValueTypePropertyChain(root, "Text");

            Assert.Equal("Hello", sut.Value);
        }