public void TestExtractObjectFromPropertyPathSimple()
        {
            var testObj = new
            {
                foo    = "bar",
                nested = new
                {
                    foo = "bar"
                }
            };

            StringFormatHelpers.ExtractObjectFromPropertyPath("foo", testObj).Should().Be(testObj.foo);
            StringFormatHelpers.ExtractObjectFromPropertyPath("nested.foo", testObj).Should().Be(testObj.nested.foo);

            Action negative = () => StringFormatHelpers.ExtractObjectFromPropertyPath("bar", testObj);

            negative.ShouldThrow <InvalidOperationException>();
        }
        public void TestExtractObjectFromPropertyPathCircular()
        {
            var a = new A()
            {
                Value = 1
            };
            var b = new B()
            {
                Value = 2, A = a
            };

            a.B = b;

            StringFormatHelpers.ExtractObjectFromPropertyPath("Value", a).Should().Be(a.Value);
            StringFormatHelpers.ExtractObjectFromPropertyPath("Value", b).Should().Be(b.Value);

            StringFormatHelpers.ExtractObjectFromPropertyPath("B.Value", a).Should().Be(a.B.Value);
            StringFormatHelpers.ExtractObjectFromPropertyPath("A.Value", b).Should().Be(b.A.Value);

            StringFormatHelpers.ExtractObjectFromPropertyPath("A.B.A.B.A.Value", b).Should().Be(a.Value);
        }