public void FirstPage_GivenDataRecordsAndPageSize_ReturnsFirstPage()
        {
            var sut = new Table(Create10Records(), defaultPageSize: 3);

            Page nextPage = sut.LastPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages.Last()), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages.First()), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[1]), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[2]), "table's page");

            nextPage = sut.LastPage();
            Assert.That(nextPage, Is.EqualTo(sut.LastPage()), "table's page");

            nextPage = sut.FirstPage();
            Assert.That(nextPage, Is.EqualTo(sut.FirstPage()), "table's page");

            nextPage = sut.PreviousPage();
            Assert.That(nextPage, Is.EqualTo(sut.LastPage()), "table's page");
        }
        public void Show_GivenATableFilledWithDataRecordsFittingOnTwoPages_ShowTableWithAllUserCommands()
        {
            Table table = new Table(ThreeDataRecords(), defaultPageSize: 1);

            var sut = new ConsoleDisplay();
            sut.Show(table.NextPage());
            sut.PrintUserOptionsFor(table.PageCount);

            var expectedOutput = "Field1|Field2|Field3|" + NL +
                                 "------+------+------+" + NL +
                                 "Field1|Field2|Field3|" + NL +
                                 CR + NL +
                                 ConsoleDisplay.ALL_USER_COMMANDS + CR + NL;

            Assert.That(displayOutput.ToString(), Is.EqualTo(expectedOutput), "display output");
        }
        public void NextPage_GivenDataRecordsAndPageSize_ReturnsNextPage()
        {
            var sut = new Table(Create10Records(), defaultPageSize: 3);

            Page nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[0]), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[1]), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[2]), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[3]), "table's page");

            nextPage = sut.NextPage();
            Assert.That(nextPage, Is.EqualTo(sut.Pages[0]), "table's page");
        }