public void GreaterItemGreaterThanLesserItem()
        {
            var anFirst  = new int[] { 1, 2, 3, 5 };
            var anSecond = new int[] { 1, 2, 3, 4 };

            Assert.Greater(ArrayUtility.Compare(anFirst, anSecond), 0);
        }
Пример #2
0
        /// <summary>
        /// Check an assembly to see if it has the given public key token.
        /// </summary>
        /// <param name="assembly">Assembly to check.</param>
        /// <param name="expectedToken"></param>
        /// <returns></returns>
        /// <remarks>Does not check to make sure the assembly's signature
        /// is valid.</remarks>
        public static bool CheckForToken
        (
            Assembly assembly,
            byte[] expectedToken)
        {
            ArgumentUtility.NotNull
            (
                assembly,
                "assembly");
            ArgumentUtility.NotNull
            (
                expectedToken,
                "expectedToken");

            byte[] realToken = assembly.GetName()
                               .GetPublicKeyToken();
            if (realToken == null)
            {
                return(false);
            }
            return(ArrayUtility.Compare
                   (
                       realToken,
                       expectedToken) == 0);
        }
        public void ConcatenateOne()
        {
            var anFirst = new int[] { 1, 2, 4, 8 };

            Assert.AreEqual(0, ArrayUtility.Compare(ArrayUtility.Concatenate <int>(anFirst),
                                                    new int[] { 1, 2, 4, 8 }));
        }
        public void NonNullItemGreaterThanNullItem()
        {
            var astrFirst  = new string?[] { "1", "2", "3", "4" };
            var astrSecond = new string?[] { "1", "2", "3", null };

            Assert.Greater(ArrayUtility.Compare(astrFirst, astrSecond), 0);
        }
        public void LongerArrayGreaterThanShorterArray()
        {
            var anFirst  = new int[] { 1, 2, 3, 4, 5 };
            var anSecond = new int[] { 1, 2, 3, 4 };

            Assert.Greater(ArrayUtility.Compare(anFirst, anSecond), 0);
        }
        public void ShorterArrayLessThanLongerArray()
        {
            var anFirst  = new int[] { 1, 2, 3, 4 };
            var anSecond = new int[] { 1, 2, 3, 4, 5 };

            Assert.Less(ArrayUtility.Compare(anFirst, anSecond), 0);
        }
        public void ArraysCompareEqualWithNull()
        {
            var astrFirst  = new string?[] { "1", "2", null, "4", "5" };
            var astrSecond = new string?[] { "1", "2", null, "4", "5" };

            Assert.AreEqual(0, ArrayUtility.Compare(astrFirst, astrSecond));
        }
        public void ArraysCompareEqual()
        {
            var anFirst  = new int[] { 1, 2, 3, 4, 5 };
            var anSecond = new int[] { 1, 2, 3, 4, 5 };

            Assert.AreEqual(0, ArrayUtility.Compare(anFirst, anSecond));
        }
Пример #9
0
 public void ConcatenateThree()
 {
     int[] anFirst  = new int[] { 1, 2, 4, 8 };
     int[] anSecond = new int[] { 8, 4, 2, 1 };
     int[] anThird  = new int[] { 3, 5, 6, 7 };
     Assert.AreEqual(0, ArrayUtility.Compare(ArrayUtility.Concatenate(anFirst, anSecond, anThird),
                                             new int[] { 1, 2, 4, 8, 8, 4, 2, 1, 3, 5, 6, 7 }));
 }
Пример #10
0
        public void ArrayUtility_Compare_1()
        {
            int[] first  = { 1, 2, 3 };
            int[] second = { 1, 3, 4 };
            Assert.IsTrue(ArrayUtility.Compare(first, second) < 0);

            first  = new int[0];
            second = new int[0];
            Assert.IsTrue(ArrayUtility.Compare(first, second) == 0);
        }
Пример #11
0
 public void ConcatenateEmpty()
 {
     Assert.AreEqual(0, ArrayUtility.Compare(ArrayUtility.Concatenate(new int[] { }, new int[] { }), new int[] { }));
 }
Пример #12
0
 public void ConcatenateNone()
 {
     Assert.AreEqual(0, ArrayUtility.Compare(ArrayUtility.Concatenate <int>(), new int[] { }));
 }
Пример #13
0
 public void LesserItemLesserThanGreaterItem()
 {
     int[] anFirst  = new int[] { 1, 2, 3, 4 };
     int[] anSecond = new int[] { 1, 2, 3, 5 };
     Assert.Less(ArrayUtility.Compare(anFirst, anSecond), 0);
 }
Пример #14
0
 public void NullItemLessThanNonNullItem()
 {
     string[] astrFirst  = new string[] { "1", "2", "3", null };
     string[] astrSecond = new string[] { "1", "2", "3", "4" };
     Assert.Less(ArrayUtility.Compare(astrFirst, astrSecond), 0);
 }
Пример #15
0
 public void ArrayGreaterThanNullArray()
 {
     int[] anFirst = new int[] { 1, 2, 3, 4 };
     Assert.Greater(ArrayUtility.Compare(anFirst, null), 0);
 }
Пример #16
0
 public void NullArrayLessThanArray()
 {
     int[] anSecond = new int[] { 1, 2, 3, 4 };
     Assert.Less(ArrayUtility.Compare(null, anSecond), 0);
 }
Пример #17
0
 public void NullArraysCompareEqual()
 {
     Assert.AreEqual(0, ArrayUtility.Compare <int>(null, null));
 }
Пример #18
0
 public void ArrayUtility_Compare_2()
 {
     int[] first  = { };
     int[] second = { 1, 3, 4 };
     Assert.IsTrue(ArrayUtility.Compare(first, second) < 0);
 }