コード例 #1
0
 public EmailBuilderTests()
 {
     _exception          = new Exception("This is an exception!");
     _emailConfiguration = new EmailConfiguration
     {
         SmtpServer     = "http://localhost",
         SmtpPort       = 8080,
         UseCredentials = false,
         EnableSsl      = true,
         Sender         = new EmailAddress {
             Address = "*****@*****.**", DisplayName = "Sender"
         },
         Recipients = new List <EmailAddress>
         {
             new EmailAddress {
                 Address = "*****@*****.**", DisplayName = "Recipient 1"
             },
             new EmailAddress {
                 Address = "*****@*****.**", DisplayName = "Recipient 2"
             }
         }
     };
     _notifierOptions = new NotifierOptions
     {
         Environment = "Test",
         ProjectName = "Fried Chicken"
     };
 }
コード例 #2
0
 public ExceptionMessageBuilderTests()
 {
     _notifierOptions = new NotifierOptions
     {
         ProjectName = "Fried Chicken",
         Environment = "Development"
     };
 }
コード例 #3
0
 public HipchatMessageBuilderTests()
 {
     _exception       = new Exception("This is an exception!");
     _notifierOptions = new NotifierOptions
     {
         ProjectName = "Fried Chicken",
         Environment = "Development"
     };
 }
コード例 #4
0
 public FavoriteBasketsWatcherJob(ILogger <FavoriteBasketsWatcherJob> logger, IOptions <NotifierOptions> notifierOptions, ITooGoodToGoService tooGoodToGoService, IEmailService emailService, Context context)
 {
     _logger             = logger;
     _notifierOptions    = notifierOptions.Value;
     _tooGoodToGoService = tooGoodToGoService;
     _emailService       = emailService;
     _context            = context;
     _guid = Guid.NewGuid();
 }
コード例 #5
0
 public TooGoodToGoNotifierWorker(ILogger <TooGoodToGoNotifierWorker> logger, IHostApplicationLifetime hostApplicationLifetime, IServiceProvider serviceProvider, IOptions <NotifierOptions> notifierOptions, ITooGoodToGoService tooGoodToGoService, Context context)
 {
     _logger                  = logger;
     _serviceProvider         = serviceProvider;
     _hostApplicationLifetime = hostApplicationLifetime;
     _notifierOptions         = notifierOptions.Value;
     _tooGoodToGoService      = tooGoodToGoService;
     _context                 = context;
 }
コード例 #6
0
        public SlackMessageBuilder(SlackConfiguration configuration, Exception exception,
                                   NotifierOptions notifierOptions, HttpRequest request) : base(exception, notifierOptions, request)
        {
            if (!Uri.IsWellFormedUriString(configuration.WebhookUri, UriKind.Absolute))
            {
                throw new MalformedUriException("SlackMessageBuilder failure: Slack's webhook URI is invalid.");
            }

            _configuration = configuration;
        }
コード例 #7
0
        public EmailBuilder(EmailConfiguration configuration, Exception exception, NotifierOptions notifierOptions,
                            HttpRequest request) : base(exception, notifierOptions, request)
        {
            if (IsSenderNull(configuration.Sender))
            {
                throw new SenderNullException("EmailBuilder failure: Sender is null.");
            }

            if (IsRecipientsCollectionEmpty(configuration.Recipients))
            {
                throw new EmptyRecipientsException("EmailBuilder failure: Recipients collection is empty.");
            }

            _configuration = configuration;
        }
コード例 #8
0
 public SlackMessageBuilderTests()
 {
     _exception       = new Exception("This is an exception!");
     _notifierOptions = new NotifierOptions
     {
         ProjectName = "Fried Chicken",
         Environment = "Development"
     };
     _slackConfiguration = new SlackConfiguration
     {
         Channel    = "the chicken channel",
         Username   = "******",
         WebhookUri = "http://chicken-channel.slack.com/services/hooks/incomig-webhook?token=123"
     };
 }
コード例 #9
0
ファイル: NotifierService.cs プロジェクト: litfung/travely
 public NotifierService(IHubContext <NotificationHub, INotificationHub> hub, IOptionsMonitor <NotifierOptions> options)
 {
     _hubContext      = hub;
     _notifierOptions = options.CurrentValue;
 }
コード例 #10
0
ファイル: DIExtensions.cs プロジェクト: Hermeskhach/travely
 public static IServiceCollection AddNotifier(this IServiceCollection services, NotifierOptions options)
 {
     services.AddStackExchangeRedisCache(x => x.Configuration = options.RedisConnectionString);
     services.AddScoped <INotifierService, NotifierService>();
     services.AddSignalR()
     .AddStackExchangeRedis(options.RedisConnectionString, options =>
     {
         options.Configuration.ChannelPrefix = "Travely";
     });
     services.AddHostedService <Worker>();
     return(services);
 }
コード例 #11
0
 public HipchatMessageBuilder(Exception exception,
                              NotifierOptions notifierOptions, HttpRequest request) : base(exception, notifierOptions, request)
 {
 }