示例#1
0
        public RulesEngineWrapper()
        {
            TrayNotificationEvents = new List <TrayNotifyEventArgs>();
            SetTrayIconEvents      = new List <SetTrayIconEventArgs>();
            RefreshStatusEvents    = new List <RefreshStatusEventArgs>();
            PlayWindowsAudioEvents = new List <PlayWindowsAudioEventArgs>();
            StatusBarUpdateEvents  = new List <UpdateStatusBarEventArgs>();
            ModalDialogEvents      = new List <ModalDialogEventArgs>();
            SetAudioEvents         = new List <SetAudioEventArgs>();
            SetLightsEvents        = new List <SetLightsEventArgs>();
            NewAlertEvents         = new List <NewAlertEventArgs>();
            NewAchievementEvents   = new List <NewAchievementEventArgs>();
            NewNewsItemEvents      = new List <NewNewsItemEventArgs>();
            NewUserEvents          = new List <NewUserEventArgs>();

            Settings            = new SirenOfShameSettingsFake();
            CiEntryPointSetting = new CiEntryPointSettingFake(Settings);
            Settings.CiEntryPointSettings.Add(CiEntryPointSetting);
            Settings.CiEntryPointSettings.First().BuildDefinitionSettings.Add(new BuildDefinitionSetting {
                Active = true, AffectsTrayIcon = true, Id = BUILD1_ID, Name = "Build Def 1"
            });
            Settings.CiEntryPointSettings.First().BuildDefinitionSettings.Add(new BuildDefinitionSetting {
                Active = true, AffectsTrayIcon = true, Id = BUILD2_ID, Name = "Build Def 2"
            });

            _rulesEngine = new FakeRulesEngine(Settings)
            {
                SosDb = _sosDbFake
            };

            _rulesEngine.TrayNotify       += (sender, arg) => TrayNotificationEvents.Add(arg);
            _rulesEngine.SetTrayIcon      += (sender, arg) => SetTrayIconEvents.Add(arg);
            _rulesEngine.RefreshStatus    += (sender, arg) => RefreshStatusEvents.Add(arg);
            _rulesEngine.PlayWindowsAudio += (sender, arg) => PlayWindowsAudioEvents.Add(arg);
            _rulesEngine.UpdateStatusBar  += (sender, arg) => StatusBarUpdateEvents.Add(arg);
            _rulesEngine.ModalDialog      += (sender, arg) => ModalDialogEvents.Add(arg);
            _rulesEngine.SetAudio         += (sender, arg) => SetAudioEvents.Add(arg);
            _rulesEngine.SetLights        += (sender, arg) => SetLightsEvents.Add(arg);
            _rulesEngine.NewAlert         += (sender, arg) => NewAlertEvents.Add(arg);
            _rulesEngine.NewAchievement   += (sender, arg) => NewAchievementEvents.Add(arg);
            _rulesEngine.NewNewsItem      += (sender, arg) => NewNewsItemEvents.Add(arg);
            _rulesEngine.NewUser          += (sender, arg) => NewUserEvents.Add(arg);
            _rulesEngine.StatsChanged     += (sender, arg) => StatsChangedEvents.Add(arg);

            _rulesEngine.Start(initialStart: true);
        }
        public RulesEngineWrapper()
        {
            TrayNotificationEvents = new List<TrayNotifyEventArgs>();
            SetTrayIconEvents = new List<SetTrayIconEventArgs>();
            RefreshStatusEvents = new List<RefreshStatusEventArgs>();
            PlayWindowsAudioEvents = new List<PlayWindowsAudioEventArgs>();
            StatusBarUpdateEvents = new List<UpdateStatusBarEventArgs>();
            ModalDialogEvents = new List<ModalDialogEventArgs>();
            SetAudioEvents = new List<SetAudioEventArgs>();
            SetLightsEvents = new List<SetLightsEventArgs>();
            NewAlertEvents = new List<NewAlertEventArgs>();
            NewAchievementEvents = new List<NewAchievementEventArgs>();
            NewNewsItemEvents = new List<NewNewsItemEventArgs>();
            NewUserEvents = new List<NewUserEventArgs>();

            Settings = new SirenOfShameSettingsFake();
            CiEntryPointSetting = new CiEntryPointSettingFake(Settings);
            Settings.CiEntryPointSettings.Add(CiEntryPointSetting);
            Settings.CiEntryPointSettings.First().BuildDefinitionSettings.Add(new BuildDefinitionSetting { Active = true, AffectsTrayIcon = true, Id = BUILD1_ID, Name = "Build Def 1" });
            Settings.CiEntryPointSettings.First().BuildDefinitionSettings.Add(new BuildDefinitionSetting { Active = true, AffectsTrayIcon = true, Id = BUILD2_ID, Name = "Build Def 2" });

            _rulesEngine = new FakeRulesEngine(Settings)
            {
                SosDb = _sosDbFake
            };

            _rulesEngine.TrayNotify += (sender, arg) => TrayNotificationEvents.Add(arg);
            _rulesEngine.SetTrayIcon += (sender, arg) => SetTrayIconEvents.Add(arg);
            _rulesEngine.RefreshStatus += (sender, arg) => RefreshStatusEvents.Add(arg);
            _rulesEngine.PlayWindowsAudio += (sender, arg) => PlayWindowsAudioEvents.Add(arg);
            _rulesEngine.UpdateStatusBar += (sender, arg) => StatusBarUpdateEvents.Add(arg);
            _rulesEngine.ModalDialog += (sender, arg) => ModalDialogEvents.Add(arg);
            _rulesEngine.SetAudio += (sender, arg) => SetAudioEvents.Add(arg);
            _rulesEngine.SetLights += (sender, arg) => SetLightsEvents.Add(arg);
            _rulesEngine.NewAlert += (sender, arg) => NewAlertEvents.Add(arg);
            _rulesEngine.NewAchievement += (sender, arg) => NewAchievementEvents.Add(arg);
            _rulesEngine.NewNewsItem += (sender, arg) => NewNewsItemEvents.Add(arg);
            _rulesEngine.NewUser += (sender, arg) => NewUserEvents.Add(arg);

            _rulesEngine.Start(initialStart: true);
        }