public ActionResult <string> Reverse(int[] productIds)
        {
            if (productIds == null)
            {
                return(Content(""));
            }

            //The array is reversed in place
            ArrayManipService.Reverse(productIds);

            //Format as string
            return(Content(string.Format("[{0}]", string.Join(",", productIds))));
        }
示例#2
0
 public void reverseTestMethod4()
 {
     int[] testArr = new int[] { 0, 1, 2, 3 };
     ArrayManipService.Reverse(testArr);
     CollectionAssert.AreEqual(testArr, new int[] { 3, 2, 1, 0 });
 }
示例#3
0
 public void reverseTestMethod7()
 {
     int[] testArr = new int[] { 4, 2, 3, 1, 5 };
     ArrayManipService.Reverse(testArr);
     CollectionAssert.AreEqual(testArr, new int[] { 5, 1, 3, 2, 4 });
 }
示例#4
0
 public void reverseTestMethod1()
 {
     int[] testArr = null;
     ArrayManipService.Reverse(testArr);
     CollectionAssert.AreEqual(testArr, null);
 }