예제 #1
0
 public int GetIntFromStream(Stream stream)
 {
     Interlocked.Increment(ref s_getIntFromStreamCallbacks);
     // we don't know the stream size
     // If we care much about the buffer size it should go to IDuplexStreamingTestParams
     return(VerifiableStream.VerifyStream(stream, -1, 4096, _verifyContent));
 }
예제 #2
0
 private void TestGetStreamFromInt(StreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = channel.GetStreamFromInt(requestedStreamSize))
     {
         var receivedStreamSize = VerifiableStream.VerifyStream(stream, requestedStreamSize, bufSize, _params.VerifyStreamContent);
         if (receivedStreamSize != requestedStreamSize)
         {
             VerifiableStream.ReportIncorrectStreamSize(receivedStreamSize, requestedStreamSize);
         }
     }
 }
예제 #3
0
        public Stream GetStreamFromInt(int bytesToStream)
        {
            var stream = new VerifiableStream(bytesToStream);
            OperationContext clientContext = OperationContext.Current;

            clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)
            {
                stream.Dispose();
            });
            return(stream);
        }
예제 #4
0
 private async Task TestGetStreamFromIntAsync(StreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = await channel.GetStreamFromIntAsync(requestedStreamSize))
     {
         var receivedStreamSize = VerifiableStream.VerifyStream(stream, requestedStreamSize, bufSize);
         if (receivedStreamSize != requestedStreamSize)
         {
             VerifiableStream.ReportIncorrectStreamSize(receivedStreamSize, requestedStreamSize);
         }
     }
 }
예제 #5
0
        private void TestGetIntFromStream(StreamingService channel, int requestedStreamSize, int bufSize)
        {
            using (var stream = new VerifiableStream(requestedStreamSize))
            {
                int receivedSize = channel.GetIntFromStream(stream);

                if (receivedSize != requestedStreamSize)
                {
                    VerifiableStream.ReportIncorrectStreamSize(receivedSize, requestedStreamSize);
                }
            }
        }
예제 #6
0
 private void TestGetIntFromStream(IStreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = new VerifiableStream(requestedStreamSize))
     {
         int receivedSize = channel.GetIntFromStream(stream);
         if (receivedSize != requestedStreamSize)
         {
             Console.WriteLine("We didn't receive the correct stream size. Stream size: " + requestedStreamSize + "received: " + receivedSize);
             System.Diagnostics.Debugger.Break();
         }
     }
 }
예제 #7
0
        private static int TestGetIntFromStream(StreamingRequestContext <StreamingService> details)
        {
            details.TestScenario = StreamingScenarios.StreamOut;
            using (var stream = new VerifiableStream(details.StreamSize))
            {
                int receivedSize = details.Channel.GetIntFromStream(stream);

                if (receivedSize != details.StreamSize)
                {
                    VerifiableStream.ReportIncorrectStreamSize(receivedSize, details.StreamSize);
                }
            }
            return(1);
        }
예제 #8
0
        private static async Task <int> TestGetStreamFromIntAsync(StreamingRequestContext <StreamingService> details)
        {
            details.TestScenario = StreamingScenarios.StreamIn; // update the scenario
            using (var stream = await details.Channel.GetStreamFromIntAsync(details.StreamSize))
            {
                var receivedStreamSize = await VerifiableStream.VerifyStreamAsync(stream, details.StreamSize, details.BufferSize, details.VerifyStreamContent);

                if (receivedStreamSize != details.StreamSize)
                {
                    VerifiableStream.ReportIncorrectStreamSize(receivedStreamSize, details.StreamSize);
                }
            }
            return(1);
        }
예제 #9
0
        private async Task TestEchoStreamAsync(StreamingService channel, int requestedStreamSize, int bufSize)
        {
            using (var stream = new VerifiableStream(requestedStreamSize))
            {
                using (var receivedStream = await channel.EchoStreamAsync(stream))
                {
                    var receivedSize = await VerifiableStream.VerifyStreamAsync(receivedStream, requestedStreamSize, bufSize, _params.VerifyStreamContent);

                    if (receivedSize != requestedStreamSize)
                    {
                        VerifiableStream.ReportIncorrectStreamSize(receivedSize, requestedStreamSize);
                    }
                }
            }
        }
예제 #10
0
        private static int TestGetStreamFromInt(StreamingRequestContext <StreamingService> details)
        {
            details.TestScenario = StreamingScenarios.StreamIn;
            bool verifyStreamContent = details.VerifyStreamContent;

            using (var stream = details.Channel.GetStreamFromInt(details.StreamSize))
            {
                var receivedStreamSize = VerifiableStream.VerifyStream(stream, details.StreamSize, details.BufferSize, verifyStreamContent);
                if (receivedStreamSize != details.StreamSize)
                {
                    VerifiableStream.ReportIncorrectStreamSize(receivedStreamSize, details.StreamSize);
                }
            }
            return(1);
        }
예제 #11
0
        private void TestEchoStream(StreamingService channel, int requestedStreamSize, int bufSize)
        {
            using (var stream = new VerifiableStream(requestedStreamSize))
            {
                using (var receivedStream = channel.EchoStream(stream))
                {
                    var receivedSize = VerifiableStream.VerifyStream(receivedStream, requestedStreamSize, bufSize);

                    if (receivedSize != requestedStreamSize)
                    {
                        VerifiableStream.ReportIncorrectStreamSize(receivedSize, requestedStreamSize);
                    }
                }
            }
        }
예제 #12
0
 private void TestEchoStream(IStreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = new VerifiableStream(requestedStreamSize))
     {
         using (var receivedStream = channel.EchoStream(stream))
         {
             var receivedSize = VerifyStream(receivedStream, requestedStreamSize, bufSize);
             if (receivedSize != requestedStreamSize)
             {
                 Console.WriteLine("Unexpected stream size: " + receivedSize);
                 //if (requestedStreamSize % 384 != 0)
                 System.Diagnostics.Debugger.Break();
             }
         }
     }
 }
예제 #13
0
        private static int TestEchoStream(StreamingRequestContext <StreamingService> details)
        {
            details.TestScenario = StreamingScenarios.StreamEcho;
            using (var stream = new VerifiableStream(details.StreamSize))
            {
                using (var receivedStream = details.Channel.EchoStream(stream))
                {
                    var receivedSize = VerifiableStream.VerifyStream(receivedStream, details.StreamSize, details.BufferSize, details.VerifyStreamContent);

                    if (receivedSize != details.StreamSize)
                    {
                        VerifiableStream.ReportIncorrectStreamSize(receivedSize, details.StreamSize);
                    }
                }
            }
            return(1);
        }
예제 #14
0
        private static async Task <int> TestEchoStreamAsync(StreamingRequestContext <StreamingService> details)
        {
            details.TestScenario = StreamingScenarios.StreamEcho;
            using (var stream = new VerifiableStream(details.StreamSize))
            {
                details.StreamOut = stream;
                using (var receivedStream = await details.Channel.EchoStreamAsync(stream))
                {
                    details.StreamIn = receivedStream;
                    var receivedSize = await VerifiableStream.VerifyStreamAsync(receivedStream, details.StreamSize, details.BufferSize, details.VerifyStreamContent);

                    if (receivedSize != details.StreamSize)
                    {
                        VerifiableStream.ReportIncorrectStreamSize(receivedSize, details.StreamSize);
                    }
                }
            }
            return(1);
        }
예제 #15
0
 public int GetIntFromStream(Stream stream)
 {
     // we don't know the stream size
     // If we care much about the buffer size it should go to IDuplexStreamingTestParams
     return(VerifiableStream.VerifyStream(stream, -1, 4096));
 }