public void ShouldParseResponse_WithFile() { const string file = "../../YAML/response-file.yaml"; var endpoint = YamlParser.FromFile(file)[0]; Assert.AreEqual(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(file), "path/to/response/body")), endpoint.Responses[0].File); }
public void ShouldParseResponse_WithHeaders() { var endpoint = YamlParser.FromFile("../../YAML/response-headers.yaml")[0]; Assert.AreEqual("application/json", endpoint.Responses[0].Headers["content-type"]); Assert.AreEqual("application/json", endpoint.Responses[0].Headers["accept"]); }
public void ShouldParseRequest_WithQuery() { var endpoint = YamlParser.FromFile("../../YAML/request-query.yaml")[0]; Assert.AreEqual("tada", endpoint.Request.Query["first"]); Assert.AreEqual("voila", endpoint.Request.Query["second"]); }
public void ShouldParseRequest_WithHeaders() { var endpoint = YamlParser.FromFile("../../YAML/request-headers.yaml")[0]; Assert.AreEqual("text/xml", endpoint.Request.Headers["content-type"]); Assert.AreEqual("firefox(Mozilla)", endpoint.Request.Headers["user-agent"]); }
private void LoadEndpoints() { IList <Endpoint> endpoints = new List <Endpoint>(); try { endpoints = YamlParser.FromFile(_arguments.Data); } catch (FileNotFoundException) { Out.Warn("File '" + _arguments.Data + "' couldn't be found. Ignoring..."); } catch (YamlException ex) { Out.Error(ex.Message); throw new EndpointParsingException("Could not parse endpoints due to YAML errors.", ex); } _endpointDb.Delete(); _endpointDb.Insert(endpoints); }
public void ShouldParseMultipleEndpoints() { var endpoints = YamlParser.FromFile("../../YAML/multiple.yaml"); Assert.AreEqual(3, endpoints.Count); }
public void ShouldParseResponse_WithBody() { var endpoint = YamlParser.FromFile("../../YAML/response-body.yaml")[0]; Assert.AreEqual("body contents!", endpoint.Responses[0].Body); }
public void ShouldParseRequest_WithUrl() { var endpoint = YamlParser.FromFile("../../YAML/hello-world.yaml")[0]; Assert.AreEqual("/hello/world", endpoint.Request.Url); }
public void ShouldParseRequest_WithPostBody() { var endpoint = YamlParser.FromFile("../../YAML/request-post.yaml")[0]; Assert.AreEqual("post body!", endpoint.Request.Post); }
public void ShouldParseRequest_WithManyMethods() { var endpoint = YamlParser.FromFile("../../YAML/request-methods.yaml")[0]; Assert.AreEqual(new[] { "GET", "HEAD" }, endpoint.Request.Method); }
public void ShouldParseRequest_WithMethod() { var endpoint = YamlParser.FromFile("../../YAML/request-method.yaml")[0]; Assert.AreEqual(new[] { "DELETE" }, endpoint.Request.Method); }
public void ShouldReturnEmptyArray_GivenNullOrWhitespaceFileName() { Assert.IsEmpty(YamlParser.FromFile("")); Assert.IsEmpty(YamlParser.FromFile(null)); }
public void ShouldParseResponse_WithStatus() { var endpoint = YamlParser.FromFile("../../YAML/response-status.yaml")[0]; Assert.AreEqual(204, endpoint.Responses[0].Status); }
public void ShouldParseResponse_WithLatency() { var endpoint = YamlParser.FromFile("../../YAML/response-latency.yaml")[0]; Assert.AreEqual(987654321, endpoint.Responses[0].Latency); }