public void CommandCanReturnTrue(CommandTestData test)
        {
            _runtime.Run(test.ExpectedCommand, ExpectedResultPrefix, test.Timeout).Returns(ExpectedResultYes);

            Assert.That(test.Method(_session, _pattern), Is.True);

            _pattern.Received(1).Validate();
            _runtime.Received(1).Run(test.ExpectedCommand, ExpectedResultPrefix, test.Timeout);
        }
Exemple #2
0
        public bool Type(IImage image, string text)
        {
            this.Click(image);
            if (InvalidTextRegex.IsMatch(text))
            {
                throw new ArgumentException("Text cannot contain control characters. Escape them before, e.g. \\n should be \\\\n", "text");
            }

            string script = $"print \"SIKULI#: YES\" if type(\"{text}\") == 1 else \"SIKULI#: NO\"";
            string result = _runtime.Run(script, "SIKULI#: ", 0d);

            return(result.Contains("SIKULI#: YES"));
        }
Exemple #3
0
        public bool Type(string text)
        {
            if (InvalidTextRegex.IsMatch(text))
            {
                throw new ArgumentException("Text cannot contain control characters. Escape them before, e.g. \\n should be \\\\n", "text");
            }

            var script = string.Format(
                "print \"SIKULI#: YES\" if type(\"{0}\") == 1 else \"SIKULI#: NO\"",
                text
                );

            var result = _runtime.Run(script, "SIKULI#: ", 0d);

            return(result.Contains("SIKULI#: YES"));
        }
Exemple #4
0
 public bool Exists(IImage image, double timeoutInSeconds = 1)
 {
     _runtime.Run(image.ToSikuliScript("exists", timeoutInSeconds), timeoutInSeconds);
     return(true);
 }