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