Пример #1
0
        /// <summary>
        /// Read a User's Wall. This includes User's posts, as well as their subscriptions' posts.
        /// </summary>
        /// <param name="userName"></param>
        private static void ReadUserWall(string userName)
        {
            IDictionary <Post, string> wall = _socialNetworkService.GetUserWall(userName);

            foreach (KeyValuePair <Post, string> keyValuePair in wall)
            {
                Console.WriteLine($"{keyValuePair.Value} - {keyValuePair.Key.Text} ({keyValuePair.Key.TimeAgo()})");
            }
        }
Пример #2
0
        public void GetsUsersWall()
        {
            // Arrange.
            string               dbConnectionString   = ConfigurationManager.ConnectionStrings["DbConnectionString"].ConnectionString;
            int                  timeoutSeconds       = int.Parse(ConfigurationManager.AppSettings["TimeoutSeconds"]);
            DbConnection         dbConnection         = new DbConnection(dbConnectionString, timeoutSeconds);
            SocialNetworkService socialNetworkService = new SocialNetworkService(dbConnection);

            // Act and assert.
            Assert.DoesNotThrow(() =>
            {
                var timeline = socialNetworkService.GetUserWall("Bodrul");
                if (timeline.Count < 1)
                {
                    throw new ArgumentException();
                }
            });
        }