コード例 #1
0
            public When_reading_from_a_stream_containing_multiple_data_tables_with_big_buffer()
            {
                var testData = new DataSet
                {
                    Tables =
                    {
                        TestData.GenerateRandomDataTable(10,  50),
                        TestData.GenerateRandomDataTable(5,  100),
                        TestData.GenerateRandomDataTable(20, 10000)
                    }
                };

                using (var r = testData.CreateDataReader())
                    using (var memoryStream = new MemoryStream())
                    {
                        DataSerializer.Serialize(memoryStream, r);
                        this.expectedBytes = memoryStream.GetTrimmedBuffer();
                    }

                this.reader = testData.CreateDataReader();
                using (var stream = new ProtoDataStream(this.reader, 50 * 1024 * 1024)) // 50 Mb buffer which
                    using (var memoryStream = new MemoryStream())
                    {
                        stream.CopyTo(memoryStream);
                        this.actualBytes = memoryStream.GetTrimmedBuffer();
                    }
            }
コード例 #2
0
            public void SetUp()
            {
                var testData = new DataSet
                {
                    Tables =
                    {
                        TestData.GenerateRandomDataTable(10,  50),
                        TestData.GenerateRandomDataTable(5,  100),
                        TestData.GenerateRandomDataTable(20, 10000)
                    }
                };

                using (var r = testData.CreateDataReader())
                    using (var memoryStream = new MemoryStream())
                    {
                        DataSerializer.Serialize(memoryStream, r);
                        expectedBytes = memoryStream.GetTrimmedBuffer();
                    }

                reader = testData.CreateDataReader();
                using (var stream = new ProtoDataStream(reader))
                    using (var memoryStream = new MemoryStream())
                    {
                        stream.CopyTo(memoryStream);
                        actualBytes = memoryStream.GetTrimmedBuffer();
                    }
            }
コード例 #3
0
            public When_reading_from_a_stream_with_varying_buffer_sizes()
            {
                this.testData = TestData.GenerateRandomDataTable(10, 10000);

                using (var reader = this.testData.CreateDataReader())
                    using (var memoryStream = new MemoryStream())
                    {
                        DataSerializer.Serialize(memoryStream, reader);
                        this.expectedBytes = memoryStream.GetTrimmedBuffer();
                    }
            }
コード例 #4
0
            public void SetUp()
            {
                testData = TestData.GenerateRandomDataTable(10, 10000);

                using (var reader = testData.CreateDataReader())
                    using (var memoryStream = new MemoryStream())
                    {
                        DataSerializer.Serialize(memoryStream, reader);
                        expectedBytes = memoryStream.GetTrimmedBuffer();
                    }
            }
コード例 #5
0
            public When_disposing_the_read_before_all_the_data_has_been_read()
            {
                var testData = TestData.GenerateRandomDataTable(10, 10000);

                this.reader = testData.CreateDataReader();
                this.stream = new ProtoDataStream(this.reader);

                var buffer = new byte[512];

                this.stream.Read(buffer, 0, buffer.Length);
                this.stream.Read(buffer, 0, buffer.Length);
                this.stream.Read(buffer, 0, buffer.Length);

                this.stream.Dispose();
            }
コード例 #6
0
            public void SetUp()
            {
                var testData = TestData.GenerateRandomDataTable(10, 10000);

                reader = testData.CreateDataReader();
                stream = new ProtoDataStream(reader);

                var buffer = new byte[512];

                stream.Read(buffer, 0, buffer.Length);
                stream.Read(buffer, 0, buffer.Length);
                stream.Read(buffer, 0, buffer.Length);

                stream.Dispose();
            }
コード例 #7
0
            public When_reading_from_a_stream()
            {
                var testData = TestData.GenerateRandomDataTable(10, 10000);

                using (var r = testData.CreateDataReader())
                    using (var memoryStream = new MemoryStream())
                    {
                        DataSerializer.Serialize(memoryStream, r);
                        this.expectedBytes = memoryStream.GetTrimmedBuffer();
                    }

                this.reader = testData.CreateDataReader();
                using (var stream = new ProtoDataStream(this.reader))
                    using (var memoryStream = new MemoryStream())
                    {
                        stream.CopyTo(memoryStream);
                        this.actualBytes = memoryStream.GetTrimmedBuffer();
                    }
            }