< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Forms.KrRawPart
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Forms/KrModels.cs
Tag: Kestrun/Kestrun@d9261bd752e45afa789d10bc0c82b7d5724d9589
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 122
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 02/05/2026 - 00:28:18 Line coverage: 100% (6/6) Total lines: 122 Tag: Kestrun/Kestrun@d9261bd752e45afa789d10bc0c82b7d5724d9589

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
get_ContentType()100%11100%
get_Length()100%11100%
get_TempPath()100%11100%
get_Headers()100%11100%
get_NestedPayload()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Forms/KrModels.cs

#LineLine coverage
 1using System.Collections.ObjectModel;
 2
 3namespace Kestrun.Forms;
 4
 5/// <summary>
 6/// Represents a parsed form payload.
 7/// </summary>
 8public interface IKrFormPayload { }
 9
 10/// <summary>
 11/// Represents a form payload containing named fields and files.
 12/// </summary>
 13[OpenApiSchemaComponent(
 14    Description = "Base schema for parsed multipart/form-data payloads. Concrete form models should declare the expected
 15    Type = OaSchemaType.Object,
 16    AdditionalPropertiesAllowed = true, AdditionalProperties = typeof(string)
 17)]
 18public class KrFormData : IKrFormPayload
 19{
 20    /// <summary>
 21    /// Gets the parsed fields keyed by field name.
 22    /// </summary>
 23    public Dictionary<string, string[]> Fields { get; } = new(StringComparer.OrdinalIgnoreCase);
 24
 25    /// <summary>
 26    /// Gets the parsed files keyed by field name.
 27    /// </summary>
 28    public Dictionary<string, KrFilePart[]> Files { get; } = new(StringComparer.OrdinalIgnoreCase);
 29}
 30
 31/// <summary>
 32/// Represents a form payload containing ordered parts.
 33/// </summary>
 34[OpenApiSchemaComponent(
 35    Description = "Base schema for parsed multipart/mixed payloads. Concrete models should declare the expected parts as
 36    Type = OaSchemaType.Object,
 37    AdditionalPropertiesAllowed = true
 38)]
 39public class KrMultipart : IKrFormPayload
 40{
 41    /// <summary>
 42    /// Gets the ordered list of parts in the payload.
 43    /// </summary>
 44    public List<KrRawPart> Parts { get; } = [];
 45}
 46
 47/// <summary>
 48/// Represents a stored file part.
 49/// </summary>
 50public sealed record KrFilePart
 51{
 52    /// <summary>
 53    /// Gets the field name associated with the file part.
 54    /// </summary>
 55    public required string Name { get; init; }
 56
 57    /// <summary>
 58    /// Gets the original file name.
 59    /// </summary>
 60    public required string OriginalFileName { get; init; }
 61
 62    /// <summary>
 63    /// Gets the content type of the file.
 64    /// </summary>
 65    public string ContentType { get; init; } = "application/octet-stream";
 66
 67    /// <summary>
 68    /// Gets the length of the stored file.
 69    /// </summary>
 70    public long Length { get; init; }
 71
 72    /// <summary>
 73    /// Gets the temporary storage path for the file.
 74    /// </summary>
 75    public required string TempPath { get; init; }
 76
 77    /// <summary>
 78    /// Gets the SHA-256 hash of the file if computed.
 79    /// </summary>
 80    public string? Sha256 { get; init; }
 81
 82    /// <summary>
 83    /// Gets the headers associated with the part.
 84    /// </summary>
 85    public IReadOnlyDictionary<string, string[]> Headers { get; init; } = new ReadOnlyDictionary<string, string[]>(new D
 86}
 87
 88/// <summary>
 89/// Represents a stored raw part, preserving order in multipart/mixed payloads.
 90/// </summary>
 91public sealed record KrRawPart
 92{
 93    /// <summary>
 94    /// Gets the optional part name.
 95    /// </summary>
 1996    public string? Name { get; init; }
 97
 98    /// <summary>
 99    /// Gets the content type of the part.
 100    /// </summary>
 20101    public string ContentType { get; init; } = "application/octet-stream";
 102
 103    /// <summary>
 104    /// Gets the length of the stored part.
 105    /// </summary>
 4106    public long Length { get; init; }
 107
 108    /// <summary>
 109    /// Gets the temporary storage path for the part.
 110    /// </summary>
 22111    public required string TempPath { get; init; }
 112
 113    /// <summary>
 114    /// Gets the headers associated with the part.
 115    /// </summary>
 13116    public IReadOnlyDictionary<string, string[]> Headers { get; init; } = new ReadOnlyDictionary<string, string[]>(new D
 117
 118    /// <summary>
 119    /// Gets the nested multipart payload, if present.
 120    /// </summary>
 8121    public IKrFormPayload? NestedPayload { get; init; }
 122}