Use fluent helper for line-end normalization

This commit is contained in:
Nick Guerrera 2017-06-19 11:54:42 -07:00
parent 11967b7d9c
commit 62c3798679

View file

@ -61,13 +61,10 @@ namespace Microsoft.DotNet.Tests
[Fact] [Fact]
public void ItShowsTheAppropriateMessageToTheUser() public void ItShowsTheAppropriateMessageToTheUser()
{ {
string firstTimeUseWelcomeMessage = NormalizeLineEndings(Configurer.LocalizableStrings.FirstTimeWelcomeMessage); _firstDotnetVerbUseCommandResult.StdOut
// normalizing line endings as what is used in the resources may .Should()
// does not necessarily match how the command stdout capturing logic .ContainVisuallySameFragment(Configurer.LocalizableStrings.FirstTimeWelcomeMessage)
// handles newlines. .And.NotContain("Restore completed in");
NormalizeLineEndings(_firstDotnetVerbUseCommandResult.StdOut)
.Should().Contain(firstTimeUseWelcomeMessage)
.And.NotContain("Restore completed in");
} }
[Fact] [Fact]
@ -112,10 +109,5 @@ namespace Microsoft.DotNet.Tests
return new DotnetCommand().ExecuteWithCapturedOutput("--version").StdOut return new DotnetCommand().ExecuteWithCapturedOutput("--version").StdOut
.TrimEnd(Environment.NewLine.ToCharArray()); .TrimEnd(Environment.NewLine.ToCharArray());
} }
private static string NormalizeLineEndings(string s)
{
return s.Replace("\r\n", "\n").Replace("\r", "\n");
}
} }
} }