コード例 #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
            };
        }
コード例 #2
0
ファイル: YamlParser.cs プロジェクト: turbonaitis/stubby4net
        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;
        }
コード例 #3
0
ファイル: Response.cs プロジェクト: turbonaitis/stubby4net
 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;
 }