Exemple #1
0
        public void Should_fail_with_descriptive_message_when_asserting_datetime_is_on_or_after_later_datetime()
        {
            DateTimeOffsetAssertions assertions = Today.Should();

            assertions.Invoking(x => x.BeOnOrAfter(Tomorrow, "because we want to test the failure {0}", "message"))
            .ShouldThrow <AssertFailedException>()
            .WithMessage(string.Format(
                             "Expected a date and time on or after <{0}> because we want to test the failure message, but found <{1}>.",
                             Tomorrow.ToString("yyyy-MM-dd"), Today.ToString("yyyy-MM-dd")));
        }
Exemple #2
0
        public void Should_fail_with_descriptive_message_when_asserting_datetime_is_before_earlier_datetime()
        {
            DateTimeOffsetAssertions assertions = Today.Should();

            assertions.Invoking(x => x.BeBefore(Yesterday, "because we want to test the failure {0}", "message"))
            .ShouldThrow <AssertFailedException>()
            .WithMessage(string.Format(
                             "Expected a date and time before <{0}> because we want to test the failure message, but found <{1}>.",
                             Yesterday.ToString("yyyy-MM-dd"), Today.ToString("yyyy-MM-dd")));
        }