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