Пример #1
0
    private void alreadyHasAnotherManagerNotRaise()
    {
        IConversationManager otherConversationManager = new WebConversationManager();

        //Not raise error
        IConversationState otherConversationState = null;
        try
        {
            otherConversationState = new WebConversationSpringState();
            otherConversationState.Id = "otherConversationState";
            otherConversationManager.AddConversation(otherConversationState);
            this.Session["testResult"] = "OK";
        }
        catch (InvalidOperationException ioe)
        {
            this.Session["testResult"] = "NOT OK " + ioe.ToString();
        }
        finally
        {
            otherConversationState.EndConversation();
        }
    }
Пример #2
0
    private void idIsDifferentFromSpringName()
    {
        Regex msgErrorRx = new Regex(".*Id.*is.*different.*from.*spring.*name.*");
        IConversationState otherConversationState = null;
        //BEGIN: Raise error
        try
        {
            otherConversationState = new WebConversationSpringState();
            otherConversationState.Id = "otherConversationState";
            // different name
            ((IObjectNameAware)otherConversationState).ObjectName = "different_name";
            throw new Exception("NOT OK: No raise for '((IObjectNameAware)otherConversationState).ObjectName ='");
        }
        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
            // different name
            ((IObjectNameAware)otherConversationState).ObjectName = "otherConversationState";
            this.Session["testResult"] = "OK";
        }
        finally
        {
            otherConversationState.EndConversation();
        }
        //END: NO Raise error
    }
Пример #3
0
    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
    }
Пример #4
0
    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
    }
Пример #5
0
    private void conversationAlreadyDifferentParent()
    {
        Regex msgErrorRx = new Regex(".*conversation.*already.*different.*parent.*");
        //BEGIN: Raise error
        IConversationState otherConversationState = null;
        try
        {
            otherConversationState = new WebConversationSpringState();
            otherConversationState.Id = "otherConversationState";
            //try first by 'InnerConversations.Add'
            otherConversationState.InnerConversations.Add(this.ConversationAA);
            throw new Exception("NOT OK: No raise for 'InnerConversations.Add(this.ConversationAA)'");
        }
        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";
            //try second by 'ParentConversation = '
            this.ConversationAA.ParentConversation = otherConversationState;
            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
        otherConversationState = null;
        try
        {
            otherConversationState = new WebConversationSpringState();
            otherConversationState.Id = "otherConversationState";
            //try first by 'InnerConversations.Add'
            this.ConversationAA.InnerConversations.Add(otherConversationState);
            this.Session["testResult"] = "OK";
        }
        finally
        {
            otherConversationState.EndConversation();
        }

        try
        {
            otherConversationState = new WebConversationSpringState();
            otherConversationState.Id = "otherConversationState";
            //try second by 'ParentConversation = '
            otherConversationState.ParentConversation = this.ConversationA;
            this.Session["testResult"] = "OK";
        }
        finally
        {
            otherConversationState.EndConversation();
        }
        //END: NO Raise error
    }