コード例 #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>();
        }
コード例 #2
0
        public void ExceptionThrownWhenAmbiguousWhenMethodFound()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));

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

            action.ShouldThrow <AmbiguousTestMethodFoundException>();
        }
コード例 #3
0
        public void WhenMethodFoundForRegExPattern()
        {
            ScenarioWrapper scenarioWrapper = new ScenarioWrapper(typeof(MethodSearchTestsClass));

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

            action.ShouldNotThrow();
        }