public void Push(IRootObject rootObject, params string[] path) { var index = rootObject.BeginAccess(this); Kernel.LuaPushValue(index + 1); foreach (var key in path) { Stack.GetTable(key, 0); Kernel.LuaRemove(-2); } rootObject.EndAccess(this, index); }
//Is this Pattern Expression/Contravariance? void UpdateCricInfo(IRootObject IRO) { if (IRO is RootObject scoreboardBO) { ModifyScoreboardBO(ref scoreboardBO); dgMatches.ItemsSource = scoreboardBO.data; } else if (IRO is RootObjectScore rscoreboardBO) { ModifyScoreboardBO(ref rscoreboardBO); ((Datum)dgMatches.SelectedItem).description = rscoreboardBO.description; } }
public string GetNextKey(IRootObject rootObject, string currentKey, params string[] path) { Push(rootObject, path); Stack.Push(currentKey); var result = Kernel.LuaNext(-2) != 0; Stack.Drop(); var newKey = Stack.Top[0].Materialize().AsString; Stack.Drop(); Stack.Drop(); return(result? newKey:null); }
public void Set(IRootObject rootObject, object value, params string[] path) { if (path.Length < 1) { throw new Exception("key required"); } Push(rootObject, path.Take(path.Length - 1).ToArray()); Stack.Push(path.Last()); Stack.Push(value); Kernel.LuaSetTable(-3); Stack.Drop(); }
public IEnumerable <string> GetKeys(IRootObject rootObject, params string[] path) { Push(rootObject, path); Kernel.LuaPushNil(); var result = new List <string>(); while (Kernel.LuaNext(-2) != 0) { Stack.Drop(); var key = Stack.Top[0].Materialize().AsString; result.Add(key); } Stack.Drop(); Stack.Drop(); return(result.ToArray()); }
/// <summary> /// Initializes a new instance of the <see cref="UIObjectInterfaceResolver"/> class. /// </summary> /// <param name="rootObject">The process object.</param> public UIObjectInterfaceResolver(IRootObject rootObject) => this.rootObject = rootObject;
/// <summary> /// コンストラクタ /// </summary> public SelectableElementBase(IRootObject root) : base(root) { }
/// <summary> /// コンストラクタ /// </summary> /// <param name='root'> /// ルートオブジェクト /// </param> public DiagramElementBase(IRootObject root) { this.root = root; }
/// <summary> /// コンストラクタ /// </summary> public NodeElementBase(IRootObject root) : base(root) { }
public VirtualObjectView(HWLua parent, IRootObject rootObject, params string[] path) : base(parent, rootObject, path) { }
/// <summary> /// Initializes a new instance of the <see cref="PageObjectLocator"/> class. /// </summary> /// <param name="processObject">The process object.</param> internal PageObjectLocator(IRootObject processObject) { Clear(); rootObject = processObject; }
public HomeController(IRootObject root) { _root = root; }
public UserDataObject(HWLua parent, IRootObject rootObject, string[] path) : base(parent, rootObject, path) { }
public FunctionObject(HWLua parent, IRootObject rootObject, string[] path) : base(parent, rootObject, path) { }
/// <summary> /// Run tests for this page object. /// </summary> /// <param name="source">The source page object.</param> /// <param name="methodFilter">The test method filter predicate.</param> /// <param name="pageTestClassFilter">The page test class filter predicate.</param> /// <returns>This page object.</returns> public static IPageObject Test(this IPageObject source, Predicate <MethodInfo> methodFilter = null, Predicate <IPageObjectTests> pageTestClassFilter = null) { methodFilter = methodFilter ?? (_ => true); pageTestClassFilter = pageTestClassFilter ?? (_ => true); foreach (Type classWithTests in source.TestClasses()) { // create and initialize page test class IPageObjectTestsInternal instance; IRootObject root = GetRoot(source); var configuration = root.Configuration; configuration.LogAction("Found page test class for current class " + source.GetType().ToString() + ": " + classWithTests.ToString()); try { configuration .DependencyRegistrator .Register(classWithTests); instance = (IPageObjectTestsInternal)configuration.resolver.Resolve(classWithTests); } catch (Stashbox.Exceptions.ResolutionFailedException exception) { throw new TypeResolutionFailedException(exception, $"Configure the resolver via '{nameof(Configuration.DependencyRegistrator)}' in class '{root.GetType().FullName}'."); } // init page test class instance.Init(source); // check if tests should be executed according to the page test filter if (pageTestClassFilter(instance)) { configuration.LogAction("Page test class filter returned true; running tests..."); } else { configuration.LogAction("Page test class filter returned true; skipping tests..."); continue; } // check if tests should be executed according to the runnable predicate if (instance.Runnable) { configuration.LogAction("Runnable returned true; running tests..."); } else { configuration.LogAction("Runnable returned false; skipping tests"); continue; } // get page test methods, and order them from top to bottom // ordering does not respect inheritence var methods = classWithTests.GetMethods().Where(method => method.GetCustomAttributes(typeof(PageTestAttribute), false).Length > 0); var methodsByLine = methods.OrderBy(method => method.GetCustomAttribute <PageTestAttribute>(true).Line); var matchingMethodsByLine = methodsByLine.Where(method => methodFilter(method)); int testMethodsCount = matchingMethodsByLine.Count(); if (testMethodsCount > 0) { configuration.LogAction("Found " + testMethodsCount + " test methods"); } else { configuration.LogAction("No test method found; skipping test class"); continue; } configuration.LogAction($"Execute function {nameof(IPageObjectTests.BeforeFirstTest)}..."); instance.BeforeFirstTest(); // check if tests should be executed if (!instance.ReadyToRun) { throw new TestNotReadyToRunException(classWithTests.FullName); } else { configuration.LogAction("Tests are ready to run..."); } // create class statistics object TestClassStatistic testClassStatistic = new TestClassStatistic(classWithTests); // execute test methods try { foreach (var testMethod in matchingMethodsByLine) { if (instance.IsTestRunnable(testMethod)) { Test(testClassStatistic, instance, testMethod, configuration.LogAction); } else { configuration.LogAction($"Skipping test: '{nameof(instance.IsTestRunnable)}' returned false for test method '{testMethod.Name}'."); } } configuration.LogAction($"Execute function {nameof(IPageObjectTests.AfterLastTest)}..."); instance.AfterLastTest(); } finally { var pageObjectStatistic = PageObjectStatistic(source); pageObjectStatistic += testClassStatistic; } } return(source); }
/// <summary> /// コンストラクタ /// </summary> public EdgeElementBase(IRootObject root) : base(root) { }