コード例 #1
0
ファイル: Request.cs プロジェクト: senior0023/twilio-csharp
        /// <summary>
        /// Compare request
        /// </summary>
        /// <param name="obj">object to compare to</param>
        /// <returns>true if requests are equal; false otherwise</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != typeof(Request))
            {
                return(false);
            }

            var other = (Request)obj;

            return(Method.Equals(other.Method) &&
                   buildUri().Equals(other.buildUri()) &&
                   QueryParams.All(other.QueryParams.Contains) &&
                   other.QueryParams.All(QueryParams.Contains) &&
                   PostParams.All(other.PostParams.Contains) &&
                   other.PostParams.All(PostParams.Contains) &&
                   HeaderParams.All(other.HeaderParams.Contains) &&
                   other.HeaderParams.All(HeaderParams.Contains));
        }
コード例 #2
0
        private bool ContainsMatchingQueryParams(HttpRequestMessage httpRequestMessage)
        {
            if (QueryParams.Count == 0) // Ignored
            {
                return(true);
            }

            var requestQueryParams = HttpUtility.ParseQueryString(httpRequestMessage.RequestUri.Query);

            return(QueryParams.All(q => q.Value.IsSameString(requestQueryParams[q.Key])));
        }