public void Test() { Ohtapi ohtapi = new Ohtapi(Tools.TestPublicKey, Tools.TestSecretKey, true); Assert.IsNotNull(ohtapi); var result = ohtapi.GetProjectsComments("808128"); Assert.IsNotNull(result); Assert.AreEqual(0, result.Status.Code); ohtapi = new Ohtapi("", "", true); result = ohtapi.GetProjectsComments("808128"); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Status.Code); Assert.AreNotEqual(-1, result.Status.Code); var provider = Substitute.For <IGetProjectsCommentsProvider>(); ohtapi.GetProjectsCommentsProvider = provider; provider.Get(string.Empty, null, string.Empty, string.Empty, string.Empty).ReturnsForAnyArgs(ExpectedJsonResultOk); result = ohtapi.GetProjectsComments(string.Empty); Assert.IsNotNull(result); Assert.AreEqual(0, result.Status.Code); provider.Get(string.Empty, null, string.Empty, string.Empty, string.Empty).ReturnsForAnyArgs(ExpectedJsonResultErr); result = ohtapi.GetProjectsComments(string.Empty); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Status.Code); Assert.AreNotEqual(-1, result.Status.Code); provider.Get(string.Empty, null, string.Empty, string.Empty, string.Empty).ReturnsForAnyArgs(string.Empty); result = ohtapi.GetProjectsComments(string.Empty); Assert.IsNotNull(result); Assert.AreEqual(-1, result.Status.Code); }
private void butGetProjectsComments_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(textProjectID.Text)) { tools.SetMsg("enter", textProjectID); return; } var r = _api.GetProjectsComments(textProjectID.Text); MessageBox.Show(r.ToString()); }