protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var mongoUrlStore = new MongoUrlStore("mongodb://localhost:27010/short_url"); container.Register<UrlStore>(mongoUrlStore); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var mongoUrlStore = new MongoUrlStore("mongodb://localhost:27017/short_url"); container.Register <UrlStore>(mongoUrlStore); }
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); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var mongoUrl = System.Environment.GetEnvironmentVariable("DATABASE_URL"); if (mongoUrl == null) { mongoUrl = "mongodb://localhost:27017/short_url"; } var mongoUrlStore = new MongoUrlStore(mongoUrl); container.Register <UrlStore>(mongoUrlStore); }
protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var connString = Environment.GetEnvironmentVariable("MONGOLAB_URI"); if (String.IsNullOrEmpty(connString)) { connString = ConfigurationManager.AppSettings["MONGOLAB_URI"]; } var mongoUrlStore = new MongoUrlStore(connString); container.Register <UrlStore>(mongoUrlStore); }
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"); }