public void TestCreateNewPollWithRange() { // Create the app context for the poll to run in IAppContext mockedAppContext = CreateMockedAppContextAndDiagnostics(); using (IDnaDataReader reader = CreateDataReaderForMockedAppContextForStoreProcedure("CreateNewVote", mockedAppContext)) { PollContentRating testPoll = new PollContentRating(mockedAppContext, null); testPoll.SetResponseMinMax(0, 10); Assert.IsTrue(testPoll.CreatePoll(), "Creating a poll with a range should return true!"); } }
/// <summary> /// Creates a new valid content rating poll /// </summary> /// <param name="minResponse">The minimum response value</param> /// <param name="maxResponse">The maximum response value</param> /// <param name="appContext">The App context you want to create the poll in</param> /// <returns>The new poll</returns> private PollContentRating CreateValidPoll(int minResponse, int maxResponse, IAppContext appContext) { // Create the app context for the poll to run in using (IDnaDataReader reader = CreateDataReaderForMockedAppContextForStoreProcedure("CreateNewVote", appContext)) { PollContentRating testPoll = new PollContentRating(appContext, null); testPoll.SetResponseMinMax(0, 10); if (!testPoll.CreatePoll()) { return null; } return testPoll; } }
public void TestCreateNewPollFailsWithValidPollID() { // 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.CreatePoll(), "Creating a poll with a valid poll id should return false!"); }