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!"); } }
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!"); } } }
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!"); }