< Summary

Information
Class: Anichron.Worker.Ingestion.Extraction.RecordedDate
Assembly: Anichron.Worker
File(s): /home/runner/work/anichron/anichron/src/Anichron.Worker/Ingestion/Extraction/RecordedDate.cs
Tag: 19_45211875487
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 42
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
In(...)100%22100%
In(...)100%22100%
In(...)100%44100%

File(s)

/home/runner/work/anichron/anichron/src/Anichron.Worker/Ingestion/Extraction/RecordedDate.cs

#LineLine coverage
 1using Anichron.Core.Domain;
 2using NodaTime;
 3
 4namespace Anichron.Worker.Ingestion.Extraction;
 5
 6/// <summary>A capture date as a file records it: a clock time, a date alone, or a moment recorded only in UTC.</summary
 7internal abstract record RecordedDate
 8{
 1989    private RecordedDate()
 19810    {
 19811    }
 12
 13    /// <summary>The capture date, with the time zone at the asset's position; the zone never changes a recorded clock t
 14    /// <param name="atPosition">The zone at the asset's position, if it has one.</param>
 15    /// <param name="library">The library's zone, which reads a moment recorded without a position.</param>
 16    public abstract CaptureDate In(DateTimeZone? atPosition, DateTimeZone library);
 17
 18    /// <summary>A clock time, with the offset the file records beside it.</summary>
 19    /// <param name="At">The recorded clock time.</param>
 20    /// <param name="Offset">The recorded offset, if any.</param>
 21    internal sealed record ClockTime(LocalDateTime At, Offset? Offset) : RecordedDate
 22    {
 23        public override CaptureDate In(DateTimeZone? atPosition, DateTimeZone library)
 5324            => new(At, Offset, CaptureSource.Recorded, atPosition?.Id);
 25    }
 26
 27    /// <summary>A date the file records without a time; it dates the asset at 00:00 and keeps no offset.</summary>
 28    /// <param name="Date">The recorded date.</param>
 29    internal sealed record DateAlone(LocalDate Date) : RecordedDate
 30    {
 31        public override CaptureDate In(DateTimeZone? atPosition, DateTimeZone library)
 332            => new(Date.AtMidnight(), null, CaptureSource.RecordedDateOnly, atPosition?.Id);
 33    }
 34
 35    /// <summary>A moment the file records only in UTC; it keeps no offset, since the zone it is read in gives one.</sum
 36    /// <param name="At">The recorded moment.</param>
 37    internal sealed record Moment(Instant At) : RecordedDate
 38    {
 39        public override CaptureDate In(DateTimeZone? atPosition, DateTimeZone library)
 440            => new(At.InZone(atPosition ?? library).LocalDateTime, null, CaptureSource.RecordedInUtc, atPosition?.Id);
 41    }
 42}