public CoverageProcessorTest() { this._stubFileHelper = Substitute.For <IFileHelper>(); this._stubReportParser = Substitute.For <IReportParser>(); this._stubCoverageUpdater = Substitute.For <ICoverageUpdater>(); this._stubNotifyer = Substitute.For <INotifyer>(); this._stubEmailNotifyer = Substitute.For <INotifyer>(); this._stubCoverageLogger = Substitute.For <ICoverageLogger>(); this._stubCoverageCollect = Substitute.For <ICoverageCollect>(); this._stubConfiguration = Substitute.For <IConfiguration>(); this._stubServiceProvider = Substitute.For <IServiceProvider>(); this._stubServiceProvider.GetService <IFileHelper>().Returns(this._stubFileHelper); this._stubServiceProvider.GetService <IReportParser>().Returns(this._stubReportParser); this._stubServiceProvider.GetService <ICoverageUpdater>().Returns(this._stubCoverageUpdater); //this._stubServiceProvider.GetService<INotifyer>().Returns(this._stubNotifyer); //this._stubServiceProvider.GetService<INotifyer>().Returns(this._stubEmailNotifyer); //this._stubServiceProvider.GetService<INotifyer>().Returns(new SlackNotifyer(this._stubServiceProvider)); //this._stubServiceProvider.GetService<INotifyer>().Returns(new EmailNotifyer(this._stubServiceProvider)); this._stubServiceProvider.GetService <IEnumerable <INotifyer> >().Returns(new List <INotifyer> { this._stubNotifyer, this._stubEmailNotifyer }); this._stubServiceProvider.GetService <ICoverageLogger>().Returns(this._stubCoverageLogger); this._stubServiceProvider.GetService <ICoverageCollect>().Returns(this._stubCoverageCollect); this._stubServiceProvider.GetService <IConfiguration>().Returns(this._stubConfiguration); //this._stubServiceProvider.GetServices<INotifyer>(); //this._stubServiceProvider.GetServices<INotifyer>().Returns(new List<INotifyer> { this._stubNotifyer, this._stubEmailNotifyer }); }
public CoverageProcessor(IServiceProvider serviceProvider) { this._serviceProvider = serviceProvider; this._fileHelper = serviceProvider.GetRequiredService <IFileHelper>(); this._reportParser = serviceProvider.GetRequiredService <IReportParser>(); this._coverageCollect = serviceProvider.GetRequiredService <ICoverageCollect>(); this._coverageUpdater = serviceProvider.GetRequiredService <ICoverageUpdater>(); this._coverageLogger = serviceProvider.GetRequiredService <ICoverageLogger>(); this._configuration = serviceProvider.GetRequiredService <IConfiguration>(); }