本文整理汇总了C#中Range.Includes方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Includes方法的具体用法?C# Range.Includes怎么用?C# Range.Includes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.Includes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AmountRange01Test
public void AmountRange01Test()
{
Range<Amount> intr = new Range<Amount>(new Amount(5m, LengthUnits.Meter), new Amount(200m, LengthUnits.CentiMeter));
Assert.IsFalse(intr.Includes(new Amount(1.9m, LengthUnits.Meter)));
Assert.IsTrue(intr.Includes(new Amount(2.0m, LengthUnits.Meter)));
Assert.IsTrue(intr.Includes(new Amount(4.0m, LengthUnits.Meter)));
Assert.IsTrue(intr.Includes(new Amount(5.0m, LengthUnits.Meter)));
Assert.IsFalse(intr.Includes(new Amount(5.1m, LengthUnits.Meter)));
}
示例2: RangeString01Test
public void RangeString01Test()
{
Range<string> intr = new Range<string>("ddd", "kkk");
Assert.IsFalse(intr.Includes("dda"));
Assert.IsTrue(intr.Includes("ddd"));
Assert.IsTrue(intr.Includes("fff"));
Assert.IsTrue(intr.Includes("kkk"));
Assert.IsFalse(intr.Includes("zzz"));
}
示例3: RangeInt01Test
public void RangeInt01Test()
{
Range<int> intr = new Range<int>(12, 20);
Assert.IsFalse(intr.Includes(8));
Assert.IsTrue(intr.Includes(12));
Assert.IsTrue(intr.Includes(18));
Assert.IsTrue(intr.Includes(20));
Assert.IsFalse(intr.Includes(21));
}
示例4: RangeDateTime01Test
public void RangeDateTime01Test()
{
DateTime d1 = new DateTime(2007, 06, 10);
DateTime d2 = new DateTime(2008, 06, 10);
Range<DateTime> intr = new Range<DateTime>(d1, d2);
Assert.IsFalse(intr.Includes(new DateTime(2007, 06, 09)));
Assert.IsTrue(intr.Includes(new DateTime(2007, 06, 10)));
Assert.IsTrue(intr.Includes(new DateTime(2007, 12, 31)));
Assert.IsTrue(intr.Includes(new DateTime(2008, 06, 10)));
Assert.IsFalse(intr.Includes(new DateTime(2008, 06, 11)));
}
示例5: RangeIncludes01Test
public void RangeIncludes01Test()
{
Range<int> range = new Range<int>(12, 20);
Range<int> ra = new Range<int>(4, 8);
Range<int> rb = new Range<int>(10, 16);
Range<int> rc = new Range<int>(10, 24);
Range<int> rd = new Range<int>(12, 14);
Range<int> re = new Range<int>(14, 18);
Range<int> rf = new Range<int>(18, 20);
Range<int> rg = new Range<int>(12, 20);
Range<int> rh = new Range<int>(12, 24);
Range<int> ri = new Range<int>(20, 24);
Range<int> rj = new Range<int>(22, 24);
Assert.IsFalse(range.Includes(ra));
Assert.IsFalse(range.Includes(rb));
Assert.IsFalse(range.Includes(rc));
Assert.IsTrue(range.Includes(rd));
Assert.IsTrue(range.Includes(re));
Assert.IsTrue(range.Includes(rf));
Assert.IsTrue(range.Includes(rg));
Assert.IsFalse(range.Includes(rh));
Assert.IsFalse(range.Includes(ri));
Assert.IsFalse(range.Includes(rj));
}
示例6: Includes_NumberInNonInclusiveRange_ReturnsCorrect
public void Includes_NumberInNonInclusiveRange_ReturnsCorrect()
{
var r = new Range<int>(10, 20, false, false);
Assert.IsFalse(r.Includes(10));
Assert.IsTrue(r.Includes(11));
Assert.IsTrue(r.Includes(19));
Assert.IsFalse(r.Includes(20));
Assert.IsFalse(r.Includes(9));
Assert.IsFalse(r.Includes(21));
}