public int Hyperlinq_Collection_Value() { var sum = 0; foreach (var item in ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()).Distinct()) { sum += item; } return(sum); }
public int Hyperlinq_Collection_Value() { var sum = 0; foreach (var item in ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Where(item => (item & 0x01) == 0) .Select(item => item)) { sum += item; } return(sum); }
public void AsValueEnumerable_With_ValidData_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsReadOnlyCollection(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable(wrapped); // Assert _ = result.Must() .BeOfType <ReadOnlyCollectionExtensions.ValueEnumerableWrapper <int> >() .BeEnumerableOf <int>() .BeEqualTo(wrapped); }
public void AsValueEnumerable_GetEnumerator_With_ValidData_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsReadOnlyCollection(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable <Wrap.ReadOnlyCollectionWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, enumerable => enumerable.GetEnumerator()); // Assert _ = result.Must() .BeOfType <ReadOnlyCollectionExtensions.ValueEnumerableWrapper <Wrap.ReadOnlyCollectionWrapper <int>, Wrap.Enumerator <int>, int, FunctionWrapper <Wrap.ReadOnlyCollectionWrapper <int>, Wrap.Enumerator <int> > > >() .BeEnumerableOf <int>() .BeEqualTo(wrapped); }
public void AsValueEnumerable6_Enumerator2_With_ValidData_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsReadOnlyCollection(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable <Wrap.ReadOnlyCollectionWrapper <int>, Wrap.Enumerator <int>, ValueEnumerator <int>, int>( wrapped, enumerable => enumerable.GetEnumerator(), enumerable => new ValueEnumerator <int>(((IEnumerable <int>)enumerable).GetEnumerator())); // Assert _ = result.Must() .BeEnumerableOf <int>() .BeEqualTo(source); }
public void AsValueEnumerable_GetEnumerator_Collection_With_ToArray_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsCollection(source); var expected = Enumerable .ToArray(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable <Wrap.CollectionWrapper <int>, Wrap.Enumerator <int>, int>(wrapped, enumerable => enumerable.GetEnumerator()) .ToArray(); // Assert _ = result.Must() .BeArrayOf <int>() .BeEqualTo(expected); }
public void ToArray_With_ValidData_Collections_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsCollection(source); var expected = Enumerable .ToArray(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable(wrapped) .ToArray(); // Assert _ = result.Must() .BeArrayOf <int>() .BeEqualTo(expected); }
public void AsValueEnumerable_With_ToList_Must_Succeed(int[] source) { // Arrange var wrapped = Wrap .AsReadOnlyCollection(source); var expected = Enumerable .ToList(source); // Act var result = ReadOnlyCollectionExtensions .AsValueEnumerable <int>(wrapped) .ToList(); // Assert _ = result.Must() .BeOfType <List <int> >() .BeEnumerableOf <int>() .BeEqualTo(expected); }
public List <int> Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Where(item => (item & 0x01) == 0) .ToList();
public Option <int> Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .First();
public bool Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Contains(Count - 1, EqualityComparer <int> .Default);
public bool Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Any(_ => false);
public int[] Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .ToArray();
public int Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Select(item => item) .Count();
public bool Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Contains(Count - 1, this);
public bool Hyperlinq_Collection_Reference() => ReadOnlyCollectionExtensions.AsValueEnumerable(collectionReference) .Contains(Count - 1);
public bool Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .All(item => (item & 0x01) == 0);
public Option <int> Hyperlinq_Collection_Value() => ReadOnlyCollectionExtensions.AsValueEnumerable <TestCollection.Enumerable, TestCollection.Enumerable.Enumerator, int>(collectionValue, enumerable => enumerable.GetEnumerator()) .Where(item => item == Count - 1) .Single();