Пример #1
0
 public void NameSimilarityTestFull()
 {
     Init();
     double score = (double)0.9486632809417912;
     string headersAsString = " { \"Content-Type\": \"application/json\", \"date\": \"Thu, 11 Aug 2016 15:47:32 GMT\", \"server\": \"openresty\", \"strict-transport-security\": \"max-age=63072000; includeSubdomains; preload\", \"x-rosetteapi-app-id\": \"1409611723442\", \"x-rosetteapi-concurrency\": \"50\", \"x-rosetteapi-request-id\": \"d4176692-4f14-42d7-8c26-4b2d8f7ff049\", \"content-length\": \"72\", \"connection\": \"Close\" }";
     Dictionary<string, string> responseHeaders = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(headersAsString);
     Dictionary<string, object> content = new Dictionary<string, object>();
     content.Add("score", score);
     NameSimilarityResponse expected = new NameSimilarityResponse(score, responseHeaders, content, null);
     String mockedContent = expected.ContentToString();
     HttpResponseMessage mockedMessage = MakeMockedMessage(responseHeaders, HttpStatusCode.OK, mockedContent);
     _mockHttp.When(_testUrl + "name-similarity").Respond(mockedMessage);
     NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON"), new Name("Vladmir Putin", "eng", null, "PERSON"));
     Assert.AreEqual(expected, response);
 }