Exemple #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));
 }
Exemple #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);
         }
     }
 }
Exemple #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);
        }
Exemple #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);
         }
     }
 }
Exemple #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);
                }
            }
        }
 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();
         }
     }
 }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
                    }
                }
            }
        }
Exemple #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);
        }
Exemple #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);
                    }
                }
            }
        }
 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();
             }
         }
     }
 }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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));
 }