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