public void SequenceEqualEmptyDefault()
 {
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SequenceEqual(s_oneElement, s_emptyDefault));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SequenceEqual(s_emptyDefault, s_empty));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SequenceEqual(s_emptyDefault, s_emptyDefault));
     AssertExtensions.Throws <ArgumentNullException>("predicate", () => ImmutableArrayExtensions.SequenceEqual(s_emptyDefault, s_emptyDefault, (Func <int, int, bool>)null));
 }
        public void SelectMany()
        {
            Func <int, IEnumerable <int> > collectionSelector = i => Enumerable.Range(i, 10);
            Func <int, int, int>           resultSelector     = (i, e) => e * 2;

            foreach (var arr in new[] { s_empty, s_oneElement, s_manyElements })
            {
                Assert.Equal(
                    Enumerable.SelectMany(arr, collectionSelector, resultSelector),
                    ImmutableArrayExtensions.SelectMany(arr, collectionSelector, resultSelector));
            }

            TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SelectMany <int, int, int>(s_emptyDefault, null, null));
            AssertExtensions.Throws <ArgumentNullException>("collectionSelector", () =>
                                                            ImmutableArrayExtensions.SelectMany <int, int, int>(s_manyElements, null, (i, e) => e));
            AssertExtensions.Throws <ArgumentNullException>("resultSelector", () =>
                                                            ImmutableArrayExtensions.SelectMany <int, int, int>(s_manyElements, i => new[] { i }, null));
        }
 public void AnyEmptyDefault()
 {
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.Any(s_emptyDefault));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.Any(s_emptyDefault, n => true));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.Any(s_emptyDefault, null));
 }
 public void SingleOrDefaultEmptyDefault()
 {
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SingleOrDefault(s_emptyDefault));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.SingleOrDefault(s_emptyDefault, n => true));
     AssertExtensions.Throws <ArgumentNullException>("predicate", () => ImmutableArrayExtensions.SingleOrDefault(s_emptyDefault, null));
 }
 public void SelectEmptyDefault()
 {
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.Select <int, bool>(s_emptyDefault, null));
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => ImmutableArrayExtensions.Select(s_emptyDefault, n => true));
 }
Beispiel #6
0
 public void AsSpanEmptyRangeNotInitialized()
 {
     TestExtensionsMethods.ValidateDefaultThisBehavior(() => s_emptyDefault.AsSpan(new Range(0, 0)));
 }