public void ValidateSizeNoThrow(int count) { // 10 bytes = 80 bits reader.Reset(new byte[10]); Assert.DoesNotThrow(() => { CollectionExtensions.ValidateSize(reader, count); }); }
public void ValidateSizeThrows(int count) { // 10 bytes = 80 bits reader.Reset(new byte[10]); var e = Assert.Throws <EndOfStreamException>(() => { CollectionExtensions.ValidateSize(reader, count); }); Assert.That(e.Message, Is.EqualTo($"Can't read {count} elements because it would read past the end of the stream.")); }