Permalink
Browse files

Adding specs for the ShouldMatch extension method. Closes #99

  • Loading branch information...
1 parent 5fe88cd commit de79ba21bad932f2e6d9dd1bfc74877376ac0c3c @agross agross committed Mar 15, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 Source/Machine.Specifications.Specs/AssertionSpecs.cs
@@ -175,4 +175,32 @@ public class when_a_type_assertion_fails
It should_report_the_requested_type =
() => Exception.Message.ShouldStartWith("Should be of type System.Int32");
}
+
+ [Subject(typeof(ShouldExtensionMethods))]
+ public class when_checking_if_an_item_matches_a_func
+ {
+ static Exception Exception;
+ static int Int;
+
+ Establish context = () => { Int = 42; };
+
+ Because of = () => { Exception = Catch.Exception(() => Int.ShouldMatch(x => x > 1)); };
+
+ It should_succeed =
+ () => Exception.ShouldBeNull();
+ }
+
+ [Subject(typeof(ShouldExtensionMethods))]
+ public class when_checking_if_an_item_matches_a_func_and_the_check_fails
+ {
+ static Exception Exception;
+ static int Int;
+
+ Establish context = () => { Int = 42; };
+
+ Because of = () => { Exception = Catch.Exception(() => Int.ShouldMatch(x => x > 50)); };
+
+ It should_print_the_func_description =
+ () => Exception.Message.ShouldContain("Should match expression [x => (x > 50)], but does not.");
+ }
}

0 comments on commit de79ba2

Please sign in to comment.