protected void Page_Load(object sender, EventArgs e)
        {
            IIoCManager ioCManager = (IIoCManager)HttpContext.Current.Application["managerIoC"];
            IRecommendationGroupService recommendationGroupService = ioCManager.Resolve <IRecommendationGroupService>();

            HttpCookie cookie    = Request.Cookies["loginName"];
            DataTable  dataTable = new DataTable();

            HashSet <DTORecommendation> recommendations = recommendationGroupService.ShowUserRecommendations(cookie.Value);

            if (recommendations.Count == 0)
            {
                this.lblNorecommendations.Visible = true;
                this.lblRecommendations.Visible   = false;
                return;
            }

            using (var reader = ObjectReader.Create(recommendations, "recommendationId", "eventId", "login_user", "eventName", "recommendation_text"))
            {
                dataTable.Load(reader);
            }

            this.gvRecommendations.DataSource = dataTable;
            this.DataBind();
            gvRecommendations.Columns[0].Visible = false;
            gvRecommendations.Columns[1].Visible = false;
        }
        public void TestRecommendation()
        {
            //Create user1
            UserProfileDetails user1Details = new UserProfileDetails("testUserName1", "testLastName1", "*****@*****.**", "en", "US");
            long user1Id = userService.RegisterUser("testLogin1", "passwordtest1", user1Details);
            //Create user2
            UserProfileDetails user2Details = new UserProfileDetails("testUserName2", "testLastName2", "*****@*****.**", "en", "US");
            long user2Id = userService.RegisterUser("testLogin2", "passwordtest2", user2Details);

            //User1 creates group
            long group1Id = recommendationGroupService.CreateGroup("tesNameGroup1", "testDescriptionGroup1", "testLogin1");
            //User2 creates group
            long group2Id = recommendationGroupService.CreateGroup("testNameGroup2", "testDescriptionGroup2", "testLogin2");

            // User 2 on Group1
            recommendationGroupService.AddUserToGroup("testLogin2", group1Id);

            //User1 on Group2
            recommendationGroupService.AddUserToGroup("testLogin1", group2Id);

            //List with only group1Id
            List <long> group1List = new List <long>();

            group1List.Add(group1Id);

            //List with only group2Id
            List <long> group2List = new List <long>();

            group2List.Add(group2Id);

            //List of groupsIds
            List <long> groupAllIds = new List <long>();

            groupAllIds.Add(group1Id);
            groupAllIds.Add(group2Id);

            //Creating Category for sport event
            //1 = eventId1, 2=eventId2

            //User1 add recomendation event1 to group1
            long idRecommendation1 = recommendationGroupService.AddRecommendation("testLogin1", 1, group1List, "my_recommendation_text1");
            List <DTORecommendation> ListRecommendation = recommendationGroupService.ShowGroupRecommendations(group1Id);

            //Check if we insert 1
            Assert.AreEqual(1, ListRecommendation.Count);
            // User2 add recommendation event2 to group2
            long idRecommendation2 = recommendationGroupService.AddRecommendation("testLogin2", 2, group2List, "my_recommendation_text2");

            ListRecommendation = recommendationGroupService.ShowGroupRecommendations(group1Id);
            //Check if we insert 1 and if is "my_recommendation_text1"
            Assert.AreEqual(1, ListRecommendation.Count);
            Assert.IsTrue(ListRecommendation[0].recommendation_text.Equals("my_recommendation_text1"));

            //Check recommendations
            List <DTORecommendation> lista = new List <DTORecommendation>(ListRecommendation);

            Assert.AreEqual(lista[0].eventId, 1);
            //List<GroupUsers> groupsInRecommendation = new List<GroupUsers>(lista[0].GroupUsers);
            //Assert.AreEqual(groupsInRecommendation[0].group_usersId, group1Id);
            Assert.AreEqual(lista[0].recommendationId, idRecommendation1);
            Assert.AreEqual(lista[0].recommendation_text, "my_recommendation_text1");
            Assert.AreEqual(lista[0].login_user, "testLogin1");

            //User1 add recomendation on groups
            long idRecommendation3 = recommendationGroupService.AddRecommendation("testLogin1", 1, groupAllIds, "recommendations on 2 groups");

            //Get and check group1
            List <DTORecommendation> ListRecommendations = recommendationGroupService.ShowGroupRecommendations(group1Id);

            Assert.AreEqual(2, ListRecommendations.Count());
            Assert.IsTrue(ListRecommendations[0].recommendation_text.Equals("recommendations on 2 groups"));

            //Get all recommendations from user

            HashSet <DTORecommendation> dTORecommendations = recommendationGroupService.ShowUserRecommendations("testLogin1");

            Assert.AreEqual(3, dTORecommendations.Count);

            //Assert.AreEqual(lista[1].eventId, 2);
            ////groupsInRecommendation = new List<GroupUsers>(lista[1].GroupUsers);
            ////Assert.AreEqual(groupsInRecommendation[0].group_usersId, group1Id);
            //Assert.AreEqual(lista[1].recommendationId, idRecommendation2);
            //Assert.AreEqual(lista[1].recommendation_text, "my_recommendation_text2");
            //Assert.AreEqual(lista[1].login_user, "testLogin2");
        }