Esempio n. 1
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. 2
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);
        }