Esempio n. 1
0
        public void ReadUnknownKey()
        {
            var testStream = MakeTestStream();
            var reader     = new ResourceReaderStream(testStream, "unknown");
            var buffer     = new byte[10];
            int read       = reader.Read(buffer, 0, 10);

            Assert.AreEqual(0, read);
        }
        private List <byte> Read(string key, TestStream stream)
        {
            var reader = new ResourceReaderStream(stream, key);
            var buffer = new byte[100];
            var result = new List <byte>();

            while (true)
            {
                var count = reader.Read(buffer, 0, 100);
                if (count == 0)
                {
                    break;
                }
                result.AddRange(buffer.Take(count));
            }

            return(result);
        }
        void Read(string key, TestStream stream)
        {
            var reader = new ResourceReaderStream(stream, key);
            var buffer = new byte[100];
            var result = new List <byte>();

            while (true)
            {
                var count = reader.Read(buffer, 0, 100);
                if (count == 0)
                {
                    break;
                }
                result.AddRange(buffer.Take(count));
            }
            var str = Encoding.ASCII.GetString(result.ToArray());

            Assert.AreEqual(data[key], str);
        }