コード例 #1
0
        public void Should_return_an_http_not_found_result()
        {
            var sut = new LinkController(
                Substitute.For <IRetrieveLinks>(),
                Substitute.For <ISaveLinks>());

            var result = sut.Follow("unknown-link-id");

            result.Should().BeOfType <NotFoundResult>();
        }
コード例 #2
0
        public void Should_return_an_http_moved_result()
        {
            var getLink = Substitute.For <IRetrieveLinks>();

            getLink.WithId("id").Returns(new Link("id,", "http://example.com"));
            var sut = new LinkController(getLink, Substitute.For <ISaveLinks>());

            var result = sut.Follow("id");

            result.Should().BeOfType <RedirectResult>();
        }
コード例 #3
0
        public void Should_return_the_url_of_the_link()
        {
            var getLink = Substitute.For <IRetrieveLinks>();

            getLink.WithId("id").Returns(new Link("id,", "http://example.com"));
            var sut = new LinkController(getLink, Substitute.For <ISaveLinks>());

            var result = sut.Follow("id");

            result.Should().BeOfType <RedirectResult>()
            .Which.Location.Should().Be("http://example.com/");
        }