public void GetWordCloudOK() { // Arrange iApiRepository stub = new ApiRepositoryStub(); var controller = new ApiWordCloudController(stub) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act var response = controller.Get("10"); var responseString = response.Content.ReadAsStringAsync().Result; dynamic results = JsonConvert.DeserializeObject <dynamic>(responseString); // Assert Assert.AreEqual("10", (string)results[0].weight); Assert.AreEqual("system", (string)results[0].text); Assert.AreEqual("#0077c2", (string)results[0].color); Assert.AreEqual("4", (string)results[1].weight); Assert.AreEqual("text", (string)results[1].text); Assert.AreEqual("#80d6ff", (string)results[1].color); Assert.AreEqual("1", (string)results[2].weight); Assert.AreEqual("cancer", (string)results[2].text); Assert.AreEqual("#42a5f5", (string)results[2].color); }
public void GetWordCloudEmpty() { // Arrange iApiRepository stub = new ApiRepositoryStub(); var controller = new ApiWordCloudController(stub) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act var response = controller.Get("-1"); var responseString = response.Content.ReadAsStringAsync().Result; dynamic results = JsonConvert.DeserializeObject <dynamic>(responseString); // Assert Assert.AreEqual("No data found for user", results); }