예제 #1
0
 /// <summary>
 /// Checks if the given array or collection is null or has no elements.
 /// </summary>
 /// <param name="collection"></param>
 /// <returns></returns>
 public static bool HasLength(ICollection collection)
 {
     return(ArrayUtils.HasLength(collection));
 }
예제 #2
0
 public void ConcatsNullArrays()
 {
     byte[] array = new byte[] { 0, 1, 2, 3 };
     Assert.AreEqual(new byte[] { 0, 1, 2, 3 }, ArrayUtils.Concat(array, null));
     Assert.AreEqual(new byte[] { 0, 1, 2, 3 }, ArrayUtils.Concat(null, array));
 }
예제 #3
0
 /// <summary>
 /// Checks if the given array or collection has elements and none of the elements is null.
 /// </summary>
 /// <param name="collection">the collection to be checked.</param>
 /// <returns>true if the collection has a length and contains only non-null elements.</returns>
 public static bool HasElements(ICollection collection)
 {
     return(ArrayUtils.HasElements(collection));
 }
예제 #4
0
 public void HasLengthTests()
 {
     Assert.IsFalse(ArrayUtils.HasLength(null));
     Assert.IsFalse(ArrayUtils.HasLength(new byte[0]));
     Assert.IsTrue(ArrayUtils.HasLength(new byte[1]));
 }