public void ReenviarClave_ReenvioExitoso() { try { Uri baseAddress = new Uri("net.tcp://localhost:8090/UNO.Contratos"); serviceHost = new ServiceHost(typeof(UNO.Contratos.JuegoUNOServicio), baseAddress); Binding binding = new NetTcpBinding(); EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:8090/UNOServerTest"); var endpoint = serviceHost.AddServiceEndpoint(typeof(UNO.Contratos.AdministrarJugador.IRegistrarJugador), binding, endpointAddress.Uri); ServiceMetadataBehavior smb = new ServiceMetadataBehavior { HttpGetEnabled = false }; serviceHost.Description.Behaviors.Add(smb); registroAdmin = new RegistroJugadorCallback(); instanceContext = new InstanceContext(registroAdmin); cliente = new RegistrarJugadorClient(instanceContext); endpoint.Name = cliente.Endpoint.Name; serviceHost.Open(); cliente.EnviarClaveDeNuevo(); Assert.IsTrue(registroAdmin.ClaveEnviada); } catch (EndpointNotFoundException) { } }
/// <summary> /// Hace la llamada al servidor para enviar la clave de verificación nuevamente. /// </summary> /// <exception cref="EndpointNotFoundException"></exception> /// <exception cref="TimeoutException"></exception> /// <exception cref="CommunicationObjectFaultedException"></exception> public static void EnviarClave() { try { servidor.EnviarClaveDeNuevo(); } catch (EndpointNotFoundException ex) { LoggerAdmin.EscribirLog("Error", ex); throw; } catch (TimeoutException ex) { LoggerAdmin.EscribirLog("Error", ex); throw; } catch (CommunicationObjectFaultedException ex) { LoggerAdmin.EscribirLog("Error", ex); throw; } }