public void SetUp() { //控制接口 theController = new ChannelFactory <ISmsControllerContract>("ISmsControllerContractService").CreateChannel(); theController.StopTheSmsThread(); theController.StopConnection(); //数据接口 theDataServices = new ChannelFactory <ISmsServiceContract>("ISmsServiceContractService").CreateChannel(); //客户段监听接口 _SmsServiceTypeHost = new ServiceHost(typeof(MockClientServicesProvider)); _SmsServiceTypeHost.Open(); //清空数据 ClearAllAddressData(); }