Exemplo n.º 1
0
        public void Should_return_an_http_not_found_result()
        {
            var sut = new LinkController(
                Substitute.For <IRetrieveLinks>(),
                Substitute.For <ISaveLinks>());

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

            result.Should().BeOfType <NotFoundResult>();
        }
Exemplo n.º 2
0
        public void Should_return_an_http_ok_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.Metadata("id");

            result.Should().BeOfType <OkNegotiatedContentResult <Link> >();
        }
Exemplo n.º 3
0
        public void Should_return_the_href_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.Metadata("id");

            result.ContentAs <Link>().Href.Should().Be("http://example.com");
        }
        public void Should_return_an_http_ok_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.Metadata("id");

            result.StatusCode().Should().Be(200);
        }