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