Esempio n. 1
0
        public static T NewObject <T>()
        {
            var config   = new FakeUpConfig <T>();
            var instance = (T)NewObject(typeof(T), new ObjectCreationContext <T>(config));

            return(instance);
        }
Esempio n. 2
0
 internal ObjectCreationContext(FakeUpConfig <TFakeObject> config)
 {
     this.Config           = config;
     this.StatesRepository = this.Config.StatesConfig.GetRepository();
     this.InvocationStack  = new Stack <PropertyInfo>();
     this.Evaluators       = config.ValueEvaluators.Concat(this.DefaultValueEvaluators).ToArray();
 }
Esempio n. 3
0
        private static FakeUpConfig <T> GetConfig <T>(Action <IFakeUpConfig <T> > action)
        {
            var opt = new FakeUpConfig <T>();

            action?.Invoke(opt);
            return(opt);
        }
Esempio n. 4
0
 public WithAbsoluteCollectionPath(Expression <Func <TFakeObject, TCollection> > memberPath,
                                   FakeUpConfig <TFakeObject> config)
 {
     this.memberPath = memberPath;
     this.config     = config;
 }
Esempio n. 5
0
 public WithAbsolutePath(FakeUpConfig <TFakeObject> config, Expression <Func <TFakeObject, TMember> > memberPath)
 {
     this.config     = config;
     this.memberPath = memberPath;
 }
Esempio n. 6
0
 public WithType(FakeUpConfig <TFakeObject> config)
 {
     this.config = config;
 }
Esempio n. 7
0
 public WithCollectionType(FakeUpConfig <TFakeObject> config)
 {
     this.config = config;
 }
Esempio n. 8
0
 public WithRelativePath(FakeUpConfig <TFakeObject> config, Expression <Func <TMember, TMetaMember> > memberExpr)
 {
     this.config     = config;
     this.memberExpr = memberExpr;
 }