up
This commit is contained in:
@@ -41,7 +41,9 @@ internal sealed class InMemoryReachabilityFactRepository : IReachabilityFactRepo
|
||||
RuntimeFacts = source.RuntimeFacts?.Select(CloneRuntime).ToList(),
|
||||
Metadata = source.Metadata is null ? null : new Dictionary<string, string?>(source.Metadata, StringComparer.OrdinalIgnoreCase),
|
||||
ContextFacts = source.ContextFacts,
|
||||
Uncertainty = CloneUncertainty(source.Uncertainty),
|
||||
Score = source.Score,
|
||||
RiskScore = source.RiskScore,
|
||||
UnknownsCount = source.UnknownsCount,
|
||||
UnknownsPressure = source.UnknownsPressure,
|
||||
ComputedAt = source.ComputedAt,
|
||||
@@ -81,4 +83,33 @@ internal sealed class InMemoryReachabilityFactRepository : IReachabilityFactRepo
|
||||
ObservedAt = source.ObservedAt,
|
||||
Metadata = source.Metadata is null ? null : new Dictionary<string, string?>(source.Metadata, StringComparer.OrdinalIgnoreCase)
|
||||
};
|
||||
|
||||
private static UncertaintyDocument? CloneUncertainty(UncertaintyDocument? source)
|
||||
{
|
||||
if (source is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new UncertaintyDocument
|
||||
{
|
||||
States = source.States?.Select(CloneUncertaintyState).ToList() ?? new List<UncertaintyStateDocument>()
|
||||
};
|
||||
}
|
||||
|
||||
private static UncertaintyStateDocument CloneUncertaintyState(UncertaintyStateDocument source) => new()
|
||||
{
|
||||
Code = source.Code,
|
||||
Name = source.Name,
|
||||
Entropy = source.Entropy,
|
||||
Timestamp = source.Timestamp,
|
||||
Evidence = source.Evidence?.Select(CloneUncertaintyEvidence).ToList() ?? new List<UncertaintyEvidenceDocument>()
|
||||
};
|
||||
|
||||
private static UncertaintyEvidenceDocument CloneUncertaintyEvidence(UncertaintyEvidenceDocument source) => new()
|
||||
{
|
||||
Type = source.Type,
|
||||
SourceId = source.SourceId,
|
||||
Detail = source.Detail
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user