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