Esempio n. 1
0
        public void ShouldAskForPageNumber()
        {
            var output = A.Fake<IConsole>();
              var jtp = new JumpToPage(output);
              jtp.GetCommand(new PagedModel(new Model(), 0, 1), 0);

              A
            .CallTo(() => output.ReadLine())
            .MustHaveHappened();
        }
Esempio n. 2
0
        public void ShouldAskForPageNumber()
        {
            var output = A.Fake <IConsole>();
            var jtp    = new JumpToPage(output);

            jtp.GetCommand(new PagedModel(new Model(), 0, 1));

            A
            .CallTo(() => output.ReadLine())
            .MustHaveHappened();
        }
Esempio n. 3
0
        public void ShouldYieldExpectedPageIndexForUserInput(string userInput, int expectedNewPageIndex)
        {
            var model = new Model()
            .SetHeader(new[] { "header" })
            .AddRow(new[] { "one" })
            .AddRow(new[] { "two" })
            .AddRow(new[] { "three" });

              const int CurrentPage = 1;
              var paged = new PagedModel(model, CurrentPage, 1);

              var output = A.Fake<IConsole>();
              A
            .CallTo(() => output.ReadLine())
            .Returns(userInput);

              var jtp = new JumpToPage(output);
              var newPageIndex = jtp.GetCommand(paged, CurrentPage).Execute();

              Assert.AreEqual(expectedNewPageIndex, newPageIndex);
        }
Esempio n. 4
0
        public void ShouldYieldExpectedPageIndexForUserInput(string userInput, int expectedNewPageIndex)
        {
            var model = new Model()
                        .SetHeader(new[] { "header" })
                        .AddRow(new[] { "one" })
                        .AddRow(new[] { "two" })
                        .AddRow(new[] { "three" });

            const int CurrentPage = 1;
            var       paged       = new PagedModel(model, CurrentPage, 1);

            var output = A.Fake <IConsole>();

            A
            .CallTo(() => output.ReadLine())
            .Returns(userInput);

            var jtp          = new JumpToPage(output);
            var newPageIndex = jtp.GetCommand(paged).GetNextPageIndex();

            Assert.AreEqual(expectedNewPageIndex, newPageIndex);
        }