public void Setup()
        {
            _provider    = TestUtility.InitDI();
            _logger      = Substitute.For <ILogger <SlackNotificationService> >();
            _settings    = Substitute.For <SettingsService>((IServiceProvider)null);
            _httpHandler = _provider.GetRequiredService <HttpClientHandler>() as TestHttpHandler;
            _bgExec      = Substitute.For <BackgroundExecutionWrapper>();

            _service = new SlackNotificationService(_logger, _settings, _provider, _bgExec);

            _settings.Notifications_Slack_WebHook.Returns("https://webhook.example.com/hook");
        }
Exemple #2
0
        public void Setup()
        {
            _notifier1 = Substitute.For <INotificationService>();
            _notifier2 = Substitute.For <INotificationService>();
            _bgExec    = Substitute.For <BackgroundExecutionWrapper>();
            _service   = new AggregateNotificationService(new List <INotificationService> {
                _notifier1, _notifier2
            }, _bgExec);

            _bgExec.When(bgx => bgx.Execute(Arg.Any <Action>()))
            .Do(ci =>
            {
                var action = ci.Arg <Action>();
                action.Invoke();
            });
        }