Example #1
0
        public async Task TestComments()
        {
            // Test that the comment values are mapped correctly from the viewModel we pass in
            var posts            = MockFacebook.GetPosts();
            var viewModel        = new FacebookCardViewModel(posts[0]);
            var commentViewModel = new CommentViewModel(viewModel);

            await commentViewModel.DidLoad();

            // We do (+2) because there are always two additional more, the primary comment card and the "Now" header
            Assert.AreEqual(viewModel, commentViewModel.PrimaryCardViewModel);
            Assert.AreEqual(viewModel.CommentViewModels.Count + 2, commentViewModel.CardViewModels.Count);
        }
Example #2
0
        public void TestFacebookCard()
        {
            // Test that Facebook posts are mapped and formatted through viewModels correctly
            var posts      = MockFacebook.GetPosts();
            var viewModels = new List <BaseContentCardViewModel>();

            foreach (FacebookPost p in posts)
            {
                viewModels.Add(new FacebookCardViewModel(p));
            }

            var viewModel = viewModels[0];
            var post      = posts[0];

            Assert.AreEqual(viewModel.SocialMediaImage, "Facebook.png");
            Assert.AreEqual(viewModel.CommentCount.Value, post.Comments.Count);
            Assert.AreEqual(viewModel.ShareCount.Value, post.ShareCount);
        }