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");
        }
        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.");
        }