public void InitializeComponent() { if (!this._contentLoaded) { this._contentLoaded = true; Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/Shell/OnDemandShellView.xaml", UriKind.Relative)); this.userControl = (UserControl) base.FindName("userControl"); this.LayoutRoot = (Grid) base.FindName("LayoutRoot"); this.AssetInfoStates = (VisualStateGroup) base.FindName("AssetInfoStates"); this.ShowAssetInfo = (VisualState) base.FindName("ShowAssetInfo"); this.InfoPanelIn = (Storyboard) base.FindName("InfoPanelIn"); this.HideAssetInfo = (VisualState) base.FindName("HideAssetInfo"); this.ShowSmallAssetInfoPopupBubble = (VisualState) base.FindName("ShowSmallAssetInfoPopupBubble"); this.CaptionSettingsStates = (VisualStateGroup) base.FindName("CaptionSettingsStates"); this.ShowCaptionSettings = (VisualState) base.FindName("ShowCaptionSettings"); this.HideCaptionSettings = (VisualState) base.FindName("HideCaptionSettings"); this.CaptionSettingsPopupStates = (VisualStateGroup) base.FindName("CaptionSettingsPopupStates"); this.ShowSettingsBubble = (VisualState) base.FindName("ShowSettingsBubble"); this.HideSettingsBubble = (VisualState) base.FindName("HideSettingsBubble"); this.BackgroundRectangle = (Rectangle) base.FindName("BackgroundRectangle"); this.AssetViewer = (ContentControl) base.FindName("AssetViewer"); this.ClickToggleControlBarAction = (ActionMessage) base.FindName("ClickToggleControlBarAction"); this.controller = (OnDemandController) base.FindName("controller"); this.assetInfoContentControl = (BubbleContentControl) base.FindName("assetInfoContentControl"); this.captionBubble = (BubbleContentControl) base.FindName("captionBubble"); this.CaptionSettings = (ContentControl) base.FindName("CaptionSettings"); this.Interaction = (ContentControl) base.FindName("Interaction"); } }
static ActionMessage CreateMessage(DependencyObject target, string messageText) { var message = new ActionMessage(); messageText = Regex.Replace(messageText, "^Action", string.Empty); var openingParenthesisIndex = messageText.IndexOf('('); if (openingParenthesisIndex < 0) openingParenthesisIndex = messageText.Length; var closingParenthesisIndex = messageText.LastIndexOf(')'); if (closingParenthesisIndex < 0) closingParenthesisIndex = messageText.Length; var core = messageText.Substring(0, openingParenthesisIndex).Trim(); message.MethodName = core; if (closingParenthesisIndex - openingParenthesisIndex > 1) { var paramString = messageText.Substring(openingParenthesisIndex + 1, closingParenthesisIndex - openingParenthesisIndex - 1); var parameters = Regex.Split(paramString); foreach (var parameter in parameters) { message.Parameters.Add(CreateParameter(target, parameter.Trim())); } } return message; }
public void can_determine_positive_trigger_effect() { var filter = Mock<IPreProcessor>(); var handlingNode = Stub<IInteractionNode>(); var sourceNode = Stub<IInteractionNode>(); var message = new ActionMessage(); message.Initialize(sourceNode); var target = new object(); var parameters = new object[] { 5, "param" }; messageBinder.Expect(x => x.DetermineParameters(message, null, handlingNode, null)) .Return(parameters); filterManager.Stub(x => x.TriggerEffects) .Return(new[] { filter }).Repeat.Any(); filter.Expect(x => x.Execute(message, handlingNode, parameters)) .IgnoreArguments() .Return(true); var result = action.ShouldTriggerBeAvailable(message, handlingNode); Assert.That(result, Is.True); }
public void can_handle_an_action_message_with_approriate_name() { var message = new ActionMessage {MethodName = _methodName}; _host.Expect(x => x.GetAction(message)).Return(Stub<IAction>()); var result = _handler.Handles(message); Assert.That(result, Is.True); }
public void cannot_handle_an_action_message_with_invalid_name() { var message = new ActionMessage {MethodName = _methodName}; _host.Expect(x => x.GetAction(message)).Return(null); var result = _handler.Handles(message); Assert.That(result, Is.False); }
public void BuildDetails(TimerResult timerResult, string controllerName, string actionName, bool isChildAction, Type executedType, MethodInfo method, string eventName, Core.Message.TimelineCategory eventCategory) { var message = new ActionMessage(timerResult, controllerName, actionName, isChildAction, executedType, method, eventName, eventCategory); var dictionary = new Dictionary<string, object>(); message.BuildDetails(dictionary); Assert.Equal(3, dictionary.Count); }
public void Construct(TimerResult timerResult, string controllerName, string actionName, bool isChildAction, Type executedType, MethodInfo method) { var message = new ActionMessage(timerResult, controllerName, actionName, isChildAction, executedType, method); Assert.Equal(timerResult.Duration, message.Duration); Assert.Equal(timerResult.Offset, message.Offset); Assert.Equal(timerResult.StartTime, message.StartTime); Assert.Equal(executedType, message.ExecutedType); Assert.Equal(method, message.ExecutedMethod); Assert.Equal(controllerName, message.ControllerName); Assert.Equal(actionName, message.ActionName); Assert.Equal(string.Format("{0}:{1}", controllerName, actionName), message.EventName); }
public ActionMessage Put(int id, [FromBody] ContractInfo _contract) { ActionMessage ret = new ActionMessage(); try { ret = ContractService.GetInstance().editContract(id, _contract, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage ExecuteFile(ActionMessage msg) { var returnActionMessage = new ActionMessage(); try { Process.Start(msg.Message); } catch (Exception ex) { returnActionMessage.Message = String.Format("Errore in fase di esecuzione del file {0}. Errore restituito: {1}", msg.Message, ex.Message); } return(returnActionMessage); }
public ActionMessage createBranch([FromBody] BranchInfo branch) { ActionMessage ret = new ActionMessage(); try { ret = BranchService.GetInstance().createBranch(branch); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage deleteManyBranch(string ids) { ActionMessage ret = new ActionMessage(); try { ret = BranchService.GetInstance().deleteManyBranch(ids); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage DeleteAll(string proposalIDs, string _userID) { ActionMessage ret = new ActionMessage(); try { ret = ProposalService.GetInstance().DeleteProposals(proposalIDs, GetUserId(), _userID); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Put(int id, [FromForm] ProposalInfo _proposal) { ActionMessage ret = new ActionMessage(); try { ret = ProposalService.GetInstance().editProposal(id, _proposal, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] ContractInfo _contract, string _userID) { ActionMessage ret = new ActionMessage(); try { ret = ContractService.GetInstance().createContract(_contract, GetUserId(), _userID); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Put(int id, [FromBody] SurveyInfo _survey) { ActionMessage ret = new ActionMessage(); /* try * { * ret = SurveyService.GetInstance().editSurvey(id, _survey, getUserId()); * } * catch (Exception ex) * { * ret.isSuccess = false; * ret.err.msgCode = "Internal Error !!!"; * ret.err.msgString = ex.ToString(); * }*/ return(ret); }
public static new ActionMessage ReadFrom(System.IO.BinaryReader reader) { var result = new ActionMessage(); int ActionSize = reader.ReadInt32(); result.Action = new System.Collections.Generic.Dictionary <int, Model.UnitAction>(ActionSize); for (int i = 0; i < ActionSize; i++) { int ActionKey; ActionKey = reader.ReadInt32(); Model.UnitAction ActionValue; ActionValue = Model.UnitAction.ReadFrom(reader); result.Action.Add(ActionKey, ActionValue); } return(result); }
public ActionMessage Post([FromBody] ProposalTypeInfo _proposalType) { ActionMessage ret = new ActionMessage(); try { ret = ProposalTypeService.GetInstance().createProposalType(_proposalType, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage DeleteAll(string ids) { ActionMessage ret = new ActionMessage(); try { ret = SurveyService.GetInstance().DeleteAll(ids); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] SurveyInfo _survey) { ActionMessage ret = new ActionMessage(); try { ret = SurveyService.GetInstance().createSurvey(_survey, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public async Task <ActionMessage> Put(int id, [FromForm] SurveyInfo _Survey, [FromForm] List <IFormFile> files) { ActionMessage ret = new ActionMessage(); try { ret = await SurveyService.GetInstance().editSurvey(id, _Survey, GetUserId(), files); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Delete(int id, string _userID) { ActionMessage ret = new ActionMessage(); try { ret = SurveyService.GetInstance().DeleteSurvey(id, GetUserId(), _userID); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public static void AttachActionMessage(this UIElement control, string eventName, string methodName, object parameter) { var action = new ActionMessage(); action.MethodName = methodName; action.Parameters.Add(new Parameter { Value = parameter }); action.Attach(control); var trigger = new System.Windows.Interactivity.EventTrigger(); trigger.EventName = eventName; trigger.SourceObject = control; trigger.Actions.Add(action); Interaction.GetTriggers(control).Add(trigger); }
/// <summary> /// Handle received action /// </summary> /// <param name="actions">dictionary with all available actions</param> /// <param name="interceptor">function that gets called before action is executed. action is aborted when function returns false</param> /// <param name="onUnknownAction">function that gets called when action is unknown</param> /// <param name="sender">EasyTcpClient or EasyTcpServer as object</param> /// <param name="message">received data</param> internal static async Task HandleAction(this Dictionary <int, Action> actions, Func <ActionMessage, bool> interceptor, Action <ActionMessage> onUnknownAction, object sender, ActionMessage message) { if (interceptor?.Invoke(message) != false) { if (!actions.TryGetValue(message.ActionCode, out var action)) { onUnknownAction?.Invoke(message); } else if (action.ClientHasAccess(sender, message)) { await action.Execute(sender, message); } } }
public async Task <ActionMessage> PostwithAttFile([FromForm] BidPlanInfo BidPlanObj, [FromForm] List <IFormFile> files, string _userID) { ActionMessage ret = new ActionMessage(); try { ret = await BidPlanService.GetInstance().createBidPlan2(BidPlanObj, GetUserId(), files, _userID); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] CapitalInfo _capital) { ActionMessage ret = new ActionMessage(); try { ret = CapitalServices.GetInstance().createCapital(_capital); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage DeleteAll(string bidPlanIDs, string _userID) { ActionMessage ret = new ActionMessage(); try { ret = BidPlanService.GetInstance().DeleteMuti(bidPlanIDs, _userID); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Put(int id, [FromBody] BidPlanInfo _bidPlan) { ActionMessage ret = new ActionMessage(); //try //{ // ret = BidPlanService.GetInstance().editBidPlan(id, _bidPlan, getUserId()); //} //catch (Exception ex) //{ // ret.isSuccess = false; // ret.err.msgCode = "Internal Error !!!"; // ret.err.msgString = ex.ToString(); //} return(ret); }
public ActionMessage Delete(int id) { ActionMessage ret = new ActionMessage(); try { ret = DocumentService.GetInstance().DeleteDocument(id); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public async Task <ActionMessage> Put(int id, [FromBody] AnalyzerGroupInfo _AnalyzerGroup) { ActionMessage ret = new ActionMessage(); try { ret = await AnalyzerGroupService.GetInstance().editAnalyzerGroup(id, _AnalyzerGroup, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] AnalyzerGroupInfo _AnalyzerGroup) { ActionMessage ret = new ActionMessage(); try { ret = AnalyzerGroupService.GetInstance().createAnalyzerGroup(_AnalyzerGroup, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Put(int id, [FromBody] ProposalTypeInfo _department) { ActionMessage ret = new ActionMessage(); try { ret = ProposalTypeService.GetInstance().editProposalType(id, _department, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public async Task <ActionMessage> PostwithAttFile([FromForm] SurveyInfo SurveyObj, [FromForm] List <IFormFile> files) { ActionMessage ret = new ActionMessage(); try { ret = await SurveyService.GetInstance().createSurvey2(SurveyObj, GetUserId(), files); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] BidPlanInfo _bidPlan) { ActionMessage ret = new ActionMessage(); try { ret = BidPlanService.GetInstance().createBidPlan(_bidPlan, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public async Task <ActionMessage> Put([FromForm] DeliveryReceiptInfo obj, [FromForm] List <IFormFile> files) { ActionMessage ret = new ActionMessage(); try { ret = await DeliveryReceiptServices.GetInstance().Update(obj, files, GetUserId()); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Post([FromBody] EmployeeRoleInfo _employeeRole) { ActionMessage ret = new ActionMessage(); try { ret = EmployeeRoleServices.GetInstance().createEmployeeRole(_employeeRole); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Delete(int id) { ActionMessage ret = new ActionMessage(); try { ret = ProposalTypeService.GetInstance().deleteProposalType(id); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage CreateQuoteWithMutilProposal(QuoteCreateRequest QuoteObj, string _userI) { ActionMessage ret = new ActionMessage(); SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); using (SqlConnection connection = sqlConnection.GetConnection()) { try { int quoteId = 0; quoteId = QuoteDataLayer.GetInstance().InsertQuoteWithOutDetails(connection, _userI); int i = 0; foreach (int customerID in QuoteObj.CustomerList) { if (QuoteObj.CustomerList.Length == 1) { QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, true); } else { if (i == 0) { QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, true); } else { QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, false); } } i++; } foreach (int proposalId in QuoteObj.ProposalList) { QuoteDataLayer.GetInstance().InsertQuoteProposal(connection, quoteId, proposalId); } ret.isSuccess = true; } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error"; ret.err.msgString = ex.Message; } } return(ret); }
public void alters_return_with_post_execute_filters() { var handlingNode = Stub<IInteractionNode>(); var sourceNode = Stub<IInteractionNode>(); var result = Mock<IResult>(); var message = new ActionMessage(); message.Initialize(sourceNode); var target = new object(); var parameters = new object[] { 5, "param" }; var returnValue = new object(); var filter = MockRepository.GenerateMock<IPostProcessor>(); var context = EventArgs.Empty; var handler = Stub<IRoutedMessageHandler>(); handler.Stub(x => x.Unwrap()).Return(new object()); handlingNode.Stub(x => x.MessageHandler).Return(handler); messageBinder.Expect(x => x.DetermineParameters(message, null, handlingNode, context)) .Return(parameters); filterManager.Stub(x => x.PreProcessors) .Return(new IPreProcessor[] {}); method.Expect(x => x.Invoke(target, parameters)) .Return(returnValue); filterManager.Stub(x => x.PostProcessors) .Return(new[] { filter }); var outcome = new MessageProcessingOutcome(returnValue, returnValue.GetType(), false); filter.Expect(x => x.Execute(message, handlingNode, outcome)); messageBinder.Expect(x => x.CreateResult(outcome)) .IgnoreArguments() .Return(result); result.Expect(x => x.Execute(null)).IgnoreArguments(); action.Execute(message, handlingNode, context); }
public void can_determine_overload() { var message = new ActionMessage(); message.Parameters.Add(new Parameter(5)); var found = action.DetermineOverloadOrFail(message); Assert.That(found, Is.Not.Null); message.Parameters.Add(new Parameter("hello")); found = action.DetermineOverloadOrFail(message); Assert.That(found, Is.Not.Null); message.Parameters.Add(new Parameter(5d)); found = action.DetermineOverloadOrFail(message); Assert.That(found, Is.Not.Null); }
private void CreateActionMessage() { string methodName = "Execute"; var att = Command.GetType() .GetAttributes<CommandAttribute>(true) .FirstOrDefault(); if(att != null) methodName = att.ExecuteMethod; actionMessage = new ActionMessage { MethodName = methodName, AvailabilityEffect = AvailabilityEffect, OutcomePath = OutcomePath }; actionMessage.Initialize(Source); foreach(var parameter in Parameters) { actionMessage.Parameters.Add(new Parameter(parameter.Value)); } }
///<summary> /// Uses the action pipeline to invoke the method. ///</summary> ///<param name="target"> The object instance to invoke the method on. </param> ///<param name="methodName"> The name of the method to invoke. </param> ///<param name="view"> The view. </param> ///<param name="source"> The source of the invocation. </param> ///<param name="eventArgs"> The event args. </param> ///<param name="parameters"> The method parameters. </param> public static void Invoke(object target, string methodName, DependencyObject view = null, FrameworkElement source = null, object eventArgs = null, object[] parameters = null) { var message = new ActionMessage {MethodName = methodName}; var context = new ActionExecutionContext { Target = target, #if WinRT Method = target.GetType().GetRuntimeMethods().Single(m => m.Name == methodName), #else Method = target.GetType().GetMethod(methodName), #endif Message = message, View = view, Source = source, EventArgs = eventArgs }; if (parameters != null) { parameters.Apply(x => context.Message.Parameters.Add(x as Parameter ?? new Parameter { Value = x })); } ActionMessage.InvokeAction(context); // This is a bit of hack but keeps message being garbage collected Log.Info("Invoking action {0} on {1}.", message.MethodName, target); }
public void when_executing_pre_filters_can_cancel() { var filter1 = Mock<IPreProcessor>(); var filter2 = Mock<IPreProcessor>(); var sourceNode = Stub<IInteractionNode>(); var message = new ActionMessage(); message.Initialize(sourceNode); var handlingNode = Stub<IInteractionNode>(); var parameters = new object[] { 5, "param" }; var context = EventArgs.Empty; var handler = Stub<IRoutedMessageHandler>(); handler.Stub(x => x.Unwrap()).Return(new object()); handlingNode.Stub(x => x.MessageHandler).Return(handler); messageBinder.Expect(x => x.DetermineParameters(message, null, handlingNode, context)) .Return(parameters); filterManager.Stub(x => x.PreProcessors) .Return(new[] { filter1, filter2 }); filter1.Expect(x => x.Execute(message, handlingNode, parameters)) .Return(false); filter2.Expect(x => x.Execute(message, handlingNode, parameters)) .Return(true); action.Execute(message, handlingNode, context); }
public void can_execute() { var soureceNode = Stub<IInteractionNode>(); var handlingNode = Stub<IInteractionNode>(); var message = new ActionMessage(); message.Initialize(soureceNode); var target = new object(); var parameters = new object[] { 5, "param" }; var task = MockRepository.GenerateMock<IBackgroundTask>(); var context = EventArgs.Empty; var handler = Stub<IRoutedMessageHandler>(); handler.Stub(x => x.Unwrap()).Return(target); handlingNode.Stub(x => x.MessageHandler).Return(handler); messageBinder.Expect(x => x.DetermineParameters(message, null, handlingNode, context)) .IgnoreArguments() .Return(parameters); filterManager.Stub(x => x.PreProcessors) .Return(new IPreProcessor[] {}); method.Stub(x => x.CreateBackgroundTask(target, parameters)) .Return(task); task.Expect(x => x.Start(null)); action.Execute(message, handlingNode, context); }
public void can_throw_exception_on_execute() { var handlingNode = Stub<IInteractionNode>(); var sourceNode = Stub<IInteractionNode>(); var message = new ActionMessage(); message.Initialize(sourceNode); var target = new object(); var parameters = new object[] { 5, "param" }; var returnValue = new object(); var context = EventArgs.Empty; var handler = Stub<IRoutedMessageHandler>(); handler.Stub(x => x.Unwrap()).Return(new object()); handlingNode.Stub(x => x.MessageHandler).Return(handler); messageBinder.Expect(x => x.DetermineParameters(message, null, handlingNode, context)) .Return(parameters); filterManager.Stub(x => x.PreProcessors) .Return(new IPreProcessor[] {}); method.Expect(x => x.Invoke(target, parameters)) .Return(returnValue); filterManager.Stub(x => x.PostProcessors) .Return(new IPostProcessor[] {}); filterManager.Stub(x => x.Rescues) .Return(new IRescue[] {}); messageBinder.Expect(x => x.CreateResult(new MessageProcessingOutcome( null, method.Info.ReturnType, false ))).IgnoreArguments().Throw(new InvalidOperationException("test exception")); try { action.Execute(message, handlingNode, context); } catch(InvalidOperationException inex) { Assert.That(inex.StackTrace.Contains("Rhino.Mocks.Expectations.AbstractExpectation.ReturnOrThrow")); return; } Assert.Fail("The test exception was not fired"); }
public void SetActionMessage(PolytexControls.Label label, ActionMessage actionMessage) { switch (actionMessage) { case ActionMessage.InsertedSuccessfuly: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; case ActionMessage.InsertFailure: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Failure); break; case ActionMessage.UpdatedSuccessfuly: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; case ActionMessage.UpdateFailure: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Failure); break; case ActionMessage.EnabledSuccessfuly: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; case ActionMessage.DisabledSuccessfuly: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; case ActionMessage.DeletedSuccessfuly: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; case ActionMessage.DeleteFailure: SetActionMessage(label, actionMessage.ToString(), ActionMessageType.Success); break; } }
public void can_update_a_trigger_if_has_trigger_effects_and_false() { var node = Stub<IInteractionNode>(); var message = new ActionMessage { MethodName = _methodName }; var action = Mock<IAction>(); var trigger = Mock<IMessageTrigger>(); var filters = Stub<IFilterManager>(); filters.Stub(x => x.TriggerEffects).Return(new[] { Stub<IPreProcessor>() }).Repeat.Any(); action.Stub(x => x.Filters).Return(filters).Repeat.Any(); trigger.Stub(x => x.Message).Return(message); _host.Expect(x => x.GetAction(message)).Return(action); action.Expect(x => x.ShouldTriggerBeAvailable(message, node)).Return(false); trigger.Expect(x => x.UpdateAvailabilty(false)); _handler.UpdateAvailability(trigger); }
public void can_process_an_action_message() { var handlingNode = Stub<IInteractionNode>(); var sourceNode = Stub<IInteractionNode>(); var context = new object(); var message = new ActionMessage {MethodName = _methodName}; message.Initialize(sourceNode); var action = Mock<IAction>(); _host.Expect(x => x.GetAction(message)).Return(action); action.Expect(x => x.Execute(message, handlingNode, context)); _handler.Process(message, context); }
public void fails_if_no_match_is_found() { var message = new ActionMessage(); action.DetermineOverloadOrFail(message); }
/// <summary> /// Gets the action. /// </summary> /// <param name="message">The message.</param> /// <returns></returns> public IAction GetAction(ActionMessage message) { IAction found; actions.TryGetValue(message.MethodName, out found); return found; }
public void cannot_update_a_trigger_if_missing_trigger_effects() { var message = new ActionMessage { MethodName = _methodName }; var action = Mock<IAction>(); var trigger = Mock<IMessageTrigger>(); var filters = Stub<IFilterManager>(); filters.Stub(x => x.TriggerEffects).Return(new IPreProcessor[]{}).Repeat.Any(); action.Stub(x => x.Filters).Return(filters).Repeat.Any(); trigger.Stub(x => x.Message).Return(message); _host.Expect(x => x.GetAction(message)).Return(action); _handler.UpdateAvailability(trigger); }
/// <summary> /// Makes the parameter aware of the <see cref="ActionMessage"/> that it's attached to. /// </summary> /// <param name="owner">The action message.</param> internal void MakeAwareOf(ActionMessage owner) { Owner = owner; }
public void SetActionMessage(ActionMessage actionMessage) { SetActionMessage(ActionMessageLabel, actionMessage); }