コード例 #1
0
        public void ReturnsFeedInfo()
        {
            FeedDataController controller = new FeedDataController(new FeedServices());

            var feedInfo = (FeedInfo)controller.ReturnsFeedInfo().Value;

            Assert.AreEqual(feedInfo.MostUsed10.Count, 10);
            Assert.AreEqual(feedInfo.Topics.Count, 10);
        }
コード例 #2
0
        public void ReturnsFeedInfo()
        {
            Mock <IFeedServices> feedServicesMock = new Mock <IFeedServices>();

            var feedTopics = new List <FeedTopic>();

            for (int i = 0; i < 10; i++)
            {
                feedTopics.Add(new FeedTopic("Exemplo de topico com palavras de exemplo " + i));
            }

            feedServicesMock.Setup(x => x.GetFirst10FeedTopics(false)).Returns(feedTopics);

            FeedDataController controller = new FeedDataController(feedServicesMock.Object);

            var feedInfo = (FeedInfo)controller.ReturnsFeedInfo().Value;

            var expected = new FeedInfo(feedTopics);

            Assert.AreEqual(expected.MostUsed10.Count, feedInfo.MostUsed10.Count);
            Assert.AreEqual(expected.Topics.Count, feedInfo.Topics.Count);
        }