File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ internal Dictionary<string, string> ToDictionary() {
59
59
var map = Author . ToDictionary ( ) ;
60
60
if ( ! string . IsNullOrWhiteSpace ( Content ) ) map [ "comment_content" ] = Content ;
61
61
// TODO if (Context.Count > 0) map["comment_context"] = string.Join(',', Context);
62
- if ( Date is not null ) map [ "comment_date_gmt" ] = Date ? . ToUniversalTime ( ) . ToString ( "yyyy-MM-ddTHH:mm:ssZ " ) ! ;
62
+ if ( Date is not null ) map [ "comment_date_gmt" ] = Date ? . ToUniversalTime ( ) . ToString ( "o " ) ! ;
63
63
if ( Permalink is not null ) map [ "permalink" ] = Permalink . ToString ( ) ;
64
- if ( PostModified is not null ) map [ "comment_post_modified_gmt" ] = PostModified ? . ToUniversalTime ( ) . ToString ( "yyyy-MM-ddTHH:mm:ssZ " ) ! ;
64
+ if ( PostModified is not null ) map [ "comment_post_modified_gmt" ] = PostModified ? . ToUniversalTime ( ) . ToString ( "o " ) ! ;
65
65
if ( ! string . IsNullOrWhiteSpace ( RecheckReason ) ) map [ "recheck_reason" ] = RecheckReason ;
66
66
if ( Referrer is not null ) map [ "referrer" ] = Referrer . ToString ( ) ;
67
67
if ( ! string . IsNullOrWhiteSpace ( Type ) ) map [ "comment_type" ] = Type ;
Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ public ClientTest() {
49
49
UserAgent = "Spam Bot/6.6.6"
50
50
} ;
51
51
52
- spam = new Comment ( spamAuthor ) { Content = "Spam!" , Type = CommentType . BlogPost } ;
52
+ spam = new Comment ( spamAuthor ) {
53
+ Content = "Spam!" ,
54
+ Date = DateTime . Now ,
55
+ Type = CommentType . BlogPost
56
+ } ;
53
57
}
54
58
55
59
[ TestMethod ]
Original file line number Diff line number Diff line change 1
1
namespace Belin . Akismet ;
2
2
3
+ using System . Globalization ;
4
+
3
5
/// <summary>
4
6
/// Tests the features of the <see cref="Comment"/> class.
5
7
/// </summary>
@@ -21,7 +23,7 @@ public void ToDictionary() {
21
23
22
24
var comment = new Comment ( author ) {
23
25
Content = "A user comment." ,
24
- Date = DateTime . Parse ( "2000-01-01T00:00:00.000Z" ) ,
26
+ Date = DateTime . Parse ( "2000-01-01T00:00:00Z" , styles : DateTimeStyles . RoundtripKind ) ,
25
27
Referrer = new Uri ( "https://belin.io" ) ,
26
28
Type = "blog-post"
27
29
} ;
@@ -30,7 +32,7 @@ public void ToDictionary() {
30
32
AreEqual ( 7 , map . Count ) ;
31
33
AreEqual ( "Cédric Belin" , map [ "comment_author" ] ) ;
32
34
AreEqual ( "A user comment." , map [ "comment_content" ] ) ;
33
- AreEqual ( "2000-01-01T00:00:00Z " , map [ "comment_date_gmt" ] ) ;
35
+ AreEqual ( "2000-01-01T00:00:00.0000000Z " , map [ "comment_date_gmt" ] ) ;
34
36
AreEqual ( "blog-post" , map [ "comment_type" ] ) ;
35
37
AreEqual ( "https://belin.io/" , map [ "referrer" ] ) ;
36
38
AreEqual ( "Doom/6.6.6" , map [ "user_agent" ] ) ;
You can’t perform that action at this time.
0 commit comments