Ejemplo n.º 1
0
        public void CheckForNotMatchingParametersIndex_Should_ReturnTheExpectedListOfUnityTestBDDErrorObjects_Given_TheParametersIndexesAndTheDynamicComponentWithTheCorrespondingMethodsButWithAParameterWithDifferentType()
        {
            Component component = UnitTestUtility.CreateComponent <ChosenMethodsCheckerTestFirstDynamicComponent>();

            Component[] components = new Component[1] {
                component
            };
            MethodInfo methodInfo = component.GetType().GetMethod("GivenMethod");

            string[] chosenMethods = new string[1] {
                "ChosenMethodsCheckerTestFirstDynamicComponent.GivenMethod"
            };
            string[] parametersIndexes = new string[1] {
                ";System.Int32,ChosenMethodsCheckerTestFirstDynamicComponent.GivenMethod.stringParam.,intPVS.Array.data[0];"
            };
            ChosenMethodsChecker     checkForErrors = new ChosenMethodsChecker();
            List <UnityTestBDDError> result         = checkForErrors.CheckForNotMatchingParametersIndex <GivenBaseAttribute>(chosenMethods, parametersIndexes, components);
            string expectedMessage = "The parameter ChosenMethodsCheckerTestFirstDynamicComponent.GivenMethod.stringParam has a wrong type in Given methods at position 1.\n Previous type: System.Int32\n Current type System.String";

            Assert.AreEqual(expectedMessage, result[0].Message, "The method CheckForNotMatchingParametersIndex doesn't resturn the right message");
            Assert.That(component.Equals(result[0].Component), "The method CheckForNotMatchingParametersIndex doesn't resturn the right Component");
            Assert.That(methodInfo.Equals(result[0].MethodMethodInfo), "The method CheckForNotMatchingParametersIndex doesn't resturn the right MethodInfo");
            Assert.AreEqual(typeof(GivenBaseAttribute), result[0].StepType, "The method CheckForNotMatchingParametersIndex doesn't resturn the right StepType");
            Assert.AreEqual(0, result[0].Index, "The method CheckForNotMatchingParametersIndex doesn't resturn the right method index");
        }
Ejemplo n.º 2
0
        public void CheckForNotMatchingParametersIndex_Should_ReturnTheExpectedListOfUnityTestBDDErrorObjects_Given_TheParametersIndexesAndTheDynamicComponentWithTheCorrespondingMethodsAndParameters()
        {
            Component component = UnitTestUtility.CreateComponent <ChosenMethodsCheckerTestFirstDynamicComponent>();

            Component[] components = new Component[1] {
                component
            };
            string[] chosenMethods = new string[1] {
                "ChosenMethodsCheckerTestFirstDynamicComponent.GivenMethod"
            };
            string[] parametersIndex = new string[1] {
                ";System.String,ChosenMethodsCheckerTestFirstDynamicComponent.GivenMethod.stringParam.,stringPVS.Array.data[0];"
            };
            ChosenMethodsChecker     checkForErrors = new ChosenMethodsChecker();
            List <UnityTestBDDError> result         = checkForErrors.CheckForNotMatchingParametersIndex <GivenBaseAttribute>(chosenMethods, parametersIndex, components);

            Assert.AreEqual(0, result.Count, "The method CheckForNotMatchingParametersIndex doesn't check properly");
        }