使用FluentAssertion 3.1.229,你如何比較兩個不同的MemoryStream
的內容?如何比較兩個MemoryStream與FluentAssertions
寫作actualStream.Should().Be(expectedStream);
產生以下錯誤:
System.IO.MemoryStream
{
CanRead = True
CanSeek = True
CanTimeout = False
CanWrite = True
Capacity = 8
Length = 8
Position = 0
ReadTimeout = "[Property 'ReadTimeout' threw an exception: 'Exception has been thrown by the target of an invocation.']"
WriteTimeout = "[Property 'WriteTimeout' threw an exception: 'Exception has been thrown by the target of an invocation.']"
}, but found
System.IO.MemoryStream
{
CanRead = True
CanSeek = True
CanTimeout = False
CanWrite = True
Capacity = 8
Length = 8
Position = 0
ReadTimeout = "[Property 'ReadTimeout' threw an exception: 'Exception has been thrown by the target of an invocation.']"
WriteTimeout = "[Property 'WriteTimeout' threw an exception: 'Exception has been thrown by the target of an invocation.']"
}.
是的,我可以使用NUnit Assert.That(actualStream, Is.EqualTo(expectedStream));
但有可能與FluentAssertions?
謝謝。
.Be()在byte []上不可用(無論如何版本爲3.1.229)。但通過Equal(),它可以工作。 – dstj 2014-09-04 14:14:29