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); }