예제 #1
0
        public void Throws_MissingArgumentCraneException_when_required_parameter_not_given(CommandArgParser commandArgParser, Exception result)
        {
            "Given I have a commandArgParser"
            ._(() => commandArgParser = new CommandArgParser());

            "When I dont pass in the Bar parameter"
            ._(() => result = Throws.Exception(() => commandArgParser.Parse(typeof(FooCommand), "FooCommand")));

            "Then a MissingArgumentCraneException is thrown"
            ._(() => result.Should().BeOfType <MissingArgumentCraneException>());
        }
        public void Resolves_throws_a_no_solutions_found_exception_when_no_solutions_found(Exception result, string path, SolutionPathResolver solutionPathResolver)
        {
            "Given I have a path to a project where there are no solutions"
            ._(() =>
            {
                solutionPathResolver = new SolutionPathResolver();
                path = "TestProjects/NoSolutions";
            });

            "When I resolve the path relative to the build folder"
            ._(() => result = Throws.Exception(() => solutionPathResolver.GetPathRelativeFromBuildFolder(path)));

            "Then a NoSolutionsFoundCraneException should be thrown"
            ._(() => result.Should().BeOfType <NoSolutionsFoundCraneException>());
        }
예제 #3
0
        public void Throws_exception_detailing_missing_argument_when_all_arguments_not_passed(
            ICommandFactory commandFactory,
            CraneException craneException)
        {
            "Given I have a command factory"
            ._(() => commandFactory = ServiceLocator.Resolve <ICommandFactory>());

            "When I create a command with based on the arguments 'init'"
            ._(() => craneException = Throws.Exception(() => commandFactory.Create("init")) as CraneException);

            "Then a missing argument exception should be thrown"
            ._(() => craneException.Should().BeOfType <MissingArgumentCraneException>());

            "And the message should contain -projectName"
            ._(() => craneException.Message.Should().Contain("ProjectName"));
        }
예제 #4
0
        public void Throws_unknown_command_exception_if_none_match(CommandResolver commandResolver, List <ICraneCommand> commands, Exception result)
        {
            "Given I have the commands init and help"
            ._(() =>
            {
                commandResolver = new CommandResolver();
                commands        = new List <ICraneCommand> {
                    B.AutoMock <Help>().Subject, B.AutoMock <Init>().Subject
                };
            });

            "When I resolve the command bob"
            ._(() => result = Throws.Exception(() => commandResolver.Resolve(commands, "bob")));

            "Then an UnknownCommandCraneException is thrown"
            ._(() => result.Should().BeOfType <UnknownCommandCraneException>());

            "And the exception message should detail the command passed in"
            ._(() => result.Message.Should().Contain("bob"));
        }
예제 #5
0
 public void NonExistingView_Test()
 {
     Assert.That(() => ProcessViewInEngine(@"simple\nonexistingview"), Throws.Exception <MonoRailException>(Has.Property("Message").Contains("Missing or invalid view")));
 }