Пример #1
0
        public void CancelarRegistro_CancelacionExitosa()
        {
            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.CancelarRegistro();

                Assert.IsTrue(registroAdmin.RegistroCancelado);
            }
            catch (EndpointNotFoundException)
            {
            }
        }
Пример #2
0
 /// <summary>
 /// Hace la llamada al servidor para cancelar el registro de un jugador.
 /// </summary>
 /// <exception cref="EndpointNotFoundException"></exception>
 /// <exception cref="TimeoutException"></exception>
 /// <exception cref="CommunicationObjectFaultedException"></exception>
 public static void CancelarRegistrarJugador()
 {
     try
     {
         servidor.CancelarRegistro();
     }
     catch (EndpointNotFoundException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
     catch (TimeoutException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
     catch (CommunicationObjectFaultedException ex)
     {
         LoggerAdmin.EscribirLog("Error", ex);
         throw;
     }
 }