Example #1
0
        /// <summary>
        /// Gets the text describing for the method for log operations.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns>The text describing for the method for log operations.</returns>
        private string GetMethodText(FullMethodDescription method)
        {
            string result = method.GetFullName();

            result += " [Delay= " + method.Delay + " Timeout= " + method.TimeOut + "]";
            return(result);
        }
Example #2
0
        /// <summary>
        /// Get the BDD methods chain list indicating which method raised the error.
        /// </summary>
        /// <param name="methods">The methods.</param>
        /// <param name="methodDescription">The method description.</param>
        /// <returns>The BDD methods chain list indicating which method raised the error.</returns>
        public virtual string GetbddMethodLocationForSpecificMethod(List <FullMethodDescription> methods, FullMethodDescription methodDescription)
        {
            string result = string.Empty;

            for (int index = 0; index < methods.Count; index++)
            {
                FullMethodDescription method = methods[index];
                string partialString         = string.Empty;
                if (method.Equals(methodDescription))
                {
                    partialString = "\n---------->$ & %%%";
                }
                else
                {
                    partialString = "\n           $ & %%%";
                }

                string indenting    = this.GetIndentingForMethod(method);
                string methodText   = this.GetMethodText(method);
                string stepTypeText = this.GetStepTypeText(method);
                result += partialString.Replace("$", stepTypeText).Replace("&", indenting).Replace("%%%", methodText);
            }

            return(result);
        }
        public void InvokeMethod_Should_ReturnTrue_Given_TheInvokedMethodReturnsAAssertionResultSuccessfulObject()
        {
            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);

            Component  component                   = Substitute.For <Component>();
            MethodInfo mockedMethodInfo            = Substitute.For <MethodInfo>();
            object     methodInvokeAssertionResult = new AssertionResultSuccessful();

            object[] parameters = new object[0];
            mockedMethodInfo.Invoke(component, parameters).Returns(methodInvokeAssertionResult);
            FullMethodDescription methodDescription = Substitute.For <FullMethodDescription>();

            methodDescription.Method = mockedMethodInfo;
            methodDescription.GetFullName().Returns <string>("component.method");

            ExtensionRunnerBusinessLogic mockedBusinessLogic = Substitute.For <ExtensionRunnerBusinessLogic>(gameObject);

            DateTime firstNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.StartDelayTime = firstNowDatetime;
            DateTime secondNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.DateTimeNow().Returns <DateTime>(secondNowDatetime);
            mockedBusinessLogic.GetParametersValues(methodDescription).Returns <object[]>(parameters);
            mockedMethodInfo.Invoke(component, parameters).Returns(methodInvokeAssertionResult);
            methodDescription.Method = mockedMethodInfo;
            bool result = businessLogic.InvokeMethod(mockedBusinessLogic, methodDescription, gameObject);

            Assert.IsTrue(result, "The method InvokeMethod doesn't return the right state");
        }
        /// <summary>
        /// Builds the index of the parameter.
        /// </summary>
        /// <param name="fullMethodDescription">The full method description.</param>
        /// <param name="parameter">The parameter.</param>
        /// <param name="index">The index.</param>
        /// <param name="arrayFieldInfo">The array field information.</param>
        /// <returns>A string containing the parameter index.</returns>
        private string BuildParameterIndex(FullMethodDescription fullMethodDescription, MethodParameter parameter, int index, FieldInfo arrayFieldInfo)
        {
            // ";string,BDDComponentForTest.GivenMethod.stringParam.fullId,stringsArrayStorage.Array.data[0];"
            MethodsManagementUtilities methodsManagementUtilities = new MethodsManagementUtilities();

            return(parameter.ParameterInfoObject.ParameterType.FullName + "," + fullMethodDescription.GetFullName() + "." +
                   parameter.ParameterInfoObject.Name + "." + methodsManagementUtilities.GetMainFullId(fullMethodDescription.MainMethod) + fullMethodDescription.Id + "," + arrayFieldInfo.Name + ".Array.data[" + index + "]");
        }
Example #5
0
        /// <summary>
        /// Adds the delay and timeout information to the Main method.
        /// </summary>
        /// <param name="mainFullMethodDescription">The main full method description.</param>
        private void AddDelayAndTimeoutToMainFullMethodDescription(FullMethodDescription mainFullMethodDescription)
        {
            object[] customCallBeforeAttributes = mainFullMethodDescription.Method.GetCustomAttributes(mainFullMethodDescription.StepType, true);
            IGivenWhenThenDeclaration bddBethodBaseAttribute = (IGivenWhenThenDeclaration)customCallBeforeAttributes[0];

            mainFullMethodDescription.Delay   = bddBethodBaseAttribute.GetDelay();
            mainFullMethodDescription.TimeOut = bddBethodBaseAttribute.GetTimeout();
        }
        /// <summary>
        /// Gets the main full id of a method.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns>The main full id of a method.</returns>
        public string GetMainFullId(FullMethodDescription method)
        {
            if (method == null || method.MainMethod == null)
            {
                return(string.Empty);
            }

            return(this.GetMainFullId(method.MainMethod) + method.Id + "_");
        }
Example #7
0
        /// <summary>
        /// Gets the parameters values for the method Invoke.
        /// </summary>
        /// <param name="methodDescription">The method description.</param>
        /// <returns>An array containing the ordered collection of the parameters values.</returns>
        public virtual object[] GetParametersValues(FullMethodDescription methodDescription)
        {
            List <object> parameters = new List <object>();

            foreach (MethodParameter parameter in methodDescription.Parameters.Parameters)
            {
                parameters.Add(parameter.Value);
            }

            return(parameters.ToArray());
        }
        /// <summary>
        /// Gets the full id of a method.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns>The full id of a method.</returns>
        public string GetFullId(FullMethodDescription method)
        {
            if (method == null)
            {
                return(string.Empty);
            }

            string mainFullId = this.GetMainFullId(method.MainMethod);

            return(mainFullId + method.Id);
        }
        /// <summary>
        /// Adds the index of the parameters.
        /// </summary>
        /// <param name="fullMethodDescription">The full method description.</param>
        /// <param name="parametersIndex">Index of the parameters.</param>
        private void AddParametersIndex(FullMethodDescription fullMethodDescription, string parametersIndex)
        {
            FullMethodDescription baseFullMethodDescription = fullMethodDescription;

            while (baseFullMethodDescription.MainMethod != null)
            {
                baseFullMethodDescription = baseFullMethodDescription.MainMethod;
            }

            baseFullMethodDescription.ParametersIndex += parametersIndex;
        }
Example #10
0
        /// <summary>
        /// Gets the <see cref="FullMethodDescription"/> for the method declared by the <see cref="CallBefore"/> attribute.
        /// </summary>
        /// <param name="callBefore">The call before.</param>
        /// <param name="mainMethod">The main method.</param>
        /// <param name="parametersIndex">Index of the parameters.</param>
        /// <returns>The <see cref="FullMethodDescription"/> for the method declared by the <see cref="CallBefore"/> attribute.</returns>
        private FullMethodDescription GetCallBeforeFullMethodDescription(CallBefore callBefore, FullMethodDescription mainMethod, string parametersIndex)
        {
            MethodInfo                 methodInfo                 = mainMethod.ComponentObject.GetType().GetMethod(callBefore.Method);
            MethodParametersLoader     methodParametersLoader     = new MethodParametersLoader();
            MethodsManagementUtilities methodsManagementUtilities = new MethodsManagementUtilities();
            string           fullId           = methodsManagementUtilities.GetMainFullId(mainMethod) + callBefore.Id;
            MethodParameters methodParameters = methodParametersLoader.LoadMethodParameters(mainMethod.ComponentObject, methodInfo, fullId, parametersIndex);

            FullMethodDescription result = this.GetFullMethodDescription(mainMethod.ComponentObject, methodInfo, mainMethod.StepType, mainMethod.Text, methodParameters, string.Empty, 0, callBefore.Delay, callBefore.Timeout, callBefore.ExecutionOrder, callBefore.Id, mainMethod);

            return(result);
        }
        public void InvokeMethod_Should_PerformTheExpectedCallsAndReturnFalse_Given_TheInvokedMethodReturnsAAssertionResultRetryObject()
        {
            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);

            Component        component                   = Substitute.For <Component>();
            MethodInfo       mockedMethodInfo            = Substitute.For <MethodInfo>();
            string           errorText                   = "message";
            IAssertionResult methodInvokeAssertionResult = new AssertionResultRetry(errorText);

            object[] parameters = new object[0];
            mockedMethodInfo.Invoke(component, parameters).Returns(methodInvokeAssertionResult);
            FullMethodDescription methodDescription = Substitute.For <FullMethodDescription>();

            methodDescription.Method = mockedMethodInfo;
            methodDescription.GetFullName().Returns <string>("component.method");
            ExtensionRunnerBusinessLogic mockedBusinessLogic = Substitute.For <ExtensionRunnerBusinessLogic>(gameObject);

            DateTime firstNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.StartDelayTime = firstNowDatetime;
            DateTime secondNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.DateTimeNow().Returns <DateTime>(secondNowDatetime);

            mockedBusinessLogic.GetParametersValues(methodDescription).Returns <object[]>(parameters);
            string scenarioText                  = "scenarioText";
            string bddMethodLocation             = "bddMethodLocation";
            List <FullMethodDescription> methods = new List <FullMethodDescription>();

            methods.Add(methodDescription);

            mockedBusinessLogic.MethodsDescription = methods;
            mockedBusinessLogic.GetScenarioTextForErrorInSpecificMethod(methods, methodDescription).Returns(scenarioText);
            mockedBusinessLogic.GetbddMethodLocationForSpecificMethod(methods, methodDescription).Returns(bddMethodLocation);

            bool result = businessLogic.InvokeMethod(mockedBusinessLogic, methodDescription, gameObject);

            Received.InOrder(() =>
            {
                mockedBusinessLogic.DateTimeNow();
                mockedBusinessLogic.DateTimeNow();
                mockedBusinessLogic.GetParametersValues(methodDescription);
                mockedMethodInfo.Invoke(component, parameters);
                mockedBusinessLogic.DateTimeNow();

                mockedBusinessLogic.InvokeAssertionFailed(errorText, scenarioText, bddMethodLocation, gameObject);
            });
            Assert.IsFalse(result, "The method InvokeMethod doesn't return the right state");
        }
Example #12
0
        /// <summary>
        /// Builds the list of <see cref="FullMethodDescription"/> objects based on the information contained into a <see cref="MethodDescription"/> object.
        /// </summary>
        /// <param name="methodDescription">The method description.</param>
        /// <param name="stepNumber">The step number.</param>
        /// <returns>A <see cref="List"/> of <see cref="FullMethodDescription"/> object. Each element represent one of the element in the call chain defined by the <see cref="CallBefore"/> attributes. The last one is the main method described by the <paramref name="methodDescription"/> parameter.</returns>
        public virtual List <FullMethodDescription> Build(MethodDescription methodDescription, uint stepNumber)
        {
            List <FullMethodDescription> result = new List <FullMethodDescription>();

            if (methodDescription != null)
            {
                FullMethodDescription mainFullMethodDescription = this.GetFullMethodDescription(methodDescription.ComponentObject, methodDescription.Method, methodDescription.StepType, methodDescription.Text, methodDescription.Parameters, methodDescription.ParametersIndex, methodDescription.ExecutionOrder, 0, 0, stepNumber, string.Empty, null);
                this.AddDelayAndTimeoutToMainFullMethodDescription(mainFullMethodDescription);
                result = this.GetCallBeforeListFullMethodsDescriptions(mainFullMethodDescription, mainFullMethodDescription.ParametersIndex);
                result.Add(mainFullMethodDescription);
            }

            return(result);
        }
Example #13
0
        /// <summary>
        /// Gets the indenting for method for log operations.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns>The indenting for method for log operations.</returns>
        private string GetIndentingForMethod(FullMethodDescription method)
        {
            string result                    = string.Empty;
            int    numberOfIndents           = 0;
            FullMethodDescription mainMethod = method.MainMethod;

            while (mainMethod != null)
            {
                numberOfIndents++;
                mainMethod = mainMethod.MainMethod;
            }

            result = string.Empty.PadRight(numberOfIndents * 3, ' ');
            return(result);
        }
        /// <summary>
        /// Gets the header text for the parameters area.
        /// </summary>
        /// <param name="fullMethodDescription">The full method description.</param>
        /// <returns>The header text for the parameters area.</returns>
        private string GetHeaderTextForFullMethodDescription(FullMethodDescription fullMethodDescription)
        {
            string result = "Method ";

            string methodName = fullMethodDescription.Method.Name;
            MethodsManagementUtilities methodsManagementUtilities = new MethodsManagementUtilities();
            string fullId = methodsManagementUtilities.GetMainFullId(fullMethodDescription.MainMethod) + fullMethodDescription.Id;

            result += methodName;
            if (!fullId.Equals(string.Empty))
            {
                result += " Id=" + fullId;
            }

            return(result);
        }
Example #15
0
        /// <summary>
        /// Gets the full method description.
        /// </summary>
        /// <param name="componentObject">The <see cref="Component"/> object containing the method.</param>
        /// <param name="method">The <see cref="MethodInfo"/> object for the method.</param>
        /// <param name="stepType">The Step Type.</param>
        /// <param name="text">The BDD text for the method. Can be empty. Cannot be null.</param>
        /// <param name="parameters">The <see cref="MethodParameters"/> object.</param>
        /// <param name="parametersIndex">The string indicating the ParametersIndex for the values of the parameters.</param>
        /// <param name="executionOrder">The relative order of the execution of the method in the call chain.</param>
        /// <param name="delay">The value of the delay.</param>
        /// <param name="timeOut">The value of the timeout.</param>
        /// <param name="callBeforeExecutionOrder">The relative order of the execution of the method in the call chain of the CallBefore methods.</param>
        /// <param name="id">The string that can make the parameter identifier unique.</param>
        /// <param name="mainMethod">The <see cref="FullMethodDescription"/> object if the parent method in the call chain.</param>
        /// <returns>THe <see cref="FullMethodDescription"/> object describing the information passed by the parameters.</returns>
        private FullMethodDescription GetFullMethodDescription(Component componentObject, MethodInfo method, Type stepType, string text, MethodParameters parameters, string parametersIndex, uint executionOrder, uint delay, uint timeOut, uint callBeforeExecutionOrder, string id, FullMethodDescription mainMethod)
        {
            FullMethodDescription result = new FullMethodDescription();

            result.ComponentObject = componentObject;
            result.Method          = method;
            result.StepType        = stepType;
            result.Text            = text;
            result.Parameters      = parameters;
            result.ParametersIndex = parametersIndex;
            result.ExecutionOrder  = executionOrder;
            result.Delay           = delay;
            result.TimeOut         = timeOut;
            result.SuccessionOrder = callBeforeExecutionOrder;
            result.MainMethod      = mainMethod;
            result.Id = id;

            return(result);
        }
        public void GetScenarioTextForError_Should_ReturnTheExpectedString_Given_TheListOfTheFullMethodDescriptionObjectsBeteweenThreeDynamicComponentsAndAndTheErrorInACallBeforeMethod()
        {
            ExtensionRunnerBusinessLogicTestFirstDynamicComponent  firstComponent  = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestFirstDynamicComponent>();
            ExtensionRunnerBusinessLogicTestSecondDynamicComponent secondComponent = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestSecondDynamicComponent>();
            ExtensionRunnerBusinessLogicTestThirdDynamicComponent  thirdComponent  = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestThirdDynamicComponent>();

            Component[] components = new Component[3] {
                firstComponent, secondComponent, thirdComponent
            };

            string[] givenMethods = new string[3] {
                "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.GivenMethod", "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.GivenMethod"
            };
            string[] givenParameters = new string[3] {
                string.Empty, string.Empty, string.Empty
            };

            string[] whenMethods = new string[2] {
                "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.WhenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.WhenMethod"
            };
            string[] whenParameters = new string[2] {
                string.Empty, string.Empty
            };

            string[] thenMethods = new string[2] {
                "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondThenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.ThenMethod"
            };
            string[] thenParameters = new string[2] {
                string.Empty, string.Empty
            };

            GameObject gameObject = UnitTestUtility.CreateGameObject();
            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);
            List <FullMethodDescription> methods       = businessLogic.GetAllMethodsDescriptions(components, givenMethods, givenParameters, whenMethods, whenParameters, thenMethods, thenParameters);

            FullMethodDescription methodDescription = methods[9];

            string expectedString = "\n            Given Given method\n              and Second Given method\n              and Given method\n             when When method\n              and When method\n             then Second Then method\n---------->   and Then method";

            string result = businessLogic.GetScenarioTextForErrorInSpecificMethod(methods, methodDescription);

            Assert.AreEqual(expectedString, result, "The method GetScenarioTextForErrorInSpecificMethod doesn't return the right scenario text");
        }
        public void GetbddMethodLocationForSpecificMethod_Should_ReturnTheExpectedString_Given_AListOfFullMethodDescriptionObjectsAndANestedMethodInError()
        {
            ExtensionRunnerBusinessLogicTestFirstDynamicComponent  firstComponent  = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestFirstDynamicComponent>();
            ExtensionRunnerBusinessLogicTestSecondDynamicComponent secondComponent = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestSecondDynamicComponent>();
            ExtensionRunnerBusinessLogicTestThirdDynamicComponent  thirdComponent  = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestThirdDynamicComponent>();

            Component[] components = new Component[3] {
                firstComponent, secondComponent, thirdComponent
            };

            string[] givenMethods = new string[3] {
                "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.GivenMethod", "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.GivenMethod"
            };
            string[] givenParameters = new string[3] {
                string.Empty, string.Empty, string.Empty
            };

            string[] whenMethods = new string[2] {
                "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.WhenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.WhenMethod"
            };
            string[] whenParameters = new string[2] {
                string.Empty, string.Empty
            };

            string[] thenMethods = new string[2] {
                "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondThenMethod", "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.ThenMethod"
            };
            string[] thenParameters = new string[2] {
                string.Empty, string.Empty
            };

            GameObject gameObject = UnitTestUtility.CreateGameObject();
            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);
            List <FullMethodDescription> methods       = businessLogic.GetAllMethodsDescriptions(components, givenMethods, givenParameters, whenMethods, whenParameters, thenMethods, thenParameters);

            FullMethodDescription methodDescription = methods[5];

            string expectedString = "\n           [Given]  ExtensionRunnerBusinessLogicTestFirstDynamicComponent.GivenMethod [Delay= 0 Timeout= 3000]\n           [Given]  ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod [Delay= 0 Timeout= 3000]\n           [Given]  ExtensionRunnerBusinessLogicTestSecondDynamicComponent.GivenMethod [Delay= 0 Timeout= 3000]\n           [ When]  ExtensionRunnerBusinessLogicTestFirstDynamicComponent.WhenMethod [Delay= 21 Timeout= 34]\n           [ When]  ExtensionRunnerBusinessLogicTestSecondDynamicComponent.WhenMethod [Delay= 21 Timeout= 34]\n---------->[ Then]        ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod [Delay= 32 Timeout= 54]\n           [ Then]     ExtensionRunnerBusinessLogicTestThirdDynamicComponent.ThenMethod [Delay= 56 Timeout= 65]\n           [ Then]     ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod [Delay= 65 Timeout= 64]\n           [ Then]  ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondThenMethod [Delay= 11 Timeout= 33]\n           [ Then]     ExtensionRunnerBusinessLogicTestSecondDynamicComponent.SecondGivenMethod [Delay= 32 Timeout= 54]\n           [ Then]  ExtensionRunnerBusinessLogicTestSecondDynamicComponent.ThenMethod [Delay= 0 Timeout= 3000]";

            string result = businessLogic.GetbddMethodLocationForSpecificMethod(methods, methodDescription);

            Assert.AreEqual(expectedString, result, "The method GetbddMethodLocationForSpecificMethod doesn't return the right location text");
        }
Example #18
0
        /// <summary>
        /// Gets the text describing the Type of the BDD Step.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns>The text describing the Type of the BDD Step.</returns>
        private string GetStepTypeText(FullMethodDescription method)
        {
            string result = null;

            if (method.StepType.Equals(typeof(GivenBaseAttribute)))
            {
                result = "[Given]";
            }
            else if (method.StepType.Equals(typeof(WhenBaseAttribute)))
            {
                result = "[ When]";
            }
            else
            {
                result = "[ Then]";
            }

            return(result);
        }
        public void RunCycle_Should_PerformTheExpectedCallsForTheFirstMethodInTheListAndReturnTheIndexForTheNextMethod_Given_TheMethodHasNotAConfiguredDelay()
        {
            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);

            Component  component                   = Substitute.For <Component>();
            MethodInfo mockedMethodInfo            = Substitute.For <MethodInfo>();
            object     methodInvokeAssertionResult = new AssertionResultSuccessful();

            object[] parameters = new object[0];
            mockedMethodInfo.Invoke(component, parameters).Returns(methodInvokeAssertionResult);
            FullMethodDescription methodDescription = Substitute.For <FullMethodDescription>();

            methodDescription.Method = mockedMethodInfo;
            methodDescription.GetFullName().Returns <string>("component.method");

            ExtensionRunnerBusinessLogic mockedBusinessLogic = Substitute.For <ExtensionRunnerBusinessLogic>(gameObject);

            mockedBusinessLogic.IntegrationTestGameObject = gameObject;

            List <FullMethodDescription> methodsDescription = new List <FullMethodDescription>();

            methodsDescription.Add(methodDescription);
            methodsDescription.Add(Substitute.For <FullMethodDescription>());

            DateTime firstNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.DateTimeNow().Returns <DateTime>(firstNowDatetime);
            mockedBusinessLogic.InvokeMethod(mockedBusinessLogic, methodDescription, gameObject).Returns <bool>(true);

            int indexToRun    = -1;
            int newIndexToRun = businessLogic.RunCycle(mockedBusinessLogic, methodsDescription, indexToRun);

            Received.InOrder(() =>
            {
                mockedBusinessLogic.DateTimeNow();
                mockedBusinessLogic.InvokeMethod(mockedBusinessLogic, methodDescription, gameObject);
                mockedBusinessLogic.DateTimeNow();
            });
            Assert.AreEqual(1, newIndexToRun, "The method RunCycle doesn't return the right value");
        }
Example #20
0
        /// <summary>
        /// Gets the call chain defined by the <see cref="CallBefore"/> attributes.
        /// </summary>
        /// <param name="mainMethodDescription">The main method description.</param>
        /// <param name="parametersIndex">Index of the parameters.</param>
        /// <returns>A <see cref="List"/> of <see cref="FullMethodDescription"/> object. Each element represent one of the element in the call chain defined by the <see cref="CallBefore"/> attributes.</returns>
        private List <FullMethodDescription> GetCallBeforeListFullMethodsDescriptions(FullMethodDescription mainMethodDescription, string parametersIndex)
        {
            List <FullMethodDescription> result = new List <FullMethodDescription>();

            object[] customCallBeforeAttributes = mainMethodDescription.Method.GetCustomAttributes(typeof(CallBefore), true);
            foreach (object callBeforeAttribute in customCallBeforeAttributes)
            {
                CallBefore callBefore = (CallBefore)callBeforeAttribute;
                if (callBefore.Method != null && !callBefore.Method.Equals(string.Empty))
                {
                    FullMethodDescription        callBeforeFullMethodDescription        = this.GetCallBeforeFullMethodDescription(callBefore, mainMethodDescription, parametersIndex);
                    List <FullMethodDescription> listOfCallBeforeFullMethodDescriptions = this.GetCallBeforeListFullMethodsDescriptions(callBeforeFullMethodDescription, parametersIndex);
                    result.AddRange(listOfCallBeforeFullMethodDescriptions);
                    result.Add(callBeforeFullMethodDescription);
                }
            }

            result.Sort();
            return(result);
        }
        public void InvokeMethod_Should_PerformTheExpectedCallsAndReturnFalse_Given_TheInvokedMethodHasAReachedDelayAndReturnsAAssertionResultRetryObject()
        {
            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);

            Component  component                   = Substitute.For <Component>();
            MethodInfo mockedMethodInfo            = Substitute.For <MethodInfo>();
            object     methodInvokeAssertionResult = new AssertionResultRetry("message");

            object[] parameters = new object[0];
            mockedMethodInfo.Invoke(component, parameters).Returns(methodInvokeAssertionResult);
            FullMethodDescription methodDescription = Substitute.For <FullMethodDescription>();

            methodDescription.Method = mockedMethodInfo;
            methodDescription.GetFullName().Returns <string>("component.method");
            methodDescription.TimeOut = 1000;
            ExtensionRunnerBusinessLogic mockedBusinessLogic = Substitute.For <ExtensionRunnerBusinessLogic>(gameObject);

            DateTime firstNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.StartDelayTime = firstNowDatetime;
            DateTime secondNowDatetime = new DateTime(2017, 05, 01, 00, 00, 00, 000);

            mockedBusinessLogic.DateTimeNow().Returns <DateTime>(secondNowDatetime);

            mockedBusinessLogic.GetParametersValues(methodDescription).Returns <object[]>(parameters);

            bool result = businessLogic.InvokeMethod(mockedBusinessLogic, methodDescription, gameObject);

            Received.InOrder(() =>
            {
                mockedBusinessLogic.DateTimeNow();
                mockedBusinessLogic.DateTimeNow();
                mockedBusinessLogic.GetParametersValues(methodDescription);
                mockedMethodInfo.Invoke(component, parameters);
                mockedBusinessLogic.DateTimeNow();
            });
            Assert.IsFalse(result, "The method InvokeMethod doesn't return the right state");
        }
Example #22
0
        /// <summary>
        /// Gets the scenario text indicating the sentence that raises the error.
        /// </summary>
        /// <param name="methods">The methods.</param>
        /// <param name="methodDescription">The method description.</param>
        /// <returns>The scenario text indicating the sentence that raised the error.</returns>
        public virtual string GetScenarioTextForErrorInSpecificMethod(List <FullMethodDescription> methods, FullMethodDescription methodDescription)
        {
            string result                 = string.Empty;
            Type   previousStepType       = null;
            bool   nextMainMethodHasError = false;

            for (int index = 0; index < methods.Count; index++)
            {
                FullMethodDescription method = methods[index];
                if (method.MainMethod == null)
                {
                    Type   currentStepType = method.StepType;
                    string label           = this.GetLabel(previousStepType, currentStepType);
                    string partialString   = string.Empty;
                    if (method.Equals(methodDescription) || nextMainMethodHasError)
                    {
                        partialString = "\n----------> &&&&& %%%";
                    }
                    else
                    {
                        partialString = "\n            &&&&& %%%";
                    }

                    result                += partialString.Replace("&&&&&", label).Replace("%%%", method.GetDecodifiedText());
                    previousStepType       = method.StepType;
                    nextMainMethodHasError = false;
                }
                else
                {
                    if (method.Equals(methodDescription))
                    {
                        nextMainMethodHasError = true;
                    }
                }
            }

            return(result);
        }
        /// <summary>
        /// Draws the parameters rows.
        /// </summary>
        /// <param name="unityInterface">The unity interface.</param>
        /// <param name="foldout">If set to <c>true</c> [foldout].</param>
        /// <param name="fullMethodDescription">The full method description.</param>
        /// <param name="serializedObjects">The serialized objects.</param>
        /// <param name="lockParametersRows">If set to <c>true</c> [lock parameters rows].</param>
        public void DrawParametersRows(IUnityInterfaceWrapper unityInterface, bool foldout, FullMethodDescription fullMethodDescription, Dictionary <Type, ISerializedObjectWrapper> serializedObjects, bool lockParametersRows)
        {
            if (fullMethodDescription != null && foldout && !lockParametersRows)
            {
                ISerializedObjectWrapper serializedObject = null;
                serializedObjects.TryGetValue(fullMethodDescription.ComponentObject.GetType(), out serializedObject);

                foreach (MethodParameter parameter in fullMethodDescription.Parameters.Parameters)
                {
                    string            parameterName     = parameter.ParameterInfoObject.Name;
                    ParameterLocation parameterLocation = parameter.ParameterLocation;

                    // "given.Array.data[0]"
                    string     parameterLocationString = parameterLocation.ParameterArrayLocation.ArrayName + ".Array.data[" + parameterLocation.ParameterArrayLocation.ArrayIndex + "]";
                    GUIContent label = unityInterface.GUIContent(parameterName);
                    ISerializedPropertyWrapper property = serializedObject.FindProperty(parameterLocationString);
                    unityInterface.EditorGUILayoutPropertyField(property, label);
                }
            }

            if (fullMethodDescription != null && foldout && lockParametersRows)
            {
                float labelWidth = unityInterface.EditorGUIUtilityCurrentViewWidth();
                unityInterface.EditorGUILayoutLabelField("When there are some errors the parameters are protected to avoid data lost.", labelWidth);
            }
        }
Example #24
0
        /// <summary>
        /// Invokes the <paramref name="methodDescription"/> method.
        /// </summary>
        /// <param name="businessLogic">The business logic.</param>
        /// <param name="methodDescription">The method description.</param>
        /// <param name="gameObject">The game object.</param>
        /// <returns>True if the method is executed or false if the method still has to be executed.</returns>
        public virtual bool InvokeMethod(ExtensionRunnerBusinessLogic businessLogic, FullMethodDescription methodDescription, GameObject gameObject)
        {
            bool performed = false;

            if (businessLogic.DateTimeNow().Subtract(businessLogic.StartDelayTime).TotalMilliseconds >= methodDescription.Delay)
            {
                if (businessLogic.StartTimoutTime == null)
                {
                    businessLogic.StartTimoutTime = businessLogic.DateTimeNow();
                }

                if (methodDescription.Method != null && !methodDescription.Method.Equals(string.Empty))
                {
                    MethodInfo       method          = methodDescription.Method;
                    Component        component       = methodDescription.ComponentObject;
                    object[]         parameters      = businessLogic.GetParametersValues(methodDescription);
                    IAssertionResult executionResult = null;

                    object executionResultObject = method.Invoke(component, parameters);
                    if (executionResultObject == null)
                    {
                        string errorText         = "The Step Method return null.";
                        string scenarioText      = businessLogic.GetScenarioTextForErrorInSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                        string bddMethodLocation = businessLogic.GetbddMethodLocationForSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                        businessLogic.InvokeAssertionFailed(errorText, scenarioText, bddMethodLocation, gameObject);
                        return(true);
                    }

                    if (typeof(AssertionResultSuccessful).IsAssignableFrom(executionResultObject.GetType()) ||
                        typeof(AssertionResultFailed).IsAssignableFrom(executionResultObject.GetType()) ||
                        typeof(AssertionResultRetry).IsAssignableFrom(executionResultObject.GetType()))
                    {
                        executionResult = (IAssertionResult)executionResultObject;
                    }
                    else
                    {
                        string errorText         = "The return value of the Step Method is not a valid IAssertionResult implementation.";
                        string scenarioText      = businessLogic.GetScenarioTextForErrorInSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                        string bddMethodLocation = businessLogic.GetbddMethodLocationForSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                        businessLogic.InvokeAssertionFailed(errorText, scenarioText, bddMethodLocation, gameObject);
                        return(true);
                    }

                    if (executionResult is AssertionResultSuccessful)
                    {
                        performed = true;
                    }
                    else if (executionResult is AssertionResultFailed)
                    {
                        string errorText = ((AssertionResultFailed)executionResult).Text;

                        string scenarioText      = businessLogic.GetScenarioTextForErrorInSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                        string bddMethodLocation = businessLogic.GetbddMethodLocationForSpecificMethod(businessLogic.MethodsDescription, methodDescription);

                        businessLogic.InvokeAssertionFailed(errorText, scenarioText, bddMethodLocation, gameObject);
                        performed = true;
                    }
                    else if (executionResult is AssertionResultRetry)
                    {
                        if (businessLogic.DateTimeNow().Subtract(businessLogic.StartTimoutTime ?? DateTime.MaxValue).TotalMilliseconds >= methodDescription.TimeOut)
                        {
                            string errorText = ((AssertionResultRetry)executionResult).Text;

                            string scenarioText      = businessLogic.GetScenarioTextForErrorInSpecificMethod(businessLogic.MethodsDescription, methodDescription);
                            string bddMethodLocation = businessLogic.GetbddMethodLocationForSpecificMethod(businessLogic.MethodsDescription, methodDescription);

                            businessLogic.InvokeAssertionFailed(errorText, scenarioText, bddMethodLocation, gameObject);

                            performed = true;
                        }

                        performed = false;
                    }
                }
                else
                {
                    performed = true;
                    businessLogic.StartTimoutTime = null;
                }
            }

            return(performed);
        }
Example #25
0
        public void BuildParametersLocation_Should_LoadTheExpectedValuesForTheParametersAndBuildTheExpectedParametersIndexes_Given_AFullMethodDescriptionListOnTwoDynamicComponentsAndOnThreeMethodsInAdding()
        {
            RunnerEditorBusinessLogicParametersLocationsBuilder parametersLocationsBuilder = new RunnerEditorBusinessLogicParametersLocationsBuilder();

            BaseMethodDescriptionBuilder metodBuilder = new BaseMethodDescriptionBuilder();

            string[] givenMethodsFullNamesList = new string[1] {
                "RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.GivenMethod"
            };
            string[] givenParametersIndexes = new string[1]
            {
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.GivenMethod.stringParam.,stringPVS.Array.data[2]"
            };

            string[] whenMethodsFullNamesList = new string[2]
            {
                "RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod", "RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest.SecondWhenMethod"
            };
            string[] whenParametersIndexes = new string[2]
            {
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenStringParam.,stringPVS.Array.data[3]" +
                ";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenIntParam.,intPVS.Array.data[2]",
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest.SecondWhenMethod.whenStringParam.,stringPVS.Array.data[1]"
            };

            RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest  firstDynamicBDDComponent  = UnitTestUtility.CreateComponent <RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest>();
            RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest secondDynamicBDDComponent = UnitTestUtility.CreateComponent <RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest>();

            Component[] components = new Component[2] {
                secondDynamicBDDComponent, firstDynamicBDDComponent
            };

            string[] stringArray = new string[4] {
                string.Empty, string.Empty, "GivenStringParamFirstClass", "WhenStringParamFirstClass"
            };
            FieldInfo firstStringPVS = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(string), stringArray);

            int[] intArray = new int[3] {
                -1, -1, 103
            };
            FieldInfo firstIntPVS = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(int), intArray);

            stringArray = new string[4] {
                string.Empty, "SecondWhenMethodSecondClass", string.Empty, string.Empty
            };
            FieldInfo secondStringPVS = this.SetPVSAndReturnFieldInfo(secondDynamicBDDComponent, typeof(string), stringArray);

            intArray = null;
            FieldInfo secondIntPVS = this.SetPVSAndReturnFieldInfo(secondDynamicBDDComponent, typeof(int), intArray);

            IMethodsFilter             methodFilterForGivenList     = new MethodsFilterByMethodsFullNameList(givenMethodsFullNamesList);
            IMethodsFilter             methodFilterForWhenList      = new MethodsFilterByMethodsFullNameList(whenMethodsFullNamesList);
            MethodsLoader              methodsLoaderForGivenMethods = new MethodsLoader(metodBuilder, methodFilterForGivenList);
            MethodsLoader              methodsLoaderForWhenMethods  = new MethodsLoader(metodBuilder, methodFilterForWhenList);
            MethodsManagementUtilities methodsManagementUtilities   = new MethodsManagementUtilities();
            MethodDescriptionBuilder   methodDescriptionBuilder     = new MethodDescriptionBuilder();
            MethodParametersLoader     methodParametersLoader       = new MethodParametersLoader();
            List <MethodDescription>   givenMethodsDescriptionsList = methodsManagementUtilities.LoadMethodsDescriptionsFromChosenMethods <GivenBaseAttribute>(components, methodsLoaderForGivenMethods, methodDescriptionBuilder, methodParametersLoader, givenMethodsFullNamesList, givenParametersIndexes);
            List <MethodDescription>   whenMethodsDescriptionsList  = methodsManagementUtilities.LoadMethodsDescriptionsFromChosenMethods <WhenBaseAttribute>(components, methodsLoaderForWhenMethods, methodDescriptionBuilder, methodParametersLoader, whenMethodsFullNamesList, whenParametersIndexes);

            firstStringPVS  = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(string), new string[0]);
            firstIntPVS     = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(int), new int[0]);
            secondStringPVS = this.SetPVSAndReturnFieldInfo(secondDynamicBDDComponent, typeof(string), new string[0]);
            secondIntPVS    = this.SetPVSAndReturnFieldInfo(secondDynamicBDDComponent, typeof(int), new int[0]);

            FullMethodDescriptionBuilder fullMethodDescriptionBuilder     = new FullMethodDescriptionBuilder();
            List <FullMethodDescription> givenFullMethodsDescriptionsList = fullMethodDescriptionBuilder.Build(givenMethodsDescriptionsList[0], 1);

            parametersLocationsBuilder.BuildParametersLocation(givenFullMethodsDescriptionsList);

            List <FullMethodDescription> whenFullMethodsDescriptionsList = fullMethodDescriptionBuilder.Build(whenMethodsDescriptionsList[0], 1);

            whenFullMethodsDescriptionsList.AddRange(fullMethodDescriptionBuilder.Build(whenMethodsDescriptionsList[1], 2));

            parametersLocationsBuilder.BuildParametersLocation(whenFullMethodsDescriptionsList);

            Array firstStringArrayPVS  = firstStringPVS.GetValue(firstDynamicBDDComponent) as Array;
            Array firstIntArrayPVS     = firstIntPVS.GetValue(firstDynamicBDDComponent) as Array;
            Array secondStringArrayPVS = secondStringPVS.GetValue(secondDynamicBDDComponent) as Array;
            Array secondIntArrayPVS    = secondIntPVS.GetValue(secondDynamicBDDComponent) as Array;

            Assert.AreEqual(2, firstStringArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(1, firstIntArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");

            Assert.AreEqual(1, secondStringArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(0, secondIntArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");

            Assert.AreEqual("GivenStringParamFirstClass", firstStringArrayPVS.GetValue(0), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(103, firstIntArrayPVS.GetValue(0), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");

            Assert.AreEqual("SecondWhenMethodSecondClass", secondStringArrayPVS.GetValue(0), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");

            FullMethodDescription givenFullMethodMethodDescription      = givenFullMethodsDescriptionsList[0];
            FullMethodDescription whenFullMethodMethodDescription       = null;
            FullMethodDescription secondWhenFullMethodMethodDescription = null;

            foreach (FullMethodDescription fullMethodDescription in whenFullMethodsDescriptionsList)
            {
                if (fullMethodDescription.GetFullName().Equals("RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod"))
                {
                    whenFullMethodMethodDescription = fullMethodDescription;
                }
                else if (fullMethodDescription.GetFullName().Equals("RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest.SecondWhenMethod"))
                {
                    secondWhenFullMethodMethodDescription = fullMethodDescription;
                }
            }

            Assert.AreEqual(";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.GivenMethod.stringParam.,stringPVS.Array.data[0]", givenFullMethodMethodDescription.ParametersIndex, "The method BuildParametersLocation doesn't build the parametersIndex properly");
            Assert.AreEqual(
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenStringParam.,stringPVS.Array.data[1]" +
                ";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenIntParam.,intPVS.Array.data[0]",
                whenFullMethodMethodDescription.ParametersIndex,
                "The method BuildParametersLocation doesn't build the parametersIndex properly");
            Assert.AreEqual(";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTSecondDynamicBDDForTest.SecondWhenMethod.whenStringParam.,stringPVS.Array.data[0]", secondWhenFullMethodMethodDescription.ParametersIndex, "The method BuildParametersLocation doesn't build the parametersIndex properly");
        }
Example #26
0
        public void BuildParametersLocation_Should_LoadTheExpectedValuesForTheParametersAndBuildTheExpectedParametersIndexes_Given_AFullMethodDescriptionListOnASingleDynamicComponentAndOnThreeMethods()
        {
            RunnerEditorBusinessLogicParametersLocationsBuilder parametersLocationsBuilder = new RunnerEditorBusinessLogicParametersLocationsBuilder();

            BaseMethodDescriptionBuilder metodBuilder = new BaseMethodDescriptionBuilder();

            string[] methodsFullNamesList = new string[3]
            {
                "RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod", "RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.SecondWhenMethod", "RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.ThirdWhenMethod"
            };
            string[] parametersIndexes = new string[3]
            {
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenStringParam.,stringPVS.Array.data[3]" +
                ";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenIntParam.,intPVS.Array.data[2]",
                ";String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.SecondWhenMethod.whenStringParam.,stringPVS.Array.data[0]",
                ";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.ThirdWhenMethod.whenIntParam.,intPVS.Array.data[0]"
            };

            RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest firstDynamicBDDComponent = UnitTestUtility.CreateComponent <RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest>();

            Component[] components = new Component[1] {
                firstDynamicBDDComponent
            };

            string[] stringArray = new string[4] {
                "String Value for the SecondWhenMethod WhenStringParam parameter", string.Empty, string.Empty, "String Value for the WhenMethod WhenStringParam parameter"
            };
            FieldInfo stringPVS = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(string), stringArray);

            int[] intArray = new int[3] {
                103, 0, 201
            };
            FieldInfo intPVS = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(int), intArray);

            IMethodsFilter             methodFilter  = new MethodsFilterByMethodsFullNameList(methodsFullNamesList);
            MethodsLoader              methodsLoader = new MethodsLoader(metodBuilder, methodFilter);
            MethodsManagementUtilities methodsManagementUtilities = new MethodsManagementUtilities();
            MethodDescriptionBuilder   methodDescriptionBuilder   = new MethodDescriptionBuilder();
            MethodParametersLoader     methodParametersLoader     = new MethodParametersLoader();
            List <MethodDescription>   methodsDescriptionsList    = methodsManagementUtilities.LoadMethodsDescriptionsFromChosenMethods <WhenBaseAttribute>(components, methodsLoader, methodDescriptionBuilder, methodParametersLoader, methodsFullNamesList, parametersIndexes);

            stringArray = new string[0];
            stringPVS   = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(string), stringArray);

            intArray = new int[0];
            intPVS   = this.SetPVSAndReturnFieldInfo(firstDynamicBDDComponent, typeof(int), intArray);

            FullMethodDescriptionBuilder fullMethodDescriptionBuilder = new FullMethodDescriptionBuilder();
            List <FullMethodDescription> fullMethodsDescriptionsList  = fullMethodDescriptionBuilder.Build(methodsDescriptionsList[0], 1);

            fullMethodsDescriptionsList.AddRange(fullMethodDescriptionBuilder.Build(methodsDescriptionsList[1], 2));
            fullMethodsDescriptionsList.AddRange(fullMethodDescriptionBuilder.Build(methodsDescriptionsList[2], 3));

            parametersLocationsBuilder.BuildParametersLocation(fullMethodsDescriptionsList);

            Array stringArrayPVS = stringPVS.GetValue(firstDynamicBDDComponent) as Array;
            Array intArrayPVS    = intPVS.GetValue(firstDynamicBDDComponent) as Array;

            Assert.AreEqual(2, stringArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(2, intArrayPVS.Length, "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");

            Assert.AreEqual("String Value for the WhenMethod WhenStringParam parameter", stringArrayPVS.GetValue(0), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual("String Value for the SecondWhenMethod WhenStringParam parameter", stringArrayPVS.GetValue(1), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(201, intArrayPVS.GetValue(0), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            Assert.AreEqual(103, intArrayPVS.GetValue(1), "The method BuildParametersLocation doesn't build the ParameterArrayStorage properly");
            FullMethodDescription whenFullMethodMethodDescription       = null;
            FullMethodDescription secondWhenFullMethodMethodDescription = null;
            FullMethodDescription thirdWhenFullMethodMethodDescription  = null;

            foreach (FullMethodDescription fullMethodDescription in fullMethodsDescriptionsList)
            {
                if (fullMethodDescription.GetFullName().Equals("RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod"))
                {
                    whenFullMethodMethodDescription = fullMethodDescription;
                }
                else if (fullMethodDescription.GetFullName().Equals("RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.SecondWhenMethod"))
                {
                    secondWhenFullMethodMethodDescription = fullMethodDescription;
                }
                else if (fullMethodDescription.GetFullName().Equals("RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.ThirdWhenMethod"))
                {
                    thirdWhenFullMethodMethodDescription = fullMethodDescription;
                }
            }

            Assert.AreEqual(
                ";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenStringParam.,stringPVS.Array.data[0]" +
                ";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.WhenMethod.whenIntParam.,intPVS.Array.data[0]",
                whenFullMethodMethodDescription.ParametersIndex,
                "The method BuildParametersLocation doesn't build the parametersIndex properly");
            Assert.AreEqual(";System.String,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.SecondWhenMethod.whenStringParam.,stringPVS.Array.data[1]", secondWhenFullMethodMethodDescription.ParametersIndex, "The method BuildParametersLocation doesn't build the parametersIndex properly");
            Assert.AreEqual(";System.Int32,RunnerEditorBusinessLogicParametersLocationsBuilderUTFirstDynamicBDDForTest.ThirdWhenMethod.whenIntParam.,intPVS.Array.data[1]", thirdWhenFullMethodMethodDescription.ParametersIndex, "The method BuildParametersLocation doesn't build the parametersIndex properly");
        }