Ejemplo n.º 1
0
        public void PrivatePropertyTest2()
        {
            var t = new SubPropertyClass();

            var p2 = t.Reflection()
                     .Property("P2")
                     .SetValue(230)
                     .Property("P2")
                     .GetValue();

            var pi2 = t.Reflection()
                      .Property("P2")
                      .PropertyInfoType;

            var p4 = t.Reflection()
                     .Property("P4")
                     .SetValue(456.25)
                     .Property("P4")
                     .GetValue();

            var pi4 = t.Reflection()
                      .Property("P4")
                      .PropertyInfoType;

            var t2 = t.Reflection()
                     .Return();

            Assert.Equal(230, p2);
            Assert.Equal(456.25, p4);
            Assert.Equal(t, t2);
            Assert.Equal("Int32", pi2.Name);
            Assert.Equal("Double", pi4.Name);
        }
Ejemplo n.º 2
0
        public void PublicPropertyTest2()
        {
            var t = new SubPropertyClass();

            var p1 = t.Reflection()
                     .Property(x => x.P1)
                     .SetValue("Foo")
                     .Property(x => x.P1)
                     .GetValue();

            var pi1 = t.Reflection()
                      .Property(x => x.P1)
                      .PropertyInfoType;

            var p3 = t.Reflection()
                     .Property(x => x.P3)
                     .SetValue(987654321)
                     .Property(x => x.P3)
                     .GetValue();

            var pi3 = t.Reflection()
                      .Property(x => x.P3)
                      .PropertyInfoType;

            var t2 = t.Reflection()
                     .Return();

            Assert.Equal("Foo", t.P1);
            Assert.Equal("Foo", p1);

            Assert.Equal(987654321, t.P3);
            Assert.Equal(987654321, p3);
            Assert.Equal(t, t2);
            Assert.Equal("String", pi1.Name);
            Assert.Equal("Int64", pi3.Name);
        }