public void AddDiagram(string name, bool guardCondition)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new MessageFormatException();
            }

            if (ActivityDiagram == null)
            {
                throw new Exception();
            }

            if (Diagrams == null)
            {
                Diagrams = new Dictionary <string, SequenceDiagram>();
            }

            var activity = ActivityDiagram.GetDiagramElement(name, ActivityDiagramElements.ElementTypes.Activity);

            if (activity == null)
            {
                throw new ActivityRepresentationException();
            }

            if (Diagrams.ContainsKey(name))
            {
                throw new ActivityRepresentationException();
            }

            Diagrams.Add(name, new SequenceDiagram(name, guardCondition, this));
        }
        public void CreateActivityDiagramTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.True(activityDiagram != null);
            Assert.Equal("nome do diagrama", activityDiagram.Name);
            Assert.True(activityDiagram.AcceptDuplicate);
        }
        public void ActivityDiagram_Add_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            activityDiagram.AddStartNode("nome do nodo inicial");
            activityDiagram.AddActivityNode("nome da atividade");
            activityDiagram.AddDecisionNode("nome do nodo de decisao");
            activityDiagram.AddMergeNode("nome do nodo de fusao");

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.Check());
        }
        public void ActivityDiagram_Add5_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.AddFinalNode("nome do nodo final"));
        }
        public void ActivityDiagram_Add4_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.AddMergeNode("nome do nodo de fusao"));
        }
        public void ActivityDiagram_Add3_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.AddDecisionNode("nome do nodo de decisao"));
        }
        public void ActivityDiagram_Add2_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.AddActivityNode("nome da atividade"));
        }
        public void ActivityDiagram_Create_ActivityDiagramRuleExceptionTest()
        {
            ActivityDiagram activityDiagram = new ActivityDiagram("nome do diagrama", true);

            Assert.Throws <ActivityDiagramRuleException>(() => activityDiagram.Check());
        }
 public SequenceRoot(ActivityDiagram activityDiagram)
 {
     ActivityDiagram = activityDiagram;
 }