Exemplo n.º 1
0
        public void ExceptionThrownIfMethodNotFound()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));

            Action action = () =>
            {
                scenarioWrapper.Given("NonExistingGivenMethod");
            };

            action.ShouldThrow <TestMethodNotFoundException>();

            action = () =>
            {
                scenarioWrapper.When("NonExistingWhenMethod");
            };

            action.ShouldThrow <TestMethodNotFoundException>();

            action = () =>
            {
                scenarioWrapper.Then("NonExistingThenMethod");
            };

            action.ShouldThrow <TestMethodNotFoundException>();
        }
Exemplo n.º 2
0
        public void ExceptionThrownWhenAmbiguousThenMethodFound()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));

            Action action = () =>
            {
                scenarioWrapper.Then("ThenStaticMethodSearchTestsClassDuplicate");
            };

            action.ShouldThrow <AmbiguousTestMethodFoundException>();
        }
Exemplo n.º 3
0
        public void ThenMethodFoundForRegExPattern()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));


            Action action = () =>
            {
                scenarioWrapper.Then("ThenStaticMethodSearchTestsClass");
            };

            action.ShouldNotThrow();
        }