public static StreamInstrumentationParameters GetParameters(TestContext ctx, ConnectionTestCategory category,
                                                                    StreamInstrumentationType type)
        {
            var certificateProvider = DependencyInjector.Get <ICertificateProvider> ();
            var acceptAll           = certificateProvider.AcceptAll();
            var effectiveType       = type == StreamInstrumentationType.MartinTest ? MartinTest : type;

            var name = GetTestName(category, type);

            var parameters = new StreamInstrumentationParameters(category, type, name, ResourceManager.SelfSignedServerCertificate)
            {
                ClientCertificateValidator = acceptAll
            };

            switch (effectiveType)
            {
            case StreamInstrumentationType.ServerRequestsShutdown:
            case StreamInstrumentationType.ServerRequestsShutdownDuringWrite:
                parameters.SslStreamFlags |= SslStreamFlags.CleanShutdown;
                break;
            }

            if (category == ConnectionTestCategory.SslStreamInstrumentationShutdown)
            {
                parameters.SslStreamFlags = SslStreamFlags.CleanShutdown;
            }

            return(parameters);
        }
        static InstrumentationFlags GetFlags(StreamInstrumentationType type)
        {
            switch (type)
            {
            case StreamInstrumentationType.ClientHandshake:
            case StreamInstrumentationType.ReadDuringClientAuth:
            case StreamInstrumentationType.ShortReadDuringClientAuth:
                return(InstrumentationFlags.ClientInstrumentation | InstrumentationFlags.ClientStream);

            case StreamInstrumentationType.CloseBeforeClientAuth:
            case StreamInstrumentationType.CloseDuringClientAuth:
            case StreamInstrumentationType.DisposeDuringClientAuth:
            case StreamInstrumentationType.InvalidDataDuringClientAuth:
                return(InstrumentationFlags.ClientInstrumentation | InstrumentationFlags.ServerInstrumentation |
                       InstrumentationFlags.ClientHandshake | InstrumentationFlags.SkipMainLoop |
                       InstrumentationFlags.ServerHandshake | InstrumentationFlags.ServerHandshakeFails |
                       InstrumentationFlags.ClientHandshakeFails);

            case StreamInstrumentationType.ShortReadAndClose:
                return(InstrumentationFlags.ClientShutdown | InstrumentationFlags.ServerShutdown);

            case StreamInstrumentationType.RemoteClosesConnectionDuringRead:
                return(InstrumentationFlags.ClientShutdown | InstrumentationFlags.ServerShutdown);

            case StreamInstrumentationType.CleanShutdown:
            case StreamInstrumentationType.DoubleShutdown:
            case StreamInstrumentationType.WriteAfterShutdown:
            case StreamInstrumentationType.ReadAfterShutdown:
            case StreamInstrumentationType.WaitForShutdown:
                return(InstrumentationFlags.ClientShutdown | InstrumentationFlags.ServerShutdown);

            case StreamInstrumentationType.ConnectionReuse:
            case StreamInstrumentationType.ConnectionReuseWithShutdown:
                return(InstrumentationFlags.ClientShutdown | InstrumentationFlags.ServerShutdown |
                       InstrumentationFlags.ReuseClientSocket | InstrumentationFlags.ReuseServerSocket);

            case StreamInstrumentationType.Flush:
            case StreamInstrumentationType.WriteDoesNotFlush:
            case StreamInstrumentationType.FlushAfterDispose:
            case StreamInstrumentationType.DisposeClosesInnerStream:
            case StreamInstrumentationType.PropertiesAfterDispose:
                return(InstrumentationFlags.ClientInstrumentation | InstrumentationFlags.SkipMainLoop |
                       InstrumentationFlags.SkipShutdown);

            case StreamInstrumentationType.ServerRequestsShutdown:
            case StreamInstrumentationType.ServerRequestsShutdownDuringWrite:
                return(InstrumentationFlags.ClientInstrumentation | InstrumentationFlags.SkipMainLoop |
                       InstrumentationFlags.SkipShutdown);

            case StreamInstrumentationType.VerifyAsyncStreamCalls:
                return(InstrumentationFlags.ClientStream);

            default:
                throw new InternalErrorException();
            }
        }
Exemple #3
0
        static string GetTestName(ConnectionTestCategory category, StreamInstrumentationType type, params object[] args)
        {
            var sb = new StringBuilder();

            sb.Append(type);
            foreach (var arg in args)
            {
                sb.AppendFormat(":{0}", arg);
            }
            return(sb.ToString());
        }
Exemple #4
0
        public static StreamInstrumentationParameters GetParameters(TestContext ctx, ConnectionTestCategory category,
                                                                    StreamInstrumentationType type)
        {
            var certificateProvider = DependencyInjector.Get <ICertificateProvider> ();
            var acceptAll           = certificateProvider.AcceptAll();

            var name = GetTestName(category, type);

            return(new StreamInstrumentationParameters(category, type, name, ResourceManager.SelfSignedServerCertificate)
            {
                ClientCertificateValidator = acceptAll
            });
        }
        static string GetTestName(ConnectionTestCategory category, StreamInstrumentationType type, params object[] args)
        {
            var sb = new StringBuilder();

            sb.Append(type);
            if (type == StreamInstrumentationType.MartinTest)
            {
                sb.Append($"({MartinTest})");
            }
            foreach (var arg in args)
            {
                sb.Append($":{arg}");
            }
            return(sb.ToString());
        }
 public StreamInstrumentationParametersAttribute(StreamInstrumentationType type)
     : base(null, TestFlags.Browsable | TestFlags.ContinueOnError)
 {
     Type = type;
 }
 protected StreamInstrumentationParameters(StreamInstrumentationParameters other)
     : base(other)
 {
     Type = other.Type;
 }
 public StreamInstrumentationParameters(ConnectionTestCategory category, StreamInstrumentationType type,
                                        string identifier, X509Certificate certificate)
     : base(category, identifier, certificate)
 {
     Type = type;
 }