C# Класс NFluent.DateTimeCheckExtensions

Provides check methods to be executed on a date time instance.
Показать файл Открыть проект

Открытые методы

Метод Описание
IsAfter ( this check, System.DateTime other ) : ICheckLink>

Checks that the actual DateTime is strictly after the given one.

IsAfterOrEqualTo ( this check, System.DateTime other ) : ICheckLink>

Checks that the actual DateTime is after or equals to the given one.

IsBefore ( this check, System.DateTime other ) : ICheckLink>

Checks that the actual DateTime is strictly before the given one.

IsBeforeOrEqualTo ( this check, System.DateTime other ) : ICheckLink>

Checks that the actual DateTime is before or equals to the given one.

IsEqualToIgnoringHours ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same year, month and day fields, * (Hours, minutes, seconds and millisecond fields are ignored in comparison). * check can fail with dateTimes in same chronological minute time window, e.g : 2000-01-01T23:59:00.000 and 2000-01-02T00:00:00.000. Time difference is only 1min but day fields differ. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 59, 59, 999); DateTime dateTime2 = new DateTime(2000, 1, 1, 00, 00, 00, 000); CheckThat(dateTime1).IsEqualToIgnoringHours(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 2, 00, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 59, 59, 999); CheckThat(dateTimeA).IsEqualToIgnoringHours(dateTimeB);

IsEqualToIgnoringMillis ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same year, month, day, hour, minute and second fields, (millisecond fields are ignored in comparison). Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 0, 0, 1, 456); Check.That(dateTime1).IsEqualToIgnoringMillis(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTimeB = new DateTime(2000, 1, 1, 0, 0, 0, 999); Check.That(dateTimeA).IsEqualToIgnoringMillis(dateTimeB);

Check can fail with dateTimes in same chronological millisecond time window, e.g : 2000-01-01T00:00:01.000 and 2000-01-01T00:00:00.999. check fails as second fields differ even if time difference is only 1 millis.

IsEqualToIgnoringMinutes ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same year, month, day and hour fields, (Minutes, seconds and millisecond fields are ignored in comparison). check can fail with dateTimes in same chronological second time window, e.g : 2000-01-01T01:00:00.000 and 2000-01-01T00:59:59.000. Time difference is only 1s but hour fields differ. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 00, 2, 7); Check.That(dateTime1).IsEqualToIgnoringMinutes(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 01, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 00, 59, 59, 999); Check.That(dateTimeA).IsEqualToIgnoringMinutes(dateTimeB);

IsEqualToIgnoringSeconds ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same year, month, day, hour and minute fields, (Seconds and millisecond fields are ignored in comparison). check can fail with DateTimes in same chronological second time window, e.g : 2000-01-01T00:01:00.000 and 2000-01-01T00:00:59.000. check fails as minute fields differ even if time difference is only 1s. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 50, 10, 456); Check.That(dateTime1).IsEqualToIgnoringSeconds(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 23, 50, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 49, 59, 999); Check.That(dateTimeA).IsEqualToIgnoringSeconds(dateTimeB);

IsInSameDayAs ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same day, whatever the year or the month.

IsInSameMonthAs ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same month, whatever the year.

IsInSameYearAs ( this check, System.DateTime other ) : ICheckLink>

Checks that actual and given DateTime have same year.

Описание методов

IsAfter() публичный статический Метод

Checks that the actual DateTime is strictly after the given one.
The checked date time is not after the given one.
public static IsAfter ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsAfterOrEqualTo() публичный статический Метод

Checks that the actual DateTime is after or equals to the given one.
The checked date time is not after or equals to the given one.
public static IsAfterOrEqualTo ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsBefore() публичный статический Метод

Checks that the actual DateTime is strictly before the given one.
The checked date time is not before the given one.
public static IsBefore ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsBeforeOrEqualTo() публичный статический Метод

Checks that the actual DateTime is before or equals to the given one.
The checked date time is not before or equals to the given one.
public static IsBeforeOrEqualTo ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsEqualToIgnoringHours() публичный статический Метод

Checks that actual and given DateTime have same year, month and day fields, * (Hours, minutes, seconds and millisecond fields are ignored in comparison). * check can fail with dateTimes in same chronological minute time window, e.g : 2000-01-01T23:59:00.000 and 2000-01-02T00:00:00.000. Time difference is only 1min but day fields differ. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 59, 59, 999); DateTime dateTime2 = new DateTime(2000, 1, 1, 00, 00, 00, 000); CheckThat(dateTime1).IsEqualToIgnoringHours(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 2, 00, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 59, 59, 999); CheckThat(dateTimeA).IsEqualToIgnoringHours(dateTimeB);
The checked date time is not equal to the given one with hour, minute, second and millisecond fields ignored.
public static IsEqualToIgnoringHours ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsEqualToIgnoringMillis() публичный статический Метод

Checks that actual and given DateTime have same year, month, day, hour, minute and second fields, (millisecond fields are ignored in comparison). Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 0, 0, 1, 456); Check.That(dateTime1).IsEqualToIgnoringMillis(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTimeB = new DateTime(2000, 1, 1, 0, 0, 0, 999); Check.That(dateTimeA).IsEqualToIgnoringMillis(dateTimeB);
Check can fail with dateTimes in same chronological millisecond time window, e.g : 2000-01-01T00:00:01.000 and 2000-01-01T00:00:00.999. check fails as second fields differ even if time difference is only 1 millis.
The checked date time is not equal to the given one with the milliseconds ignored.
public static IsEqualToIgnoringMillis ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsEqualToIgnoringMinutes() публичный статический Метод

Checks that actual and given DateTime have same year, month, day and hour fields, (Minutes, seconds and millisecond fields are ignored in comparison). check can fail with dateTimes in same chronological second time window, e.g : 2000-01-01T01:00:00.000 and 2000-01-01T00:59:59.000. Time difference is only 1s but hour fields differ. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 00, 2, 7); Check.That(dateTime1).IsEqualToIgnoringMinutes(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 01, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 00, 59, 59, 999); Check.That(dateTimeA).IsEqualToIgnoringMinutes(dateTimeB);
The checked date time is not equal to the given one with minute, second and millisecond fields ignored.
public static IsEqualToIgnoringMinutes ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsEqualToIgnoringSeconds() публичный статический Метод

Checks that actual and given DateTime have same year, month, day, hour and minute fields, (Seconds and millisecond fields are ignored in comparison). check can fail with DateTimes in same chronological second time window, e.g : 2000-01-01T00:01:00.000 and 2000-01-01T00:00:59.000. check fails as minute fields differ even if time difference is only 1s. Code example : // successfull checks DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 50, 10, 456); Check.That(dateTime1).IsEqualToIgnoringSeconds(dateTime2); // failing checks (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 23, 50, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 49, 59, 999); Check.That(dateTimeA).IsEqualToIgnoringSeconds(dateTimeB);
The checked date time is not equal to the given one with second and millisecond fields ignored.
public static IsEqualToIgnoringSeconds ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsInSameDayAs() публичный статический Метод

Checks that actual and given DateTime have same day, whatever the year or the month.
The checked date time day is not equal to the given day, whatever the year or the month.
public static IsInSameDayAs ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsInSameMonthAs() публичный статический Метод

Checks that actual and given DateTime have same month, whatever the year.
The checked date time month is not equal to the given month, whatever the year.
public static IsInSameMonthAs ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>

IsInSameYearAs() публичный статический Метод

Checks that actual and given DateTime have same year.
The checked date time year is not equal to the given year.
public static IsInSameYearAs ( this check, System.DateTime other ) : ICheckLink>
check this The fluent check to be extended.
other System.DateTime The other DateTime.
Результат ICheckLink>