Exemplo n.º 1
0
        public override bool IsValid(params ILegalPerson[] persons)
        {
            var defendant = this.Defendant(persons);

            if (defendant == null)
            {
                return(false);
            }
            var title = defendant.GetLegalPersonTypeName();

            //threats for what is honestly owed is not illegal
            if (SubjectProperty?.IsEntitledTo(defendant) ?? false)
            {
                AddReasonEntry($"{title} {defendant.Name}, is entitled to " +
                               $"{SubjectProperty?.GetType().Name} " +
                               $"named '{SubjectProperty?.Name}'");
                return(false);
            }

            if (!base.IsValid(persons))
            {
                return(false);
            }

            var threatening = Threatening ?? new ByThreatening();

            if (!threatening.IsValid(persons))
            {
                AddReasonEntryRange(threatening.GetReasonEntries());
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public override bool IsValid(params ILegalPerson[] persons)
        {
            var defendant = this.Defendant(persons);

            if (defendant == null)
            {
                return(false);
            }
            var title = defendant.GetLegalPersonTypeName();

            if (!WithoutConsent(persons))
            {
                return(false);
            }

            if (PropertyOwnerIsSubjectPerson(persons))
            {
                return(false);
            }

            if (!IsCauseOfDamage(defendant))
            {
                AddReasonEntry($"{title} {defendant.Name}, {nameof(IsCauseOfDamage)} is false");
                return(false);
            }

            if (!IsDamaged(SubjectProperty))
            {
                AddReasonEntry($"property {SubjectProperty?.GetType().Name}, '{SubjectProperty?.Name}', " +
                               $"{nameof(IsDamaged)} is false");
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        protected virtual bool InPossessionOfDefendant(ILegalPerson[] persons)
        {
            var defendant = this.Defendant(persons);

            if (defendant == null)
            {
                return(false);
            }
            var title   = defendant.GetLegalPersonTypeName();
            var possess = persons.FirstOrDefault(p => SubjectProperty.IsInPossessionOf(p));

            if (!defendant.Equals(possess) && !ReferenceEquals(defendant, possess))
            {
                AddReasonEntry($"{title} {defendant.Name}, does not " +
                               $"possess {SubjectProperty?.GetType().Name} " +
                               $"named {SubjectProperty?.Name} - it is possessed " +
                               $"by {possess?.Name}");
                return(false);
            }

            return(true);
        }