public void NominalTest() { ListCompareTestUtil.ValidateEqual( Enumerable.Repeat(5, 10), FastLinq.Repeat(5, 10), 4); }
public void RepeatNull() { ListCompareTestUtil.ValidateEqual( Enumerable.Repeat <object>(null, 3), FastLinq.Repeat <object>(null, 3), 1); }
public void Empty() { EnsureResultOrExceptionSame( new int[] { }, arr => Enumerable.Reverse(arr), arr => FastLinq.Reverse(arr)); }
public void Nominal() { EnsureResultOrExceptionSame( new int[] { 1, 2, 3 }, arr => Enumerable.Reverse(arr), arr => FastLinq.Reverse(arr)); }
public void Null() { EnsureResultOrExceptionSame( (int[])null, arr => Enumerable.Reverse(arr), arr => FastLinq.Reverse(arr)); }
public void IntMin() { ListCompareTestUtil.ValidateEqual( Enumerable.Range(int.MinValue, 10), FastLinq.Range(int.MinValue, 10), 4); }
public void IntMaxCountTwo() { new Action( () => FastLinq.Range(int.MaxValue, 2)) .Should() .Throw <ArgumentOutOfRangeException>(); }
public void RepeatNone() { ListCompareTestUtil.ValidateEqual( Enumerable.Repeat(5, 0), FastLinq.Repeat(5, 0), 1); }
public void Objects() { ListCompareTestUtil.ValidateEqual( Enumerable.Empty <object>(), FastLinq.Empty <object>(), 1); }
public void IntMaxCountOne() { ListCompareTestUtil.ValidateEqual( Enumerable.Range(int.MaxValue, 1), FastLinq.Range(int.MaxValue, 1), 1); }
public void FastLinq_SecondToLastItemCollection() { char _ = Enumerable.FirstOrDefault( FastLinq.Skip( FastLinq.Reverse(this.allLetters), 1)); }
public void NotDuplicateBecauseOfComparer() { ICollection <int> source = new[] { 1, 2, 3 }; Func <int, string> keySelector = i => { switch (i) { case 1: return("a"); case 2: // Not duplicate, because we consider the case return("A"); case 3: return("c"); default: throw new Exception(); } }; var result = FastLinq.ToDictionary(source.AsReadOnly(), keySelector, StringComparer.Ordinal); Assert.AreEqual(source.Count, result.Count); CollectionAssert.AreEqual( new[] { new KeyValuePair <string, int>("a", 1), new KeyValuePair <string, int>("A", 2), new KeyValuePair <string, int>("c", 3), }, result); }
public void TwoCountIntMax() { new Action( () => FastLinq.Range(2, int.MaxValue)) .Should() .Throw <ArgumentOutOfRangeException>(); }
public void FastLinq_SecondToLastItemArray() { int _ = FastLinq.FirstOrDefault( FastLinq.Skip( FastLinq.Reverse(this.intArray), 1)); }
public void FastLinq_Paginate_ToList() { List <string> _ = FastLinq.ToList( FastLinq.Take( FastLinq.Skip(this.stringList, 30), 10)); }
public void FastLinq_LastTen_Lazy() { IReadOnlyList <int> _ = FastLinq.Reverse( FastLinq.Take( FastLinq.Reverse(this.intArray), 10)); }
public void NominalTest() { ListCompareTestUtil.ValidateEqual( Enumerable.Empty <int>(), FastLinq.Empty <int>(), 1); }
public void CountNegative() { new Action( () => FastLinq.Repeat(0, -100)) .Should() .Throw <ArgumentOutOfRangeException>(); }
public void DuplicateKeysIfComparerHonored() { ICollection <int> source = new[] { 1, 2, 3 }; Func <int, string> keySelector = i => { switch (i) { case 1: return("a"); case 2: // Duplicate, if we ignore the case return("A"); case 3: return("c"); default: throw new Exception(); } }; Func <int, int> valueSelector = i => i * 2; new Action( () => FastLinq.ToDictionary(source.AsReadOnly(), keySelector, valueSelector, StringComparer.OrdinalIgnoreCase)) .Should() .Throw <ArgumentException>() .WithMessage("An item with the same key has already been added."); }
public void CountIntMax() { // Cannot use ListCompare due to memory constraints (in x86 at least) new Action( () => FastLinq.Repeat(2, int.MaxValue)) .Should() .NotThrow(); }
public void NullInput() { IList list = null; new Action( () => FastLinq.Cast <string>(list)) .Should() .Throw <ArgumentNullException>(); }
public void Null() { IReadOnlyList <int> input = null; new Action( () => FastLinq.Reverse(input)) .Should() .Throw <ArgumentNullException>(); }
public void MoreThanOne() { IReadOnlyList <int> list = new[] { 1, 2, 3 }; new Action( () => FastLinq.SingleOrDefault(list)) .Should() .Throw <InvalidOperationException>(); }
public void Nominal() { int[] list = new[] { 1, 2, 3 }; ListCompareTestUtil.ValidateEqual( Enumerable.Cast <object>(list), FastLinq.Cast <object>(list), itemNotInTheCollection: null, enforceWritable: false); }
public void InputNull() { IReadOnlyList <int> list = null; new Action( () => FastLinq.Last(list)) .Should() .Throw <ArgumentNullException>(); }
public void NullInput() { IReadOnlyCollection <int> input = null; new Action( () => FastLinq.ToList(input)) .Should() .Throw <ArgumentNullException>(); }
public void EmptySource() { ICollection <int> source = new int[] { }; Func <int, string> keySelector = i => i.ToString(); var result = FastLinq.ToDictionary(source.AsReadOnly(), keySelector, StringComparer.Ordinal); Assert.AreEqual(0, result.Count); }
public void InputEmpty() { IReadOnlyList <int> list = new int[] { }; new Action( () => FastLinq.ElementAt(list, 0)) .Should() .Throw <ArgumentOutOfRangeException>(); }
public void InputEmpty() { IReadOnlyList <int> list = new int[] { }; new Action( () => FastLinq.Last(list)) .Should() .Throw <InvalidOperationException>(); }
public void NullInput2() { IReadOnlyList <int> list = null; new Action( () => FastLinq.Cast <int, object>(list)) .Should() .Throw <ArgumentNullException>(); }