Ejemplo n.º 1
0
        /// <summary>Checks that the instance has no data.</summary>
        public static bool IsEmpty(CommentPages value)
        {
            if (!string.IsNullOrWhiteSpace(value.FirstUrl))
            {
                return(false);
            }

            if (!string.IsNullOrWhiteSpace(value.LastUrl))
            {
                return(false);
            }

            if (!string.IsNullOrWhiteSpace(value.PrevUrl))
            {
                return(false);
            }

            if (!string.IsNullOrWhiteSpace(value.NextUrl))
            {
                return(false);
            }

            if (value.Current > 1 || value.Total > 1)
            {
                return(false);
            }

            return(true);
        }
        public void SaysItsEmptyOnlyWhenItIsReallyEmpty()
        {
            CommentPages cp = new CommentPages();

            Assert.IsTrue(CommentPages.IsEmpty(cp));

            Action <CommentPages>[] changers =
            {
                z => z.Current   =          2, z => z.Total   = 2, z => z.FirstUrl = "http://1", z => z.LastUrl = "http://1"
                , z => z.PrevUrl = "http://1", z => z.NextUrl = "http://1"
            };

            foreach (Action <CommentPages> changer in changers)
            {
                cp = new CommentPages();
                changer(cp);

                Assert.IsFalse(CommentPages.IsEmpty(cp));
            }
        }
Ejemplo n.º 3
0
 public EntryPage()
 {
     Replies      = new Replies();
     Entry        = new Entry();
     CommentPages = new CommentPages();
 }
 public void CommentPagesEmptyIsEmpty()
 {
     Assert.IsTrue(CommentPages.IsEmpty(CommentPages.Empty));
 }