File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
src/CloudNative.CloudEvents
test/CloudNative.CloudEvents.UnitTests Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,11 @@ internal static class Timestamps
44
44
/// <summary>
45
45
/// Attempts to parse a string as an RFC-3339-formatted date/time and UTC offset.
46
46
/// </summary>
47
- /// <param name="input"></param>
48
- /// <param name="result"></param>
49
- /// <returns></returns>
50
- public static bool TryParse ( string input , out DateTimeOffset result )
47
+ /// <param name="input">A string to be parsed as a <see cref="DateTimeOffset"/>. </param>
48
+ /// <param name="result">A <see cref="DateTimeOffset"/> parsed from the <paramref name="input"/>. </param>
49
+ /// <returns><see langword="true"/> if <paramref name="input"/> was parsed successfully, <see langword="false"/> otherwise.< /returns>
50
+ internal static bool TryParse ( string input , out DateTimeOffset result )
51
51
{
52
- // TODO: Check this and add a test
53
52
Validation . CheckNotNull ( input , nameof ( input ) ) ;
54
53
55
54
if ( input . Length < MinLength ) // "yyyy-MM-ddTHH:mm:ssZ" is the shortest possible value.
Original file line number Diff line number Diff line change 1
- // Copyright 2021 Cloud Native Foundation.
1
+ // Copyright 2021 Cloud Native Foundation.
2
2
// Licensed under the Apache 2.0 license.
3
3
// See LICENSE file in the project root for full license information.
4
4
@@ -123,6 +123,13 @@ public void Parse_Failure(string text)
123
123
Assert . Throws < FormatException > ( ( ) => Timestamps . Parse ( text ) ) ;
124
124
}
125
125
126
+ [ Fact ]
127
+ public void Parse_Null ( )
128
+ {
129
+ Assert . Throws < ArgumentNullException > ( ( ) => Timestamps . TryParse ( null ! , out _ ) ) ;
130
+ Assert . Throws < ArgumentNullException > ( ( ) => Timestamps . Parse ( null ! ) ) ;
131
+ }
132
+
126
133
/// <summary>
127
134
/// As we're already testing parsing thoroughly, the simplest way of providing
128
135
/// a value to format is to parse a string. Many examples will round-trip, in which
You can’t perform that action at this time.
0 commit comments