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); }
public urlshortener(IUrlHandler urlHandler) { _urlHandler = urlHandler; }
/// <summary> /// The AddHandler /// </summary> /// <param name="handler">The handler<see cref="IUrlHandler"/></param> private void AddHandler(IUrlHandler handler) { this.UrlHandlerDict.Add(handler.DomainName, handler); }
public TweetProcessor(ITwitterDataCapturer twitterDataCapturer, IUrlHandler urlHandler, TelemetryClient telementryClient) { _twitterDataCapturer = twitterDataCapturer; _urlHandler = urlHandler; _telementryClient = telementryClient; }