示例#1
0
        public void Add_Add_a_valid_tweet_to_database_Returns_true()
        {
            bool expected = true;
            bool actual   = service.Add(newTweet);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public ActionResult Index(Tweet tweet)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Tweet"));
            }
            int userID;

            int.TryParse(Session["UserID"].ToString(), out userID);
            tweet.PostDate = DateTime.Now;
            tweet.UserId   = userID;
            if (tweetBl.Add(tweet))
            {
                log.Info("A new Tweet has been added");
                return(RedirectToAction("Index", "User"));
            }
            else
            {
                log.Error("Tweet could't bee added");
                return(RedirectToAction("Error", "Home"));
            }
        }