예제 #1
0
        public void QueryPostID1()
        {
            var result = _iPostDAL.QueryDetail <Post>(Helper.GetURL(new RequestObject()
            {
                id = 1, URL = Constants.Posts
            }));

            ////Assert
            Assert.IsTrue(result != null && result.id == 1);
        }
예제 #2
0
        public void QueryAllPostsOnGetStringException()
        {
            _iPostDAL = new PostDAL(_iLogger, _stubIClient);

            _stubIClient.GetResponseHttpClientString = (arg1, arg2) =>
            {
                throw new Exception();
            };
            _iPostDAL.QueryDetail <Post>(Helper.GetURL(new RequestObject()
            {
                URL = ""
            }));
        }
예제 #3
0
        public void QueryAllPostsOnGetStringIsNull()
        {
            try
            {
                _iPostDAL = new PostDAL(_iLogger, _stubIClient);

                _stubIClient.GetResponseHttpClientString = (arg1, arg2) =>
                {
                    return("...");
                };
                _iPostDAL.QueryDetail <Post>(Helper.GetURL(new RequestObject()
                {
                    URL = ""
                }));
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.Message == "Input string '...' is not a valid number. Path '', line 1, position 3.");
            }
        }