Пример #1
0
        /// <summary>
        /// Creates a new Request Match for the given URL and HTTP Method. Note rules around QueryStrings in URLs.
        /// </summary>
        /// <param name="url">The URL value to match on. Absolute URLs only (Protocol, Host, Port, Path). If QueryString is included then QueryString matching can only be
        /// done using the URL for all other requests (<c>ContainingQueryParam</c> cannot be used).  It it recommended to omit QueryString from the URL
        /// here and instead use <c>ContainingQueryParam</c> - in which case incoming URLs will be stripped of all QueryString before matching the URL.
        /// </param>
        /// <param name="httpMethod">The HTTP Method to match on.</param>
        public RequestMatchBuilder ForRequest(string url, HttpMethod httpMethod)
        {
            if (m_IsBuilt)
            {
                throw new InvalidOperationException("Cannot add more request tracking after builder has been built.");
            }

            var builder = new RequestMatchBuilder(this, m_BodySerializeOptions, url, httpMethod);

            // Note: This assumes valid before adding
            m_Requests.Add(builder);
            return(builder);
        }
Пример #2
0
 internal ResponseBuilder(RequestMatchBuilder requestMatchBuilder, JsonSerializerOptions bodySerializeOptions)
 {
     m_RequestMatchBuilder  = requestMatchBuilder;
     m_BodySerializeOptions = bodySerializeOptions;
 }