public Implementation(Classifier start, Classifier end) :base(start,end, RelationType.Implementation, string.Empty) { Requires(start != end); Requires(end.IsInterface); }
public void ReplaceInterface(Classifier newInterface) { Requires(newInterface != null); Requires(newInterface.IsInterface); End.Classifier = newInterface; }
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)); }
/// <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; }
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)); }
public Relation AddNewRelation( Classifier target, RelationType associationType, string startName="", string endName="") => Associations.AddNewRelation(target, associationType, startName, endName);
public void ReplaceInterface(Implementation implementation, Classifier newInterface) => _interfaceImplementations.ReplaceInterface(implementation, newInterface);
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); }
public Method CreateMethod(string name, Classifier type,bool isVisible = true) => Methods.CreateMethod(name, type,isVisible);
public virtual BaseList<Implementation>.SubSet FindImplementationsOfInterface(Classifier @interface) => _interfaceImplementations.FindImplementationsOfInterface(@interface);
public void CreateParameter(Classifier classifier, string name) => _parameters.CreateParameter(classifier, name);
public Property(string name, Classifier type, bool isVisible = true) { Type = type; Name = name; IsVisible = isVisible; }
public void RemoveImplementationForInterface(Classifier @interface,MessageSystem messageSystem = null) => _interfaceImplementations.RemoveImplementationForInterface(@interface,messageSystem);
public Method(string name, Classifier returnType, bool isVisible = true) { Name = name; ReturnType = returnType; IsVisible = isVisible; }
protected override bool ShouldItemBeVisible(Classifier classifier) => classifier.IsInterface;
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); }
public RelationNode(Classifier classifier, string name = "", bool isNavigable = false) { Classifier = classifier; Name = name; IsNavigatable = isNavigable; }
public Property CreateProperty(string name, Classifier type,bool isVisible = true) => Properties.CreateProperty(name, type,isVisible);