Exemplo 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);
        }
Exemplo 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();
 }
Exemplo n.º 3
0
        private static FakeUpConfig <T> GetConfig <T>(Action <IFakeUpConfig <T> > action)
        {
            var opt = new FakeUpConfig <T>();

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