public void _0018_Comment() { string input = string.Empty; string expect = string.Empty; var comments = new CommentsObject(); input = "CM_ \"Multi\r\nline\r\nNetwork\r\nComment\";"; expect = "Multi\r\nline\r\nNetwork\r\nComment"; comments.Parse(input); Assert.AreEqual(expect, comments.Network); input = "CM_ \"Single Line Comment\";"; expect = "Single Line Comment"; comments.Parse(input); Assert.AreEqual(expect, comments.Network); int msgTestIndex = 0; input = "CM_ BO_ 2 \"Single Line Comment\";"; expect = "Single Line Comment"; comments.Parse(input); Assert.AreEqual(2, comments.Messages[msgTestIndex].ArbitrationId); Assert.AreEqual(expect, comments.Messages[msgTestIndex].Comment); input = "CM_ BO_ 2 \"Multi\r\nline\r\nNetwork\r\nComment\";"; expect = "Single Line Comment"; comments.Parse(input); Assert.AreEqual(2, comments.Messages[msgTestIndex].ArbitrationId); Assert.AreEqual(expect, comments.Messages[msgTestIndex].Comment); int sigTestIndex = 0; input = "CM_ SG_ 4 EM_State_Signal \"Jel megjegyzés\";"; expect = "Jel megjegyzés"; comments.Parse(input); Assert.AreEqual("EM_State_Signal", comments.Signals[sigTestIndex].Name); Assert.AreEqual(4, comments.Signals[sigTestIndex].ArbitrationId); Assert.AreEqual(expect, comments.Signals[sigTestIndex].Comment); int nodeTestIndex = 0; input = "CM_ BU_ Omron \"Node Comment\";"; expect = "Node Comment"; comments.Parse(input); Assert.AreEqual("Omron", comments.Nodes[nodeTestIndex].Name); Assert.AreEqual(expect, comments.Nodes[nodeTestIndex].Comment); }
public async static Task <CommentsObject> GetCommentsOfAnswer(int ansId) { dynamic dynComObj = await GetResultFromURL(ANSWER_PATH + ansId + "/comments.json"); CommentsObject commentsObj = new CommentsObject(); commentsObj.Count = dynComObj.count; ObservableCollection <CommentObject> comments = new ObservableCollection <CommentObject>(); foreach (var comment in dynComObj.comments) { comments.Add(CommentObject.fromDynamic(comment)); } commentsObj.Comments = comments; return(commentsObj); }