Beispiel #1
0
        /// <summary>
        /// Runs a test cycle.
        /// </summary>
        /// <param name="businessLogic">The business logic.</param>
        /// <param name="methodsDescription">The methods description.</param>
        /// <param name="indexToRun">The index to run.</param>
        /// <returns>The index of the next method to run.</returns>
        public int RunCycle(ExtensionRunnerBusinessLogic businessLogic, List <FullMethodDescription> methodsDescription, int indexToRun)
        {
            int runningIndex = indexToRun;

            if (runningIndex == -1)
            {
                runningIndex++;
                businessLogic.StartDelayTime = businessLogic.DateTimeNow();
            }

            if (runningIndex < methodsDescription.Count)
            {
                bool performed = businessLogic.InvokeMethod(businessLogic, methodsDescription[runningIndex], businessLogic.IntegrationTestGameObject);
                if (performed)
                {
                    runningIndex++;
                    businessLogic.StartDelayTime = businessLogic.DateTimeNow();
                }
            }
            else
            {
                businessLogic.InvokeAssertionSuccessful(businessLogic.IntegrationTestGameObject);
            }

            return(runningIndex);
        }
        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");
        }
        public void RunCycle_ShouldPerFormTheExpectedCalls_Given_ItIsInvokedAfterTheLastMethodInTheList()
        {
            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);

            ExtensionRunnerBusinessLogicTestFirstStaticComponent component = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestFirstStaticComponent>();

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

            List <FullMethodDescription> methodsDescription = businessLogic.GetAllMethodsDescriptions(components, null, null, null, null, null, null);

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

            mockedBusinessLogic.InvokeMethod(businessLogic, methodsDescription[0], gameObject).Returns <bool>(true);

            int indexToRun = 8;

            businessLogic.RunCycle(mockedBusinessLogic, methodsDescription, indexToRun);
            Received.InOrder(() =>
            {
                businessLogic.InvokeAssertionSuccessful(gameObject);
            });
        }
        public void GetAllMethodsDescriptions_Should_ReturnTheExpectedListOfFullMethodDescriptionObjects_Given_AStaticComponentWithNestedCallBeforeAttributes()
        {
            ExtensionRunnerBusinessLogicTestFirstStaticComponent component = UnitTestUtility.CreateComponent <ExtensionRunnerBusinessLogicTestFirstStaticComponent>();

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

            GameObject gameObject = UnitTestUtility.CreateGameObject();

            ExtensionRunnerBusinessLogic businessLogic = new ExtensionRunnerBusinessLogic(gameObject);
            List <FullMethodDescription> resultList    = businessLogic.GetAllMethodsDescriptions(components, null, null, null, null, null, null);

            string expecetdMethod1 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.GivenMethod";
            string expecetdMethod5 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.WhenMethod";

            string expecetdMethod6 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.SecondGivenMethod";
            string expecetdMethod7 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.ThenMethod";
            string expecetdMethod8 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.SecondGivenMethod";
            string expecetdMethod9 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.SecondThenMethod";

            string expecetdMethod10 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.SecondGivenMethod";
            string expecetdMethod11 = "ExtensionRunnerBusinessLogicTestFirstStaticComponent.ThenMethod";

            Assert.AreEqual(8, resultList.Count, "The method GetAllMethodsDescriptions doesn't return the right number of methods.");
            Assert.AreEqual(expecetdMethod1, resultList[0].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod5, resultList[1].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod6, resultList[2].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod7, resultList[3].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod8, resultList[4].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod9, resultList[5].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod10, resultList[6].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod11, resultList[7].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
        }
        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");
        }
        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");
        }
        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 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");
        }
        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");
        }
Beispiel #10
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);
        }
        public void GetAllMethodsDescriptions_Should_ReturnTheExpectedListOfFullMethodDescriptionObjects_Given_ACompleteListOfGivenWhenThenChosenMethodsWithNestedCallBeforeAttributesForDynamicComponents()
        {
            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> resultList    = businessLogic.GetAllMethodsDescriptions(components, givenMethods, givenParameters, whenMethods, whenParameters, thenMethods, thenParameters);

            string expecetdMethod1 = "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.GivenMethod";
            string expecetdMethod2 = "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod";
            string expecetdMethod3 = "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.GivenMethod";
            string expecetdMethod4 = "ExtensionRunnerBusinessLogicTestFirstDynamicComponent.WhenMethod";
            string expecetdMethod5 = "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.WhenMethod";

            string expecetdMethod6 = "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod";
            string expecetdMethod7 = "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.ThenMethod";
            string expecetdMethod8 = "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondGivenMethod";
            string expecetdMethod9 = "ExtensionRunnerBusinessLogicTestThirdDynamicComponent.SecondThenMethod";

            string expecetdMethod10 = "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.SecondGivenMethod";
            string expecetdMethod11 = "ExtensionRunnerBusinessLogicTestSecondDynamicComponent.ThenMethod";

            Assert.AreEqual(11, resultList.Count, "The method GetAllMethodsDescriptions doesn't return the right number of methods.");
            Assert.AreEqual(expecetdMethod1, resultList[0].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod2, resultList[1].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod3, resultList[2].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod4, resultList[3].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod5, resultList[4].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod6, resultList[5].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod7, resultList[6].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod8, resultList[7].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod9, resultList[8].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod10, resultList[9].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
            Assert.AreEqual(expecetdMethod11, resultList[10].GetFullName(), "The method GetAllMethodsDescriptions doesn't return the right methods order.");
        }