Exemple #1
0
 public void Read_1_1_1()
 {
     using (var stream = new MemoryStream(BitOperation.ParseToBytes("01101101 10000000"))) {
         using (var reader = new FibonacciUnsignedReader(stream)) {
             Assert.AreEqual((ulong)1, reader.Read());
             Assert.AreEqual((ulong)1, reader.Read());
             Assert.AreEqual((ulong)1, reader.Read());
         }
     }
 }
        public void WriteRead_First1000_Appending()
        {
            ulong min = 0;
            ulong max = 1000;

            using (var stream = new MemoryStream()) {
                using (var writer = new FibonacciUnsignedWriter(stream)) {
                    for (var i = min; i < max; i++)
                    {
                        writer.Write(i);
                    }
                }
                stream.Position = 0;
                using (var reader = new FibonacciUnsignedReader(stream)) {
                    for (var i = min; i < max; i++)
                    {
                        Assert.AreEqual(i, reader.Read());
                    }
                }
            }
        }