예제 #1
0
        /// <summary>
        ///     Implements IForcesModel.GetConcernsPerForce()
        /// </summary>
        /// <returns></returns>
        public Dictionary <IEAElement, List <IEAElement> > GetConcernsPerForce()
        {
            var forceConcernDictionary = new Dictionary <IEAElement, List <IEAElement> >();

            foreach (IEAElement force in GetForces())
            {
                List <IEAElement> concerns =
                    force.GetConnectedConcerns(_diagram.GUID).Where(concern => _diagram.Contains(concern)).ToList();
                forceConcernDictionary.Add(force, concerns);
            }
            return(forceConcernDictionary);
        }
예제 #2
0
        public void EA_DiagramTests()
        {
            // Properties

            {
                IEADiagram diagram = _e.GetDecisionForcesDiagram();
                Assert.IsTrue(DateTime.Now > diagram.Created);
                Assert.IsTrue(EANativeType.Diagram == diagram.EANativeType);
                Assert.IsTrue("" != diagram.GUID);
                Assert.IsTrue(0 < diagram.ID);
                Assert.IsTrue("" != diagram.Metatype);
                Assert.IsTrue(DateTime.Now > diagram.Modified);
                Assert.IsTrue("" != diagram.Name);
                Assert.IsTrue("" == diagram.Notes);
                Assert.IsNotNull(diagram.ParentElement);
                Assert.IsNotNull(diagram.ParentPackage);
                Assert.IsTrue("" != diagram.Version);
            }

            // Operations

            {
                // IsForcesView / AddElement / Contains / OpenAndSelectElement / HideConnectors / RemoveElement
                IEAPackage package = _e.GetDecisionPackage();
                IEADiagram diagram = _e.GetDecisionForcesDiagram();
                IEAElement element = package.CreateElement("MyNote", "MyStereotype", "Note");
                package.RefreshElements();
                diagram.AddElement(element);
                Assert.IsTrue(diagram.Contains(element));
                diagram.OpenAndSelectElement(element);
                diagram.HideConnectors(new[]
                {
                    EAConstants.RelationAlternativeFor, EAConstants.RelationCausedBy,
                    EAConstants.RelationDependsOn,
                    EAConstants.RelationExcludedBy, EAConstants.RelationReplaces, EAConstants.RelationFollowedBy
                });
                diagram.RemoveElement(element);
                Assert.IsFalse(diagram.Contains(element));
                Assert.IsTrue(deleteElementFromPackage(package, element));
            }

            {
                // ShowInProjectView / DiagramToStream
                IEAPackage package = _e.GetDecisionPackage();
                IEADiagram diagram = _e.GetDecisionForcesDiagram();
                diagram.ShowInProjectView();
                FileStream fs = diagram.DiagramToStream();
                Assert.IsNotNull(fs);
                Assert.IsTrue(fs.Name.Contains(".emf"));
            }

            {
                // GetElements
                IEAPackage package           = _e.GetDecisionPackage();
                IEADiagram diagram           = _e.GetDecisionForcesDiagram();
                List <IEADiagramObject> objs = diagram.GetElements();
                Assert.IsNotNull(objs);
                Assert.IsTrue(0 < objs.Count);
            }

            /* TODO: adjust for Decision Architect MDG
             * {  // IsChronologicalView
             *  IEAPackage package = _e.GetDecisionPackage();
             *  IEADiagram diagram = _e.GetDecisionChronologicalDiagram();
             * }
             *
             * {  // IsRelationshipView
             *  IEAPackage package = _e.GetDecisionPackage();
             *  IEADiagram diagram = _e.GetDecisionRelationshipDiagram();
             * }
             *
             * {  // IsStakeholderInvolvementView
             *  IEAPackage package = _e.GetDecisionPackage();
             *  IEADiagram diagram = _e.GetDecisionStakeholderDiagram();
             * }
             */
        }