Ejemplo n.º 1
0
        private static void BuildAndSendObjectsToRepos()
        {
            /*
             * Steps:
             *      loop through the array of usernames
             *      build user objects and a thread for each of them
             *      add the thread to the threadRepo
             *      add the user object to the user repo
             */
            // loop to generate user objects
            for (int i = 0; i < usernames.Length; i++)
            {
                // build user object
                User user = new User()
                {
                    UserID     = ObjectIDBuilder.GetUserID(),
                    Username   = usernames[i],
                    Password   = "******",
                    DateJoined = DateTime.Now
                };

                // call thread builder
                // pass creator username to thread
                // set owned thread property
                Thread thread = BuildThread(i);
                thread.CreatorName = user.Username;
                user.OwnedThread   = thread;

                // set objects to object repos
                new RealThreadRepo().AddThreadtoRepo(thread);
                new RealUserRepo().AddUsertoRepo(user);
            }
        }
Ejemplo n.º 2
0
        private static Thread BuildThread(int currentArrayIndex)
        {
            // build thread
            Thread thread = new Thread()
            {
                ThreadID = ObjectIDBuilder.GetThreadID(),
                Name     = threadNames[currentArrayIndex],
                Bio      = threadBios[currentArrayIndex],
                Category = threadCategories[currentArrayIndex]
            };

            thread.AddPostToThread(examplePost);

            return(thread);
        }