示例#1
0
 public YuzuDefinitionTemplates(IMapper mapper, IYuzuConfiguration config, IEnumerable <IMapperAddItem> mapperAddItems, IYuzuTypeFactoryRunner typeFactoryRunner)
 {
     this.mapper            = mapper;
     this.config            = config;
     this.mapperAddItems    = mapperAddItems;
     this.typeFactoryRunner = typeFactoryRunner;
 }
        public void Setup()
        {
            mapper            = MockRepository.GenerateStub <IMapper>();
            config            = MockRepository.GenerateStub <IYuzuConfiguration>();
            typeFactoryRunner = MockRepository.GenerateStub <IYuzuTypeFactoryRunner>();
            mapperAddItems    = new List <IMapperAddItem>();

            svc      = MockRepository.GeneratePartialMock <YuzuDefinitionTemplates>(new object[] { mapper, config, mapperAddItems.ToArray(), typeFactoryRunner });
            settings = new RenderSettings();

            config.GetRenderedHtmlCache = null;
            config.SetRenderedHtmlCache = null;

            templates = new Dictionary <string, Func <object, string> >();

            templateName             = "template";
            templateRenderer         = (object data) => { return(html); };
            config.GetTemplatesCache = () => { return(templates); };

            exampleModel = new ExampleModel()
            {
                Text = "text"
            };
            exampleViewModel  = new vmPage_ExampleViewModel();
            inputMappingItems = new Dictionary <string, object>();

            Func <object, IDictionary <string, object>, vmPage_ExampleViewModel> doFunction = (object source, IDictionary <string, object> items) => {
                usedMappingItems = items; return(exampleViewModel);
            };

            mapper.Stub(x => x.Map <vmPage_ExampleViewModel>(null, null)).IgnoreArguments().Do(doFunction);

            Mapper.Reset();
        }
 public DefaultGridItem(string docTypeAlias, IMapper mapper)
 {
     this.docTypeAlias      = docTypeAlias;
     this.mapper            = mapper;
     this.typeFactoryRunner = DependencyResolver.Current.GetService <IYuzuTypeFactoryRunner>();
 }