private void SetupCommand() { _restorePage = new RestorePage(_tabControllerMock.Object, _recyclebinControllerMock.Object, _contentVerifierMock.Object); var args = new[] { "restore-page", _tabId.ToString() }; _restorePage.Initialize(args, _portalSettings, null, 0); }
private void SetupCommand() { _getCommand = new GetPage(_tabControllerMock.Object, _securityServiceMock.Object, _contentVerifierMock.Object); var args = new[] { "get-page", _tabId.ToString() }; _getCommand.Initialize(args, _portalSettings, null, _tabId); }
private void SetupCommand(string[] argParams) { _getUserCommand = new GetUser(_userValidatorMock.Object, _userControllerWrapperMock.Object); var args = argParams.ToList(); args.Insert(0, "get-user"); _getUserCommand.Initialize(args.ToArray(), _portalSettings, null, _userId.Value); }
public TPMConsole() { //Looks for all ConsoleCommands foreach (Type t in Assembly.GetExecutingAssembly().GetTypes()) { if (t.IsAbstract == false && t.IsClass && typeof(IConsoleCommand).IsAssignableFrom(t)) { object[] commandAttrs = t.GetCustomAttributes(typeof(TPMConsoleCommandAttribute), false); if (commandAttrs != null && commandAttrs.Length == 1) { TPMConsoleCommandAttribute attribute = commandAttrs[0] as TPMConsoleCommandAttribute; ConstructorInfo ctor = t.GetConstructor(new Type[] { }); if (ctor != null) { foreach (string cmdName in attribute.CmdNames) { if (_commands.ContainsKey(cmdName) == false) { _commands.Add(cmdName, (IConsoleCommand)ctor.Invoke(new object[] { })); } } } } foreach (IConsoleCommand cmd in _commands.Values) { cmd.Initialize(this); } object[] startupAttrs = t.GetCustomAttributes(typeof(TPMConsoleStartupCommand), false); if (startupAttrs != null && startupAttrs.Length == 1) { ConstructorInfo ctor = t.GetConstructor(new Type[] { }); if (ctor != null) { IConsoleCommand cmd = (IConsoleCommand)ctor.Invoke(new object[] { }); cmd.Initialize(this); cmd.Execute(null); } } } } }