public void TestPetraShepherdFormLogicGetCurrentPageNumber() { TestLogicInterface TestLogicInterface = new TestLogicInterface(); TPetraShepherdFormLogic testGetCurrentPageNumber = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, TestLogicInterface); Assert.AreEqual(testGetCurrentPageNumber.GetCurrentPageNumber(), 1, "The current page was not 1."); testGetCurrentPageNumber.HandleActionNext(); Assert.AreEqual(testGetCurrentPageNumber.GetCurrentPageNumber(), 2, "The current page was not 2."); }
public void TestPetraShepherdFormLogicSwitchToFinishPage() { TestLogicInterface test = new TestLogicInterface(); TPetraShepherdFormLogic testFomLogicSwitchToFinishPage = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, test); Assert.AreEqual(testFomLogicSwitchToFinishPage.CurrentPage.ID, "5", "The first page was, unexpectly, not 5."); testFomLogicSwitchToFinishPage.SwitchToFinishPage(); }
public void TestPetraShepherdFormLogicSwitchToStartPage() { TestLogicInterface test = new TestLogicInterface(); TPetraShepherdFormLogic testFormLogicSwitchToStartPage = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, test); Assert.AreEqual(testFormLogicSwitchToStartPage.CurrentPage.ID, "5", "The first page was, unexpectedly, not 5."); testFormLogicSwitchToStartPage.HandleActionNext(); testFormLogicSwitchToStartPage.SwitchToStartPage(); Assert.AreEqual(testFormLogicSwitchToStartPage.CurrentPage.ID, "5", "Did not correctly switch back to the start page."); }
public void TestPetraShepherdFormLogicEnumeratePages() { TestLogicInterface TestLogicInterface = new TestLogicInterface(); TPetraShepherdFormLogic testEnumeratePages = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, TestLogicInterface); Assert.AreEqual(testEnumeratePages.EnumeratePages(), 4, "The current number of visible and inactive pages was not 4."); testEnumeratePages.HandleActionNext(); testEnumeratePages.CurrentPage.Enabled = false; testEnumeratePages.SwitchToStartPage(); Assert.AreEqual(testEnumeratePages.EnumeratePages(), 4, "The current number of visible and inactive pages was not 3. It may have been tricked up" + "by the fact that there was a change of what's visible/enabled."); }
public void TestPetraShepherdFormLogicHandleActionNextNormalCircumstances() { TestLogicInterface thisIsAtest = new TestLogicInterface(); TPetraShepherdFormLogic testFormLogic = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, thisIsAtest); //TESTS to show that the HandleActionNext() method moves from page to page under normal operating circumstances.. Assert.AreEqual(testFormLogic.CurrentPage.ID, "5"); testFormLogic.HandleActionNext(); Assert.AreEqual(testFormLogic.CurrentPage.ID, "56"); testFormLogic.HandleActionNext(); Assert.AreEqual(testFormLogic.CurrentPage.ID, "12"); testFormLogic.HandleActionNext(); Assert.AreEqual(testFormLogic.CurrentPage.ID, "FINISHPAGE_MASTER"); }
public void TestPetraShepherdFormLogicHandleActionNextOneUnenabled() { //TESTS to show that the HandleActionNext() method moves from page to page when //there is a Page that is not enabled TestLogicInterface thisIsAtest = new TestLogicInterface(); TPetraShepherdFormLogic testNotEnabledLogic = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, thisIsAtest); foreach (KeyValuePair <string, TPetraShepherdPage> pair in testNotEnabledLogic.ShepherdPages.Pages) { switch (pair.Key) { case "56": pair.Value.Enabled = false; break; } } Assert.True(testNotEnabledLogic.CurrentPage.Enabled); testNotEnabledLogic.HandleActionNext(); Assert.AreEqual(testNotEnabledLogic.CurrentPage.ID, "12"); }
public void TestPetraShepherdFormLogicSwitchToBackPage() { TestLogicInterface test = new TestLogicInterface(); TPetraShepherdFormLogic testFormLogicBackButton = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, test); Assert.AreEqual(testFormLogicBackButton.CurrentPage.ID, "5", "The first page of the shephred was not 5, as expected."); testFormLogicBackButton.HandleActionNext(); Assert.AreEqual(testFormLogicBackButton.CurrentPage.ID, "56", "The second page of the shepherd was not 56, as expected."); testFormLogicBackButton.HandleActionBack(); Assert.AreEqual(testFormLogicBackButton.CurrentPage.ID, "5", "The shepherd should have jumped back to page 5, but didn't."); testFormLogicBackButton.HandleActionNext(); testFormLogicBackButton.HandleActionNext(); testFormLogicBackButton.HandleActionBack(); Assert.AreEqual(testFormLogicBackButton.CurrentPage.ID, "56", "The shepherd should have jumped back to page 56, but didn't."); testFormLogicBackButton.HandleActionBack(); testFormLogicBackButton.HandleActionBack(); Assert.AreEqual(testFormLogicBackButton.CurrentPage.ID, "5", "The shepherd should not have jumped farther back than 5."); }
public void TestPetraShepherdFormLogicHandleActionNextOneInvisibleOneUnenabled() { //TESTS to show that the HandleActionNext() method moves from page to page when //there is a Page that is not visible nor enabled TestLogicInterface thisIsAtest = new TestLogicInterface(); TPetraShepherdFormLogic testNotVisibleOrEnabledLogic = new TPetraShepherdFormLogic(FTestShepherdYAMLFile, thisIsAtest); foreach (KeyValuePair <string, TPetraShepherdPage>pair in testNotVisibleOrEnabledLogic.ShepherdPages.Pages) { switch (pair.Key) { case "56": pair.Value.Visible = false; pair.Value.Enabled = false; break; } } Assert.True(testNotVisibleOrEnabledLogic.CurrentPage.Visible); testNotVisibleOrEnabledLogic.HandleActionNext(); Assert.AreEqual(testNotVisibleOrEnabledLogic.CurrentPage.ID, "12"); }