Пример #1
0
        public OwinSelfHost([NotNull] WireMockMiddlewareOptions options, [NotNull] params string[] uriPrefixes)
        {
            Check.NotNull(options, nameof(options));
            Check.NotEmpty(uriPrefixes, nameof(uriPrefixes));

            foreach (string uriPrefix in uriPrefixes)
            {
                var uri = new Uri(uriPrefix);
                Urls.Add(uri);
                Ports.Add(uri.Port);
            }

            _options = options;
        }
Пример #2
0
        public OwinSelfHost([NotNull] WireMockMiddlewareOptions options, [NotNull] params string[] uriPrefixes)
        {
            Check.NotNull(options, nameof(options));
            Check.NotNullOrEmpty(uriPrefixes, nameof(uriPrefixes));

            foreach (string uriPrefix in uriPrefixes)
            {
                Urls.Add(uriPrefix);

                PortUtil.TryExtractProtocolAndPort(uriPrefix, out string host, out int port);
                Ports.Add(port);
            }

            _options = options;
        }
        public AspNetCoreSelfHost([NotNull] WireMockMiddlewareOptions options, [NotNull] params string[] uriPrefixes)
        {
            Check.NotNull(options, nameof(options));
            Check.NotNullOrEmpty(uriPrefixes, nameof(uriPrefixes));

            _logger = options.Logger ?? new WireMockConsoleLogger();

            foreach (string uriPrefix in uriPrefixes)
            {
                Urls.Add(uriPrefix);

                PortUtil.TryExtractProtocolAndPort(uriPrefix, out string host, out int port);
                Ports.Add(port);
            }

            _options = options;
            _urls    = uriPrefixes;
        }
 public WireMockMiddleware(RequestDelegate next, WireMockMiddlewareOptions options)
 {
     _options          = options;
     _logTrafficStream = null;
     if (_options.TrafficLogFile != null)
     {
         if (!Directory.Exists(Path.GetDirectoryName(_options.TrafficLogFile)))
         {
             _options.Logger.Error("TrafficLogFile Folder - {0} - does NOT exist. Not logging traffic to {1}.", Path.GetDirectoryName(_options.TrafficLogFile), _options.TrafficLogFile);
         }
         else
         {
             try
             {
                 _logTrafficStream = File.AppendText(_options.TrafficLogFile);
             }
             catch (Exception e)
             {
                 _options.Logger.Error("Cannot create or access TrafficLogFile Path - {0} - does NOT exist. Not logging traffic. Exception: {1}", _options.TrafficLogFile, e.Message);
             }
         }
     }
 }
 public GlobalExceptionMiddleware(RequestDelegate next, WireMockMiddlewareOptions options)
 {
     Next     = next;
     _options = options;
 }
 public GlobalExceptionMiddleware(OwinMiddleware next, WireMockMiddlewareOptions options) : base(next)
 {
     _options = options;
 }
Пример #7
0
 public WireMockMiddleware(RequestDelegate next, WireMockMiddlewareOptions options)
 {
     _options = options;
 }