Exemple #1
0
        protected void BtnVoteClick(object sender, EventArgs e)
        {
            /* Get data. */
            String comment    = this.txtComment.Text;
            Int16  vote       = Convert.ToInt16(this.ddlVote.SelectedValue);
            string vendedorId = Request.Params.Get("vendedor");

            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.ValorarUsuario(vendedorId, idUsuario, vote, comment);
            Response.Redirect(Response.ApplyAppPathModifier("./Mainpage.aspx"));
        }
Exemple #2
0
        public void FindValoracionesAndNoteByVendedorTest()
        {
            UserProfile userProfile = CreateTestUserProfile();
            Valoracion  v1          = opinadorService.ValorarUsuario(VENDEDOR_ID, userProfile.usrId, 2, "voto1");

            opinadorService.ValorarUsuario(VENDEDOR_ID, userProfile.usrId, 4, "voto2");
            opinadorService.ValorarUsuario(VENDEDOR_ID, userProfile.usrId, 3, "voto3");

            ValoracionBlock valoracionBlock = opinadorService.FindValoracionesAndNoteByVendedor(VENDEDOR_ID, START_INDEX, COUNT);

            Assert.IsTrue(valoracionBlock.NumValoraciones == 3);
            Assert.IsTrue(valoracionBlock.AverageValoracion == 3);
            Assert.IsTrue(valoracionBlock.Valoraciones.Contains(v1));
        }