Example #1
0
 ILeoSetter IFluentSetter.Instance(object instance, bool strictMode)
 {
     if (_type.IsAbstract && _type.IsSealed)
     {
         return(LeoVisitorFactoryCore.CreateForStaticType(_type, _kind, LvMode.LITE, strictMode));
     }
     return(LeoVisitorFactoryCore.CreateForInstance(_type, instance, _kind, RpMode.NON_REPEATABLE, LvMode.LITE, strictMode));
 }
Example #2
0
        ILeoSetter IFluentSetter.InitialValues(IDictionary <string, object> initialValues, bool strictMode)
        {
            if (_type.IsAbstract && _type.IsSealed)
            {
                var visitor = LeoVisitorFactoryCore.CreateForStaticType(_type, _kind, LvMode.LITE, strictMode);
                visitor.SetValue(initialValues);
                return(visitor);
            }

            return(LeoVisitorFactoryCore.CreateForFutureInstance(_type, _kind, RpMode.NON_REPEATABLE, LvMode.LITE, strictMode, initialValues));
        }
Example #3
0
        IFluentValueSetter IFluentSetter.Value(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            _func1 = (t, strictMode) =>
            {
                var visitor = LeoVisitorFactoryCore.CreateForInstance(_type, t, _kind, RpMode.NON_REPEATABLE, LvMode.LITE, strictMode);
                return(new ValueSetter(visitor, name));
            };

            return(this);
        }
Example #4
0
        IFluentValueSetter IFluentSetter.Value(FieldInfo fieldInfo)
        {
            if (fieldInfo is null)
            {
                throw new ArgumentNullException(nameof(fieldInfo));
            }

            _func1 = (t, strictMode) =>
            {
                var visitor = LeoVisitorFactoryCore.CreateForInstance(_type, t, _kind, RpMode.NON_REPEATABLE, LvMode.LITE, strictMode);
                return(new ValueSetter(visitor, fieldInfo.Name));
            };

            return(this);
        }
Example #5
0
        IFluentValueGetter IFluentGetter.Value(PropertyInfo propertyInfo)
        {
            if (propertyInfo is null)
            {
                throw new ArgumentNullException(nameof(propertyInfo));
            }

            _func1 = t =>
            {
                var visitor = LeoVisitorFactoryCore.CreateForInstance(_type, t, _kind, RpMode.NON_REPEATABLE, LvMode.LITE, StMode.NORMALE);
                return(new ValueGetter(visitor, propertyInfo.Name));
            };

            return(this);
        }