csf-dev / CSF.Screenplay

Implementation of the Screenplay pattern (aka Journey) in .NET
https://csf-dev.github.io/CSF.Screenplay/
MIT License
13 stars 1 forks source link

Newline error in unit test on Windows #97

Closed craigfowler closed 7 years ago

craigfowler commented 7 years ago

There is a newline error in one of the unit tests, present on Windows.

1) Failed : CSF.Screenplay.Reporting.Tests.TextReportWriterTests.Reported_exceptions_should_not_be_duplicated_up_the_reporting_chain(Mock<CSF.Screenplay.Actors.IActor:699f>.Object,Mock<CSF.Screenplay.Performables.IPerformable:82fc>.Object,Mock<CSF.Screenplay.Performables.IPerformable:96b7>.Object,"id0f181e74-ec19-4429-9e3a-ad528ef07a0b","name3996d0d2-bb47-4aca-ac76-f4ad88314487","featuref8971692-8b00-4ce0-900e-e1a1a4d04860",System.Exception: Exception of type 'System.Exception' was thrown.)

Expected string length 295 but was 294. Strings differ at index 225.

Expected: "... FAILED with an exception:\r\nSystem.Exception: Exceptio..."

But was: "... FAILED with an exception:\nSystem.Exception: Exception..."

---------------------------------------------^

at CSF.Screenplay.Reporting.Tests.TextReportWriterTests.Reported_exceptions_should_not_be_duplicated_up_the_reporting_chain(IActor actor, IPerformable performable, IPerformable childPerformable, String id, String name, String feature, Exception error) in C:\projects\csf-screenplay\Tests\CSF.Screenplay.Reporting.Tests\TextReportWriterTests.cs:line 161
craigfowler commented 7 years ago

The error is here, in the code of the text report writer:

if(exception != null)
  writer.WriteLine("FAILED with an exception:\n{0}", exception);
else
  writer.WriteLine("FAILED");

There is an explicit \n in there. Instead it should use Environment.NewLine.