Exemplo n.º 1
0
        public void Before()
        {
            translator = new MapBasedTranslator();
            dynamicProvider = new RowModelTypeProvider(translator);

            new ModelContextProvider().CreateContext += (source, args) =>
            {
                args.Context = new ModelContext(dynamicProvider);
            };
        }
Exemplo n.º 2
0
        public void Before()
        {
            translator = new MapBasedTranslator();
            dynamicProvider = new RowModelTypeProvider(translator);
            staticProvider = new JsonModel();

            new ModelContextProvider().CreateContext += (source, args) =>
            {
                args.Context = new ModelContext(dynamicProvider, staticProvider);
            };

            //build up the mock types by utilizing JsonModel Provider
            //will be the root object.
            string mockAccount = @"{
                                    'types' : {
                                        'Payment' : {
                                            'properties' : {
                                                'amount' : {
                                                    type : 'Number'
                                                }
                                            }
                                        },
                                        'Account' : {
                                            'properties' : {
                                                'firstName' : {
                                                    type : 'String'
                                                },
                                                'lastName' : {
                                                    type : 'String'
                                                },
                                                'accountNumber' : {
                                                    type : 'Number'
                                                },
                                                'payments' : {
                                                    type : 'Payment',
                                                    isList : true
                                                }
                                            }
                                        }
                                    },
                                    'instances' : {
                                        'Account' : {
                                            '1' : ['Test', 'User', '1234', ['1']]
                                        },
                                        'Payment' : {
                                            '1' : [23.05]
                                        }
                                    }
                                }
                                ";

            staticProvider.Load(mockAccount);
        }