public void ReturnFalseOnNullLeft() { Range <int> left = null; var right = Range <int> .All(); Assert.False(Range <int> .Equals(left, right)); }
public static void CreationTest() { Range range = Range.Create(new Index(10, fromEnd: false), new Index(2, fromEnd: true)); Assert.Equal(10, range.Start.Value); Assert.False(range.Start.FromEnd); Assert.Equal(2, range.End.Value); Assert.True(range.End.FromEnd); range = Range.FromStart(new Index(7, fromEnd: false)); Assert.Equal(7, range.Start.Value); Assert.False(range.Start.FromEnd); Assert.Equal(0, range.End.Value); Assert.True(range.End.FromEnd); range = Range.ToEnd(new Index(3, fromEnd: true)); Assert.Equal(0, range.Start.Value); Assert.False(range.Start.FromEnd); Assert.Equal(3, range.End.Value); Assert.True(range.End.FromEnd); range = Range.All(); Assert.Equal(0, range.Start.Value); Assert.False(range.Start.FromEnd); Assert.Equal(0, range.End.Value); Assert.True(range.End.FromEnd); }
public void ToStringHandlesAllRange() { var range = Range <int> .All(); var expected = "(-∞..+∞)"; var actual = range.ToString(); Assert.Equal(expected, actual); }
public void InfiniteRangesEqual() { var a = Range <int> .All(); var b = Range <int> .All(); Assert.True(a.Equals(b)); Assert.True(b.Equals(a)); }
public void ReturnUnboundedForLowerInfiniteBound() { var range = Range <int> .All(); Assert.Equal(BoundType.UNBOUNDED, range.LowerBoundType); }
public void HasUpperBoundReturnsFalse() { var infinite = Range <int> .All(); Assert.False(infinite.HasUpperEndpoint); }
public void ThrowsWhenAccessingUpperBound() { var infinite = Range <int> .All(); Assert.Throws <InvalidOperationException>(() => infinite.UpperEndpoint); }