public void AddFavoritoTest() { UserProfile userProfile = CreateTestUserProfile(); Favorito favorito = opinadorService.AddFavorito(userProfile.usrId, PRODUCTO_ID, "bookmark", "interesante"); List <Favorito> favoritos = opinadorService.FindFavoritosByUsrId(userProfile.usrId, START_INDEX, COUNT); Assert.IsTrue(favoritos.Count == 1); Assert.IsTrue(favoritos.Contains(favorito)); }
protected void BtnAcceptClick(object sender, EventArgs e) { /* Get data. */ String bookmark = this.txtFavorito.Text; long idProducto = long.Parse(Request.Params.Get("idProducto")); string comment = this.txtComment.Text; UserSession userSession = (UserSession)Context.Session["userSession"]; long idUsuario = userSession.UserProfileId; /* Do action. */ IUnityContainer container = (IUnityContainer)HttpContext.Current.Application["unityContainer"]; IOpinadorService opinadorService = container.Resolve <IOpinadorService>(); opinadorService.AddFavorito(idUsuario, idProducto, bookmark, comment); Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx")); }