public void AddComentarioEtiquetaTest() { UserProfile userProfile = CreateTestUserProfile(); ComentarioEtiquetaBlock comEtiBlo = opinadorService.AddComentarioEtiqueta(userProfile.usrId, PRODUCTO_ID, "texto", null); Assert.IsTrue(opinadorService.FindComentariosByProductoId(PRODUCTO_ID, START_INDEX, COUNT).Contains(comEtiBlo.Comentario)); Assert.IsTrue(opinadorService.GetNumberOfComentariosByProductoId(PRODUCTO_ID) == 1); }
protected void Page_Load(object sender, EventArgs e) { /* Hide the links */ lnkAnterior.Visible = false; lnkSiguiente.Visible = false; /* Get de Service */ IUnityContainer container = (IUnityContainer)HttpContext.Current.Application["unityContainer"]; IOpinadorService opinadorService = container.Resolve <IOpinadorService>(); int startIndex; long idProducto = long.Parse(Request.Params.Get("idProducto")); try { startIndex = Int32.Parse(Request.Params.Get("startIndex")); } catch (ArgumentNullException) { startIndex = 0; } Int32 count = 5; if (opinadorService.FindComentariosByProductoId(idProducto, startIndex, count).Count == 0) { lblNoComments.Visible = true; } List <Comentario> comentarios = opinadorService.FindComentariosByProductoId(idProducto, startIndex, count); foreach (Comentario c in comentarios) { c.UserProfileReference.Load(); } this.gvReviews.DataSource = comentarios; this.gvReviews.DataBind(); int numeroDeComentarios = opinadorService.GetNumberOfComentariosByProductoId(idProducto); /* "Previous" link */ if ((startIndex - count) >= 0) { String url = "./ShowComments.aspx?idProducto=" + idProducto + "&startIndex=" + (startIndex - count); this.lnkAnterior.NavigateUrl = Response.ApplyAppPathModifier(url); this.lnkAnterior.Visible = true; } /* "Next" link */ if ((startIndex + count) < numeroDeComentarios) { String url = "./ShowComments.aspx" + "?idProducto=" + idProducto + "&startIndex=" + (startIndex + count); this.lnkSiguiente.NavigateUrl = Response.ApplyAppPathModifier(url); this.lnkSiguiente.Visible = true; } }