public void GetParameterType_Should_ReturnSystemString_Given_AParameterIndexForAStringParameter() { string parameterIndex = ";System.String,ComponentName.MethodName.parameterName.parameterId,parameterPVS.Array.data[0]"; string expectedParameterType = "System.String"; ParametersIndexUtilities parametersIndexUtilities = new ParametersIndexUtilities(); string result = parametersIndexUtilities.GetParameterType(parameterIndex); Assert.AreEqual(expectedParameterType, result, "The method GetParameterType doesn't return the right parameterType"); }
/// <summary> /// Checks the parameters index for not matching parameters. /// </summary> /// <typeparam name="T">The type of the Step Method.</typeparam> /// <param name="chosenMethods">The chosen methods.</param> /// <param name="parametersIndexes">The parameters indexes.</param> /// <param name="components">The components.</param> /// <returns>A list of <see cref="UnityTestBDDError"/> objects. Each element describes an error found. If the list is empty, there are no errors. The list cannot be null.</returns> public List <UnityTestBDDError> CheckForNotMatchingParametersIndex <T>(string[] chosenMethods, string[] parametersIndexes, Component[] components) where T : IGivenWhenThenDeclaration { List <UnityTestBDDError> result = new List <UnityTestBDDError>(); ParametersIndexUtilities parametersIndexUtilities = new ParametersIndexUtilities(); for (int index = 0; index < chosenMethods.Length; index++) { string[] parametersIndexList = parametersIndexUtilities.GetParametersIndexList(parametersIndexes[index]); foreach (string parametersIndex in parametersIndexList) { string parameterType = parametersIndexUtilities.GetParameterType(parametersIndex); string parameterName = parametersIndexUtilities.GetParameterName(parametersIndex); string methodFullName = parametersIndexUtilities.GetMethodFullName(parametersIndex); Component component = this.GetComponent(methodFullName, components); MethodInfo methodInfo = this.GetMethodInfo(methodFullName, component); List <UnityTestBDDError> partialResult = this.CheckForNotMatchingParametersIndex <T>(component, methodInfo, parameterType, parameterName, index); result.AddRange(partialResult); } } return(result); }