Ejemplo n.º 1
0
        public static void CreateListOfPostsForListOfUsers(List <string> listUserNames)
        {
            foreach (var userName in listUserNames)
            {
                //Logger.InfoFormat("Doing user: {0}", userName);

                List <string> userList = UserPostsAnalyzer.GetListOfUserPosts(userName);

                string userFileName = "../../../Data/UsersLists/" + userName;
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(userFileName))
                {
                    foreach (string post in userList)
                    {
                        file.WriteLine(post);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void CreateListOfPostsForEachUser(string inFileNameWithUsersList)
        {
            using (System.IO.StreamReader file = new System.IO.StreamReader(inFileNameWithUsersList))
            {
                string userName;
                int    c = 0;
                while ((userName = file.ReadLine()) != null)
                {
                    try
                    {
                        List <string> userPostList = UserPostsAnalyzer.GetListOfUserPosts(userName);

                        if (userPostList.Count > 0)
                        {
                            string userFileName = "../../../Data/UsersLists/" + userName + ".txt";
                            using (System.IO.StreamWriter fileUser = new System.IO.StreamWriter(userFileName))
                            {
                                foreach (string post in userPostList)
                                {
                                    fileUser.WriteLine(post);
                                }
                            }

                            foreach (var s in userPostList)
                            {
                                Logger.Info("   " + s);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("Exception thrown. Error message: " + ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void GetUserPostList_Test7()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("zoran-ostric");

            Assert.AreEqual(45 * 10 + 6, listPosts.Count);
        }
Ejemplo n.º 4
0
        public void GetUserPostList_Test6()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("liberty-valance");

            Assert.AreEqual(0, listPosts.Count);
        }
Ejemplo n.º 5
0
        public void GetUserPostList_Test5()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("otpisani");

            Assert.AreEqual(4 * 10 + 1, listPosts.Count);
        }
Ejemplo n.º 6
0
        public void GetUserPostList_Test4()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("ppetra");

            Assert.AreEqual(25 * 10 + 10, listPosts.Count);
        }
Ejemplo n.º 7
0
        public void GetUserPostList_Test3()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("frederik");

            Assert.AreEqual(31 * 10 + 6, listPosts.Count);
        }
Ejemplo n.º 8
0
        public void GetUserPostList_Test2()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("mrak");

            Assert.AreEqual(31 * 10 + 7, listPosts.Count);
        }
Ejemplo n.º 9
0
        public void GetUserPostList_Test1()
        {
            var listPosts = UserPostsAnalyzer.GetListOfUserPosts("zvone-radikalni");

            Assert.AreEqual(14 * 10 + 1, listPosts.Count);
        }