Created
June 11, 2011 15:56
-
-
Save derekgreer/1020707 to your computer and use it in GitHub Desktop.
Custom Assertion Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class when_asserting_unsorted_comments_are_sorted_in_descending_order | |
{ | |
static Exception _exception; | |
static List<Comment> _unsortedComments; | |
Establish context = () => | |
{ | |
_unsortedComments = new List<Comment> | |
{ | |
new Comment("comment 1", DateTime.MinValue.AddDays(1)), | |
new Comment("comment 4", DateTime.MinValue.AddDays(4)), | |
new Comment("comment 3", DateTime.MinValue.AddDays(3)), | |
new Comment("comment 2", DateTime.MinValue.AddDays(2)) | |
}; | |
}; | |
Because of = () => _exception = Catch.Exception(() => _unsortedComments.ShouldBeSortedByDateInDescendingOrder()); | |
It should_throw_an_exception = () => _exception.ShouldBeOfType(typeof(Exception)); | |
} | |
public class when_asserting_sorted_comments_are_sorted_in_descending_order | |
{ | |
static Exception _exception; | |
static List<Comment> _unsortedComments; | |
Establish context = () => | |
{ | |
_unsortedComments = new List<Comment> | |
{ | |
new Comment("comment 4", DateTime.MinValue.AddDays(4)), | |
new Comment("comment 3", DateTime.MinValue.AddDays(3)), | |
new Comment("comment 2", DateTime.MinValue.AddDays(2)), | |
new Comment("comment 1", DateTime.MinValue.AddDays(1)) | |
}; | |
}; | |
Because of = () => _exception = Catch.Exception(() => _unsortedComments.ShouldBeSortedByDateInDescendingOrder()); | |
It should_not_throw_an_exception = () => _exception.ShouldBeNull(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment