public void GetRandomStringTest() { int length = 10; string str = PostHelper.GetRandomString(length); Assert.AreEqual(length, str.Length); }
private PostsModels GetPostsModel(TagIya tagIya, Mensahe msg) { MensaheRepository mr = new MensaheRepository(); PostsModels post = new PostsModels(); post.DisplayName = tagIya.ScreenName; post.Message = msg.Message; post.Comments = CommentsModels.ParseComments(msg.Kumentaryos.ToList()); post.DatePosted = msg.DatePosted; post.NumberOfVotes = mr.GetMessageVotes(msg.MessageId); post.PostUserId = tagIya.UserId; post.MessageId = msg.MessageId; if (string.IsNullOrEmpty(tagIya.Gravatar)) { post.Gravatar = Utility.GetMD5Hash(PostHelper.GetRandomString(10) + "@no-email.com"); } else { post.Gravatar = Utility.GetMD5Hash(tagIya.Gravatar); } return(post); }