public void ExampleAppropriateDeadlyForce() { var testCrime = new Felony { ActusReus = new ActusReus { IsVoluntary = lp => lp is WandaEg, IsAction = lp => lp is WandaEg }, MensRea = new Knowingly { IsKnowledgeOfWrongdoing = lp => lp is WandaEg, IsIntentOnWrongdoing = lp => lp is WandaEg } }; var testResult = testCrime.IsValid(new WandaEg()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => lp is WandaEg ? Imminence.NormalReactionTimeToDanger : TimeSpan.Zero }, Provocation = new Provocation(ExtensionMethods.Defendant) { IsInitiatorOfAttack = lp => lp is NicholasEg }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { //deadly force is appropriate to serious bodily harm GetChoice = lp => { if (lp is WandaEg) { return(new DeadlyForce()); } if (lp is NicholasEg) { return(new SeriousBodilyInjury()); } return(null); } } }; testResult = testSubject.IsValid(new WandaEg(), new NicholasEg()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void CourvoisiervRaymond() { var test = new DefenseOfSelf(ExtensionMethods.Tortfeasor) { IsReasonableFearOfInjuryOrDeath = lp => lp is Courvoisier, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Tortfeasor) { GetChoice = lp => new PullRevolverShoot(), IsProportional = (t1, t2) => t1.Equals(t2), }, }; var testResult = test.IsValid(new Courvoisier(), new Raymond()); Console.WriteLine(test.ToString()); Assert.IsTrue(testResult); }
public void ExampleWithdrawalException() { var testCrime = new Felony { ActusReus = new ActusReus { IsAction = lp => lp is PattyEg, IsVoluntary = lp => lp is PattyEg }, MensRea = new MaliceAforethought { IsKnowledgeOfWrongdoing = lp => lp is PattyEg, IsIntentOnWrongdoing = lp => lp is PattyEg } }; var testResult = testCrime.IsValid(new PattyEg()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => lp is PattyEg ? Imminence.NormalReactionTimeToDanger : TimeSpan.Zero }, Provocation = new Provocation(ExtensionMethods.Defendant) { //in example, patty slaps paige, paige pummels on patty, patty runs away, paige pursues, patty defends, paige loses IsInitiatorOfAttack = lp => lp is PattyEg, IsInitiatorWithdraws = lp => lp is PattyEg, //in example, these are both non-deadly force responses IsInitiatorRespondingToExcessiveForce = lp => false }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { GetChoice = lp => new NondeadlyForce() } }; testResult = testSubject.IsValid(new PattyEg(), new PaigeEg()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void ExampleAttackIsRetaliatory() { var testCrime = new Felony { ActusReus = new ActusReus { IsVoluntary = lp => lp is DwightEg, IsAction = lp => lp is DwightEg }, MensRea = new MaliceAforethought { IsKnowledgeOfWrongdoing = lp => lp is DwightEg, IsIntentOnWrongdoing = lp => lp is DwightEg } }; var testResult = testCrime.IsValid(new DwightEg()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => lp is DwightEg ? new TimeSpan(0, 0, 2, 0) : TimeSpan.Zero }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { //example seems to assume that the fist fight is deadly GetChoice = lp => new DeadlyForce() }, Provocation = new Provocation(ExtensionMethods.Defendant) { //example doesn't say who started it IsInitiatorOfAttack = lp => true } }; testResult = testSubject.IsValid(new DwightEg(), new AbelEg()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }
public void RodriguezvState() { var testCrime = new Felony { ActusReus = new ActusReus { IsAction = lp => lp is Rodriguez, IsVoluntary = lp => lp is Rodriguez }, MensRea = new Knowingly { IsIntentOnWrongdoing = lp => lp is Rodriguez, IsKnowledgeOfWrongdoing = lp => lp is Rodriguez } }; var testResult = testCrime.IsValid(new Rodriguez()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => Imminence.NormalReactionTimeToDanger }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { GetChoice = lp => new DeadlyForce(), }, Provocation = new Provocation(ExtensionMethods.Defendant) { IsInitiatorOfAttack = lp => lp is Rodriguez, IsInitiatorWithdraws = lp => false, IsInitiatorRespondingToExcessiveForce = lp => false } }; testResult = testSubject.IsValid(new Rodriguez()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }
public void ExampleAttackNotImminent() { var testCrime = new Felony { ActusReus = new ActusReus { IsAction = lp => lp is FionaEg, IsVoluntary = lp => lp is FionaEg }, MensRea = new Knowingly { IsIntentOnWrongdoing = lp => lp is FionaEg, IsKnowledgeOfWrongdoing = lp => lp is FionaEg } }; var testResult = testCrime.IsValid(new FionaEg()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => lp is FionaEg || lp is VinnyEg ? new TimeSpan(365, 0, 0, 0) : TimeSpan.Zero }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { GetChoice = lp => new DeadlyForce(), }, Provocation = new Provocation(ExtensionMethods.Defendant) { IsInitiatorOfAttack = lp => lp is VinnyEg, } }; testResult = testSubject.IsValid(new FionaEg(), new VinnyEg()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }
public void ShulervBabbitt() { var testCrime = new Infraction { ActusReus = new ActusReus { IsVoluntary = lp => lp is Shuler, IsAction = lp => lp is Shuler, }, MensRea = StrictLiability.Value }; var testResult = testCrime.IsValid(new Shuler()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new Imminence(ExtensionMethods.Defendant) { GetResponseTime = lp => Imminence.NormalReactionTimeToDanger }, Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { GetChoice = lp => new DeadlyForce() }, Provocation = new Provocation(ExtensionMethods.Defendant) { IsInitiatorOfAttack = lp => lp is GrizzlyBear, } }; testResult = testSubject.IsValid(new Shuler(), new GrizzlyBear()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void ExampleBatteredWifeDefense() { var testCrime = new Felony { ActusReus = new ActusReus { IsVoluntary = lp => lp is VeronicaEg, IsAction = lp => lp is VeronicaEg }, MensRea = new MaliceAforethought { IsIntentOnWrongdoing = lp => lp is VeronicaEg, IsKnowledgeOfWrongdoing = lp => lp is VeronicaEg } }; var testResult = testCrime.IsValid(new VeronicaEg()); Assert.IsTrue(testResult); var testSubject = new DefenseOfSelf { IsReasonableFearOfInjuryOrDeath = lp => true, Imminence = new BatteredWomanSyndrome(ExtensionMethods.Defendant), Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant) { GetChoice = lp => new DeadlyForce(), }, Provocation = new Provocation(ExtensionMethods.Defendant) { IsInitiatorOfAttack = lp => lp is SpikeEg } }; testResult = testSubject.IsValid(new VeronicaEg(), new SpikeEg()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }