internal void SetFromQuestionInfo(string site, QuestionInfo qInfo) { this.QuestionId = qInfo.Id; this.Date = qInfo.CreationDate; this.Site = site; this.TagsList = String.Join(",", qInfo.Tags); }
public void ToQuestionInfoShouldSplitTags() { Question target = new Question { Date = new DateTime(2010, 06,23), Id = 1, QuestionId = 45, Site = "site", TagsList="tag1,tag2"}; QuestionInfo expected = new QuestionInfo { CreationDate = new DateTime(2010, 06, 23), Id = 45, Tags = new System.Collections.Generic.List<string> { "tag1", "tag2"} }; var actual = target.ToQuestionInfo(); Assert.AreEqual(expected, actual); }
public void ToQuestionInfoShouldReturnEmptyTagsForNullTagsList() { Question target = new Question { Date = new DateTime(2010, 06, 23), Id = 1, QuestionId = 45, Site = "site", TagsList = null }; QuestionInfo expected = new QuestionInfo { CreationDate = new DateTime(2010, 06, 23), Id = 45, Tags = new System.Collections.Generic.List<string> { } }; var actual = target.ToQuestionInfo(); Assert.AreEqual(expected, actual); }
public void ToQuestionInfoTest() { Question question = new Question { CreationDate = new DateTime(2009, 06, 23, 1, 2, 3), Id = 123, Tags = new List<string> { "tag1", "tag2" } }; QuestionInfo expected = new QuestionInfo { CreationDate = new DateTime(2009, 06, 23, 1, 2, 3), Id = 123, Tags = new List<string> { "tag1", "tag2"} }; QuestionInfo actual; actual = StackyExtensions.ToQuestionInfo(question); Assert.AreEqual(expected, actual); }
public void SetFromQuestionInfoTest() { Question expected = new Question { Date = new DateTime(2010, 06, 23),QuestionId = 45, Site="site1", TagsList = "tag1,tag2" }; QuestionInfo qInfo = new QuestionInfo { CreationDate = new DateTime(2010, 06, 23), Id = 45, Tags = new System.Collections.Generic.List<string> { "tag1", "tag2" } }; var target = new Question(); target.SetFromQuestionInfo("site1", qInfo); Assert.AreEqual(expected, target); }