• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Jericho / StrongGrid / 1200

18 Apr 2024 01:42PM UTC coverage: 73.71% (-0.8%) from 74.544%
1200

push

appveyor

Jericho
Merge branch 'release/0.107.0'

2829 of 3838 relevant lines covered (73.71%)

82.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/Source/StrongGrid/Json/NullableEpochConverter.cs
1
using System;
2
using System.Text.Json;
3
using System.Text.Json.Serialization;
4

5
namespace StrongGrid.Json
6
{
7
        /// <summary>
8
        /// Converts a 'Unix time' expressed as the number of seconds since midnight on January 1st 1970 to and from JSON.
9
        /// </summary>
10
        /// <seealso cref="JsonConverter" />
11
        internal class NullableEpochConverter : BaseJsonConverter<DateTime?>
12
        {
13
                private readonly EpochConverter _epochConverter = new EpochConverter();
7✔
14

15
                public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
16
                {
17
                        switch (reader.TokenType)
27✔
18
                        {
19
                                case JsonTokenType.None:
20
                                case JsonTokenType.Null:
21
                                        return null;
×
22

23
                                default:
24
                                        return _epochConverter.Read(ref reader, typeToConvert, options);
27✔
25
                        }
26
                }
27

28
                public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options)
29
                {
30
                        if (!value.HasValue) writer.WriteNullValue();
1✔
31
                        else _epochConverter.Write(writer, value.Value, options);
1✔
32
                }
1✔
33
        }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc