コード例 #1
0
 public void should_return_failed_status()
 {
     var result = new RuleExecution().RunRule(happymethod, "test rule", typeof(AssertionException));
     Assert.AreEqual(result.Status, RuleStatus.Failed);
 }
コード例 #2
0
        public void should_explain_expected_exception_was_supposed_to_be()
        {
            var result = new RuleExecution().RunRule(happymethod , "test rule", typeof(AssertionException));

            StringAssert.Contains("Expected exception was NUnit.Framework.AssertionException but it never occured", result.RuleMessage);
        }
コード例 #3
0
 public void should_store_error_message_for_rule_exceptions()
 {
     var result = new RuleExecution().RunRule(() => { throw new RuleException("this is an error"); }, "test rule");
     Assert.IsTrue(result.RuleMessage.Contains( "this is an error"));
 }
コード例 #4
0
 public void should_return_failed_status()
 {
     var result = new RuleExecution().RunRule(() => { throw new AbandonedMutexException(); }, "test rule", typeof(AssertionException));
     Assert.AreEqual(result.Status, RuleStatus.Failed);
 }
コード例 #5
0
 public void should_ignore_errors_that_are_expected()
 {
     var result = new RuleExecution().RunRule(() => { throw new AbandonedMutexException(); }, "test rule", typeof(AbandonedMutexException));
     Assert.AreEqual(result.Status, RuleStatus.Passed);
 }
コード例 #6
0
        public void should_explain_expected_exception_was_supposed_to_be()
        {
            var result = new RuleExecution().RunRule(() => { throw new AbandonedMutexException(); }, "test rule", typeof(AssertionException));

            StringAssert.Contains("Expected exception was NUnit.Framework.AssertionException but instead was System.Threading.AbandonedMutexException", result.RuleMessage);
        }