コード例 #1
0
 public void Should_fail_with_descriptive_message_when_asserting_datetime_has_seconds_with_different_value()
 {
     DateTimeOffsetAssertions assertions = new DateTimeOffset(31.December(2009).At(23, 59, 00)).Should();
     assertions.Invoking(x => x.HaveSecond(1, "because we want to test the failure {0}", "message"))
         .ShouldThrow<AssertFailedException>()
         .WithMessage("Expected second 1 because we want to test the failure message, but found 0.");
 }
コード例 #2
0
 public void Should_fail_with_descriptive_message_when_asserting_datetime_has_a_year_with_a_different_value()
 {
     DateTimeOffsetAssertions assertions = new DateTimeOffset(31.December(2009)).Should();
     assertions.Invoking(x => x.HaveYear(2008, "because we want to test the failure {0}", "message"))
         .ShouldThrow<AssertFailedException>()
         .WithMessage("Expected year 2008 because we want to test the failure message, but found 2009.");
 }