Exemplo n.º 1
0
        public void EnsureDependenciesAreSetup()
        {
            IConfiguration configuration = new ConfigurationBuilder()
                                           .AddJsonFile("appsettings.Development.json")
                                           .Build();

            ServiceCollection services = new ServiceCollection();

            //Due to needing a IHostingService when adding services.AddApplicationInsightsTelemetry() in Startup.
            //We need this line to avoid an exception being thrown when trying to get the IUrlHandler service.
            services.AddSingleton <TelemetryClient>();

            Startup startup = new Startup(configuration);

            startup.ConfigureServices(services);

            IUrlHandler urlHandler = services.BuildServiceProvider().GetService <IUrlHandler>();

            Assert.NotNull(urlHandler);
            Assert.IsType <UrlHandler>(urlHandler);
        }
Exemplo n.º 2
0
 public urlshortener(IUrlHandler urlHandler)
 {
     _urlHandler = urlHandler;
 }
Exemplo n.º 3
0
 /// <summary>
 /// The AddHandler
 /// </summary>
 /// <param name="handler">The handler<see cref="IUrlHandler"/></param>
 private void AddHandler(IUrlHandler handler)
 {
     this.UrlHandlerDict.Add(handler.DomainName, handler);
 }
Exemplo n.º 4
0
 public TweetProcessor(ITwitterDataCapturer twitterDataCapturer, IUrlHandler urlHandler, TelemetryClient telementryClient)
 {
     _twitterDataCapturer = twitterDataCapturer;
     _urlHandler          = urlHandler;
     _telementryClient    = telementryClient;
 }