Example #1
0
        public void CanWritePublicProperty()
        {
            var x = new TestClass()
            {
                MyInt = 1
            };

            SetterDelegateCache <TestClass> .Write("MyInt", x, 2);

            x.MyInt.ShouldBe(2);
        }
Example #2
0
        public void CanWriteWriteOnlyProperty()
        {
            var x = new TestClass()
            {
                MyInt = 2
            };

            SetterDelegateCache <TestClass> .Write("MyWriteOnlyInt", x, 3);

            x.MyInt.ShouldBe(3);
        }
Example #3
0
        public void CanWriteWriteOnlyPropertyByOrdinal()
        {
            var x = new TestClass()
            {
                MyInt = 4
            };
            var ordinal = SetterDelegateCache <TestClass> .OrdinalLookup["MyWriteOnlyInt"];

            SetterDelegateCache <TestClass> .Write(ordinal, x, 5);

            x.MyInt.ShouldBe(5);
        }
Example #4
0
        public void CanWriteByOrdinal()
        {
            var x = new TestClass()
            {
                MyInt = 3
            };
            var ordinal = SetterDelegateCache <TestClass> .OrdinalLookup["MyInt"];

            SetterDelegateCache <TestClass> .Write(ordinal, x, 4);

            x.MyInt.ShouldBe(4);
        }