예제 #1
0
 internal void SetFromQuestionInfo(string site, QuestionInfo qInfo)
 {
     this.QuestionId = qInfo.Id;
     this.Date = qInfo.CreationDate;
     this.Site = site;
     this.TagsList = String.Join(",", qInfo.Tags);
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 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);
 }
예제 #5
0
        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);
        }