예제 #1
0
        public void Extend_after_going_back()
        {
            var sut = new NavigationHistory();

            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;

            sut.GoBack(out item); // b

            sut.Extend("x");
            sut.Extend("y");

            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("x", item);
            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("b", item);

            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("x", item);
            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("y", item);
        }
        public void Go_back_from_end()
        {
            var sut = new NavigationHistory();
            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;
            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("b", item);
            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("a", item);
            Assert.IsFalse(sut.GoBack(out item));
        }
        public void Go_forward_from_beginning()
        {
            var sut = new NavigationHistory();
            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;
            sut.GoBack(out item);
            sut.GoBack(out item);

            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("b", item);
            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("c", item);
        }
예제 #4
0
        public void Go_back_from_end()
        {
            var sut = new NavigationHistory();

            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;

            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("b", item);
            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("a", item);
            Assert.IsFalse(sut.GoBack(out item));
        }
예제 #5
0
        public void Go_forward_from_beginning()
        {
            var sut = new NavigationHistory();

            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;

            sut.GoBack(out item);
            sut.GoBack(out item);

            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("b", item);
            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("c", item);
        }
        public void Extend_after_going_back()
        {
            var sut = new NavigationHistory();
            sut.Extend("a");
            sut.Extend("b");
            sut.Extend("c");

            string item;
            sut.GoBack(out item); // b

            sut.Extend("x");
            sut.Extend("y");

            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("x", item);
            Assert.IsTrue(sut.GoBack(out item));
            Assert.AreEqual("b", item);

            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("x", item);
            Assert.IsTrue(sut.GoForward(out item));
            Assert.AreEqual("y", item);
        }
예제 #7
0
 public Navigator()
 {
     _history.Extend("/");
 }