Adding pre/post publish scripts

Fixes #742
This commit is contained in:
moozzyk 2016-01-11 13:40:47 -08:00
parent 02827620f8
commit 0e4719ee95
8 changed files with 94 additions and 27 deletions

View file

@ -1,13 +1,11 @@
// 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 System;
using System.Text.RegularExpressions;
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.DotNet.Cli.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
@ -28,7 +26,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
}
public AndConstraint<CommandResultAssertions> Pass()
{
{
Execute.Assertion.ForCondition(_commandResult.ExitCode == 0)
.FailWith("Expected command to pass but it exited with {0}.", _commandResult.ExitCode);
return new AndConstraint<CommandResultAssertions>(this);
@ -42,7 +40,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
}
public AndConstraint<CommandResultAssertions> HaveStdOut()
{
{
Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdOut))
.FailWith("Command did not output anything to stdout");
return new AndConstraint<CommandResultAssertions>(this);
@ -55,6 +53,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return new AndConstraint<CommandResultAssertions>(this);
}
public AndConstraint<CommandResultAssertions> StdOutMatchPattern(string pattern, RegexOptions options = RegexOptions.None)
{
Execute.Assertion.ForCondition(Regex.Match(_commandResult.StdOut, pattern, options).Success)
.FailWith($"Matching the command output failed. Pattern: {pattern}{Environment.NewLine} input: {_commandResult.StdOut}");
return new AndConstraint<CommandResultAssertions>(this);
}
public AndConstraint<CommandResultAssertions> HaveStdErr()
{
Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdErr))