Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit be517f0

Browse files
AlexRadchstephentoub
authored andcommitted
Fixed netfx System.Diagnostics.TraceSource.Tests on non English Windows (#28154)
1 parent ccc6d32 commit be517f0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,16 @@ public void TraceTest01()
354354
[Fact]
355355
public void TraceTest02()
356356
{
357+
String newLine = Environment.NewLine;
357358
var textTL = new TestTextTraceListener();
359+
Trace.Listeners.Clear();
360+
Trace.Listeners.Add(textTL);
361+
Trace.IndentLevel = 0;
362+
Trace.Fail("");
363+
textTL.Flush();
364+
var fail = textTL.Output.TrimEnd(newLine.ToCharArray());
365+
366+
textTL = new TestTextTraceListener();
358367
// We have to clear the listeners list on Trace since there is a trace listener by default with AssertUiEnabled = true in Desktop and that will pop up an assert window with Trace.Fail
359368
Trace.Listeners.Clear();
360369
Trace.Listeners.Add(textTL);
@@ -377,8 +386,8 @@ public void TraceTest02()
377386
Trace.Unindent();
378387
Trace.WriteLine("Message end.");
379388
textTL.Flush();
380-
String newLine = Environment.NewLine;
381-
var expected = "Message start." + newLine + " This message should be indented.This should not be indented." + newLine + " Fail: This failure is reported with a detailed message" + newLine + " Fail: " + newLine + " Fail: This assert is reported" + newLine + "Message end." + newLine;
389+
newLine = Environment.NewLine;
390+
var expected = "Message start." + newLine + " This message should be indented.This should not be indented." + newLine + " " + fail + "This failure is reported with a detailed message" + newLine + " " + fail + newLine + " " + fail + "This assert is reported" + newLine + "Message end." + newLine;
382391
Assert.Equal(expected, textTL.Output);
383392
}
384393
}

src/System.Diagnostics.TraceSource/tests/TraceEventCacheClassTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void CallstackTest_NotEmpty()
6060
public void CallstackTest_ContainsExpectedFrames()
6161
{
6262
var cache = new TraceEventCache();
63-
Assert.Contains("at System.Environment.get_StackTrace()", cache.Callstack);
63+
Assert.Contains("System.Environment.get_StackTrace()", cache.Callstack);
6464
}
6565

6666
[Fact]

0 commit comments

Comments
 (0)