Beispiel #1
0
        public void CheckForMethodNotFound_Should_ReturnTheExpectedListOfUnityTestBDDErrorObjects_Given_AListOfChosenMethodsAndADynamicComponentWithAllMethodsInTheList()
        {
            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.CheckForMethodNotFound <ThenBaseAttribute>(chosenMethods, components);

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

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

            Assert.AreEqual(1, result.Count, "The method CheckForMethodNotFound doesn't check properly");
            string expectedMessage = "Method ChosenMethodsCheckerTestFirstDynamicComponent.FakeSecondThenMethod not found on Then methods at position 2";

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