예제 #1
0
 public void ValidateSizeNoThrow(int count)
 {
     // 10 bytes = 80 bits
     reader.Reset(new byte[10]);
     Assert.DoesNotThrow(() =>
     {
         CollectionExtensions.ValidateSize(reader, count);
     });
 }
예제 #2
0
        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."));
        }