Exemplo n.º 1
0
        public void If_CmdParser_throws_a_UnclosedQuotationMarkException_its_message_should_be_displayed()
        {
            var ex = new UnclosedQuotationMarkException("", '"', 0, 0);

            A.CallTo(() => Fake<IBuildEnvironment>().CommandLineArgumentString).Returns("cmdLine");
            A.CallTo(() => Fake<ICmdParser>().Parse("cmdLine")).Throws(() => ex);

            Assert.Throws<UnclosedQuotationMarkException>(() => CreateInstance<CommandLine>().ParseArguments());

            A.CallTo(() => Fake<IOutput>().WriteErrorLine(A<string>.That.Matches(y => y.Contains(ex.Message)), false)).MustHaveHappened();
        }
Exemplo n.º 2
0
 private void ShowUnclosedQuotationMarkException(UnclosedQuotationMarkException ex)
 {
     _output.WriteError("Could not parse command line arguments. ");
     _output.WriteErrorLine(ex.Message);
     WriteSplittedParts(GetCmdLineInParts(ex.ExpectedEndIndex, 1));
 }