4
4
using System ;
5
5
using System . Threading . Tasks ;
6
6
using Microsoft . AspNetCore . Server . Kestrel . Internal . Http ;
7
- using Microsoft . AspNetCore . Server . Kestrel . Internal . Infrastructure ;
8
7
using Microsoft . AspNetCore . Testing ;
9
8
using Xunit ;
10
9
11
10
namespace Microsoft . AspNetCore . Server . KestrelTests
12
11
{
13
12
public class DateHeaderValueManagerTests
14
13
{
14
+ /// <summary>
15
+ /// DateTime format string for RFC1123.
16
+ /// </summary>
17
+ /// <remarks>
18
+ /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#RFC1123 for info on the format.
19
+ /// </remarks>
20
+ private const string Rfc1123DateFormat = "r" ;
21
+
15
22
[ Fact ]
16
23
public void GetDateHeaderValue_ReturnsDateValueInRFC1123Format ( )
17
24
{
@@ -34,7 +41,7 @@ public void GetDateHeaderValue_ReturnsDateValueInRFC1123Format()
34
41
dateHeaderValueManager . Dispose ( ) ;
35
42
}
36
43
37
- Assert . Equal ( now . ToString ( Constants . RFC1123DateFormat ) , result ) ;
44
+ Assert . Equal ( now . ToString ( Rfc1123DateFormat ) , result ) ;
38
45
}
39
46
40
47
[ Fact ]
@@ -63,8 +70,8 @@ public void GetDateHeaderValue_ReturnsCachedValueBetweenTimerTicks()
63
70
dateHeaderValueManager . Dispose ( ) ;
64
71
}
65
72
66
- Assert . Equal ( now . ToString ( Constants . RFC1123DateFormat ) , result1 ) ;
67
- Assert . Equal ( now . ToString ( Constants . RFC1123DateFormat ) , result2 ) ;
73
+ Assert . Equal ( now . ToString ( Rfc1123DateFormat ) , result1 ) ;
74
+ Assert . Equal ( now . ToString ( Rfc1123DateFormat ) , result2 ) ;
68
75
Assert . Equal ( 1 , systemClock . UtcNowCalled ) ;
69
76
}
70
77
@@ -96,8 +103,8 @@ public async Task GetDateHeaderValue_ReturnsUpdatedValueAfterIdle()
96
103
dateHeaderValueManager . Dispose ( ) ;
97
104
}
98
105
99
- Assert . Equal ( now . ToString ( Constants . RFC1123DateFormat ) , result1 ) ;
100
- Assert . Equal ( future . ToString ( Constants . RFC1123DateFormat ) , result2 ) ;
106
+ Assert . Equal ( now . ToString ( Rfc1123DateFormat ) , result1 ) ;
107
+ Assert . Equal ( future . ToString ( Rfc1123DateFormat ) , result2 ) ;
101
108
Assert . True ( systemClock . UtcNowCalled >= 2 ) ;
102
109
}
103
110
@@ -119,8 +126,8 @@ public void GetDateHeaderValue_ReturnsDateValueAfterDisposed()
119
126
systemClock . UtcNow = future ;
120
127
var result2 = dateHeaderValueManager . GetDateHeaderValues ( ) . String ;
121
128
122
- Assert . Equal ( now . ToString ( Constants . RFC1123DateFormat ) , result1 ) ;
123
- Assert . Equal ( future . ToString ( Constants . RFC1123DateFormat ) , result2 ) ;
129
+ Assert . Equal ( now . ToString ( Rfc1123DateFormat ) , result1 ) ;
130
+ Assert . Equal ( future . ToString ( Rfc1123DateFormat ) , result2 ) ;
124
131
}
125
132
}
126
133
}
0 commit comments