public void ValidateLengthOfArray(OneDimensionalArray array)
 {
     if (array.GetLength() < 0)
     {
         throw new InvalidDataException("Unable to process negative length for array");
     }
 }
        static void Main(string[] args)
        {
            OneDimensionalArray array = new OneDimensionalArray();

            array.length = 5;

            // array = ReadOneDimensionalArray(array.length);
        }
Beispiel #3
0
        public SystemTests()
        {
            _array = new OneDimensionalArray();
            _array.SetLength(7);
            _array.SetOneDimensionalArray(new[] { 12, -12, 57, 32, -321, 13, 0 });

            _processor = new SearchProcessor();
        }
Beispiel #4
0
        public bool IsValueInArray(OneDimensionalArray array, int valueToSearch)
        {
            for (int iterator = 0; iterator < array.GetLength(); iterator++)
            {
                if (array.GetOneDimensionalArray()[iterator] == valueToSearch)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #5
0
        public SystemTests()
        {
            _arraySetOne = new OneDimensionalArray();
            _arraySetOne.SetLength(7);
            _arraySetOne.SetOneDimensionalArray(new[] { 12, -12, 57, 32, -321, 13, 0 });

            _arraySetTwo = new OneDimensionalArray();
            _arraySetTwo.SetLength(7);
            _arraySetTwo.SetOneDimensionalArray(new[] { 12, -12, 31, 15, 16, 7, -32 });

            _searchProcessor = new SearchProcessor();
            _limitsOfArray   = new LimitsOfArray();
        }