Пример #1
0
        public void delTestMethod11()
        {
            int[] testArr = new int[] { 0, 1, 4, 7, 9, 100 };
            var   result  = ArrayManipService.DeletePart(testArr, 7);

            CollectionAssert.AreEqual(result, testArr);
        }
Пример #2
0
        public void delTestMethod10()
        {
            int[] testArr = new int[] { 0 };
            var   result  = ArrayManipService.DeletePart(testArr, 0);

            CollectionAssert.AreEqual(result, new int[0]);
        }
        public ActionResult <string> DeletePart(uint position, int[] productIds)
        {
            //since the position provided is 1-based, use (position - 1) for 0-based arrays
            if (position == 0)
            {
                return(Content(""));
            }
            var deleted = ArrayManipService.DeletePart(productIds, position - 1);

            if (deleted == null)
            {
                return(Content(""));
            }

            //Format as string
            return(Content(string.Format("[{0}]", string.Join(",", deleted))));
        }
Пример #4
0
 public void delTestMethod9()
 {
     int[] testArr = new int[] { 0 };
     ArrayManipService.DeletePart(testArr, 1);
     CollectionAssert.AreEqual(testArr, new int[] { 0 });
 }
Пример #5
0
 public void delTestMethod8()
 {
     int[] testArr = null;
     ArrayManipService.DeletePart(testArr, 1);
     CollectionAssert.AreEqual(testArr, null);
 }