コード例 #1
0
        public void LoadCommentTest()
        {
            List <Comment> listComment       = new List <Comment>();
            IBusiness      instagramBusinees = new InstagramBussinessImpl();

            string jsonString = "{'data': [{'id': '17870686654164119', 'from': {'id': '39217616', 'username': '******', 'full_name': 'Anh Nguyen', 'profile_picture': 'https://scontent.cdninstagram.com/t51.2885-19/s150x150/21224977_117941655535007_1148284743813431296_a.jpg'}, 'text': 'This is a block of text', 'created_time': '1504232576'}],'meta': {'code': 200}}";

            listComment = instagramBusinees.LoadComment(jsonString);

            Assert.IsTrue(listComment.Count > 0);
            Assert.AreEqual(listComment[0].text, "This is a block of text");
        }
コード例 #2
0
        public void LoadCommentWrongFormatJsonTest()
        {
            List <Comment> listComment       = new List <Comment>();
            IBusiness      instagramBusinees = new InstagramBussinessImpl();
            Exception      exception         = new Exception();
            string         jsonString        = "";

            try
            {
                listComment = instagramBusinees.LoadComment(jsonString);
            }catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsTrue(listComment.Count == 0);
            Assert.IsNotNull(exception);
        }