private void startResumeConversationIsEnded() { Regex msgErrorRx = new Regex(".*StartResumeConversation.*conversation.*is.*ended.*"); IConversationState otherConversationState = null; //BEGIN: Raise error try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // make not new otherConversationState.EndConversation(); otherConversationState.StartResumeConversation(); throw new Exception("NOT OK: No raise for 'otherConversationState.StartResumeConversation()'"); } catch (InvalidOperationException ioe) { if (msgErrorRx.IsMatch(ioe.Message)) { this.Session["testResult"] = "OK"; } else { throw new Exception("NOT OK " + ioe.Message); } } finally { otherConversationState.EndConversation(); } //END: Raise error //BEGIN: NO Raise error try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // make not new otherConversationState.StartResumeConversation(); otherConversationState.EndConversation(); this.Session["testResult"] = "OK"; } finally { otherConversationState.EndConversation(); } //END: NO Raise error }
private void setParentConversationIsNotNew() { Regex msgErrorRx = new Regex(".*Conversation.*not.*new.*Conversation.Id.*Parent.*Tried.*"); IConversationState otherConversationState = null; //BEGIN: Raise error try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // make not new otherConversationState.StartResumeConversation(); //try first by 'InnerConversations.Add' this.ConversationA.InnerConversations.Add(otherConversationState); throw new Exception("NOT OK: No raise for 'this.ConversationA.InnerConversations.Add(otherConversationState)'"); } catch (InvalidOperationException ioe) { if (msgErrorRx.IsMatch(ioe.Message)) { this.Session["testResult"] = "OK"; } else { throw new Exception("NOT OK " + ioe.Message); } } finally { otherConversationState.EndConversation(); } try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // make not new otherConversationState.StartResumeConversation(); //try second by 'ParentConversation = ' otherConversationState.ParentConversation = this.ConversationA; throw new Exception("NOT OK: No raise for 'this.ConversationAA.ParentConversation = otherConversationState'"); } catch (InvalidOperationException ioe) { if (msgErrorRx.IsMatch(ioe.Message)) { this.Session["testResult"] = "OK"; } else { throw new Exception("NOT OK, 'ex.Message' not match :" + ioe.Message); } } finally { otherConversationState.EndConversation(); } //END: Raise error //BEGIN: NO Raise error try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // leave new //try first by 'InnerConversations.Add' this.ConversationA.InnerConversations.Add(otherConversationState); this.Session["testResult"] = "OK"; } finally { otherConversationState.EndConversation(); } try { otherConversationState = new WebConversationSpringState(); otherConversationState.Id = "otherConversationState"; // leave new //try second by 'ParentConversation = ' otherConversationState.ParentConversation = this.ConversationA; this.Session["testResult"] = "OK"; } finally { otherConversationState.EndConversation(); } //END: NO Raise error }