public void CanOrderListOfTweetsByCreatedDate()
        {
            //var dates = new DateTime[] { DateTime.UtcNow, DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow.AddMinutes(-2) };

            //var tweets = new Tweet[]
            //{
            //    new Tweet { CreatedDate = dates[1] },
            //    new Tweet { CreatedDate = dates[0] },
            //    new Tweet { CreatedDate = dates[2] }
            //}.AsQueryable();

            //Mock<ITwitterService> mock = new Mock<ITwitterService>();
            //mock.Setup(m => m.GetTweets()).Returns(tweets);

            var api = new DataController(/*mock.Object*/ new FakeTwitterService());
            var data = api.Get();

            Assert.AreEqual(DateTime.UtcNow.Date, data.Results[0].CreatedDate.Date);
        }
        public void CanProvideNumberOfUserMentionsPerAccount()
        {
            var tweets = new Tweet[]
            {
                new Tweet { Name = "N1", Text = "@user1 @user2" },
                new Tweet { Name = "N2", Text = "test1" },
                new Tweet { Name = "N3", Text = "test1" },
                new Tweet { Name = "N1", Text = "@user3" },
                new Tweet { Name = "N1", Text = "test1" },
                new Tweet { Name = "N2", Text = "@user4" }
            }.AsQueryable();

            Mock<ITwitterService> mock = new Mock<ITwitterService>();
            mock.Setup(m => m.GetTweets()).Returns(tweets);

            var api = new DataController(mock.Object);
            var data = api.Get();

            Assert.AreEqual(3, data.Accounts.Single(x => x.Name == "N1").TotalNumberOfOtherUserMentions);
            Assert.AreEqual(1, data.Accounts.Single(x => x.Name == "N2").TotalNumberOfOtherUserMentions);
            Assert.AreEqual(0, data.Accounts.Single(x => x.Name == "N3").TotalNumberOfOtherUserMentions);
        }
        public void CanProvideTotalNumberOfTweetsPerAccount()
        {
            var tweets = new Tweet[]
            {
                new Tweet { Name = "N1" },
                new Tweet {  Name = "N2" },
                new Tweet {  Name = "N3" },
                new Tweet { Name = "N1" },
                new Tweet { Name = "N1" },
                new Tweet {  Name = "N2" }
            }.AsQueryable();

            //Mock<ITwitterService> mock = new Mock<ITwitterService>();
            //mock.Setup(m => m.GetTweets()).Returns(tweets);

            var api = new DataController(/*mock.Object*/ new FakeTwitterService());
            var data = api.Get();

            Assert.AreEqual(3, data.Accounts.Single(x => x.Name == "N1").TotalNumberOfTweets);
            Assert.AreEqual(2, data.Accounts.Single(x => x.Name == "N2").TotalNumberOfTweets);
            Assert.AreEqual(1, data.Accounts.Single(x => x.Name == "N3").TotalNumberOfTweets);
        }
        public void DataControllerGetReturnsTweetsViewModel()
        {
            Mock<ITwitterService> mock = new Mock<ITwitterService>();

            var api = new DataController(mock.Object);
            var data = api.Get();

            Assert.IsInstanceOfType(data, typeof(TweetsViewModel));
        }
        public void DataControllerGetReturnsListOfTweets()
        {
            Mock<ITwitterService> mock = new Mock<ITwitterService>();

            var api = new DataController(mock.Object);
            var data = api.Get();

            Assert.IsInstanceOfType(data.Results, typeof(List<Tweet>));
            //Assert.AreEqual(0, data.Results.Count);
        }