コード例 #1
0
		public virtual void Setup()
		{
			response = new StubResponse();
			var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80, 
				Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", "");
			
			var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url)
			{
				Server = MockRepository.GenerateMock<IServerUtility>()
			};

			railsContext = stubEngineContext;
			serverUtility = railsContext.Server;

			argumentConversionService = MockRepository.GenerateMock<IArgumentConversionService>();

			controller = new TestController();
			controller.Contextualize(railsContext, MockRepository.GenerateStub<IControllerContext>());
			
			parameters = new Hashtable();
			
			services = MockRepository.GenerateMock<ICodeGeneratorServices>();
			services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any();
			services.Expect(s => s.Controller).Return(controller).Repeat.Any();
			services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any();
			argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any();
		}
コード例 #2
0
        public virtual void Setup()
        {
            response = new StubResponse();
            var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80,
                                  Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", "");

            var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url)
            {
                Server = MockRepository.GenerateMock <IServerUtility>()
            };

            railsContext  = stubEngineContext;
            serverUtility = railsContext.Server;

            argumentConversionService = MockRepository.GenerateMock <IArgumentConversionService>();

            controller = new TestController();
            controller.Contextualize(railsContext, MockRepository.GenerateStub <IControllerContext>());

            parameters = new Hashtable();

            services = MockRepository.GenerateMock <ICodeGeneratorServices>();
            services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any();
            services.Expect(s => s.Controller).Return(controller).Repeat.Any();
            services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any();
            argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any();
        }
コード例 #3
0
 public IControllerActionReference CreateActionReference(ICodeGeneratorServices services, Type controllerType,
                                                         string areaName, string controllerName, string actionName,
                                                         MethodSignature signature,
                                                         params ActionArgument[] arguments)
 {
     return(new ControllerActionReference(services, controllerType, areaName, controllerName, actionName, signature, arguments));
 }
コード例 #4
0
 public virtual void Setup()
 {
     _mocks      = new MockRepository();
     _services   = _mocks.DynamicMock <ICodeGeneratorServices>();
     _controller = _mocks.DynamicMock <TestController>();
     _factory    = new DefaultControllerReferenceFactory();
 }
コード例 #5
0
        /// <summary>
        ///     构造函数
        /// </summary>
        public ToolsController(
            IHttpContextUser user
            , IWebHostEnvironment webHostEnvironment

            , ISysUserServices sysUserServices
            , ISysRoleServices sysRoleServices
            , ISysMenuServices sysMenuServices
            , ISysUserRoleServices sysUserRoleServices
            , ISysOrganizationServices sysOrganizationServices, ICodeGeneratorServices codeGeneratorServices,
            ISysLoginRecordServices sysLoginRecordServices, ISysNLogRecordsServices sysNLogRecordsServices, IOptions <FilesStorageOptions> filesStorageOptions, ISysRoleMenuServices sysRoleMenuServices)
        {
            _user = user;
            _webHostEnvironment = webHostEnvironment;


            _sysUserServices         = sysUserServices;
            _sysRoleServices         = sysRoleServices;
            _sysMenuServices         = sysMenuServices;
            _sysUserRoleServices     = sysUserRoleServices;
            _sysOrganizationServices = sysOrganizationServices;
            _codeGeneratorServices   = codeGeneratorServices;
            _sysLoginRecordServices  = sysLoginRecordServices;
            _sysNLogRecordsServices  = sysNLogRecordsServices;

            _sysRoleMenuServices = sysRoleMenuServices;
            _filesStorageOptions = filesStorageOptions.Value;
        }
コード例 #6
0
 public virtual void Setup()
 {
   _mocks = new MockRepository();
   _services = _mocks.DynamicMock<ICodeGeneratorServices>();
   _controller = _mocks.DynamicMock<TestController>();
   _factory = new DefaultControllerReferenceFactory();
 }
コード例 #7
0
 public ControllerViewReference(ICodeGeneratorServices services, Type controllerType, string areaName,
                                string controllerName, string actionName)
 {
     if (services == null)
     {
         throw new ArgumentNullException("services");
     }
     if (controllerType == null)
     {
         throw new ArgumentNullException("controllerType");
     }
     if (String.IsNullOrEmpty(controllerName))
     {
         throw new ArgumentNullException("controllerName");
     }
     if (String.IsNullOrEmpty(actionName))
     {
         throw new ArgumentNullException("actionName");
     }
     _services       = services;
     _controllerType = controllerType;
     _controllerName = controllerName;
     _areaName       = areaName;
     _actionName     = actionName;
 }
コード例 #8
0
		public IControllerActionReference CreateActionReference(ICodeGeneratorServices services, Type controllerType,
		                                                        string areaName, string controllerName, string actionName,
		                                                        MethodSignature signature,
		                                                        params ActionArgument[] arguments)
		{
			return new ControllerActionReference(services, controllerType, areaName, controllerName, actionName, signature, arguments);
		}
コード例 #9
0
 public ControllerActionReference(ICodeGeneratorServices services, Type controllerType, string areaName,
                                  string controllerName, string actionName, MethodSignature signature,
                                  params ActionArgument[] arguments)
     : base(services, controllerType, areaName, controllerName, actionName)
 {
     _arguments = arguments;
     _signature = signature;
 }
コード例 #10
0
		public ControllerActionReference(ICodeGeneratorServices services, Type controllerType, string areaName,
										 string controllerName, string actionName, MethodSignature signature,
										 params ActionArgument[] arguments)
			: base(services, controllerType, areaName, controllerName, actionName)
		{
			Arguments = arguments;
			ActionMethodSignature = signature;
		}
コード例 #11
0
        public IControllerViewReference CreateViewReference(ICodeGeneratorServices services, Type controllerType,
                                                            string areaName, string controllerName, string actionName)
        {
            string key = MakeKey(areaName, controllerName, actionName);

            if (!_views.ContainsKey(key))
            {
                _views[key] =
                    ReplayIfNecessary(_mocks.DynamicMock <ControllerViewReference>(services, controllerType, areaName, controllerName, actionName));
            }
            return(_views[key]);
        }
コード例 #12
0
		public ControllerViewReference(ICodeGeneratorServices services, Type controllerType, string areaName,
									   string controllerName, string actionName)
		{
			if (services == null) throw new ArgumentNullException("services");
			if (controllerType == null) throw new ArgumentNullException("controllerType");
			if (String.IsNullOrEmpty(controllerName)) throw new ArgumentNullException("controllerName");
			if (String.IsNullOrEmpty(actionName)) throw new ArgumentNullException("actionName");
			
			Services = services;
			ControllerType = controllerType;
			ControllerName = controllerName;
			AreaName = areaName;
			ActionName = actionName;
		}
コード例 #13
0
        public IControllerActionReference CreateActionReference(ICodeGeneratorServices services, Type controllerType,
                                                                string areaName, string controllerName, string actionName,
                                                                MethodSignature signature, params ActionArgument[] arguments)
        {
            string key = MakeKey(areaName, controllerName, actionName);

            if (!_actions.ContainsKey(key))
            {
                _actions[key] =
                    ReplayIfNecessary(_mocks.DynamicMock <ControllerActionReference>(services, controllerType, areaName, controllerName, actionName,
                                                                                     signature, arguments));
            }
            return(_actions[key]);
        }
コード例 #14
0
        public virtual void Setup()
        {
            _mocks    = new MockRepository();
            _services = _mocks.DynamicMock <ICodeGeneratorServices>();
            _response = new StubResponse();
            UrlInfo url =
                new UrlInfo("eleutian.com", "www", _virtualDirectory, "http", 80,
                            Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails",
                            "");

            _railsContext =
                new StubEngineContext(new StubRequest(), _response, new StubMonoRailServices(), url);

            ((StubEngineContext)_railsContext).Server = _mocks.DynamicMock <IServerUtility>();
            _serverUtility = _railsContext.Server;

            _argumentConversionService = _mocks.DynamicMock <IArgumentConversionService>();
            _controller = new TestController();
        }
コード例 #15
0
		public virtual void Setup()
		{
			_mocks = new MockRepository();
			_services = _mocks.DynamicMock<ICodeGeneratorServices>();
			_response = new StubResponse();
			UrlInfo url =
				new UrlInfo("eleutian.com", "www", _virtualDirectory, "http", 80,
				            Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails",
				            "");
			_railsContext =
				new StubEngineContext(new StubRequest(), _response, new StubMonoRailServices(), url);

			((StubEngineContext)_railsContext).Server = _mocks.DynamicMock<IServerUtility>();
			_serverUtility = _railsContext.Server;

			_argumentConversionService = _mocks.DynamicMock<IArgumentConversionService>();
			_controller = new TestController();
		}
コード例 #16
0
 public IControllerViewReference CreateViewReference(ICodeGeneratorServices services, Type controllerType,
                                                     string areaName, string controllerName, string actionName)
 {
     return(new ControllerViewReference(services, controllerType, areaName, controllerName, actionName));
 }
コード例 #17
0
		public IControllerViewReference CreateViewReference(ICodeGeneratorServices services, Type controllerType,
		                                                    string areaName, string controllerName, string actionName)
		{
			return new ControllerViewReference(services, controllerType, areaName, controllerName, actionName);
		}
コード例 #18
0
 public virtual void Setup()
 {
     mocks    = new MockRepository();
     services = mocks.DynamicMock <ICodeGeneratorServices>();
     factory  = new DefaultControllerReferenceFactory();
 }
コード例 #19
0
		public virtual void Setup()
		{
			mocks = new MockRepository();
			services = mocks.DynamicMock<ICodeGeneratorServices>();
			factory = new DefaultControllerReferenceFactory();
		}
コード例 #20
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public CodeGeneratorController(ICodeGeneratorServices codeGeneratorServices, IMapper mapper, IWebHostEnvironment webHostEnvironment)
 {
     _codeGeneratorServices = codeGeneratorServices;
     _mapper             = mapper;
     _webHostEnvironment = webHostEnvironment;
 }