Ejemplo n.º 1
0
        public void can_compile_getter()
        {
            var sample = new SampleClass {Message = "Success!"};

            var func = FuncBuilder.CompileGetter(sample.GetType().GetProperty("Message")).As<Func<SampleClass, string>>();
            var result = func(sample);
            result.ShouldEqual(sample.Message);
        }
Ejemplo n.º 2
0
        public void can_compile_setter()
        {
            var message = "Success!";
            var sample = new SampleClass {Message = "Failed!"};

            var func = FuncBuilder.CompileSetter(sample.GetType().GetProperty("Message")).As<Action<SampleClass, string>>();
            func(sample, message);
            sample.Message.ShouldEqual(message);
        }
Ejemplo n.º 3
0
        public void can_compile_getter()
        {
            var sample = new SampleClass {
                Message = "Success!"
            };

            var func   = FuncBuilder.CompileGetter(sample.GetType().GetProperty("Message")).As <Func <SampleClass, string> >();
            var result = func(sample);

            result.ShouldEqual(sample.Message);
        }
Ejemplo n.º 4
0
        public void can_compile_setter()
        {
            var message = "Success!";
            var sample  = new SampleClass {
                Message = "Failed!"
            };

            var func = FuncBuilder.CompileSetter(sample.GetType().GetProperty("Message")).As <Action <SampleClass, string> >();

            func(sample, message);
            sample.Message.ShouldEqual(message);
        }