Beispiel #1
0
        public void ObtenerInformacionJugador_NoExisteJugador_JugadorNulo()
        {
            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.Login.ILogin), binding, endpointAddress.Uri);
                ServiceMetadataBehavior smb             = new ServiceMetadataBehavior
                {
                    HttpGetEnabled = false
                };
                serviceHost.Description.Behaviors.Add(smb);

                perfilAdmin     = new PerfilCallbackAdmin();
                instanceContext = new InstanceContext(perfilAdmin);
                perfilCliente   = new PerfilClient(instanceContext);
                endpoint.Name   = perfilCliente.Endpoint.Name;

                serviceHost.Open();

                string nicknameIncorrecto = "nicknameIncorrecto";

                perfilCliente.BuscarJugador(nicknameIncorrecto);

                Jugador jugadorObtenido = perfilAdmin.Jugador;

                Assert.IsNull(jugadorObtenido);
            }
            catch (EndpointNotFoundException)
            {
            }
        }
Beispiel #2
0
        public void ObtenerInformacionJugador_ExisteJugador_InformacionCorrecta()
        {
            try
            {
                Uri baseAddress = new Uri("net.tcp://*****:*****@gmail.com",
                    Experiencia       = 44,
                };

                perfilCliente.BuscarJugador(jugadorEsperado.Nickname);

                Jugador jugadorObtenido = perfilAdmin.Jugador;

                Assert.IsTrue
                (
                    jugadorEsperado.Nickname == jugadorObtenido.Nickname &&
                    jugadorEsperado.CorreoElectronico == jugadorObtenido.CorreoElectronico &&
                    jugadorEsperado.Experiencia == jugadorObtenido.Experiencia
                );
            }
            catch (EndpointNotFoundException)
            {
            }
        }