/// <summary>
        /// Loads the parameter location.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameter">The parameter.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="parametersIndex">Index of the parameters.</param>
        /// <returns>The parameter location.</returns>
        private static ParameterLocation LoadParameterLocation(object obj, MethodInfo method, ParameterInfo parameter, string id, string parametersIndex)
        {
            // parametersIndex Format: ;paramtype,className.methodName.paramName.fullId,arrayName.Array.data[index];
            ParametersIndexUtilities parametersIndexUtilities = new ParametersIndexUtilities();
            ParameterLocation        result = null;

            if (parametersIndex != null)
            {
                string   expectedParameterFullName = parametersIndexUtilities.GetParameterFullName(method.DeclaringType.Name, method.Name, parameter.Name, id);
                string[] parameterIndexes          = parametersIndexUtilities.GetParametersIndexList(parametersIndex);
                foreach (string parameterIndex in parameterIndexes)
                {
                    if (!parameterIndex.Equals(string.Empty))
                    {
                        string parameterFullName = parametersIndexUtilities.GetParameterFullName(parameterIndex);
                        if (parameterFullName.Equals(expectedParameterFullName))
                        {
                            string arrayName = parametersIndexUtilities.GetParameterValueStorageName(parameterIndex);

                            int index = parametersIndexUtilities.GetParameterValueStorageLocationIndex(parameterIndex);
                            result = new ParameterLocation();
                            ArrayStorageUtilities arrayStorageUtilities = new ArrayStorageUtilities();
                            FieldInfo             field = arrayStorageUtilities.GetArrayStorageFieldInfoByName(obj, arrayName);
                            result.ParameterArrayLocation.ArrayFieldInfo  = field;
                            result.ParameterArrayLocation.ArrayIndex      = index;
                            result.ParameterArrayLocation.ArrayName       = arrayName;
                            result.ParameterClassLocation.ComponentType   = obj.GetType();
                            result.ParameterClassLocation.ComponentObject = obj;
                        }
                    }
                }
            }

            return(result);
        }
        public void GetArrayStorageFieldInfoByName_Should_ReturnNull_Given_ADynamicComponentAndANameOfAParametersValuesStorageArrayThatIsNotPresentInTheComponent()
        {
            ArrayStorageUtilities arrayStorageUtilities = new ArrayStorageUtilities();
            ArrayStorageUtilitiesTestFirstDynamicComponent dynamicBDDComponent = UnitTestUtility.CreateComponent <ArrayStorageUtilitiesTestFirstDynamicComponent>();

            string    fieldName    = "stringPVSForNotFound";
            FieldInfo arrayStorage = arrayStorageUtilities.GetArrayStorageFieldInfoByName(dynamicBDDComponent, fieldName);

            Assert.IsNull(arrayStorage, "The method GetArrayStorage doesn't return the right ArrayStorage");
        }
        public void GetArrayStorageFieldInfoByName_Should_ReturnTheExpectedFieldInfoObject_Given_ADynamicComponentAndTheNameOfTheParametersValuesStorageArray()
        {
            ArrayStorageUtilities arrayStorageUtilities = new ArrayStorageUtilities();
            ArrayStorageUtilitiesTestFirstDynamicComponent dynamicBDDComponent = UnitTestUtility.CreateComponent <ArrayStorageUtilitiesTestFirstDynamicComponent>();

            string    fieldName    = "stringPVS";
            FieldInfo arrayStorage = arrayStorageUtilities.GetArrayStorageFieldInfoByName(dynamicBDDComponent, fieldName);

            FieldInfo expectedArrayStorage = dynamicBDDComponent.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            Assert.That(expectedArrayStorage.Name.Equals(arrayStorage.Name), "The method GetArrayStorage doesn't return the right ArrayStorage");
            Assert.That(expectedArrayStorage.FieldType.Equals(arrayStorage.FieldType), "The method GetArrayStorage doesn't return the right ArrayStorage");
            Assert.That(expectedArrayStorage.DeclaringType.Equals(arrayStorage.DeclaringType), "The method GetArrayStorage doesn't return the right ArrayStorage");
        }
        /// <summary>
        /// Gets the value of the parameter from its ParametersValuesStorage field.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="arrayName">Name of the array.</param>
        /// <param name="index">The index.</param>
        /// <returns>The value of the parameter.</returns>
        private static object GetValue(object obj, string arrayName, int index)
        {
            object result = null;
            ArrayStorageUtilities arrayStorageUtilities = new ArrayStorageUtilities();
            FieldInfo             field = arrayStorageUtilities.GetArrayStorageFieldInfoByName(obj, arrayName);

            if (field == null)
            {
                return(null);
            }

            Array array = field.GetValue(obj) as Array;

            if (array.Length > index)
            {
                result = array.GetValue(index);
            }

            return(result);
        }