public void Setup() { _repo = MockRepository.GenerateMock<ITwitterRepository>(); // Stub list to return when GetAll or GetPredicate is called var list = new List<TweetFromUser>() { new TweetFromUser { TweetText = "This is my tweet", User = new User { Name = "mark" } }, new TweetFromUser { TweetText = "This is Tom's tweet" , User = new User { Name = "Tom" } }, new TweetFromUser { TweetText = "This is another tweet" , User = new User { Name = "mark" } } }; _repo.Stub(d => d.GetAll()).Return(list); // when they use UserName == "mark" // _repo.Stub(d => d.GetTweetsByScreenName("mark")).Return(list.Where(d => d.User.Name == "mark")); _vm = new TwitterViewModel(_repo); }
public void Setup() { _repo = MockRepository.GenerateMock <ITwitterRepository>(); // Stub list to return when GetAll or GetPredicate is called var list = new List <TweetFromUser>() { new TweetFromUser { TweetText = "This is my tweet", User = new User { Name = "mark" } }, new TweetFromUser { TweetText = "This is Tom's tweet" , User = new User { Name = "Tom" } }, new TweetFromUser { TweetText = "This is another tweet" , User = new User { Name = "mark" } } }; _repo.Stub(d => d.GetAll()).Return(list); // when they use UserName == "mark" // _repo.Stub(d => d.GetTweetsByScreenName("mark")).Return(list.Where(d => d.User.Name == "mark")); _vm = new TwitterViewModel(_repo); }