-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented two edge cases to support of up to nine digit nanoseconds…
… format. Added unit tests.
- Loading branch information
1 parent
cc4315e
commit 4a9ef92
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace k8s.Tests; | ||
|
||
public class KubernetesJsonTests | ||
{ | ||
private class RfcTime | ||
Check failure on line 8 in tests/KubernetesClient.Tests/KubernetesJsonTests.cs GitHub Actions / Analyze (csharp)
Check failure on line 8 in tests/KubernetesClient.Tests/KubernetesJsonTests.cs GitHub Actions / Analyze (csharp)
Check failure on line 8 in tests/KubernetesClient.Tests/KubernetesJsonTests.cs GitHub Actions / Analyze (csharp)
Check failure on line 8 in tests/KubernetesClient.Tests/KubernetesJsonTests.cs GitHub Actions / Analyze (csharp)
|
||
{ | ||
public DateTime rfc3339 { get; set; } | ||
} | ||
|
||
[Fact] | ||
public void RFC3339() | ||
{ | ||
var json = "{\"rfc3339\":\"2009-11-10T23:00:00Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T23:00:00.000000Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.000000000Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.123456789Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.12345678Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.1234567Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.123456Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.12345Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.1234Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.123Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.12Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.1Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.01Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.001Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.0001Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.00001Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.000001Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.0000001Z\"," | ||
+ "\"rfc3339\":\"2009-11-10T13:00:00.0000001\"}\r\n"; | ||
|
||
KubernetesJson.Deserialize<RfcTime>(json); | ||
} | ||
} |