public void CreateComment_ShouldReturnXml_WhenCommentProvided() { // Arrange var comment = new FacebookComment { Id = "id", CreatedTime = DateTime.Parse("2017-03-21 00:03:00"), Message = "message", From = new FacebookCommentUser { Id = "userid", Name = "username" } }; var formatter = new DisqusCommentsFormatter(); // Act var result = formatter.CreateComment(comment); // Assert result.Descendants(_wp + "comment_id").FirstOrDefault().Value.Should().Be("id"); result.Descendants(_wp + "comment_author").FirstOrDefault().Value.Should().Be("username"); result.Descendants(_wp + "comment_date_gmt").FirstOrDefault().Value.Should().Be("2017-03-21 00:03:00"); result.Descendants(_wp + "comment_approved").FirstOrDefault().Value.Should().Be("1"); }
public void CreateComment_ShouldThrowArgumentNullException_WhenCommentIsNull() { // Arrange var formatter = new DisqusCommentsFormatter(); // Act Action action = () => formatter.CreateComment(null); // Assert action.ShouldThrow <ArgumentNullException>(); }
public void CreateComment_ShouldAddZeroParentId_WhenParentIdNotProvided() { // Arrange var comment = new FacebookComment { Message = string.Empty, From = new FacebookCommentUser() }; var formatter = new DisqusCommentsFormatter(); // Act var result = formatter.CreateComment(comment); // Assert result.Descendants(_wp + "comment_parent").FirstOrDefault().Value.Should().Be("0"); }