public void ReservedWord_Any_BodyShouldtBeEquals() { var jsonReader = new JsonReader.JsonReaderBody(); var jsonBody1 = File.ReadAllText("./simple_body.json"); var jsonBody2 = File.ReadAllText("./simple_body_any.json"); Assert.IsTrue(jsonReader.Read(jsonBody1).Equals(jsonReader.Read(jsonBody2))); Assert.IsTrue(jsonReader.Read(jsonBody2).Equals(jsonReader.Read(jsonBody1))); }
public void SimpleBodyShouldNotBeEquals() { var jsonReader = new JsonReader.JsonReaderBody(); var jsonBody1 = File.ReadAllText("./simple_body.json"); var jsonBody2 = File.ReadAllText("./simple_body2.json"); Assert.IsFalse(jsonReader.Read(jsonBody1).Equals(jsonReader.Read(jsonBody2))); Assert.IsFalse(jsonReader.Read(jsonBody2).Equals(jsonReader.Read(jsonBody1))); }
public Task Replace(RequestConfig requestConfig) { var reader = new JsonReader.JsonReaderBody(); Entity.Http.Body body = reader.Read(requestConfig.Body); return(ReplaceDependecy(body)); }
public void OnSendMessageSucess() { var header = new Dictionary <string, string>() { { "Content-Type", "application/json" } }; var body = "{name: \"Robert\"}"; _server.ResponseBody = body; var cookies = new Dictionary <string, string>(); var queryString = new Dictionary <string, string>(); var request = Requests.Create(new RequestConfig($"http://localhost:{Port}/resource", "POST", header, cookies, queryString, body)); var response = request.Send().Result; Assert.AreEqual(200, response.Status); var reader = new JsonReader.JsonReaderBody(); reader.Read(body); Assert.IsTrue(reader.Read(body).Equals(response.Body)); }
public void ReservedWord_NUMBER_BodyShouldtBeEquals() { var jsonReader = new JsonReader.JsonReaderBody(); var jsonBody1 = File.ReadAllText("./simple_body.json"); var jsonBody2 = File.ReadAllText("./simple_body_number.json"); Assert.IsTrue(jsonReader.Read(jsonBody1).Equals(jsonReader.Read(jsonBody2))); Assert.IsTrue(jsonReader.Read(jsonBody2).Equals(jsonReader.Read(jsonBody1))); var jsonBody3 = File.ReadAllText("./simple_body_item1_str.json"); var jsonBody4 = File.ReadAllText("./simple_body_item1_$number.json"); Assert.IsFalse(jsonReader.Read(jsonBody3).Equals(jsonReader.Read(jsonBody4))); Assert.IsFalse(jsonReader.Read(jsonBody4).Equals(jsonReader.Read(jsonBody3))); }
public void OnEvaluateDependency() { var dep = new DependencyDetector(); var jsonReader = new JsonReader.JsonReaderBody(); var testResult = new Entity.Test.TestResult("call1", new Validation(), new Response(200, jsonReader.Read("{ id: 1314, name: \"Robson\", childrens: { name: \"Cleyton\", age: 14 } }"), new Cookies(), new Header())); Assert.AreEqual("1314", dep.Evaluate("${call1.response.body.id}", testResult)); Assert.AreEqual("Robson", dep.Evaluate("${call1.response.body.name}", testResult)); Assert.AreEqual("Cleyton", dep.Evaluate("${call1.response.body.childrens.name}", testResult)); Assert.AreEqual("14", dep.Evaluate("${call1.response.body.childrens.age}", testResult)); }