public string Perform(string[] args) { string output = ""; var childToFind = args[1]; var node = this._kingdom.FindChild(childToFind); if (node == null) { return(Message.PersonNotFound); } var operation = args[0]; switch (operation) { case "ADD_CHILD": var gender = args[3]; var childName = args[2]; var success = node.AddChildren(childName, gender.Equals(Female) ? Gender.Female : Gender.Male); output = success ? Message.ChildAdditionSuccessful : Message.ChildAdditionFailed; break; case "GET_RELATIONSHIP": var handler = _relationshipHandler.GetHandler(args[2]); if (handler != null) { var result = handler.Process(node); output = ConvertToString(result); } break; } return(output); }
public void GivenRelationshipTypeAsSiblings_ShouldReturnSiblingsHandler() { var handler = _relationshipHandler.GetHandler(Relationship.Siblings); Assert.NotNull(handler); }