コード例 #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);
        }
コード例 #2
0
        public void ExamplePolicePower()
        {
            var testCrime = new Felony
            {
                ActusReus = new ActusReus
                {
                    IsVoluntary = lp => lp is OfficerColinEg,
                    IsAction    = lp => lp is OfficerColinEg
                },
                MensRea = new GeneralIntent
                {
                    IsKnowledgeOfWrongdoing = lp => lp is OfficerColinEg,
                    IsIntentOnWrongdoing    = lp => lp is OfficerColinEg
                }
            };
            var testResult = testCrime.IsValid(new OfficerColinEg());

            Assert.IsTrue(testResult);

            var testSubject = new PolicePower
            {
                IsAgentOfTheState = lp => lp is OfficerColinEg,
                //example has officer shooting out window drive-by stlye on a fleeing person
                IsReasonableUseOfForce = lp => false
            };

            testResult = testSubject.IsValid(new OfficerColinEg(), new LindaEg());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }