Esempio n. 1
0
        public void DuttonvHayesPupko()
        {
            var testSue = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsAction    = lp => true,
                    IsVoluntary = lp => true
                },
                MensRea = StrictLiability.Value
            };

            var testResult = testSue.IsValid(new Dutton());

            Assert.IsTrue(testResult);

            var testSubject = new PolicePower
            {
                IsAgentOfTheState      = lp => lp is Dutton,
                IsReasonableUseOfForce = lp => false
            };

            testResult = testSubject.IsValid(new Dutton(), new HayesPupko());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 2
0
        public void TestBurglaryIntent()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new Burglary
                {
                    IsBreakingForce       = lp => lp is ChristianShovesEg,
                    IsTangibleEntry       = lp => lp is ChristianShovesEg,
                    IsStructuredEnclosure = lp => lp is SupposedHauntedHouse
                },
                MensRea = new IsHouseHaunted()
            };
            var testResult = testCrime.IsValid(new ChristianShovesEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);

            testCrime = new Misdemeanor
            {
                ActusReus = new CriminalTrespass
                {
                    IsTangibleEntry = lp => lp is ChristianShovesEg,
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is ChristianShovesEg
                }
            };

            testResult = testCrime.IsValid(new ChristianShovesEg());
            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 3
0
        public void ExampleMistakeOfFactCorrect()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is MickieEg,
                    IsAction    = lp => lp is MickieEg,
                },
                MensRea = new GeneralIntent
                {
                    //this is the point, prosecution says this, mistake-of-fact undo's it
                    IsKnowledgeOfWrongdoing = lp => lp is MickieEg
                }
            };

            var testResult = testCrime.IsValid(new MickieEg());

            Assert.IsTrue(testResult);

            var testSubject = new MistakeOfFact
            {
                IsBeliefNegateIntent = lp => lp is MickieEg,
                IsStrictLiability    = testCrime.MensRea is StrictLiability
            };

            testResult = testSubject.IsValid(new MickieEg());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 4
0
        public void ExampleMistakeOfFactIncorrect()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is TinaEg,
                    IsAction    = lp => lp is TinaEg,
                },
                MensRea = StrictLiability.Value
            };

            var testResult = testCrime.IsValid(new TinaEg());

            Assert.IsTrue(testResult);

            var testSubject = new MistakeOfFact
            {
                IsBeliefNegateIntent = lp => lp is TinaEg,
                IsStrictLiability    = testCrime.MensRea is StrictLiability
            };

            testResult = testSubject.IsValid(new TinaEg());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 5
0
        public void FactualImpossibilityTest()
        {
            var testCrime = new Misdemeanor
            {
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is MelissaEg2,
                    IsIntentOnWrongdoing    = lp => lp is MelissaEg2
                },
                ActusReus = new Attempt
                {
                    SubstantialSteps = new SubstantialSteps
                    {
                        IsInvestigatingPotentialScene = lp => lp is MelissaEg2,
                        IsPossessCriminalMaterial     = lp => lp is MelissaEg2
                    }
                }
            };

            var testResult = testCrime.IsValid(new MelissaEg2());

            Assert.IsTrue(testResult);

            var testSubject = new Impossibility(testCrime)
            {
                IsFactualImpossibility = MelissaEg2.IsFactual
            };

            testResult = testSubject.IsValid(new MelissaEg2());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 6
0
        public void ExampleVictimConsentGiven()
        {
            var cody     = new CodyFriendEg();
            var property = new ChewingGum {
                IsEntitledTo = lp => lp.IsSamePerson(cody)
            };

            var testCrime = new Misdemeanor
            {
                ActusReus = new ByTaking()
                {
                    SubjectProperty   = property,
                    IsTakenPossession = lp => lp is JeremyTheifEg,
                    IsAsportation     = lp => lp is JeremyTheifEg,
                    Consent           = new VictimConsent
                    {
                        IsCapableThereof = lp => true,
                        //Cody said it was ok to take the property
                        IsApprovalExpressed = lp => lp is CodyFriendEg,
                    }
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => lp is JeremyTheifEg
                },
            };
            var testResult = testCrime.IsValid(new JeremyTheifEg(), new CodyFriendEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 7
0
        public void TestOnlyForAttempt()
        {
            var testCrime = new Misdemeanor
            {
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is MelissaEg2,
                    IsIntentOnWrongdoing    = lp => lp is MelissaEg2
                },
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is MelissaEg2,
                    IsAction    = lp => lp is MelissaEg2
                }
            };

            var testResult = testCrime.IsValid(new MelissaEg2());

            Assert.IsTrue(testResult);

            var testSubject = new Impossibility(testCrime)
            {
                IsLegalImpossibility = MelissaEg2.IsLegal
            };

            var melissa = new MelissaEg2 {
                ItActuallyIsRatThatsBarking = true
            };

            testResult = testSubject.IsValid(melissa);
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
        public void TestWithAttendantCircumstances()
        {
            var publicPlace = new PublicPlace("sidewalk")
            {
                IsWithin = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
            };
            var testCrime = new Misdemeanor
            {
                ActusReus = new DisorderlyConduct
                {
                    IsUnreasonablyLoud = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
                },
                MensRea = new Recklessly
                {
                    IsDisregardOfRisk   = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg,
                    IsUnjustifiableRisk = lp => lp is DavidInebriatedEg || lp is DanielDrunkbuddyEg
                },
                AttendantCircumstances = { publicPlace }
            };
            var testResult = testCrime.IsValid(new DavidInebriatedEg(), new DanielDrunkbuddyEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);

            publicPlace.IsAccessibleToPublic = false;
            publicPlace.Name = "private residence in the country";
            testResult       = testCrime.IsValid(new DavidInebriatedEg(), new DanielDrunkbuddyEg());
            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 9
0
        public void TestDrugSale()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new DrugSale
                {
                    Acceptance = drug => drug is ScheduleI ? new LegalProperty("money")
                    {
                        PropertyValue = dt => 150m
                    } : null,
                    Assent = new Deal
                    {
                        IsApprovalExpressed = lp => true
                    },
                    Offer = new ScheduleI("pot")
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => true,
                }
            };
            var testResult = testCrime.IsValid(new CriminalNameHereEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 10
0
        public void StatevDaoud()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is Daoud,
                    IsAction    = lp => lp is Daoud
                },
                MensRea = StrictLiability.Value
            };

            var testResult = testCrime.IsValid(new Daoud());

            Assert.IsTrue(testResult);

            var testSubject = new ChoiceThereof <ITermCategory>(ExtensionMethods.Defendant)
            {
                GetChoice = lp => lp is Daoud ? new NondeadlyForce() : null,
                GetOtherPossibleChoices = lp => new List <ITermCategory>()
                {
                    new CallForTaxi(), new WalkedToNeighbor()
                },
            };

            testResult = testSubject.IsValid(new Daoud(), new JohnHilane());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 11
0
        public void ExampeMidemeanorManslaughter()
        {
            var testInputCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is RobertaBrandishEg,
                    IsAction    = lp => lp is RobertaBrandishEg
                },
                MensRea = new Negligently
                {
                    IsUnjustifiableRisk = lp => lp is RobertaBrandishEg,
                    IsUnawareOfRisk     = lp => lp is RobertaBrandishEg
                }
            };

            var testResult = testInputCrime.IsValid(new RobertaBrandishEg());

            Console.WriteLine(testInputCrime);
            Assert.IsTrue(testResult);

            var testCrime = new Felony
            {
                ActusReus = new HomicideInOther(testInputCrime)
                {
                    IsCorpusDelicti = lp => lp is RobertaBrandishEg
                },
                MensRea = testInputCrime.MensRea
            };

            testResult = testCrime.IsValid(new RobertaBrandishEg());
            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 12
0
        public void VoluntaryAbandonmentTest()
        {
            var testCrime = new Misdemeanor
            {
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is MelissaEg3,
                    IsIntentOnWrongdoing    = lp => lp is MelissaEg3
                },
                ActusReus = new Attempt
                {
                    SubstantialSteps = new SubstantialSteps
                    {
                        IsPossessCriminalMaterial = lp => lp is MelissaEg3
                    }
                }
            };

            var testResult = testCrime.IsValid(new MelissaEg3());

            Assert.IsTrue(testResult);

            var testSubject = new Abandonment(testCrime)
            {
                IsMotivatedByFearOfGettingCaught = lp => !MelissaEg3.IsAbandon(lp),
                IsMotivatedByNewDifficulty       = lp => !MelissaEg3.IsAbandon(lp)
            };

            testResult = testSubject.IsValid(new MelissaEg3());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 13
0
        public void ExampleRelianceTest()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ByDeception
                {
                    SubjectProperty   = new ActOfService("TUNE-UP SERVICE"),
                    IsFalseImpression = lp => lp is JeremyTheifEg,
                    IsAcquiredTitle   = lp => lp is JeremyTheifEg
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => lp is JeremyTheifEg,
                    IsIntentOnWrongdoing    = lp => lp is JeremyTheifEg
                }
            };
            //chuck was aware of the deception and attempted to use is for extortion
            var testReliance = new Reliance
            {
                IsReliantOnFalseRepresentation = lp => lp is ChuckUnrelianceEg
            };

            testCrime.AttendantCircumstances.Add(testReliance);

            var testResult = testCrime.IsValid(new JeremyTheifEg(), new ChuckUnrelianceEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 14
0
        public void LegalImpossibilityTest()
        {
            var testCrime = new Misdemeanor
            {
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is MelissaEg2,
                    IsIntentOnWrongdoing    = lp => lp is MelissaEg2
                },
                ActusReus = new Attempt
                {
                    SubstantialSteps = new SubstantialSteps
                    {
                        IsPossessCriminalMaterial = lp => lp is MelissaEg2,
                    }
                }
            };

            var testResult = testCrime.IsValid(new MelissaEg2());

            Assert.IsTrue(testResult);

            var testSubject = new Impossibility(testCrime)
            {
                IsLegalImpossibility = MelissaEg2.IsLegal
            };

            var melissa = new MelissaEg2 {
                ItActuallyIsRatThatsBarking = true
            };

            testResult = testSubject.IsValid(melissa);
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 15
0
        public void ExampleTreacheryTest()
        {
            var testAttendantCircumstance = new FiduciaryRelationship
            {
                IsTrustBetween = (lp1, lp2) => (lp1 is JeremyTheifEg && lp2 is CodyFriendEg) ||
                                 (lp1 is CodyFriendEg && lp2 is JeremyTheifEg)
            };

            var testCrime = new Misdemeanor
            {
                ActusReus = new ByTaking()
                {
                    SubjectProperty = new ChewingGum()
                    {
                        PropertyValue = dt => 1.25m
                    },
                    IsTakenPossession = lp => lp is JeremyTheifEg,
                    IsAsportation     = lp => lp is JeremyTheifEg
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => lp is JeremyTheifEg
                }
            };

            testCrime.AttendantCircumstances.Add(testAttendantCircumstance);
            var testResult = testCrime.IsValid(new JeremyTheifEg(), new CodyFriendEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 16
0
        public void ExampleAttemptAllFalse()
        {
            var testCrime = new Misdemeanor()
            {
                MensRea = new GeneralIntent
                {
                    IsIntentOnWrongdoing    = lp => lp is MelissaEg,
                    IsKnowledgeOfWrongdoing = lp => lp is MelissaEg,
                },
                ActusReus = new Attempt()
            };

            var testResult = testCrime.IsValid(new MelissaEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 17
0
        public void StatevSlayton()
        {
            var testSubject = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsAction    = lp => lp is Slayton,
                    IsVoluntary = lp => lp is Slayton
                },
                MensRea = StrictLiability.Value
            };

            var testResult = testSubject.IsValid(new Slayton());

            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 18
0
        public void TestDrugUse()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new DrugUse
                {
                    IsUnderInfluence = lp => true,
                    Offer            = new ScheduleI("pot")
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => true,
                }
            };
            var testResult = testCrime.IsValid(new CriminalNameHereEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 19
0
        public void TestDrugPossession()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new DrugPossession
                {
                    IsKnowinglyProcured = lp => true,
                    Offer = new ScheduleI("pot")
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => true,
                }
            };
            var testResult = testCrime.IsValid(new CriminalNameHereEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 20
0
        public void TestLoiteringIsValid()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new Loitering
                {
                    IsBegging = lp => lp is SomeBumEg,
                },
                MensRea = new Purposely
                {
                    IsIntentOnWrongdoing = lp => lp is SomeBumEg
                }
            };

            var testResult = testCrime.IsValid(new SomeBumEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 21
0
        public void ExampleRecklessIntent()
        {
            var testCrime = new Misdemeanor()
            {
                MensRea = new Recklessly
                {
                    IsDisregardOfRisk   = lp => lp is MelissaEg,
                    IsUnjustifiableRisk = lp => lp is MelissaEg
                },
                ActusReus = new Attempt
                {
                    IsProximity = lp => lp is MelissaEg
                }
            };
            var testResult = testCrime.IsValid(new MelissaEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 22
0
        public void StatevHiggs()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new Battery
                {
                    IsByViolence = lp => (lp as Higgs)?.IsThrowCupInFace ?? false
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is Higgs
                }
            };

            var testResult = testCrime.IsValid(new Higgs());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
        public void TestObstructionOfJustice()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ObstructionOfJustice
                {
                    IsRefuseToGiveEvidence = lp => lp is BarryBondsEg
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => lp is BarryBondsEg
                }
            };

            var testResult = testCrime.IsValid(new BarryBondsEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 24
0
        public void ExampleBattery()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new Battery
                {
                    IsByViolence = lp => lp is HarrietIncestEg
                },
                MensRea = new GeneralIntent
                {
                    IsIntentOnWrongdoing = lp => lp is HarrietIncestEg
                }
            };

            var testResult = testCrime.IsValid(new HarrietIncestEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
Esempio n. 25
0
        public void ExampleNotStalking()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new Stalking
                {
                    Occasions         = new[] { new DeclareLove(), new DeclareLove(), },
                    IsApparentAbility = lp => lp is ElliotStalkerEg
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is ElliotStalkerEg
                }
            };
            var testResult = testCrime.IsValid(new ElliotStalkerEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsFalse(testResult);
        }
Esempio n. 26
0
        public void CommonwealthvMiranda()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsAction    = lp => lp is TrooperSweet,
                    IsVoluntary = lp => lp is TrooperSweet
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is TrooperSweet,
                    IsIntentOnWrongdoing    = lp => lp is TrooperSweet
                }
            };

            var testResult = testCrime.IsValid(new Miranda());

            Assert.IsFalse(testResult);

            var testSubject = new DefenseOfOthers
            {
                //Maria attempted to defend Demetria based on the reasonably appearance that she was in danger from trooper Sweet
                IsReasonablyAppearedInjuryOrDeath = lp => lp is Miranda,
                Imminence = new Imminence(ExtensionMethods.Defendant)
                {
                    GetResponseTime = lp => Imminence.NormalReactionTimeToDanger
                },
                Provocation = new Provocation(ExtensionMethods.Defendant)
                {
                    IsInitiatorOfAttack = lp => lp is TrooperSweet,
                },
                Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant)
                {
                    GetChoice = lp => new NondeadlyForce()
                }
            };

            testResult = testSubject.IsValid(new Miranda(), new DemetriaBattle());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
        public void ExampleAccessoryTests()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is JimEg,
                    IsAction    = lp => lp is JimEg
                },
                MensRea = new Accessory
                {
                    IsAwareOfCrime             = lp => lp is JimEg,
                    IsAssistToEvadeProsecution = lp => lp is JimEg
                }
            };

            var testResult = testCrime.IsValid(new JimEg());

            Assert.IsTrue(testResult);
        }
Esempio n. 28
0
        public void ExampleEmbezzlementTheft()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ByTaking()
                {
                    SubjectProperty   = new TangiblePersonalProperty("payment for gas"),
                    IsTakenPossession = lp => lp is JeremyTheifEg,
                    IsAsportation     = lp => lp is JeremyTheifEg
                },
                MensRea = new Purposely
                {
                    IsKnowledgeOfWrongdoing = lp => lp is JeremyTheifEg
                }
            };
            var testResult = testCrime.IsValid(new JeremyTheifEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }
        public void ExampleDefenseOfProperty()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new ActusReus
                {
                    IsAction    = lp => lp is KelseyEg,
                    IsVoluntary = lp => lp is KelseyEg
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is KelseyEg,
                    IsIntentOnWrongdoing    = lp => lp is KelseyEg
                }
            };

            var testResult = testCrime.IsValid(new KelseyEg());

            Assert.IsTrue(testResult);

            var testSubject = new DefenseOfProperty
            {
                IsBeliefProtectProperty = lp => lp is KelseyEg,
                Imminence = new Imminence(ExtensionMethods.Defendant)
                {
                    GetResponseTime = lp => Imminence.NormalReactionTimeToDanger
                },
                Provocation = new Provocation(ExtensionMethods.Defendant)
                {
                    IsInitiatorOfAttack = lp => lp is KeithEg
                },
                Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant)
                {
                    GetChoice = lp => new NondeadlyForce()
                }
            };

            testResult = testSubject.IsValid(new KelseyEg(), new KeithEg());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
        public void ExampleUnlawfullAssembly()
        {
            var testCrime = new Misdemeanor
            {
                ActusReus = new UnlawfulAssembly
                {
                    IsUnreasonablyLoud = lp => lp is BuckShouterEg,
                    IsCombative        = lp => lp is BuckShouterEg,
                    IsGroupMember      = lp => lp is BuckShouterEg
                },
                MensRea = new Purposely
                {
                    IsIntentOnWrongdoing = lp => lp is BuckShouterEg
                }
            };
            var testResult = testCrime.IsValid(new BuckShouterEg(), new BuckBudoneEg(), new BuckBudtwoEg(),
                                               new BuckBudthreeEg(), new BuckBudfourEg(), new BuckBudfiveEg());

            Console.WriteLine(testCrime.ToString());
            Assert.IsTrue(testResult);
        }