本文整理汇总了C#中StateMachine.GetAvailableEvents方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.GetAvailableEvents方法的具体用法?C# StateMachine.GetAvailableEvents怎么用?C# StateMachine.GetAvailableEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateMachine
的用法示例。
在下文中一共展示了StateMachine.GetAvailableEvents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAvailableEvents_WhenValidState_ReturnsAvailableEvents
public void GetAvailableEvents_WhenValidState_ReturnsAvailableEvents(
string currentState, string[] expectedEvents)
{
var sut = new StateMachine(GetTestTransitionTable());
IEnumerable<string> result = sut.GetAvailableEvents(currentState);
Assert.Equal(expectedEvents, result.ToArray());
}
示例2: GetAvailableEvents_WhenInvalidState_Throws
public void GetAvailableEvents_WhenInvalidState_Throws()
{
var sut = new StateMachine(GetTestTransitionTable());
var ex = Assert.Throws<InvalidOperationException>(
() => sut.GetAvailableEvents("Bogus"));
Assert.Equal("Invalid state: 'Bogus'.", ex.Message);
}
示例3: GetAvailableEvents_WhenTerminalState_ReturnsEmpty
public void GetAvailableEvents_WhenTerminalState_ReturnsEmpty()
{
const string TerminalState = "Terminal";
var transitionTable =
new List<Transition>
{
new Transition("Whatever", "something", TerminalState)
};
var sut = new StateMachine(transitionTable);
IEnumerable<string> result = sut.GetAvailableEvents(TerminalState);
Assert.Empty(result);
}
示例4: GetAvailableEvents_WhenCurrentStateIsNull_Throws
public void GetAvailableEvents_WhenCurrentStateIsNull_Throws()
{
var sut = new StateMachine(GetTestTransitionTable());
Assert.Throws<ArgumentNullException>(
() => sut.GetAvailableEvents(null));
}