public void DesnickvAmericanBroadcastingCompaniesInc()
        {
            var test = new TrespassToPerson(ExtensionMethods.Tortfeasor)
            {
                Consent         = Consent.NotGiven(),
                Causation       = Causation.ItsObvious(),
                SubjectProperty = new LegalProperty("some office"),
                Injury          = new Defamation(ExtensionMethods.Tortfeasor)
                {
                    IsFalseStatement     = (l1, l2) => l1 is Desnick && l2 is AmericanBroadcastingCompaniesInc,
                    IsPublishedStatement = lp => lp is AmericanBroadcastingCompaniesInc,
                    IsUnwantedStatement  = lp => lp is Desnick
                },
            };

            var testResult = test.IsValid(new Desnick(), new AmericanBroadcastingCompaniesInc());

            Assert.IsTrue(testResult);


            test.Injury = new InvasionOfPrivacy(ExtensionMethods.Tortfeasor)
            {
                IsInPlainSight         = lp => true,
                IsExpectationOfPrivacy = lp => false
            };

            testResult = test.IsValid(new Desnick(), new AmericanBroadcastingCompaniesInc());
            Assert.IsFalse(testResult);

            Console.WriteLine(test.ToString());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public override void ClearReasons()
 {
     Injury?.ClearReasons();
     Causation?.ClearReasons();
     base.ClearReasons();
 }