示例#1
0
        public Implementation(Classifier start, Classifier end)
            :base(start,end, RelationType.Implementation, string.Empty)
        {
            Requires(start != end);
            Requires(end.IsInterface);

        }
示例#2
0
        public void ReplaceInterface(Classifier newInterface)
        {
            Requires(newInterface != null);
            Requires(newInterface.IsInterface);

            End.Classifier = newInterface;
        }
示例#3
0
        public void Classifier_InterfaceImplementations_SetRoot()
        {
            var classifier = new Classifier();
            var implementations = For<ImplementationList>();

            classifier.InterfaceImplementations = implementations;

            implementations.Received().Root = classifier;
        }
        public void FindImplementationsOfInterfaceTest()
        {
            var noInterface = new Classifier("noInterface") {IsInterface = true};
            _implementationList.AddInterfaceToList(new Implementation(_classifier, noInterface));
            noInterface.IsInterface = false;
            var implementations = _implementationList.FindImplementationsOfInterface(noInterface);

            Assert.IsTrue(implementations.IsNotEmpty());
        }
        public void RenameClassifierTest()
        {
            var oldName = RandomString(1);
            var newName = RandomString(2);

            var classifier = new Classifier(oldName);
            _classifiers = new ClassifierDictionary(classifier);
            _classifiers.RenameClassifier(classifier, newName);

            Assert.AreEqual(newName, classifier.Name);
            Assert.IsTrue(_classifiers.IsClassNameFree(oldName));
            Assert.IsNotNull(_classifiers.FindByName(newName));
        }
示例#6
0
        /// <summary>
        /// creates a new relation between two nodes
        /// </summary>
        /// <param name="start">classifier where the relation starts</param>
        /// <param name="end">classifier where the relation ends</param>
        /// <param name="startName">optional name of the start node of the relation</param>
        /// <param name="endName">optional name of the end node of the relation</param>
        /// <param name="relation">type of the relation</param>
        public Relation(
            Classifier start,
            Classifier end,
            RelationType relation = RelationType.Association,
            string startName = "",
            string endName = "")
        {
            Requires(start != null);
            Requires(end != null);

            Start = new StartNode(start,startName);
            End = new EndNode(end, endName);
            Type = relation;
            IsVisible = true;
        }
 public void FindAllImplementersTest()
 {
     // setup a class that implements an interface
     var @interface = new Classifier("interface") {IsInterface = true};
     var classifier = For<Classifier>("class",false);
     var subSet = For<ImplementationList.SubSet>();
     subSet.IsNotEmpty().Returns(true);
     classifier.FindImplementationsOfInterface(@interface).Returns(subSet);
     _classifiers = new ClassifierDictionary(classifier);
     
     // return all classes that have an implementation for the given interface
     var implementers = _classifiers.FindAllImplementers(@interface);
     
     // ensure that the implementer is in the result list
     Assert.Contains(classifier, implementers.ToList());
 }
 public ClassifierSingleCommandContext(
     Classifier classifier,
     ClassifierDictionary classifierDictionary,
     DeletionService deletionService,
     IRelationService relationService,
     IAskUserBeforeDeletionService askUserService,
     MessageSystem messageSystem)
 {
     Rename = new RenameClassifierCommand(
         classifier,
         classifierDictionary,
         new ClassifierValidationService(classifierDictionary),
         messageSystem);
     ChangeBaseClass = new ChangeBaseClassCommand(
         classifier,
         classifierDictionary,
         messageSystem);
     Delete = new DeleteClassifierCommand(classifier, deletionService,askUserService);
     Visibility = new ShowOrHideSingleObjectCommand(classifier, messageSystem);
     ChangeClassifierColor = new ChangeColorCommand(classifier, messageSystem);
     ChangeNoteColor = new ChangeNoteColorCommand(classifier.Note,messageSystem);
     ChangeNoteText = new ChangeNoteTextCommand(classifier.Note,messageSystem);
     ChangeIsInterface = new MakeClassifierToInterfaceCommand(classifier, relationService);
 }
 public ChangeAssociationTargetEvent(Relation relation, Classifier newTarget)
 {
     _relation = relation;
     _newTarget = newTarget;
 }
示例#10
0
 public void SetBaseClass(Classifier @interface, MessageSystem messageSystem)
 {
     var oldBaseClass = BaseClass;
     BaseClass = @interface;
     if (oldBaseClass == null)
         messageSystem.Publish(this, new BaseClassSetEvent(@interface.Name));
     else
         messageSystem.Publish(this, new BaseClassChangedEvent(oldBaseClass.Name,@interface.Name));
 }
示例#11
0
 public Relation AddNewRelation(
     Classifier target,
     RelationType associationType,
     string startName="", 
     string endName="") => 
     Associations.AddNewRelation(target, associationType, startName, endName);
示例#12
0
 public void ReplaceInterface(Implementation implementation, Classifier newInterface) => 
     _interfaceImplementations.ReplaceInterface(implementation, newInterface);
示例#13
0
        public void AddInterfaceImplementation(Classifier newInterface,MessageSystem messageSystem = null)
        {
            // ensure that only one interface is created after this method was executed
            // used to ensure a previous issue was fixed (two implementations were created instead of one)
            Ensures(InterfaceImplementations.Count == OldValue(InterfaceImplementations.Count + 1));

            var newImplementation = new Implementation(this, newInterface);
            InterfaceImplementations.AddInterfaceToList(newImplementation);
            messageSystem?.PublishCreated(InterfaceImplementations, newImplementation);
        }
示例#14
0
 public Method CreateMethod(string name, Classifier type,bool isVisible = true) => 
     Methods.CreateMethod(name, type,isVisible);
示例#15
0
 public virtual BaseList<Implementation>.SubSet FindImplementationsOfInterface(Classifier @interface) => 
     _interfaceImplementations.FindImplementationsOfInterface(@interface);
示例#16
0
 public void CreateParameter(Classifier classifier, string name)
     => _parameters.CreateParameter(classifier, name);
示例#17
0
 public Property(string name, Classifier type, bool isVisible = true)
 {
     Type = type;
     Name = name;
     IsVisible = isVisible;
 }
示例#18
0
 public void RemoveImplementationForInterface(Classifier @interface,MessageSystem messageSystem = null) =>
     _interfaceImplementations.RemoveImplementationForInterface(@interface,messageSystem);
示例#19
0
 public Method(string name, Classifier returnType, bool isVisible = true)
 {
     Name = name;
     ReturnType = returnType;
     IsVisible = isVisible;
 }
 protected override bool ShouldItemBeVisible(Classifier classifier) => classifier.IsInterface;
示例#21
0
 public Parameter(Classifier type, string name)
 {
     _type = type;
     Name = name;
 }
 protected override void RegisterForClassifierEvent(MessageSystem messageSystem, Classifier classifier)
 {
     messageSystem.Subscribe<ClassToInterfaceEvent>(classifier, OnClassToInterfaceChanged);
     messageSystem.Subscribe<InterfaceToClassEvent>(classifier, OnInterfaceToClassChanged);
 }
示例#23
0
 public RelationNode(Classifier classifier, string name = "", bool isNavigable = false)
 {
     Classifier = classifier;
     Name = name;
     IsNavigatable = isNavigable;
 }
示例#24
0
 public Property CreateProperty(string name, Classifier type,bool isVisible = true) => 
     Properties.CreateProperty(name, type,isVisible);