예제 #1
0
        public void CheckForComponentNotFound_Should_ReturnTheExpectedListOfUnityTestBDDErrorObjects_Given_AListOfChosenMethodsAndTheCorrespondingDynamicComponents()
        {
            Component component = UnitTestUtility.CreateComponent <ChosenMethodsCheckerTestFirstDynamicComponent>();

            Component[] components = new Component[1] {
                component
            };
            string[] chosenMethods = new string[2] {
                "ChosenMethodsCheckerTestFirstDynamicComponent.ThenMethod", "ChosenMethodsCheckerTestFirstDynamicComponent.SecondThenMethod"
            };
            ChosenMethodsChecker     checkForErrors = new ChosenMethodsChecker();
            List <UnityTestBDDError> result         = checkForErrors.CheckForComponentNotFound <ThenBaseAttribute>(chosenMethods, components);

            Assert.AreEqual(0, result.Count, "The method CheckForMethodNotFound doesn't check properly");
        }
예제 #2
0
        public void CheckForComponentNotFound_Should_ReturnTheExpectedListOfUnityTestBDDErrorObjects_Given_AListOfChosenMethodsWithoutACorrespondingDynamicComponent()
        {
            Component component = UnitTestUtility.CreateComponent <ChosenMethodsCheckerTestFirstDynamicComponent>();

            Component[] components = new Component[1] {
                component
            };
            string[] chosenMethods = new string[2] {
                "ChosenMethodsCheckerTestFirstDynamicComponentFake.ThenMethod", "ChosenMethodsCheckerTestFirstDynamicComponent.SecondThenMethod"
            };
            ChosenMethodsChecker     checkForErrors = new ChosenMethodsChecker();
            List <UnityTestBDDError> result         = checkForErrors.CheckForComponentNotFound <ThenBaseAttribute>(chosenMethods, components);
            string expectedMessage = "The component for the method ChosenMethodsCheckerTestFirstDynamicComponentFake.ThenMethod is not found  in Then methods at position 1";

            Assert.AreEqual(expectedMessage, result[0].Message, "The method CheckForComponentNotFound doesn't resturn the right message");
            Assert.IsNull(result[0].Component, "The method CheckForComponentNotFound doesn't resturn the right Component");
            Assert.IsNull(result[0].MethodMethodInfo, "The method CheckForComponentNotFound doesn't resturn the right MethodInfo");
            Assert.AreEqual(typeof(ThenBaseAttribute), result[0].StepType, "The method CheckForComponentNotFound doesn't resturn the right StepType");
            Assert.AreEqual(0, result[0].Index, "The method CheckForComponentNotFound doesn't resturn the right method index");
        }