コード例 #1
0
ファイル: LinkHistoryTests.cs プロジェクト: filipw/RestAgent
        public void SupportsMultipleLinks()
        {
            //Arrange
            var linkHistory = new LinkHistory();
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/")});

            //Act
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/foo")});

            //Assert
            Assert.AreEqual("http://example.org/foo", linkHistory.CurrentLocation.Target.AbsoluteUri);
        }
コード例 #2
0
ファイル: LinkHistoryTests.cs プロジェクト: filipw/RestAgent
        public void GoBackRemovesFromHistory()
        {
            //Arrange
            var linkHistory = new LinkHistory();
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/foo")});

            //Act
            linkHistory.GoBack();

            //Assert
            Assert.AreEqual("http://example.org/", linkHistory.CurrentLocation.Target.AbsoluteUri);
        }
コード例 #3
0
ファイル: LinkHistoryTests.cs プロジェクト: filipw/RestAgent
        public void SupportsOnly10Links()
        {
            //Arrange
            var linkHistory = new LinkHistory();

            //Act
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/1")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/2")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/3")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/4")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/5")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/6")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/7")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/8")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/9")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/10")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/11")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/12")});
            linkHistory.AddToHistory(new Link() { Target = new Uri("http://example.org/13")});

            //Assert
            Assert.AreEqual( 10, linkHistory.Count());
            Assert.AreEqual("http://example.org/13", linkHistory.CurrentLocation.Target.AbsoluteUri);
        }