Commits

Anonymous committed c76dfed

brainstorming some unit tests for future functionality. at this point they are all inconclusive

  • Participants
  • Parent commits f6bb036

Comments (0)

Files changed (1)

File development/src/Tests/PostLogicTest.cs

             #endregion //Post Types
 
             #region Posts
+
             //now let's create some posts by the user profiles
             var firstPost = new Post()
             {
                 Heading = "Why is this the first question?",
                 CreateDate = DateTime.Now,
                 Type = questionType,
+                SeoUrlSuffix = "why-is-this-the-first-question"
             };
 
             var firstAnswer = new Post()
                 Heading = "First!",
                 CreateDate = DateTime.Now,
                 Type = answerType,
+                SeoUrlSuffix = "first-answer",
+                Parent = firstPost,
             };
 
             _context.Posts.AddObject(firstPost);
         #endregion
 
 
+        #region Test Methods
+
+        #region Multi-Post Operations
+
         /// <summary>
-        ///A test for GetPostsByType
+        ///are posts returned by a post type?
         ///</summary>
         [TestMethod()]
-        public void GetPostsByTypeTest()
+        public void CanGetPostsByType()
         {
             PostLogic target = new PostLogic(_isMock);
             PostTypes pt = PostTypes.Question;
             }
             Assert.IsTrue(allMatch);
         }
+
+        /// <summary>
+        /// are highest rated questions returning?
+        /// </summary>
+        [TestMethod()]
+        public void CanGetHighestRatedQuestions()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are latest unanswered questions returning?
+        /// </summary>
+        [TestMethod()]
+        public void CanGetLatestUnansweredQuestions()
+        {
+            Assert.Inconclusive();
+        }
+
+        [TestMethod()]
+        public void CanGetHighestRatedUnansweredQuestions()
+        {
+            Assert.Inconclusive();
+        }
+
+        #endregion //Multi-Post Operations
+
+        #region Individual Post Operations
+
+        /// <summary>
+        /// is a post returned based on the unique seo url?
+        /// </summary>
+        [TestMethod()]
+        public void CanFindPostBySeoUrl()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are comments working on answer posts?
+        /// </summary>
+        [TestMethod()]
+        public void CanAddCommentsToAnswerPost()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are answer posts working on question posts?
+        /// </summary>
+        [TestMethod()]
+        public void CanAddAnswersToQuestionPost()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are answers not allowed for closed questions?
+        /// </summary>
+        [TestMethod()]
+        public void NotAllowedToAnswerClosedQuestions()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are comments not allowed for answers where the root question has been closed?
+        /// </summary>
+        [TestMethod()]
+        public void NotAllowedToCommentOnClosedAnswer()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are votes for posts working?
+        /// </summary>
+        [TestMethod()]
+        public void CanVoteOnPost()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// is selecting a favorite child post working (e.g. for selecting the best answer to a question)
+        /// </summary>
+        [TestMethod()]
+        public void CanSpecifyFavoriteChildPost()
+        {
+            Assert.Inconclusive();
+        }
+
+        /// <summary>
+        /// are duplicate posts tracking properly?
+        /// </summary>
+        [TestMethod()]
+        public void CanSpecifyDuplicateForPost()
+        {
+            Assert.Inconclusive();
+
+            //TODO: need more thought on this
+            // maybe add a "Confirmed Duplicates" type of entity
+            // that will allow the original poster to confirm that their question is a duplicate of another
+            // and then that will also close question and link back to the younger question
+            // also need to add some consideration regarding scenarios... is "creation date" the best way?
+            // should popularity and answers/etc. play a role in determining which is considered the duplicate?
+            //should both be linked to each other? (what about 10 questions each linking to 10 other duplicates?--crazy?)
+            // "DuplicateOf" property probably makes the most sense
+        }
+
+        #endregion //Individual Post Operations
+
+        #region Helper Operations
+
+        /// <summary>
+        /// is a generated seo url really unique?
+        /// </summary>
+        [TestMethod()]
+        public void GeneratedSeoUrlIsUnique()
+        {
+            Assert.Inconclusive();
+            //TODO: need more consideration on the best way to make a unique URL
+            // and whether all of that needs to be stored in the field or not
+            //
+            // stackoverflow URLS look like this: 
+            // questions/15128146/uitabbarcontroller-containing-uisplitviewcontroller-doesnt-handle-rotation-on-i
+            // seemingly following the pattern:
+            // {controller}/{id}/{seo-suffix}
+            // where the int ID is probably the primary key in the DB
+            // if i do the same pattern here, it might look something like this:
+            // questions/F52BD50C-E9A5-4B5E-962C-39FA595FB4BA/uitabbarcontroller-containing-uisplitviewcontroller-doesnt-handle-rotation-on-i
+            // problem: takes up way more space, URLS are limited
+            // does this matter?
+            //if done this way, the seo-url doesn't need to be unique or used to get data on the posts as the pkid is in the full URL
+            // other options:
+            // questions/1362029760/bogdanvarlamov/uitabbarcontroller-containing-uisplitviewcontroller-doesnt-handle-rotation-on-i
+            // pattern: {controller}/{UTC ticks}/{user}/{seo suffix}
+            // not much shorter than the guid, more work to lookup in DB :\
+            // the guid-url in the example is 126 chars long. I think the URL limit is like 255 chars, so still plenty left for domain prefixes and such
+            // what's a sensible limit to the seo-suffix?
+        }
+
+        #endregion //Helper Operations
+
+        #endregion //Test Methods
     }
 }