未验证 提交 c81fd0e1 编写于 作者: J Jared Parsons 提交者: Jared Parsons

Use exception in CappedStringWriter

The use of `Assert.True` is problematic here as it's throwing an xunit
defined exception. In this case `TrueException`. This is problematic
because it's not serializable yet it is callable from within our
isolated test `AppDomain` instances.

In this case we should just be throwing an exception directly here.
上级 14d7fc5c
......@@ -33,7 +33,7 @@ public CappedStringWriter(int expectedLength)
private void CapReached()
{
Assert.True(false, "Test produced more output than expected (" + _expectedLength + " characters). Is it in an infinite loop? Output so far:\r\n" + GetStringBuilder());
throw new Exception($"Test produced more output than expected ({_expectedLength} characters). Is it in an infinite loop? Output so far:\r\n{GetStringBuilder()}");
}
public override void Write(char value)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册