本文整理汇总了C#中SirenOfShame.Test.Unit.Watcher.RulesEngineWrapper.InvokeStatusChecked方法的典型用法代码示例。如果您正苦于以下问题:C# RulesEngineWrapper.InvokeStatusChecked方法的具体用法?C# RulesEngineWrapper.InvokeStatusChecked怎么用?C# RulesEngineWrapper.InvokeStatusChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SirenOfShame.Test.Unit.Watcher.RulesEngineWrapper
的用法示例。
在下文中一共展示了RulesEngineWrapper.InvokeStatusChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildStatusChanged_InProgressBuilds_DoSync
public void BuildStatusChanged_InProgressBuilds_DoSync()
{
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);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
mock.Verify(i => i.BuildStatusChanged(It.IsAny<SirenOfShameSettings>(), It.IsAny<IList<BuildStatus>>(), It.IsAny<List<InstanceUserDto>>()), Times.Exactly(2));
}
示例2: 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();
}
示例3: BuildStatusChanged_MyPointAndAchievementsOnly_DoesNotSync
public void BuildStatusChanged_MyPointAndAchievementsOnly_DoesNotSync()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.Settings.SosOnlineAlwaysSync = true;
rulesEngine.Settings.SosOnlineWhatToSync = WhatToSyncEnum.MyPointAndAchievementsOnly;
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.Never());
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例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);
}
示例8: 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);
}
示例9: BuildInProgressThenPassThenInProgressWithGlobalBuildTriggeredRule_TwoAlerts
public void BuildInProgressThenPassThenInProgressWithGlobalBuildTriggeredRule_TwoAlerts()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.Rules.Add(new Rule
{
TriggerType = TriggerType.BuildTriggered,
AlertType = AlertType.TrayAlert
});
rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
Assert.AreEqual(2, rulesEngine.TrayNotificationEvents.Count);
Assert.AreEqual(rulesEngine.TrayNotificationEvents[0].Title, rulesEngine.TrayNotificationEvents[1].Title);
}
示例10: ServerUnavailableThenAvailableThenUnavailable_TwoUnavailableTrayNotificationSent
public void ServerUnavailableThenAvailableThenUnavailable_TwoUnavailableTrayNotificationSent()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.InvokeServerUnavailable(new ServerUnavailableException("The network is down."));
rulesEngine.InvokeStatusChecked(new BuildStatus[] { });
rulesEngine.InvokeServerUnavailable(new ServerUnavailableException("The network is down."));
Assert.AreEqual(3, rulesEngine.TrayNotificationEvents.Count);
Assert.AreEqual(2,
rulesEngine.TrayNotificationEvents.Where(tn => tn.Title == "Build Server Unavailable").Count
());
}
示例11: NewBuildWithNewRequestedBy_PersonAdded
public void NewBuildWithNewRequestedBy_PersonAdded()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.Rules.Add(new Rule
{
TriggerType = TriggerType.InitialFailedBuild,
AlertType = AlertType.NoAlert,
});
Assert.AreEqual(0, rulesEngine.Settings.CiEntryPointSettings[0].BuildDefinitionSettings[0].People.Count);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
Assert.AreEqual(1, rulesEngine.Settings.CiEntryPointSettings[0].BuildDefinitionSettings[0].People.Count);
Assert.AreEqual(RulesEngineWrapper.CURRENT_USER,
rulesEngine.Settings.CiEntryPointSettings[0].BuildDefinitionSettings[0].People[0]);
}
示例12: IsBuildingWithBuildTriggeredRuleToStopOnSuccess_BuildSucceeds_LedsStop
public void IsBuildingWithBuildTriggeredRuleToStopOnSuccess_BuildSucceeds_LedsStop()
{
var rulesEngine = new RulesEngineWrapper();
var ledPattern = new LedPattern { Id = 2, Name = "Sally" };
rulesEngine.Rules.Add(new Rule
{
TriggerType = TriggerType.BuildTriggered,
LedPattern = ledPattern,
LightsDuration = null,
});
Assert.AreEqual(0, rulesEngine.SetLightsEvents.Count);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
Assert.AreEqual(0, rulesEngine.SetLightsEvents.Count);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.InProgress);
Assert.AreEqual(1, rulesEngine.SetLightsEvents.Count);
Assert.AreEqual("Sally", rulesEngine.SetLightsEvents[0].LedPattern.Name);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
Assert.AreEqual(2, rulesEngine.SetLightsEvents.Count);
Assert.AreEqual(null, rulesEngine.SetLightsEvents[1].LedPattern);
}
示例13: 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);
}
示例14: GlobalMuteOnBuildFailsWithWindowsAudioRule_NoAudio
public void GlobalMuteOnBuildFailsWithWindowsAudioRule_NoAudio()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.Settings.Mute = true;
Rule rule = new Rule
{
TriggerType = TriggerType.InitialFailedBuild,
WindowsAudioLocation = "SirenOfShame.Resources.Sad-Trombone.wav"
};
rulesEngine.Rules.Add(rule);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Working);
rulesEngine.InvokeStatusChecked(BuildStatusEnum.Broken);
Assert.AreEqual(0, rulesEngine.PlayWindowsAudioEvents.Count);
}
示例15: GlobalBuildDefTrayAlertConflictsWithLocalBuildDefModalAlert_ModalAlertOnly
public void GlobalBuildDefTrayAlertConflictsWithLocalBuildDefModalAlert_ModalAlertOnly()
{
var rulesEngine = new RulesEngineWrapper();
rulesEngine.Rules.Add(new Rule
{
TriggerType = TriggerType.BuildFailed,
AlertType = AlertType.TrayAlert,
});
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);
Assert.AreEqual(0, rulesEngine.TrayNotificationEvents.Count);
}