Esempio n. 1
0
        public void should_be_able_to_find_shortened_urls()
        {
            //given
            var store = new MongoUrlStore(connectionString);

            store.SaveUrl("http://somelongurl.com/", "http://shorturl/abc");

            //when
            var longUrl = store.GetUrlFor("http://shorturl/abc");

            //then
            Assert.Equal("http://somelongurl.com/", longUrl);
        }
Esempio n. 2
0
        public void should_store_urls_in_mongo()
        {
            //when
            var store = new MongoUrlStore(connectionString);

            store.SaveUrl("http://somelongurl.com/", "http://shorturl/abc");

            //then
            var urlFromDB = urlCollection
                            .Find(Query.EQ("url", "http://somelongurl.com/"))
                            .FirstOrDefault();

            Assert.NotNull(urlFromDB);
            Assert.Equal(urlFromDB["shortenedUrl"], "http://shorturl/abc");
        }