当前位置: 首页>>代码示例>>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;未经允许,请勿转载。