protected internal virtual bool IsPhysicalDamage(ILegalPerson[] persons) { if (PropertyDamage == null) { AddReasonEntry($"The {nameof(Injury)} is not of type {nameof(Damage)}"); return(false); } PropertyDamage.GetSubjectPerson = PropertyDamage.GetSubjectPerson ?? ExtensionMethods.Tortfeasor; PropertyDamage.SubjectProperty = PropertyDamage.SubjectProperty ?? SubjectProperty; var rslt = PropertyDamage.IsValid(persons); AddReasonEntryRange(PropertyDamage.GetReasonEntries()); if (Causation == null) { AddReasonEntry($"{nameof(Causation)} is unassigned"); return(rslt); } Causation.GetSubjectPerson = Causation.GetSubjectPerson ?? ExtensionMethods.Tortfeasor; rslt = rslt && Causation.IsValid(persons); AddReasonEntryRange(Causation.GetReasonEntries()); return(rslt); }
public override bool IsValid(params ILegalPerson[] persons) { var subj = GetSubjectPerson(persons); if (subj == null) { AddReasonEntry($"{nameof(GetSubjectPerson)} returned nothing"); return(false); } var title = subj.GetLegalPersonTypeName(); if (PropertyOwnerIsSubjectPerson(persons)) { return(false); } if (!WithoutConsent(persons)) { return(false); } if (Injury == null) { AddReasonEntry($"{title} {subj.Name}, {nameof(Injury)} is unassigned"); return(false); } var rslt = Injury.IsValid(persons); AddReasonEntryRange(Injury.GetReasonEntries()); if (Causation == null) { AddReasonEntry($"{nameof(Causation)} is unassigned"); return(rslt); } Causation.GetSubjectPerson = Causation.GetSubjectPerson ?? ExtensionMethods.Tortfeasor; rslt = rslt && Causation.IsValid(persons); AddReasonEntryRange(Causation.GetReasonEntries()); return(rslt); }