public bool Update(Tweet tweet) { try { if (tweet == null) { throw new NullReferenceException("Tweet is null"); } DataAccessLayer.Tweet tweetForDatabase = tweetMapper.MapToDatabaseType(tweet); tweetsRepository.Update(tweetForDatabase); log.Info("Tweet succesfully updated"); } catch (Exception e) { log.Error(e.Message); return(false); } return(true); }
public void Initialization() { tweetDALRepositoryMock = new Mock <ITweetsRepository>(); tweetMapper = new Mock <ITweetMapper>(); service = new TweetBL(tweetDALRepositoryMock.Object, tweetMapper.Object); newTweet = new Tweet { UserId = 3, Text = "This is a unit test4444!", PostDate = DateTime.Parse("2016-05-13 14:46:29.387") }; tweetsList = new List <Tweet> { new Tweet { Id = 48, UserId = 58, Text = "This is Didina's First Post!", PostDate = DateTime.Parse("2016-05-10 13:50:32.820") }, new Tweet { Id = 49, UserId = 61, Text = "This is Eugen's First Post!", PostDate = DateTime.Parse("2016-05-10 13:50:47.957") }, new Tweet { Id = 50, UserId = 59, Text = "This is Valeriu's First Post!", PostDate = DateTime.Parse("2016-05-10 13:51:43.610") } }.AsQueryable(); }