public void CommonwealthvAlexander()
        {
            var testCrime = new Infraction
            {
                MensRea = new GeneralIntent
                {
                    IsIntentOnWrongdoing    = lp => lp is Alexander,
                    IsKnowledgeOfWrongdoing = lp => lp is MichaelTEustler
                },
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is Alexander,
                    IsAction    = lp => lp is Alexander
                }
            };
            var testResult = testCrime.IsValid(new Alexander());

            Assert.IsTrue(testResult);

            var testSubject = new DefenseOfProperty
            {
                Imminence = new Imminence(ExtensionMethods.Defendant)
                {
                    GetResponseTime = lp => Imminence.NormalReactionTimeToDanger
                },
                Provocation = new Provocation(ExtensionMethods.Defendant)
                {
                    IsInitiatorOfAttack = lp => lp is MichaelTEustler,
                },
                Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Defendant)
                {
                    GetChoice = lp =>
                    {
                        if (lp is MichaelTEustler)
                        {
                            return(new NondeadlyForce());
                        }
                        if (lp is Alexander)
                        {
                            return(new DeadlyForce());
                        }
                        return(null);
                    }
                }
            };

            testResult = testSubject.IsValid(new Alexander(), new MichaelTEustler());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(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);
        }
예제 #3
0
        public void BirdvHolbrook()
        {
            var test = new DefenseOfProperty(ExtensionMethods.Tortfeasor)
            {
                Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Tortfeasor)
                {
                    GetChoice = lp =>
                    {
                        if (lp is Holbrook)
                        {
                            return(new DeadlyForce());
                        }
                        return(new NondeadlyForce());
                    }
                }
            };

            var testResult = test.IsValid(new Holbrook(), new Bird());

            Console.WriteLine(test.ToString());
            Assert.IsFalse(testResult);
        }
예제 #4
0
        public void KatkovBriney()
        {
            var test = new DefenseOfProperty(ExtensionMethods.Tortfeasor)
            {
                Proportionality = new Proportionality <ITermCategory>(ExtensionMethods.Tortfeasor)
                {
                    GetChoice = lp =>
                    {
                        if (lp is Briney)
                        {
                            return(new SeriousBodilyInjury());
                        }
                        return(new NondeadlyForce());
                    }
                }
            };

            var testResult = test.IsValid(new Briney(), new Katko());

            Console.WriteLine(test.ToString());
            Assert.IsFalse(testResult);
        }