예제 #1
0
 public void TestLinkPollFailsWhenThePollIsAlreadyLinkedToMoreThanOneItem()
 {
     // Create the app context for the poll to run in
     IAppContext mockedAppContext = CreateMockedAppContextAndDiagnostics();
     PollContentRating testPoll = new PollContentRating(mockedAppContext, null);
     testPoll.PollID = 123;
     using (IDnaDataReader mockedDataReader = CreateMockedDanDataReaderForAppContextWithValues("pollgetitemids", mockedAppContext, true, true))
     {
         Assert.IsFalse(testPoll.LinkPollWithItem(123, Poll.ItemType.ITEMTYPE_ARTICLE), "Should return false when poll is already linked to more than one item!");
     }
 }
예제 #2
0
 public void TestThatLinkingAnItemToANonLinkPollReturnsTrue()
 {
     // Create the app context for the poll to run in
     IAppContext mockedAppContext = CreateMockedAppContextAndDiagnostics();
     PollContentRating testPoll = new PollContentRating(mockedAppContext, null);
     testPoll.PollID = 123;
     using (IDnaDataReader mockedDataReader = CreateMockedDanDataReaderForAppContextWithValues("pollgetitemids", mockedAppContext, true, false))
     {
         using (IDnaDataReader mockedDataReader2 = CreateMockedDanDataReaderForAppContextWithValues("LinkPollWithItem", mockedAppContext, true, false))
         {
             Assert.IsTrue(testPoll.LinkPollWithItem(123, Poll.ItemType.ITEMTYPE_ARTICLE), "Should return true when adding a link to a poll that hasn't got one already!");
         }
     }
 }
예제 #3
0
 public void TestLinkPollWithItemReturnsFalseForInvalidPollID()
 {
     // Create the app context for the poll to run in
     IAppContext mockedAppContext = CreateMockedAppContextAndDiagnostics();
     PollContentRating testPoll = new PollContentRating(mockedAppContext, null);
     testPoll.PollID = -1;
     Assert.IsFalse(testPoll.LinkPollWithItem(123,Poll.ItemType.ITEMTYPE_ARTICLE),"Should return false when poll id is invalid!");
 }