Ejemplo n.º 1
0
        public void SettersSet()
        {
            PropertyAnalyzer propertyAnalyzer = new PropertyAnalyzer(new IntIdGenerator(), new IdentityNameGenerator());
            var actual = propertyAnalyzer.AnalyzeProperties(typeof(SimpleClassWithPrimitiveProperties), null, false).ToList();

            const int    IntValue    = 3;
            const double DoubleValue = 3.0;
            var          obj         = new SimpleClassWithPrimitiveProperties("str")
            {
            };

            actual[0].Setter(obj, IntValue);
            actual[1].Setter(obj, DoubleValue);

            Assert.Equal(IntValue, obj.IntProperty);
            Assert.Equal(DoubleValue, obj.DoubleProperty);
        }
Ejemplo n.º 2
0
        public void GettersSet()
        {
            PropertyAnalyzer propertyAnalyzer = new PropertyAnalyzer(new IntIdGenerator(), new IdentityNameGenerator());
            var actual = propertyAnalyzer.AnalyzeProperties(typeof(SimpleClassWithPrimitiveProperties), null, false).ToList();

            const int    IntValue    = 3;
            const double DoubleValue = 3.0;
            const string StringValue = "string";
            var          obj         = new SimpleClassWithPrimitiveProperties(StringValue)
            {
                IntProperty    = IntValue,
                DoubleProperty = DoubleValue
            };

            Assert.Equal(IntValue, actual[0].Getter(obj));
            Assert.Equal(DoubleValue, actual[1].Getter(obj));
            Assert.Equal(StringValue, actual[2].Getter(obj));
        }