display CommandParsingException gracefully (#5493)

* display CommandParsing gracefully

This set of changes handles CommandParsingException gracefuly (so as not to show the user a stack trace) and generalizes graceful exception display somewhat away from being type-specific.

* fix compile error by inlining constant

* remove unused test logging
This commit is contained in:
Jon Sequeira 2017-01-30 14:36:44 -08:00 committed by Piotr Puszkiewicz
parent 5aded80a7b
commit e8c5d23c29
8 changed files with 42 additions and 13 deletions

View file

@ -0,0 +1,26 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.New.Tests
{
public class NewCommandTests
{
[Fact]
public void WhenSwitchIsSkippedThenItPrintsError()
{
var cmd = new DotnetCommand().Execute("new Web1.1");
cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().Be("Unrecognized command or argument 'Web1.1'");
cmd.StdOut.Should().Be("Specify --help for a list of available options and commands.");
}
}
}