本文整理汇总了C#中DateInterval.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# DateInterval.Contains方法的具体用法?C# DateInterval.Contains怎么用?C# DateInterval.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateInterval
的用法示例。
在下文中一共展示了DateInterval.Contains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contains_DifferentCalendar
public void Contains_DifferentCalendar()
{
var start = new LocalDate(2000, 1, 1);
var end = new LocalDate(2014, 06, 30);
var interval = new DateInterval(start, end);
var candidate = new LocalDate(2000, 1, 1, JulianCalendar);
Assert.Throws<ArgumentException>(() => interval.Contains(candidate));
}
示例2: DateInterval
public void Contains_CurrentIntervalStartAndEndValuesAreTheSameAsOtherIntervalButDifferentEndPointInclusion_ReturnFalse(
bool minInclusive1, bool maxInclusive1,
bool minInclusive2, bool maxInclusive2)
{
// Arrange
var dateInterval = new DateInterval(now, inThreeHours, minInclusive1, maxInclusive1);
var otherInterval = new DateInterval(now, inThreeHours, minInclusive2, maxInclusive2);
// Act
bool contains = dateInterval.Contains(otherInterval);
// Assert
Assert.False(contains);
}
示例3: Contains
public void Contains(string candidateText, bool expectedInclusive, bool expectedExclusive)
{
var start = new LocalDate(2000, 1, 1);
var end = new LocalDate(2014, 06, 30);
var candidate = LocalDatePattern.IsoPattern.Parse(candidateText).Value;
var interval = new DateInterval(start, end, true);
Assert.AreEqual(expectedInclusive, interval.Contains(candidate));
interval = new DateInterval(start, end, false);
Assert.AreEqual(expectedExclusive, interval.Contains(candidate));
}
示例4: Contains_DateOnStartDateInterval_ReturnTrue
public void Contains_DateOnStartDateInterval_ReturnTrue()
{
// Arrange
var dateInterval = new DateInterval(now, inOneHour);
// Act
bool interesct = dateInterval.Contains(now);
// Assert
Assert.True(interesct);
}
示例5: Contains_DateOnEndDateInterval_ReturnFalse
public void Contains_DateOnEndDateInterval_ReturnFalse()
{
// Arrange
var dateInterval = new DateInterval(now, inOneHour);
// Act
bool interesct = dateInterval.Contains(inOneHour);
// Assert
Assert.False(interesct);
}
示例6: Contains_DateOnEndDateIntervalEndDateInclusive_ReturnTrue
public void Contains_DateOnEndDateIntervalEndDateInclusive_ReturnTrue()
{
// Arrange
var dateInterval = new DateInterval(now, inOneHour, isMaxInclusive: true);
// Act
bool interesct = dateInterval.Contains(inOneHour);
// Assert
Assert.True(interesct);
}
示例7: Contains_DateBeforeDateInterval_ReturnFalse
public void Contains_DateBeforeDateInterval_ReturnFalse()
{
// Arrange
var dateInterval = new DateInterval(now, inOneHour);
// Act
bool intersect = dateInterval.Contains(now.AddHours(-1));
// Assert
Assert.False(intersect);
}
示例8: Contains_CurrentIntervalStartsBeforeAndFinishedAfterOtherInterval_ReturnTrue
public void Contains_CurrentIntervalStartsBeforeAndFinishedAfterOtherInterval_ReturnTrue()
{
// Arrange
var dateInterval = new DateInterval(now, inThreeHours);
var otherInterval = new DateInterval(inOneHour, inTwoHours);
// Act
bool contains = dateInterval.Contains(otherInterval);
// Assert
Assert.True(contains);
}