本文整理汇总了C#中Atk.RefStateSet方法的典型用法代码示例。如果您正苦于以下问题:C# Atk.RefStateSet方法的具体用法?C# Atk.RefStateSet怎么用?C# Atk.RefStateSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Atk
的用法示例。
在下文中一共展示了Atk.RefStateSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: States
public static void States (Atk.Object accessible, params Atk.StateType [] expected)
{
List <Atk.StateType> expectedStates = new List <Atk.StateType> (expected);
List <Atk.StateType> missingStates = new List <Atk.StateType> ();
List <Atk.StateType> superfluousStates = new List <Atk.StateType> ();
Atk.StateSet stateSet = accessible.RefStateSet ();
foreach (Atk.StateType state in Enum.GetValues (typeof (Atk.StateType))) {
if (expectedStates.Contains (state) &&
(!(stateSet.ContainsState (state))))
missingStates.Add (state);
else if ((!expectedStates.Contains (state)) &&
(stateSet.ContainsState (state)))
superfluousStates.Add (state);
}
string missingStatesMsg = string.Empty;
string superfluousStatesMsg = string.Empty;
if (missingStates.Count != 0) {
missingStatesMsg = "Missing states: ";
foreach (Atk.StateType state in missingStates)
missingStatesMsg += state.ToString () + ",";
}
if (superfluousStates.Count != 0) {
superfluousStatesMsg = "Superfluous states: ";
foreach (Atk.StateType state in superfluousStates)
superfluousStatesMsg += state.ToString () + ",";
}
Assert.IsTrue ((missingStates.Count == 0) && (superfluousStates.Count == 0),
missingStatesMsg + " .. " + superfluousStatesMsg);
}