예제 #1
0
        public void GetAdminReportResult_ReportsFound_ReturnREPORT_EXISTSResult()
        {
            try
            {
                var baseAddress = new Uri("net.tcp://localhost:8090/Contratos");
                serviceHost = new ServiceHost(typeof(Contratos.MainService), baseAddress);
                System.ServiceModel.Channels.Binding binding = new NetTcpBinding();
                var address  = new EndpointAddress("net.tcp://localhost:8090/ServerTests");
                var endpoint = serviceHost
                               .AddServiceEndpoint(typeof(Contratos.IBanManager), binding, address.Uri);

                var smb = new ServiceMetadataBehavior {
                    HttpGetEnabled = false
                };
                serviceHost.Description.Behaviors.Add(smb);
                InstanceContext instanceContext = new InstanceContext(new BanCallbackHandler());
                banClient     = new BanManagerClient(instanceContext);
                endpoint.Name = banClient.Endpoint.Name;

                serviceHost.Open();
                banClient.GetReportData();
                BanCallbackHandler banHandler = new BanCallbackHandler();
                AdminReportResult  result     = banHandler.adminReportResult;
                Assert.AreEqual(result, AdminReportResult.REPORT_EXISTS);
            }
            catch (EndpointNotFoundException)
            {
                banClient.Abort();
            }
            catch (CommunicationException)
            {
                banClient.Abort();
            }
        }
예제 #2
0
 /// <summary>
 /// Crea una solicitud para obtener una lista de <c>Reporte</c> de jugadores guardados en el servidor
 /// </summary>
 /// <exception>
 /// Esta excepcion puede retornar una excepcion tipo EndpointNotFoundException
 /// </exception>
 public static void GetReportedList()
 {
     try
     {
         server.GetReportData();
     }
     catch (EndpointNotFoundException)
     {
         MessageBox.Show(Properties.Resources.NoConnectionMessage);
     }
 }