public void ChangeSetModificacionBorradoTest() { IMSDNVideoServices client = ConnectionHelper.ServiceClient; int actoresCount; Pelicula pelicula = client.Peliculas_ObtenerPeliculaPorCodBarras("0045907014545", true, false); ActoresPelicula actorPeliculaBorrado; DisconnectedDataContext <EntidadesDataContext> dataContext = new DisconnectedDataContext <EntidadesDataContext>(); dataContext.Attach(pelicula); pelicula.Duracion = 119; actoresCount = pelicula.ActoresPeliculas.Count; actorPeliculaBorrado = (ActoresPelicula)OperacionesEntidad.CreateDataCopy(pelicula.ActoresPeliculas[0], false); pelicula.ActoresPeliculas.RemoveAt(0); DisconnectedChangeSet changeSet = dataContext.GetChangeSet(); client.ChangeSet_ActualizarChangeSet(changeSet); pelicula = client.Peliculas_ObtenerPeliculaPorCodBarras("0045907014545", true, false); Assert.AreEqual(119, pelicula.Duracion); Assert.AreEqual(actoresCount - 1, pelicula.ActoresPeliculas.Count); // Compensación dataContext.AcceptChanges(); dataContext.Attach(pelicula); pelicula.Duracion = 118; pelicula.ActoresPeliculas.Add(actorPeliculaBorrado); changeSet = dataContext.GetChangeSet(); client.ChangeSet_ActualizarChangeSet(changeSet); }
public void AccesoClaveIncorrectaTest() { IMSDNVideoServices client = ConnectionHelper.CreateCustomServiceClient("00000000T", "00000"); Usuario usuario; usuario = client.Usuarios_ObtenerMiUsuario(); }
public void ChangeSetModificacionTest() { IMSDNVideoServices client = ConnectionHelper.ServiceClient; int duracionOriginal; Pelicula pelicula = client.Peliculas_ObtenerPeliculaPorCodBarras("0045907014545", false, false); DisconnectedDataContext <EntidadesDataContext> dataContext = new DisconnectedDataContext <EntidadesDataContext>(); dataContext.Attach(pelicula); duracionOriginal = pelicula.Duracion; pelicula.Duracion = 100; DisconnectedChangeSet changeSet = dataContext.GetChangeSet(); client.ChangeSet_ActualizarChangeSet(changeSet); pelicula = client.Peliculas_ObtenerPeliculaPorCodBarras("0045907014545", false, false); Assert.AreEqual(100, pelicula.Duracion); // Compensación dataContext.AcceptChanges(); dataContext.Attach(pelicula); pelicula.Duracion = duracionOriginal; changeSet = dataContext.GetChangeSet(); client.ChangeSet_ActualizarChangeSet(changeSet); }
public void AccesoSocioNoExisteTest() { IMSDNVideoServices client = ConnectionHelper.CreateCustomServiceClient("11111111P", "12345"); Usuario usuario; usuario = client.Usuarios_ObtenerMiUsuario(); }
public static bool SetConnectionData(string usuario, string clave, string address, out string errorMessage) { ChannelFactory <IMSDNVideoServices> factory = new ChannelFactory <IMSDNVideoServices>("ws"); IMSDNVideoServices serviceClient; Usuario usuarioEntity = null; errorMessage = null; if (address != null) { factory.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(address), factory.Endpoint.Address.Identity, factory.Endpoint.Address.Headers); } factory.Credentials.UserName.UserName = "******"; factory.Credentials.UserName.Password = ""; SetDataContractSerializerBehavior(factory.Endpoint.Contract); serviceClient = factory.CreateChannel(); try { usuarioEntity = serviceClient.Usuarios_ValidarUsuario(usuario, clave); } catch (Exception) { errorMessage = "Error conectando con el servidor"; return(false); } if (usuarioEntity == null) { errorMessage = "El usuario o la clave son incorrectos"; return(false); } if (usuarioEntity.Rol != Rol.Socio) { errorMessage = "El usuario introducido no es socio"; return(false); } factory = new ChannelFactory <IMSDNVideoServices>("ws"); if (address != null) { factory.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(address), factory.Endpoint.Address.Identity, factory.Endpoint.Address.Headers); } factory.Credentials.UserName.UserName = usuario; factory.Credentials.UserName.Password = clave; SetDataContractSerializerBehavior(factory.Endpoint.Contract); _serviceClient = factory.CreateChannel(); return(true); }
public void AccesoInvitadoTest() { IMSDNVideoServices client = ConnectionHelper.CreateCustomServiceClient("Invitado", null); Usuario usuario; usuario = client.Usuarios_ObtenerMiUsuario(); Assert.IsNull(usuario); }
public void ObtenerPeliculaTest() { IMSDNVideoServices client = ConnectionHelper.ServiceClient; Pelicula pelicula; string codBarras = "1111768176787"; pelicula = client.Peliculas_ObtenerPeliculaPorCodBarras(codBarras, false, false); Assert.AreEqual(codBarras, pelicula.CodBarras); }
public void AccesoAdminTest() { IMSDNVideoServices client = ConnectionHelper.CreateCustomServiceClient("99999999R", "12345"); Usuario usuario; usuario = client.Usuarios_ObtenerMiUsuario(); Assert.IsNotNull(usuario); Assert.AreEqual("99999999R", usuario.NIF); Assert.AreEqual(Rol.Admin, usuario.Rol); }
static ConnectionHelper() { // Por defecto nos conectamos en modo anónimo ChannelFactory <IMSDNVideoServices> factory = new ChannelFactory <IMSDNVideoServices>("ws"); factory.Credentials.UserName.UserName = "******"; factory.Credentials.UserName.Password = ""; SetDataContractSerializerBehavior(factory.Endpoint.Contract); _serviceClient = factory.CreateChannel(); }
static ConnectionHelper() { _serviceClient = CreateCustomServiceClient("99999999R", "12345"); }
public void AccesoOperacionSinPermisoTest() { IMSDNVideoServices client = ConnectionHelper.CreateCustomServiceClient("00000000T", "12345"); client.Peliculas_ObtenerPeliculasPendienteDevolver("00000000T"); }