예제 #1
0
        public void DateTimeScenarioShouldFail()
        {
            var date = new DateTime(2000, 6, 1);
            var dateString = date.ToString();
            var expected = new DateTime(2000, 6, 1, 1, 0, 1);
            var expectedString = expected.ToString();

            Verify.ShouldFail(() =>
date.ShouldNotBe(expected, TimeSpan.FromHours(1.5), "Some additional context"),

errorWithSource:
$@"date
    should not be within
01:30:00
    of
{expectedString}
    but was
{dateString}

Additional Info:
    Some additional context",

errorWithoutSource:
$@"{dateString}
    should not be within
01:30:00
    of
{expectedString}
    but was not

Additional Info:
    Some additional context");
        }
예제 #2
0
 public void DateTime()
 {
     Thread.CurrentThread.CurrentCulture = new CultureInfo("en-AU");
     DocExampleWriter.Document(() =>
     {
             var date = new DateTime(2000, 6, 1);
             date.ShouldNotBe(new DateTime(2000, 6, 1, 1, 0, 1), TimeSpan.FromHours(1.5));
         }, _testOutputHelper);
 }
예제 #3
0
 public void ShouldPass()
 {
     var date = new DateTime(2000, 6, 1);
     date.ShouldNotBe(new DateTime(2000, 6, 1, 1, 0, 1), TimeSpan.FromHours(1));
 }
예제 #4
0
 protected override void ShouldThrowAWobbly()
 {
     var date = new DateTime(2000, 6, 1);
     date.ShouldNotBe(new DateTime(2000, 6, 1, 1, 0, 1), TimeSpan.FromHours(1.5), "Some additional context");
 }
예제 #5
0
 protected override void ShouldPass()
 {
     var date = new DateTime(2000, 6, 1);
     date.ShouldNotBe(new DateTime(2000, 6, 1, 1, 0, 1), TimeSpan.FromHours(1));
 }
예제 #6
0
 protected override void ShouldThrowAWobbly()
 {
     var date = new DateTime(2000, 6, 1);
     date.ShouldNotBe(new DateTime(2000, 6, 1, 1, 0, 1), TimeSpan.FromHours(1.5));
 }