public void Create_A_New_TweeterReport_With_Predefined_Accounts() { var tweeterReport = new TweeterReport("@pay_by_phone,@PayByPhone,@PayByPhone_UK".Split(','), new TweeterRepository()); Assert.IsNotNull(tweeterReport); }
public void Get_An_Empty_List_Of_Tweets() { var mock = new Mock<IRepository<Tweet>>(MockBehavior.Strict); mock.Setup(x => x.GetAll(new AccountParameter())).Returns(Enumerable.Empty<Tweet>().AsQueryable()); // create empty report var tweeterReport = new TweeterReport(); tweeterReport.TweeterRepository = mock.Object; var result = tweeterReport.Tweets; // test TweeterReport.Tweets Assert.AreEqual(0, result.Count()); // expecting no tweet }
public void Get_Tweets_Count_Per_Account() { var mock = new Rhino.Mocks.MockRepository(); var repository = mock.StrictMock<IRepository<Tweet>>(); Expect.Call(repository.GetAll(null)).IgnoreArguments().Return(CreateTestData()); var tweeterReport = new TweeterReport("@pay_by_phone".Split(','), null); tweeterReport.TweeterRepository = repository; mock.ReplayAll(); var tweetsPerAccount = tweeterReport.TweetsPerAccount; Assert.AreEqual(3, tweetsPerAccount[0].Value); }
public void Get_All_Tweets() { var mock = new Rhino.Mocks.MockRepository(); var repository = mock.StrictMock<IRepository<Tweet>>(); Expect.Call(repository.GetAll(null)).IgnoreArguments().Return(CreateTestData()); var tweeterReport = new TweeterReport("@pay_by_phone".Split(','), null); tweeterReport.TweeterRepository = repository; mock.ReplayAll(); var result = tweeterReport.Tweets; // test TweeterReport.Tweets Assert.AreEqual(3, result.Count()); // expecting 3 tweets }
public void Get_An_Empty_List_Of_Tweets() { var mock = new Rhino.Mocks.MockRepository(); var repository = mock.StrictMock<IRepository<Tweet>>(); var report = mock.StrictMock<TweeterReport>(); Expect.Call(() => report.AddAccounts(null)).IgnoreArguments(); SetupResult.For(report.Tweets).Return(null); var tweeterReport = new TweeterReport("".Split(','), repository); mock.ReplayAll(); var pbpController = new PbpController(report); var result = pbpController.Get(); Assert.IsNull(((TweeterReport) result.Data).Tweets); }