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