public void TestRunTestMethod()
        {
            ExpectedExceptionCountAttribute expectedException = new ExpectedExceptionCountAttribute(typeof(Exception), 0);
            ITest test;

            test = MockTestingHelper.CreatePassTest();
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Pass, test.Result.Status);

            test = MockTestingHelper.CreateFailTest();
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Fail, test.Result.Status);

            expectedException.FailOnOtherExceptions = false;
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Pass, test.Result.Status);

            expectedException.ExceptionCount = 1;
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Fail, test.Result.Status);

            expectedException.ExceptionType = _assertionException;
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Pass, test.Result.Status);

            expectedException.ExceptionCount = 0;
            expectedException.RunTest(test);
            Assert.AreEqual(TestStatus.Fail, test.Result.Status);
        }
        public void TestExpectedExceptionCountAttribute()
        {
            ExpectedExceptionCountAttribute expectedException;

            expectedException = new ExpectedExceptionCountAttribute(_assertionException, 1);
            Assert.AreEqual(_assertionException, expectedException.ExceptionType);
            Assert.AreEqual(1, expectedException.ExceptionCount);
            Assert.IsTrue(expectedException.FailOnOtherExceptions);
            expectedException = new ExpectedExceptionCountAttribute(_assertionException.FullName, 1);
            Assert.AreEqual(_assertionException, expectedException.ExceptionType);
            Assert.AreEqual(1, expectedException.ExceptionCount);
            Assert.IsTrue(expectedException.FailOnOtherExceptions);
            expectedException = new ExpectedExceptionCountAttribute(_assertionException.FullName, 1, true);
            Assert.AreEqual(_assertionException, expectedException.ExceptionType);
            Assert.AreEqual(1, expectedException.ExceptionCount);
            Assert.IsTrue(expectedException.FailOnOtherExceptions);
            expectedException = new ExpectedExceptionCountAttribute(_assertionException.FullName, 1, false);
            Assert.AreEqual(_assertionException, expectedException.ExceptionType);
            Assert.AreEqual(1, expectedException.ExceptionCount);
            Assert.IsFalse(expectedException.FailOnOtherExceptions);

            Type exceptionType = typeof(Exception);

            expectedException.ExceptionType = exceptionType;
            Assert.AreEqual(typeof(Exception), expectedException.ExceptionType);
            expectedException.ExceptionCount = 2;
            Assert.AreEqual(2, expectedException.ExceptionCount);
            expectedException.FailOnOtherExceptions = false;
            Assert.IsFalse(expectedException.FailOnOtherExceptions);
        }
        public void TestRunInvalidTestMethod()
        {
            ExpectedExceptionCountAttribute expectedException = new ExpectedExceptionCountAttribute(typeof(Exception), 1);
            ITest test;

            test = MockTestingHelper.CreatePassTest();
            test.Fixture.FixtureType = typeof(ExpectedExceptionCountAttributeTests);
            test.TestMethod          = test.Fixture.FixtureType.GetMethod("InvalidTest");
            expectedException.RunTest(test);
        }
        public void ArgumentNullExceptionTest()
        {
            new ExpectedExceptionCountAttribute((Type)null, 0);                                 // Should fail
            new ExpectedExceptionCountAttribute((String)null, 0);                               // Should fail
            new ExpectedExceptionCountAttribute("BogusTypeName", 0);                            // Should fail

            ExpectedExceptionCountAttribute expectedException = new ExpectedExceptionCountAttribute(_assertionException, 0);

            expectedException.ExceptionType = null;                                                             // Should fail
        }