public void Should_return_null()
        {
            var sut = new StoreLinksInMemory();

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

            result.Should().BeNull();
        }
Exemplo n.º 2
0
        public void Should_return_the_link_with_the_specified_id()
        {
            var sut = new StoreLinksInMemory();

            var result = sut.WithId("known-link-id");

            result?.Id.Should().Be("known-link-id");
        }
Exemplo n.º 3
0
        public void Should_return_the_href_of_the_specified_link()
        {
            var sut = new StoreLinksInMemory();

            var result = sut.WithId("known-link-id");

            result?.Href.Should().Be("http://example.com");
        }
Exemplo n.º 4
0
        public void Should_save_a_link_with_the_specified_id()
        {
            var sut = new StoreLinksInMemory();

            sut.WithIdAndUrl("id", new Uri("http://example.com"));

            sut.WithId("id").Should().NotBeNull();
        }
Exemplo n.º 5
0
        internal static IServiceCollection AddLinkInMemoryStore(
            this IServiceCollection container)
        {
            var memoryStore = new StoreLinksInMemory();

            return(container
                   .AddSingleton <ISaveLinks>(memoryStore)
                   .AddSingleton <IRetrieveLinks>(memoryStore));
        }
Exemplo n.º 6
0
        public void Should_save_a_link_with_the_specified_url()
        {
            var sut = new StoreLinksInMemory();
            var url = new Uri("http://example.com");

            sut.WithIdAndUrl("id", url);

            sut.WithId("id")?.Href.Should().Be(url);
        }
        public void Should_replace_the_url_for_the_link_with_specified_id()
        {
            var sut = new StoreLinksInMemory();

            sut.WithIdAndUrl("id", new Uri("http://existing.com"));
            var newUrl = new Uri("http://example.com");

            sut.WithIdAndUrl("id", newUrl);

            sut.WithId("id")?.Href.Should().Be(newUrl);
        }