當前位置: 首頁>>代碼示例>>C#>>正文


C# Watcher.RulesEngineWrapper類代碼示例

本文整理匯總了C#中SirenOfShame.Test.Unit.Watcher.RulesEngineWrapper的典型用法代碼示例。如果您正苦於以下問題:C# RulesEngineWrapper類的具體用法?C# RulesEngineWrapper怎麽用?C# RulesEngineWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RulesEngineWrapper類屬於SirenOfShame.Test.Unit.Watcher命名空間,在下文中一共展示了RulesEngineWrapper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BuildStatusChanged_SyncBuildStatuses_DoesSync

 public void BuildStatusChanged_SyncBuildStatuses_DoesSync()
 {
     var rulesEngine = new RulesEngineWrapper();
     rulesEngine.Settings.SosOnlineAlwaysSync = true;
     rulesEngine.Settings.SosOnlineWhatToSync = WhatToSyncEnum.BuildStatuses;
     rulesEngine.Settings.SosOnlineUsername = "mockUsername";
     var mock = new Mock<SosOnlineService>();
     rulesEngine.SosOnlineService = mock.Object;
     rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
     mock.Verify(i => i.BuildStatusChanged(It.IsAny<SirenOfShameSettings>(), It.IsAny<IList<BuildStatus>>(), It.IsAny<List<InstanceUserDto>>()), Times.Once());
 }
開發者ID:BubbaFatAss,項目名稱:SirenOfShame,代碼行數:11,代碼來源:SosOnlineServiceTest.cs

示例2: BuidFailsForMyBuild_OneAlert

        public void BuidFailsForMyBuild_OneAlert()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.Rules.Add(new Rule
            {
                TriggerType = TriggerType.BuildFailed,
                AlertType = AlertType.ModalDialog,
                BuildDefinitionId = RulesEngineWrapper.BUILD1_ID
            });

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
            Assert.AreEqual(1, rulesEngine.ModalDialogEvents.Count);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:14,代碼來源:RulesEngineTest.cs

示例3: BuidFailsForSomeOtherBuild_NoAlert

        public void BuidFailsForSomeOtherBuild_NoAlert()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.Rules.Add(new Rule
            {
                TriggerType = TriggerType.BuildFailed,
                AlertType = AlertType.ModalDialog,
                BuildDefinitionId = "SomeOtherBuild"
            });

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
            Assert.AreEqual(0, rulesEngine.ModalDialogEvents.Count);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:14,代碼來源:RulesEngineTest.cs

示例4: BuidFailsThenSucceedsWithGlobalSubsequentSuccessAlerts_NoAlert

        public void BuidFailsThenSucceedsWithGlobalSubsequentSuccessAlerts_NoAlert()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.Rules.Add(new Rule
            {
                TriggerType = TriggerType.SuccessfulBuild,
                AlertType = AlertType.TrayAlert
            });

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
            Assert.AreEqual(0, rulesEngine.TrayNotificationEvents.Count);
        }
開發者ID:sscctech,項目名稱:SirenOfShame,代碼行數:15,代碼來源:RulesEngineTest.cs

示例5: Synchronize_ICheckInWithAlwaysSyncSetting_SosOnlineServiceSynchronize

        public void Synchronize_ICheckInWithAlwaysSyncSetting_SosOnlineServiceSynchronize()
        {
            var rulesEngine = new RulesEngineWrapper();
            rulesEngine.Settings.SosOnlineAlwaysSync = true;
            rulesEngine.Settings.SosOnlineUsername = "mockUsername";
            rulesEngine.Settings.MyRawName = RulesEngineWrapper.CURRENT_USER;

            var sosOnlineService = new Mock<SosOnlineService>();
            sosOnlineService.Setup(i => i.Synchronize(It.IsAny<SirenOfShameSettings>(), "633979044610000000,633979050100000000,1", null, It.IsAny<Action<DateTime>>(), It.IsAny<Action<String, ServerUnavailableException>>()))
                .Verifiable();
            rulesEngine.SosOnlineService = sosOnlineService.Object;

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);

            sosOnlineService.Verify();
        }
開發者ID:BubbaFatAss,項目名稱:SirenOfShame,代碼行數:18,代碼來源:SosOnlineServiceTest.cs

示例6: BreakThenFixesBuild_UserHasStatsUpdated

        public void BreakThenFixesBuild_UserHasStatsUpdated()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken); // it should ignore initial states
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);

            Assert.AreEqual(1, rulesEngine.Settings.People.Count);
            Assert.AreEqual(1, rulesEngine.Settings.People[0].TotalBuilds);
            Assert.AreEqual(1, rulesEngine.Settings.People[0].FailedBuilds);

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);

            Assert.AreEqual(1, rulesEngine.Settings.People[0].TotalBuilds);
            Assert.AreEqual(1, rulesEngine.Settings.People[0].FailedBuilds);

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);

            Assert.AreEqual(2, rulesEngine.Settings.People[0].TotalBuilds);
            Assert.AreEqual(1, rulesEngine.Settings.People[0].FailedBuilds);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:22,代碼來源:RulesEngineTest.cs

示例7: InProgressDoesNotWrite

        public void InProgressDoesNotWrite()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working); // do not write initial states
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);

            var lines = rulesEngine.SosDb.ReadAll(RulesEngineWrapper.BUILD1_ID);

            Assert.AreEqual(1, lines.Count);
            var buildDefinition = lines.First();
            Assert.AreEqual("User1", buildDefinition.RequestedBy);
            Assert.AreEqual(new DateTime(2010, 1, 1, 1, 1, 1), buildDefinition.StartedTime);
            Assert.AreEqual(new DateTime(2010, 1, 1, 1, 10, 10), buildDefinition.FinishedTime);
            Assert.AreEqual(null, buildDefinition.Comment);
            Assert.AreEqual(BuildStatusEnum.Broken, buildDefinition.BuildStatusEnum);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:18,代碼來源:RulesEngineTest.cs

示例8: InitialStatesDoNotWrite

 public void InitialStatesDoNotWrite()
 {
     var rulesEngine = new RulesEngineWrapper();
     rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working); // do not write initial states
     var lines = rulesEngine.SosDb.ReadAll(RulesEngineWrapper.BUILD1_ID);
     Assert.AreEqual(0, lines.Count);
 }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:7,代碼來源:RulesEngineTest.cs

示例9: InitialStatusChecked_RefreshStatus

        public void InitialStatusChecked_RefreshStatus()
        {
            var rulesEngine = new RulesEngineWrapper();

            Assert.AreEqual(1, rulesEngine.RefreshStatusEvents.Count);

            var startedTime = new DateTime(2010, 1, 2, 1, 1, 1);
            var finishedTime = new DateTime(2010, 1, 2, 1, 2, 2);

            rulesEngine.InvokeStatusChecked(new[]
            {
                new BuildStatus
                {
                    BuildStatusEnum = BuildStatusEnum.Working,
                    Name = "Build Def 1",
                    RequestedBy = "User1",
                    BuildDefinitionId = "Build Def 1",
                    StartedTime = startedTime,
                    FinishedTime = finishedTime
                },
            });

            Assert.AreEqual(2, rulesEngine.RefreshStatusEvents.Count);
            Assert.AreEqual(1, rulesEngine.RefreshStatusEvents[1].BuildStatusDtos.Count());
            BuildStatusDto buildStatus = rulesEngine.RefreshStatusEvents[1].BuildStatusDtos.First();
            Assert.AreEqual((int)BallsEnum.Green, buildStatus.ImageIndex);
            Assert.AreEqual("Build Def 1", buildStatus.BuildDefinitionDisplayName);
            Assert.AreEqual("User1", buildStatus.RequestedByRawName);
            Assert.AreEqual("Build Def 1", buildStatus.BuildDefinitionId);
            Assert.AreEqual(BuildStatus.FormatAsDayMonthTime(startedTime), buildStatus.StartTimeShort);
            Assert.AreEqual("1:01", buildStatus.Duration);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:32,代碼來源:RulesEngineTest.cs

示例10: BuildNameChanges_BuildSettingsNameIsUpdated

        public void BuildNameChanges_BuildSettingsNameIsUpdated()
        {
            var rulesEngine = new RulesEngineWrapper();
            rulesEngine.InvokeStatusChecked(
                new BuildStatus
                {
                    BuildStatusEnum = BuildStatusEnum.InProgress,
                    Name = "New Name!",
                    RequestedBy = RulesEngineWrapper.CURRENT_USER,
                    BuildDefinitionId = RulesEngineWrapper.BUILD1_ID,
                    StartedTime = new DateTime(2010, 1, 1, 11, 33, 0)
                });

            BuildDefinitionSetting buildDefinitionSetting = rulesEngine.Settings.CiEntryPointSettings.Single().BuildDefinitionSettings.Single(i => i.Id == RulesEngineWrapper.BUILD1_ID);
            Assert.AreEqual("New Name!", buildDefinitionSetting.Name);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:16,代碼來源:RulesEngineTest.cs

示例11: InitialServerUnavailable_DisconnectedTrayNotificationSent

 public void InitialServerUnavailable_DisconnectedTrayNotificationSent()
 {
     var rulesEngine = new RulesEngineWrapper();
     rulesEngine.InvokeServerUnavailable(new ServerUnavailableException("The network is down."));
     Assert.AreEqual(1, rulesEngine.TrayNotificationEvents.Count);
     var trayNotification = rulesEngine.TrayNotificationEvents[0];
     Assert.AreEqual("Build Server Unavailable", trayNotification.Title);
     Assert.AreEqual("The connection will be restored when possible.", trayNotification.TipText);
     Assert.AreEqual(ToolTipIcon.Error, trayNotification.TipIcon);
 }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:10,代碼來源:RulesEngineTest.cs

示例12: NewBuildWithEmptyRequestedBy_RequestByNotAdded

        public void NewBuildWithEmptyRequestedBy_RequestByNotAdded()
        {
            var rulesEngine = new RulesEngineWrapper();

            rulesEngine.Rules.Add(new Rule
            {
                TriggerType = TriggerType.InitialFailedBuild,
                AlertType = AlertType.NoAlert,
            });

            BuildDefinitionSetting build1Setting = rulesEngine.GetBuildDefinitionSetting(RulesEngineWrapper.BUILD1_ID);
            Assert.AreEqual(0, build1Setting.People.Count);
            rulesEngine.InvokeStatusChecked(new BuildStatus
            {
                BuildStatusEnum = BuildStatusEnum.Broken,
                Name = RulesEngineWrapper.BUILD1_ID,
                RequestedBy = "",
                BuildDefinitionId = RulesEngineWrapper.BUILD1_ID,
                StartedTime = new DateTime(2010, 1, 1)
            });
            Assert.AreEqual(0, build1Setting.People.Count);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:22,代碼來源:RulesEngineTest.cs

示例13: BuildStartTimeChanged_RefreshStatus

        public void BuildStartTimeChanged_RefreshStatus()
        {
            var rulesEngine = new RulesEngineWrapper();
            var firstStartTime = new DateTime(2011, 1, 1, 1, 1, 1);
            var secondStartTime = new DateTime(2022, 2, 2, 2, 2, 2);

            rulesEngine.InvokeStatusChecked(new BuildStatus
            {
                BuildStatusEnum = BuildStatusEnum.Working,
                Name = RulesEngineWrapper.BUILD2_ID,
                RequestedBy = RulesEngineWrapper.CURRENT_USER,
                BuildDefinitionId = RulesEngineWrapper.BUILD2_ID,
                StartedTime = firstStartTime
            });
            Assert.AreEqual(2, rulesEngine.RefreshStatusEvents.Count);

            rulesEngine.InvokeStatusChecked(new BuildStatus
            {
                BuildStatusEnum = BuildStatusEnum.Working,
                Name = RulesEngineWrapper.BUILD2_ID,
                RequestedBy = RulesEngineWrapper.CURRENT_USER,
                BuildDefinitionId = RulesEngineWrapper.BUILD2_ID,
                StartedTime = secondStartTime
            });
            Assert.AreEqual(3, rulesEngine.RefreshStatusEvents.Count);
            Assert.AreEqual(BuildStatus.FormatAsDayMonthTime(secondStartTime), rulesEngine.RefreshStatusEvents.Last().BuildStatusDtos.First().StartTimeShort);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:27,代碼來源:RulesEngineTest.cs

示例14: GlobalPlayAudioAlertButOnMute_NoAudio

        public void GlobalPlayAudioAlertButOnMute_NoAudio()
        {
            var rulesEngine = new RulesEngineWrapper();

            var audioPattern = new AudioPattern { Id = 2, Name = "Sally" };
            rulesEngine.Rules.Add(new Rule
            {
                TriggerType = TriggerType.InitialFailedBuild,
                AudioPattern = audioPattern,
                AudioDuration = 60,
            });

            rulesEngine.Settings.Mute = true;
            rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
            Assert.AreEqual(0, rulesEngine.SetAudioEvents.Count);
        }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:16,代碼來源:RulesEngineTest.cs

示例15: Hudson_BuildUrlPassesThrough

 public void Hudson_BuildUrlPassesThrough()
 {
     var rulesEngine = new RulesEngineWrapper();
     rulesEngine.InvokeStatusChecked(new BuildStatus
     {
         BuildStatusEnum = BuildStatusEnum.InProgress,
         Name = "New Name!",
         RequestedBy = RulesEngineWrapper.CURRENT_USER,
         BuildDefinitionId = RulesEngineWrapper.BUILD1_ID,
         StartedTime = new DateTime(2010, 1, 1, 11, 33, 0),
         Url = "http://win7ci:8081/job/SvnTest/32/",
         BuildId = "32",
     });
     Assert.AreEqual(2, rulesEngine.RefreshStatusEvents.Count);
     RefreshStatusEventArgs refreshStatusEventArgs = rulesEngine.RefreshStatusEvents[1];
     Assert.AreEqual(1, refreshStatusEventArgs.BuildStatusDtos.Count());
     Assert.AreEqual("http://win7ci:8081/job/SvnTest/32/", refreshStatusEventArgs.BuildStatusDtos.First().Url);
     Assert.AreEqual("32", refreshStatusEventArgs.BuildStatusDtos.First().BuildId);
 }
開發者ID:mightymuke,項目名稱:SirenOfShame,代碼行數:19,代碼來源:RulesEngineTest.cs


注:本文中的SirenOfShame.Test.Unit.Watcher.RulesEngineWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。