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 ExceptionThrownWhenAmbiguousWhenMethodFound()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));

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

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

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

            action.ShouldNotThrow();
        }