コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
 protected override string PrintRequestDetails(StreamingRequestContext <StreamingService> requestDetails)
 {
     return(base.PrintRequestDetails(requestDetails) +
            String.Format(", TestScenario {0}, StreamSize {1}", requestDetails.TestScenario, requestDetails.StreamSize));
 }
コード例 #7
0
 protected override string PrintRequestDetails(StreamingRequestContext <StreamingService> requestDetails)
 {
     return(base.PrintRequestDetails(requestDetails) +
            String.Format(", TestScenario {0}, StreamSize {1}, StreamInPosition {2}, StreamOutPosition {3}", requestDetails.TestScenario, requestDetails.StreamSize, requestDetails.StreamIn?.Position, requestDetails.StreamOut?.Position));
 }