Ejemplo n.º 1
0
 public void setup()
 {
     RestClient = Substitute.For <IRestClient>();
     Alerter    = Substitute.For <IAlerter>();
     NavService = Substitute.For <INavigationService>();
     uut        = new SignupViewModel(NavService, RestClient, Alerter);
 }
Ejemplo n.º 2
0
        public AdminController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            IViewProviderManager <DefaultTenantSettings> settingsViewProvider,
            IViewProviderManager <ShellSettings> viewProvider,
            IAuthorizationService authorizationService,
            IShellSettingsManager shellSettingsManager,
            IBreadCrumbManager breadCrumbManager,
            ITenantSetUpService setUpService,
            ILogger <AdminController> logger,
            IShellSettings shellSettings,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _shellSettingsManager = shellSettingsManager;
            _settingsViewProvider = settingsViewProvider;
            _breadCrumbManager    = breadCrumbManager;
            _shellSettings        = shellSettings;
            _viewProvider         = viewProvider;
            _setUpService         = setUpService;
            _alerter = alerter;
            _logger  = logger;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 3
0
        public AdminController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            IViewProviderManager <ThemeAdmin> viewProvider,
            IAuthorizationService authorizationService,
            ISiteThemeFileManager themeFileManager,
            ISiteSettingsStore siteSettingsStore,
            IBreadCrumbManager breadCrumbManager,
            ISiteThemeLoader siteThemeLoader,
            IContextFacade contextFacade,
            IShellSettings shellSettings,
            IPlatoFileSystem fileSystem,
            IThemeCreator themeCreator,
            ISitesFolder sitesFolder,
            IPlatoHost platoHost,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _siteSettingsStore    = siteSettingsStore;
            _breadCrumbManager    = breadCrumbManager;
            _themeFileManager     = themeFileManager;
            _siteThemeLoader      = siteThemeLoader;
            _shellSettings        = shellSettings;
            _contextFacade        = contextFacade;
            _themeCreator         = themeCreator;
            _viewProvider         = viewProvider;
            _fileSystem           = fileSystem;
            _platoHost            = platoHost;
            _alerter = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 4
0
        public AlerterTests()
        {
            var serviceProvider = AppBootstrapper.Bootstrap(Directory.GetCurrentDirectory() + "../../../../../ExcelAlerter");

            alerter  = serviceProvider.GetService <IAlerter>();
            settings = serviceProvider.GetService <IOptionsMonitor <AppSettings> >().CurrentValue;
        }
Ejemplo n.º 5
0
        public AdminController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            IUserSecurityStampStore <User> securityStampStore,
            IAuthorizationService authorizationService,
            IPlatoUserManager <User> platoUserManager,
            IViewProviderManager <User> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IPlatoUserStore <User> platoUserStore,
            UserManager <User> userManager,
            IContextFacade contextFacade,
            IUserEmails userEmails,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _securityStampStore   = securityStampStore;
            _breadCrumbManager    = breadCrumbManager;
            _platoUserManager     = platoUserManager;
            _platoUserStore       = platoUserStore;
            _contextFacade        = contextFacade;
            _viewProvider         = viewProvider;
            _userManager          = userManager;
            _userEmails           = userEmails;
            _alerter = alerter;


            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 6
0
        public AccountController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            IViewProviderManager <UserRegistration> registerViewProvider,
            IViewProviderManager <UserLogin> loginViewProvider,
            IOptions <IdentityOptions> identityOptions,
            IPlatoUserManager <User> platoUserManager,
            IPlatoUserStore <User> platoUserStore,
            IBreadCrumbManager breadCrumbManager,
            ILogger <AccountController> logger,
            SignInManager <User> signInManage,
            UserManager <User> userManager,
            IUserEmails userEmails,
            IAlerter alerter)
        {
            _registerViewProvider = registerViewProvider;
            _breadCrumbManager    = breadCrumbManager;
            _loginViewProvider    = loginViewProvider;
            _platoUserManager     = platoUserManager;
            _identityOptions      = identityOptions;
            _platoUserStore       = platoUserStore;
            _signInManager        = signInManage;
            _userManager          = userManager;
            _userEmails           = userEmails;
            _alerter = alerter;
            _logger  = logger;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructor for the ViewModel for the Signup View
 /// This sets the Title and constructs an InputValidator for use in checking inputs
 /// </summary>
 /// <param name="navigationService"></param>
 public SignupViewModel(INavigationService navigationService)
 {
     Title = "Sign Up";
     _navigationService = navigationService;
     birthday           = DateTime.Now;
     Alerter            = new Alerter();
 }
Ejemplo n.º 8
0
        public AdminController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            IViewProviderManager <FileSetting> settingsViewProvider,
            IFileViewIncrementer <File> fileViewIncrementer,
            IViewProviderManager <File> indexViewProvider,
            IAuthorizationService authorizationService,
            IBreadCrumbManager breadCrumbManager,
            IPlatoRoleStore platoRoleStore,
            IContextFacade contextFacade,
            IFeatureFacade featureFacade,
            IFileStore <File> fileStore,
            IFileManager fileManager,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _settingsViewProvider = settingsViewProvider;
            _fileViewIncrementer  = fileViewIncrementer;
            _adminViewProvider    = indexViewProvider;
            _breadCrumbManager    = breadCrumbManager;
            _platoRoleStore       = platoRoleStore;
            _featureFacade        = featureFacade;
            _contextFacade        = contextFacade;
            _fileManager          = fileManager;
            _fileStore            = fileStore;
            _alerter = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 9
0
        public AdminController(
            ISampleEntityCategoriesService sampleEntityCategoriesService,
            ISampleEntityLabelsService sampleEntityLabelsService,
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            ISampleCategoriesService sampleCategoriesService,
            IViewProviderManager <DemoSettings> viewProvider,
            ISampleEntityTagsService sampleEntityTagsService,
            ISampleEntitiesService sampleEntitiesService,
            ISampleLabelsService sampleLabelsService,
            ISampleUsersService sampleUsersService,
            ISampleTagsService sampleTagsService,
            IBreadCrumbManager breadCrumbManager,
            IAlerter alerter)
        {
            _sampleEntityCategoriesService = sampleEntityCategoriesService;
            _sampleEntityLabelsService     = sampleEntityLabelsService;
            _sampleEntityTagsService       = sampleEntityTagsService;
            _sampleCategoriesService       = sampleCategoriesService;
            _sampleEntitiesService         = sampleEntitiesService;
            _sampleLabelsService           = sampleLabelsService;
            _sampleUsersService            = sampleUsersService;
            _sampleTagsService             = sampleTagsService;
            _breadCrumbManager             = breadCrumbManager;
            _viewProvider = viewProvider;
            _alerter      = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 10
0
        public HomeController(
            IHtmlLocalizer <HomeController> htmlLocalizer,
            IStringLocalizer <HomeController> stringLocalizer,
            ISpamSettingsStore <SpamSettings> spamSettingsStore,
            IAuthorizationService authorizationService,
            IEntityReplyStore <DocComment> entityReplyStore,
            IPlatoUserStore <User> platoUserStore,
            IOptions <PlatoOptions> platoOpts,
            IEntityStore <Doc> entityStore,
            IContextFacade contextFacade,
            ISpamChecker spamChecker,
            ISpamClient spamClient,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _spamSettingsStore    = spamSettingsStore;
            _entityReplyStore     = entityReplyStore;
            _platoUserStore       = platoUserStore;
            _contextFacade        = contextFacade;
            _platoOpts            = platoOpts.Value;
            _spamChecker          = spamChecker;
            _entityStore          = entityStore;
            _spamClient           = spamClient;
            _alerter = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            //Alerter需依照傳入的system code決定告警策略
            //系統A - Log
            //系統B - Log + Mail
            //系統C - Log + Mail + SMS

            var systemCode = "A";

            //使用工廠方法得到對應的Logger
            IAlerter alerter = SimpleAlerterFactory.CreateAlerter(systemCode);

            //var alerter = new MailAlerterDecorator(new LogAlerter());
            try
            {
                //simulate exception
                throw new Exception("Database connection timeout.");
            }
            catch (Exception e)
            {
                alerter.Notify(e.Message);
            }

            Console.Read();
        }
Ejemplo n.º 12
0
        private static IInjectionAlerter GetSut(
            IAlerter raiseEventAlerter     = null,
            IAlerter debugWriteAlerter     = null,
            IAlerter debugFailAlerter      = null,
            IAlerter throwExceptionAlerter = null)
        {
            var mock = new Mock <IAlerterFactory>();

            // Mock the factory
            if (raiseEventAlerter == null && debugWriteAlerter == null && debugFailAlerter == null &&
                throwExceptionAlerter == null)
            {
                return(new InjectionAlerter(mock.Object));
            }
            if (raiseEventAlerter != null)
            {
                mock.Setup(m => m.Get(InjectionAlertChannel.RaiseEvent)).Returns(raiseEventAlerter);
            }
            if (debugWriteAlerter != null)
            {
                mock.Setup(m => m.Get(InjectionAlertChannel.DebugWrite)).Returns(debugWriteAlerter);
            }
            if (debugFailAlerter != null)
            {
                mock.Setup(m => m.Get(InjectionAlertChannel.DebugFail)).Returns(debugFailAlerter);
            }
            if (throwExceptionAlerter != null)
            {
                mock.Setup(m => m.Get(InjectionAlertChannel.ThrowException)).Returns(throwExceptionAlerter);
            }
            return(new InjectionAlerter(mock.Object));
        }
Ejemplo n.º 13
0
        public HomeController(
            IStringLocalizer stringLocalizer,
            IHtmlLocalizer localizer,
            IEntityReplyStore <IdeaComment> entityReplyStore,
            IEntityHistoryManager <EntityHistory> entityHistoryManager,
            IEntityHistoryStore <EntityHistory> entityHistoryStore,
            IEntityReplyManager <IdeaComment> entityReplyManager,
            IAuthorizationService authorizationService,
            IInlineDiffBuilder inlineDiffBuilder,
            IEntityManager <Idea> entityManager,
            IEntityStore <Idea> entityStore,
            IContextFacade contextFacade,
            IAlerter alerter)
        {
            _entityHistoryManager = entityHistoryManager;
            _authorizationService = authorizationService;
            _entityReplyManager   = entityReplyManager;
            _entityHistoryStore   = entityHistoryStore;
            _inlineDiffBuilder    = inlineDiffBuilder;
            _entityReplyStore     = entityReplyStore;
            _contextFacade        = contextFacade;
            _entityManager        = entityManager;
            _entityStore          = entityStore;
            _alerter = alerter;

            T = localizer;
            S = stringLocalizer;
        }
 public ApprovalsController(UserManager <User> userManager, IApprovalService approvalService,
                            IRequestService requestService, IAlerter alerter)
 {
     this.userManager     = userManager;
     this.approvalService = approvalService;
     this.requestService  = requestService;
     this.alerter         = alerter;
 }
Ejemplo n.º 15
0
        public SignupViewModel(INavigationService navigationService, IRestClient restClient, IAlerter alert) : base(restClient)
        {
            Title = "Sign Up";
            _navigationService = navigationService;
            birthday           = DateTime.Now;

            Alerter = alert;
        }
Ejemplo n.º 16
0
 public Mediator(GameDb context, IAlerter alerter)
 {
     services = new ServiceCollection();
     services.AddSingleton(context);
     services.AddSingleton(alerter);
     services.AddSingleton(this);
     AddHandlers();
     CreateProvider();
 }
Ejemplo n.º 17
0
 public CreateModel(ISolutionService solutionService, UserManager <User> userManager,
                    AttachmentService <SolutionAttachment> attachmentService, IFileUploader fileUploader, IAlerter alerter)
 {
     this.Model             = new SolutionCreationBindingModel();
     this.solutionService   = solutionService;
     this.userManager       = userManager;
     this.attachmentService = attachmentService;
     this.fileUploader      = fileUploader;
     this.alerter           = alerter;
 }
Ejemplo n.º 18
0
 public CheckAllServicesJob(IServiceChecker checker,
                            IServiceRepository repository,
                            IAlerter alerter,
                            ServiceMonitorSettings settings,
                            ILogger <CheckAllServicesJob> logger)
 {
     _checker    = checker;
     _repository = repository;
     _alerter    = alerter;
     _settings   = settings;
     _logger     = logger;
 }
Ejemplo n.º 19
0
 public AlertFilter(
     IShellSettings shellSettings,
     HtmlEncoder htmlEncoder,
     ILogger <AlertFilter> logger,
     ILayoutUpdater layoutUpdater,
     IAlerter alerter)
 {
     _layoutUpdater = layoutUpdater;
     _alerter       = alerter;
     _htmlEncoder   = htmlEncoder;
     _logger        = logger;
     _tenantPath    = "/" + shellSettings.RequestedUrlPrefix;
 }
Ejemplo n.º 20
0
 public AlertFilter(
     ICookieBuilder cookieBuilder,
     ILayoutUpdater layoutUpdater,
     ILogger <AlertFilter> logger,
     HtmlEncoder htmlEncoder,
     IAlerter alerter)
 {
     _layoutUpdater = layoutUpdater;
     _cookieBuilder = cookieBuilder;
     _htmlEncoder   = htmlEncoder;
     _alerter       = alerter;
     _logger        = logger;
 }
 public RequestsController(UserManager <User> userManager,
                           IRequestService requestService, ICategoriesService categoriesService,
                           AttachmentService <RequestAttachment> attachmentService, RequestSorter requestSorter,
                           IAlerter alerter, IFileUploader fileUploader) : base(attachmentService)
 {
     this.userManager       = userManager;
     this.requestService    = requestService;
     this.categoriesService = categoriesService;
     this.attachmentService = attachmentService;
     this.requestSorter     = requestSorter;
     this.alerter           = alerter;
     this.fileUploader      = fileUploader;
 }
Ejemplo n.º 22
0
        public AdminController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            IViewProviderManager <PlatoSiteSettings> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IAlerter alerter)
        {
            _breadCrumbManager = breadCrumbManager;
            _viewProvider      = viewProvider;
            _alerter           = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 23
0
        public AdminController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            IViewProviderManager <AdminIndex> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IAlerter alerter)
        {
            _breadCrumbManager = breadCrumbManager;
            _viewProvider      = viewProvider;
            _alerter           = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
        public static bool checkAndAlert(AlertTarget alertTarget, BatteryCharacter batteryChar, double temperatureInC)
        {
            bool checkAlert = false;

            BreachType breachType = classifyTemperatureBreach(batteryChar.coolingType, temperatureInC);
            IAlerter   alerter    = FetchInstance(alertTarget.ToString()) as IAlerter;

            if (alerter != null)
            {
                alerter.TriggerBreachAlert(breachType);
                checkAlert = true;
            }

            return(checkAlert);
        }
Ejemplo n.º 25
0
 public Runner(ILogger logger, ICounter counter, ICassandraService cassandraService,
               CassandraConfiguration cassandraConfiguration, BackupConfiguration backupConfiguration,
               BackupArchivingConfiguration backupArchivingConfiguration, IAlerter alerter,
               AlertingConfiguration alertingConfiguration, IPatternMatching patternMatching)
 {
     _logger                       = logger;
     _alerter                      = alerter;
     _counter                      = counter;
     _cassandraService             = cassandraService;
     _cassandraConfiguration       = cassandraConfiguration;
     _backupArchivingConfiguration = backupArchivingConfiguration;
     _backupConfiguration          = backupConfiguration;
     _alertingConfiguration        = alertingConfiguration;
     _patternMatching              = patternMatching;
 }
Ejemplo n.º 26
0
        public HomeController(
            IStringLocalizer stringLocalizer,
            IHtmlLocalizer localizer,
            IViewProviderManager <HomeIndex> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IContextFacade contextFacade,
            IAlerter alerter)
        {
            _alerter           = alerter;
            _breadCrumbManager = breadCrumbManager;
            _viewProvider      = viewProvider;

            T = localizer;
            S = stringLocalizer;
        }
Ejemplo n.º 27
0
        public AdminController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            IViewProviderManager <PlatoTwitterSettings> viewProvider,
            IAuthorizationService authorizationService,
            IBreadCrumbManager breadCrumbManager,
            IAlerter alerter)
        {
            _authorizationService = authorizationService;
            _breadCrumbManager    = breadCrumbManager;
            _viewProvider         = viewProvider;
            _alerter = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 28
0
        public AdminController(
            IHtmlLocalizer htmlLocalizer,
            IStringLocalizer stringLocalizer,
            ISiteSettingsStore settingsStore,
            IContextFacade contextFacade,
            IViewProviderManager <AdminIndex> viewProvider,
            IBreadCrumbManager breadCrumbManager,
            IAlerter alerter)
        {
            _breadCrumbManager = breadCrumbManager;
            _viewProvider      = viewProvider;
            _alerter           = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 29
0
        public HomeController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            SignInManager <User> signInManager,
            IOptions <DemoOptions> demoOptions,
            IContextFacade contextFacade,
            IAlerter alerter)
        {
            _demoOptions   = demoOptions.Value;
            _contextFacade = contextFacade;
            _signInManager = signInManager;
            _alerter       = alerter;

            T = htmlLocalizer;
            S = stringLocalizer;
        }
Ejemplo n.º 30
0
        public AdminController(
            IHtmlLocalizer <AdminController> htmlLocalizer,
            IStringLocalizer <AdminController> stringLocalizer,
            IAuthorizationService authorizationService,
            IHttpsSettingsStore <HttpsSettings> httpsSettingsStore,
            IAlerter alerter,
            IBreadCrumbManager breadCrumbManager)
        {
            _alerter              = alerter;
            _breadCrumbManager    = breadCrumbManager;
            _authorizationService = authorizationService;
            _httpsSettingsStore   = httpsSettingsStore;

            T = htmlLocalizer;
            S = stringLocalizer;
        }