Esempio n. 1
0
        public void VerificarClave_InformaciónCorrecta()
        {
            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();

                String claveRegistro = "13254";

                cliente.VerificarClave(claveRegistro);

                bool resultadoObtenido = registroAdmin.ClaveCorrecta;

                Assert.IsTrue(resultadoObtenido);
            }
            catch (EndpointNotFoundException)
            {
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Hace la llamada al servidor para verificar la clave de verificación de registro.
 /// </summary>
 /// <param name="clave">La clave de verificación</param>
 /// <exception cref="EndpointNotFoundException"></exception>
 /// <exception cref="TimeoutException"></exception>
 /// <exception cref="CommunicationObjectFaultedException"></exception>
 public static void VerificarClaveIngresada(string clave)
 {
     try
     {
         servidor.VerificarClave(clave);
     }
     catch (EndpointNotFoundException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
     catch (TimeoutException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
     catch (CommunicationObjectFaultedException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
 }