public void Test1() { //注册一个新的客户端 try { theDataServices.RegisterSmsClient("http://localhost:8000/SmsClientService/", "aNewHrmisId"); Assert.Fail("期望失败"); } catch (FaultException fe) { Assert.AreEqual("当前客户端HrmisId未被允许", fe.Message); } Assert.AreEqual(1, theController.GetAllClientAddressModel().Count); ClientInformationModel theClientInfo = theController.GetAllClientAddressModel()[0]; AssertTheClientInformationDisabled(theClientInfo); Assert.AreEqual(1, MockClientServicesProvider._ClientIsAvailableCalled); //允许该客户端 theController.ActiveTheClientInformation(theClientInfo.Pkid); Thread.Sleep(50);//此处Sleep的原因是,客户端被回调声明为OneWay,服务器没有等待结果 ClientInformationModel theClientInfo1 = theController.GetAllClientAddressModel()[0]; AssertTheClientInformationActived(theClientInfo1); Assert.AreEqual(1, MockClientServicesProvider._TheServiceStatusChanged); //todo by nh 加入更多的测试 12.7 }
protected void lblOpenClient_Click(object sender, CommandEventArgs e) { try { _TheSmsControllor.ActiveTheClientInformation(int.Parse(e.CommandArgument.ToString())); DataBindsForClientInformations(); } catch (FaultException fe) { lblMessage.Text = fe.Message; } }