Esempio n. 1
0
        private static Response VerifyResponse(Response response)
        {
            response = response ?? new Response();

            return new Response
            {
                Status = VerifyStatus(response.Status),
                Headers = response.Headers ?? new NameValueCollection(),
                Body = response.Body,
                Latency = response.Latency,
                File = response.File
            };
        }
Esempio n. 2
0
        private static Response ParseResponse(YamlMappingNode yamlResponse)
        {
            var response = new Response();

            foreach(var property in yamlResponse) {
                switch(property.Key.ToString()) {
                    case "status":
                        {
                            response.Status = ushort.Parse(property.Value.ToString());
                            break;
                        }
                    case "headers":
                        {
                            response.Headers = ParseCollection(property, false);
                            break;
                        }
                    case "latency":
                        {
                            response.Latency = ulong.Parse(property.Value.ToString());
                            break;
                        }
                    case "body":
                        {
                            response.Body = ParseString(property);
                            break;
                        }
                    case "file":
                        {
                            response.File = ParseFile(property);
                            break;
                        }
                }
            }

            return response;
        }
Esempio n. 3
0
 protected bool Equals(Response other)
 {
     if(Status != other.Status)
         return false;
     if(Latency != other.Latency)
         return false;
     if(!string.Equals(Body, other.Body))
         return false;
     if(!string.Equals(File, other.File))
         return false;
     if(!Compare.NameValueCollections(Headers, other.Headers))
         return false;
     return true;
 }