Inheritance: MonoBehaviour
コード例 #1
0
        public void RunsInCScript()
        {
            var script = new TestScript();

            script.AppendBlock(new JsHamcrestLibrary());

            Assert.DoesNotThrow(() => script.RunTest(ScriptResources.JsHamcrestSampleTest));
        }
コード例 #2
0
        public void RunsInCScript()
        {
            var script = new TestScript();

            script.AppendBlock(new JsonLibrary());

            Assert.Equal("\"1\"", script.RunTest("return JSON.stringify(JSON.parse('1'));"));
        }
コード例 #3
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestThrowsScriptExceptionBackToCaller()
        {
            var script = new TestScript();

            var ex = Assert.Throws<ScriptException>(() => script.RunTest("throw { message: 'My Script Exception' };"));

            Assert.Equal(ex.Message, "{\"message\":\"My Script Exception\"}");
        }
コード例 #4
0
        public void IgnoresMultipleRegistrations()
        {
            var script = new TestScript();

            script.AppendBlock(new JsHamcrestLibrary());
            script.AppendBlock(new JsHamcrestLibrary());

            Assert.DoesNotThrow(() => script.RunTest(ScriptResources.JsHamcrestSampleTest));
        }
コード例 #5
0
        public void IgnoresMultipleRegistrations()
        {
            var script = new TestScript();

            script.AppendBlock(new JsonLibrary());
            script.AppendBlock(new JsonLibrary());

            Assert.Equal("\"1\"", script.RunTest("return JSON.stringify(1);"));
        }
コード例 #6
0
	// Use this for initialization
	void Start () 
	{
		InputM = GetComponent<InputManager>();
		Movement = GetComponent<MovementManager>();
		Tester = GetComponent<TestScript>();

		isRunning = false;

	}
コード例 #7
0
ファイル: ActionsTest.cs プロジェクト: rzubek/UnityGameTools
        public void TestActionsInScript()
        {
            // make some actions
            var a = new TestAction("a");
            var b = new TestAction("b");
            var c = new TestAction("c");
            var d = new TestAction("d");
            var e = new TestAction("e");
            var f = new TestAction("f");

            var seq = new TestScript("test");
            seq.Enqueue(new List<Action>() { a, b, c });

            // make sure they're all enqueued but only A is activated
            Assert.IsTrue(!seq.IsEmpty && seq.Head == a);
            Assert.IsTrue(a.IsEnqueued && a.IsActive);
            Assert.IsTrue(b.IsEnqueued && !b.IsActive);
            Assert.IsTrue(c.IsEnqueued && !c.IsActive);

            // stop A, this should dequeue it and activate B
            a.Stop(true);
            Assert.IsTrue(!seq.IsEmpty && seq.Head == b);
            Assert.IsTrue(!a.IsEnqueued && !a.IsActive);
            Assert.IsTrue( b.IsEnqueued &&  b.IsActive);
            Assert.IsTrue( c.IsEnqueued && !c.IsActive);

            // stop the script, this should pop B and C without activating the latter
            seq.Clear();
            Assert.IsTrue(seq.IsEmpty && seq.Head == null);
            Assert.IsTrue(!a.IsEnqueued && !a.IsActive && a.countActivate == 1 && a.countDeactivate == 1);
            Assert.IsTrue(!b.IsEnqueued && !b.IsActive && b.countActivate == 1 && b.countDeactivate == 1);
            Assert.IsTrue(!c.IsEnqueued && !c.IsActive && c.countActivate == 0 && c.countDeactivate == 0);

            // push two more
            seq.Enqueue(new List<Action>() { d, e });
            Assert.IsTrue(d.IsEnqueued &&  d.IsActive && d.countActivate == 1 && d.countDeactivate == 0);
            Assert.IsTrue(e.IsEnqueued && !e.IsActive && e.countActivate == 0 && e.countDeactivate == 0);

            // pop E from the end, this should not affect D, or activate/deactivate E
            seq.PopTail();
            Assert.IsTrue( d.IsEnqueued &&  d.IsActive && d.countActivate == 1 && d.countDeactivate == 0);
            Assert.IsTrue(!e.IsEnqueued && !e.IsActive && e.countActivate == 0 && e.countDeactivate == 0);

            // push F to the front, this should deactivate D but keep it in the queue
            seq.PushHead(f);
            Assert.IsTrue(f.IsEnqueued &&  f.IsActive && f.countActivate == 1 && f.countDeactivate == 0);
            Assert.IsTrue(d.IsEnqueued && !d.IsActive && d.countActivate == 1 && d.countDeactivate == 1);

            // now dequeue F from the front, this should pop it, and re-activate D
            seq.StopCurrentAction(true, null);
            Assert.IsTrue(!f.IsEnqueued && !f.IsActive && f.countActivate == 1 && f.countDeactivate == 1);
            Assert.IsTrue( d.IsEnqueued &&  d.IsActive && d.countActivate == 2 && d.countDeactivate == 1);
        }
コード例 #8
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void AlwaysAppendBlockToExistingScript()
        {
            var block1 = new ScriptBlock("var x = 0;");
            var block2 = new ScriptBlock("var y = 1;");
            var block3 = new ScriptBlock("var z = 2;");
            var script = new TestScript();

            script.AppendBlock(block1);
            script.AppendBlock(block2);
            script.AppendBlock(block3);

            Assert.Equal(block1 + Environment.NewLine + block2 + Environment.NewLine + block3 + Environment.NewLine, script.ToString());
        }
コード例 #9
0
        public void R_AutoFormatIfNoScope()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.Type("if(x>1)");
                script.DoIdle(300);
                script.Type("{ENTER}a");

                string expected = "if (x > 1)\r\n    a";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #10
0
        public void R_AutoFormatFunctionBraces()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.Type("function(a,b){");
                script.DoIdle(300);
                script.Type("{ENTER}a");

                string expected = "function(a, b) {\r\n    a\r\n}";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #11
0
ファイル: IntellisenseTest.cs プロジェクト: fpcMotif/RTVS
        public void R_RequireIntellisense()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.Type("require(uti");
                script.DoIdle(100);
                script.Type("{TAB}");

                string expected = "require(utils)";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #12
0
ファイル: IntellisenseTest.cs プロジェクト: fpcMotif/RTVS
        public void R_KeywordIntellisense()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.Type("funct");
                script.DoIdle(100);
                script.Type("{TAB}");

                string expected = "function";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #13
0
ファイル: TestScriptTests.cs プロジェクト: ducas/JSTest.NET
        public void AlwaysAppendBlockToExistingScript()
        {
            var block1 = new ScriptBlock("var x = 0;");
            var block2 = new ScriptBlock("var y = 1;");
            var block3 = new ScriptBlock("var z = 2;");
            var script = new TestScript(new MsieJavaScriptEngine());

            script.AppendBlock(block1);
            script.AppendBlock(block2);
            script.AppendBlock(block3);

            Assert.Equal(block1.ToInlineScriptFragment() + Environment.NewLine + block2.ToInlineScriptFragment() + Environment.NewLine + block3.ToInlineScriptFragment() + Environment.NewLine, script.ToString());
        }
コード例 #14
0
        public IEnumerator RefuseDisabledBehaviour()
        {
            TestScript testScript = containingObject.AddComponent <TestScript>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));
            testScript.enabled = false;

            Assert.IsFalse(container.Accepts(containingObject));
        }
コード例 #15
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void AlwaysAppendBlockToExistingScript()
        {
            var block1 = new ScriptBlock("var x = 0;");
            var block2 = new ScriptBlock("var y = 1;");
            var block3 = new ScriptBlock("var z = 2;");
            var script = new TestScript();

            script.AppendBlock(block1);
            script.AppendBlock(block2);
            script.AppendBlock(block3);

            Assert.Equal(block1 + Environment.NewLine + block2 + Environment.NewLine + block3 + Environment.NewLine, script.ToString());
        }
コード例 #16
0
ファイル: IntellisenseTest.cs プロジェクト: nomada2/RTVS
        public void R_CompletionFilter02()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.Type("x <- lm");
                script.DoIdle(100);
                script.Type("+");

                string expected = "x <- lm+";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #17
0
        public void TestScriptsInQueue()
        {
            // make some scripts

            var a     = new TestAction("a");
            var b     = new TestAction("b");
            var c     = new TestAction("c");
            var abc   = new TestScript("abc", a, b, c);
            var empty = new TestScript("empty");
            var d     = new TestAction("d");
            var e     = new TestAction("e");
            var f     = new TestAction("f");
            var def   = new TestScript("def", d, e, f);

            var q = new ScriptQueue();

            q.Enqueue(new Script[] { abc, empty, def });

            // verify the first script and action are active
            Assert.IsTrue(!q.IsEmpty && q.Head == abc && q.Head.Head == a);
            Assert.IsTrue(abc.IsEnqueued && abc.IsActive);
            Assert.IsTrue(empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(def.IsEnqueued && !def.IsActive);

            // stop the first action, keeps the same script active
            a.Stop(true);
            Assert.IsTrue(!q.IsEmpty && q.Head == abc && q.Head.Head == b);

            // finish off actions. this will remove ABC from the queue
            b.Stop(true);
            c.Stop(true);
            Assert.IsTrue(!q.IsEmpty && q.Head != abc);
            Assert.IsTrue(abc.countActivate == 1 && abc.countDeactivate == 1);

            // the Empty script was activated but then immediately removed, because it's empty
            Assert.IsTrue(!empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(empty.countActivate == 1 && empty.countDeactivate == 1);

            // and let's make sure that DEF is the active one now
            Assert.IsTrue(!q.IsEmpty && q.Head == def && q.Head.Head == d);
            Assert.IsTrue(!abc.IsEnqueued && !abc.IsActive);
            Assert.IsTrue(!empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(def.IsEnqueued && def.IsActive);
            Assert.IsTrue(def.countActivate == 1 && def.countDeactivate == 0);

            // then if we force-stop DEF, it should clean out of the queue completely
            def.StopScript(true, null);
            Assert.IsTrue(q.IsEmpty && q.Head == null);
            Assert.IsTrue(!def.IsEnqueued && !def.IsActive);
            Assert.IsTrue(def.countActivate == 1 && def.countDeactivate == 1);
        }
コード例 #18
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatScopeBraces07()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = true;

                script.Type("x <-function(a,{ENTER}b){ENTER}{");
                script.DoIdle(300);
                script.Type("{ENTER}a");

                string expected = "x <- function(a,\r\n              b)\r\n{\r\n    a\r\n}";
                string actual   = script.EditorText;
                actual.Should().Be(expected);
            }
        }
コード例 #19
0
        public IEnumerator RefusesInactiveGameObject()
        {
            TestScript testScript = containingObject.AddComponent <TestScript>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));
            testScript.enabled = true;
            subject.gameObject.SetActive(false);

            Assert.IsFalse(container.Accepts(containingObject));
        }
コード例 #20
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatScopeBraces08()
        {
            using (var script = new TestScript("while (true) {\r\n}", RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = true;

                script.MoveDown();
                script.Enter();

                string expected = "while (true)\r\n{\r\n\r\n}";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #21
0
ファイル: VsRHostScript.cs プロジェクト: dudongsheng7/RTVS
        public static void DoIdle(int ms)
        {
            UIThreadHelper.Instance.Invoke(() => {
                int time = 0;
                while (time < ms)
                {
                    TestScript.DoEvents();
                    VsAppShell.Current.DoIdle();

                    Thread.Sleep(20);
                    time += 20;
                }
            });
        }
コード例 #22
0
        public void R_SmartIndentTest01()
        {
            using (var script = new TestScript(string.Empty, RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = false;
                script.MoveRight();
                script.Type("{{ENTER}a");
                script.DoIdle(300);

                string expected = "{\r\n    a\r\n}";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #23
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatFunctionArgument()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = false;

                script.Type("zzzz(a=1,{ENTER}");
                script.DoIdle(300);
                script.Type("b=2");
                string expected = "zzzz(a = 1,\r\n     b=2)";

                string actual = script.EditorText;
                actual.Should().Be(expected);
            }
        }
コード例 #24
0
ファイル: OutlineTest.cs プロジェクト: xoriath/RTVS
        public void R_OutlineToggleAll()
        {
            string text = _files.LoadDestinationFile("lsfit.r");

            using (var script = new TestScript(text, RContentTypeDefinition.ContentType)) {
                script.DoIdle(500);

                IOutliningManagerService svc = EditorShell.Current.ExportProvider.GetExportedValue <IOutliningManagerService>();
                IOutliningManager        mgr = svc.GetOutliningManager(EditorWindow.CoreEditor.View);
                var snapshot = EditorWindow.TextBuffer.CurrentSnapshot;

                var viewLines = EditorWindow.CoreEditor.View.TextViewLines;
                viewLines.Count.Should().Be(40);
                script.DoIdle(500);

                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_TOGGLE_ALL);
                script.DoIdle(1000);

                IEnumerable <ICollapsed> collapsed = mgr.GetCollapsedRegions(new SnapshotSpan(snapshot, new Span(0, snapshot.Length)));
                collapsed.Count().Should().Be(20);

                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_TOGGLE_ALL);
                script.DoIdle(500);

                viewLines = EditorWindow.CoreEditor.View.TextViewLines;
                viewLines.Count.Should().Be(40);

                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_STOP_HIDING_ALL);
                script.DoIdle(200);
                mgr.Enabled.Should().Be(false);

                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_START_AUTOHIDING);
                script.DoIdle(200);
                mgr.Enabled.Should().Be(true);

                script.MoveDown(9);
                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_TOGGLE_CURRENT);
                script.DoIdle(500);

                collapsed = mgr.GetCollapsedRegions(new SnapshotSpan(snapshot, new Span(0, snapshot.Length)));
                collapsed.Count().Should().Be(1);

                EditorWindow.ExecCommand(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.OUTLN_TOGGLE_CURRENT);
                script.DoIdle(200);

                collapsed = mgr.GetCollapsedRegions(new SnapshotSpan(snapshot, new Span(0, snapshot.Length)));
                collapsed.Count().Should().Be(0);
            }
        }
コード例 #25
0
        public void R_SelectWord03()
        {
            using (var script = new TestScript("abc\'def", RContentTypeDefinition.ContentType)) {
                script.Execute(Languages.Editor.Controller.Constants.VSConstants.VSStd2KCmdID.SELECTCURRENTWORD);
                var span         = EditorWindow.CoreEditor.View.Selection.StreamSelectionSpan;
                var selectedWord = span.GetText();
                selectedWord.Should().Be("abc");

                script.MoveRight(2);
                script.Execute(Languages.Editor.Controller.Constants.VSConstants.VSStd2KCmdID.SELECTCURRENTWORD);
                span         = EditorWindow.CoreEditor.View.Selection.StreamSelectionSpan;
                selectedWord = span.GetText();
                selectedWord.Should().Be("def");
            }
        }
コード例 #26
0
 private void UpdateLblTestScripts(TestScript testcaseScript)
 {
     if (lblPassedScripts.InvokeRequired)
     {
         var d = new SetTextCallback(UpdateLblTestScripts);
         Invoke(d, new object[] { testcaseScript });
     }
     else
     {
         lblPassedScripts.Text  = @"Passed scripts: " + _rcRunner.RunningTestsCount.TotPassed;
         lblFailedScripts.Text  = @"Failed scripts: " + _rcRunner.RunningTestsCount.TotFailed;
         lblRunningScripts.Text = @"Running scripts: " + _rcRunner.RunningTestsCount.TotRunning;
         lblWatingScripts.Text  = @"Waiting scripts: " + _rcRunner.RunningTestsCount.TotWaiting;
     }
 }
コード例 #27
0
        public void Test(TestCase testCase)
        {
            var script = new TestScript { IncludeDefaultBreakpoint = false };

            // Append required JavaScript libraries.
            script.AppendBlock(new JsAssertLibrary());

            // Append required JavaScript Files.
            script.AppendFile(@"..\..\dateExtensions.js");
            script.AppendFile(@"..\..\cookieContainer.js");
            script.AppendFile(testCase.TestFile);

            // Run 'Test'.
            script.RunTest(testCase);
        }
コード例 #28
0
ファイル: VsRHostScript.cs プロジェクト: skrutsick/RTVS
        public static void DoIdle(int ms)
        {
            UIThreadHelper.Instance.Invoke(() => {
                var idle = VsAppShell.Current.GetService <IIdleTimeSource>();
                int time = 0;
                while (time < ms)
                {
                    TestScript.DoEvents();
                    idle.DoIdle();

                    Thread.Sleep(20);
                    time += 20;
                }
            });
        }
コード例 #29
0
ファイル: IntellisenseTest.cs プロジェクト: xoriath/RTVS
        public void R_NoCompletionOnTabInComment()
        {
            // Tab only completes when selected item starts
            // with the text typed so far in the buffer
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.DoIdle(100);
                script.Type("#com");
                script.DoIdle(300);
                script.Type("{TAB}a");
                script.DoIdle(100);

                string actual = script.EditorText;
                actual.Should().Be("#com    a"); // Tab was not consumed
            }
        }
コード例 #30
0
        public async Task TestForeachWithLargeItems()
        {
            var testFlow = new TestScript()
            {
                Dialog = new ForeachItemsDialog()
            }
            .SendConversationUpdate();

            for (var i = 0; i < 1000; i++)
            {
                testFlow = testFlow.AssertReply(i.ToString());
            }

            await testFlow.ExecuteAsync(ResourceExplorer);
        }
コード例 #31
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatFunctonArguments02()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                string text = "x <-function (x,y,{ENTER}wt= NULL){ENTER}";

                script.Type(text);
                script.DoIdle(300);

                string actual   = script.EditorText;
                string expected =
                    "x <- function(x, y,\r\n" +
                    "              wt = NULL)\r\n";
                actual.Should().Be(expected);
            }
        }
コード例 #32
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatScopeBraces04()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = false;

                script.Type("while(true) {");
                script.DoIdle(300);
                script.Type("}");

                string expected = "while (true) { }";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #33
0
ファイル: AutoFormatTest.cs プロジェクト: xoriath/RTVS
        public void R_AutoFormatFuncionDefinition04()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                string text = "function(){return(1)}";

                script.Type(text);
                script.DoIdle(300);
                script.Enter();

                string actual   = script.EditorText;
                string expected =
                    @"function() { return(1) }
";
                actual.Should().Be(expected);
            }
        }
コード例 #34
0
        /// <summary>
        /// 加载测试数据
        /// </summary>
        /// <param name="testScriptFileName"></param>
        private void LoadTestScript(string testScriptFileName)
        {
            string scriptString = "";

            using (System.IO.StreamReader sr = System.IO.File.OpenText(testScriptFileName))
            {
                scriptString = sr.ReadToEnd();
            }

            ITestScriptParser parser = new AutoTestFramework.SeleniumTestEngine.SeleniumIdeHtmlScriptParser();

            scriptModel              = parser.Parse(scriptString);
            textBox3.Text            = scriptModel.StartUrl;
            textBox4.Text            = scriptModel.Title;
            dataGridView1.DataSource = new List <TestCommand>(scriptModel.GetCommandList());
        }
コード例 #35
0
        public void Test(TestCase testCase)
        {
            var script = new TestScript {
                IncludeDefaultBreakpoint = false
            };

            // Append required JavaScript libraries.
            script.AppendBlock(new JsAssertLibrary());

            // Append required JavaScript Files.
            script.AppendFile(@"..\..\dateExtensions.js");
            script.AppendFile(@"..\..\cookieContainer.js");
            script.AppendFile(testCase.TestFile);

            // Run 'Test'.
            script.RunTest(testCase);
        }
コード例 #36
0
ファイル: ProvisionalTextTest.cs プロジェクト: fpcMotif/RTVS
        public void R_ProvisionalCurlyBrace01()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = false;

                script.Type("while(1)");
                script.DoIdle(300);
                script.Type("{");
                script.DoIdle(300);
                script.Type("{ENTER}}");

                string expected = "while (1) {\r\n}";
                string actual   = script.EditorText;

                actual.Should().Be(expected);
            }
        }
コード例 #37
0
ファイル: AutoFormatTest.cs プロジェクト: nomada2/RTVS
        public void R_AutoFormatScopeBraces10()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                REditorSettings.FormatOptions.BracesOnNewLine = false;

                script.Type("if(TRUE){");
                script.DoIdle(300);
                script.Type("{ENTER}a");
                script.MoveDown();
                script.MoveRight();
                script.Type("{ENTER}");
                string expected = "if (TRUE) {\r\n    a\r\n}\r\n";

                string actual = script.EditorText;
                actual.Should().Be(expected);
            }
        }
コード例 #38
0
ファイル: IntellisenseTest.cs プロジェクト: xoriath/RTVS
        public void R_NoCompletionOnTabWhenNoMatch()
        {
            // Tab only completes when selected item starts
            // with the text typed so far in the buffer
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                script.DoIdle(100);
                script.Type("while aaa");
                script.DoIdle(300);
                script.Type("{TAB}");
                script.DoIdle(100);

                string actual = script.EditorText;
                actual.Should().Be("while aaa"); // nothing was inserted from the completion list

                EditorWindow.CoreEditor.View.Caret.Position.BufferPosition.Position.Should().Be(actual.Length);
            }
        }
コード例 #39
0
 private void UpdateListView(TestScript testcaseScript)
 {
     if (listViewTestScripts.InvokeRequired)
     {
         var d = new SetTextCallback(UpdateListView);
         Invoke(d, new object[] { testcaseScript });
     }
     else
     {
         var item = listViewTestScripts.FindItemWithText(testcaseScript.Name, true, 0);
         if (item == null)
         {
             return;
         }
         UpdateListviewItemBasedOnTestStatus(testcaseScript, item);
     }
 }
コード例 #40
0
        public void Setup()
        {
            Script = new TestScript { IncludeDefaultBreakpoint = false };

            // Append required JavaScript libraries.
            Script.AppendBlock(new JsAssertLibrary());

            // Append required JavaScript Files.
            Script.AppendFile(@"..\..\dateExtensions.js");
            Script.AppendFile(@"..\..\cookieContainer.js");
            Script.AppendFile(@"..\..\whenSettingCookies.js");

            // Setup JavaScript Context
            Script.AppendBlock(@"
                                 var document = {};
                                 var cookieContainer = new CookieContainer(document);
                               ");
        }
コード例 #41
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void AlwaysAppendIncludeToExistingScript()
        {
            using (var tempFile1 = new TempFile())
            using (var tempFile2 = new TempFile())
            using (var tempFile3 = new TempFile())
            {
                var script = new TestScript();

                script.AppendFile(tempFile1.FileName);
                script.AppendFile(tempFile2.FileName);
                script.AppendFile(tempFile3.FileName);

                Assert.Equal(String.Format(
                  @"<script language='JavaScript' src='{0}'></script>{3}<script language='JavaScript' src='{1}'></script>{3}<script language='JavaScript' src='{2}'></script>{3}",
                  tempFile1.FileName,
                  tempFile2.FileName,
                  tempFile3.FileName,
                  Environment.NewLine
                ), script.ToString());
            }
        }
コード例 #42
0
ファイル: ActionsTest.cs プロジェクト: rzubek/UnityGameTools
        public void TestActionStartupAndUpdate()
        {
            // make some actions
            var a = new TestAction("a");
            var b = new TestAction("b");
            var c = new TestAction("c", true); // this one stops before first update
            var seq = new TestScript("test", a, b, c);

            Assert.IsTrue(a.IsEnqueued && a.IsActive && !a.IsStarted);
            Assert.IsTrue(a.countUpdate == 0);

            // fake an update cycle
            seq.OnUpdate();

            Assert.IsTrue(a.IsEnqueued && a.IsActive && a.IsStarted);
            Assert.IsTrue(a.countUpdate == 1);

            // stop. this will remove and deactivate A, and activate B,
            // but not start it yet until an update
            a.Stop(true);
            Assert.IsTrue(!a.IsEnqueued && !a.IsActive && !a.IsStarted);
            Assert.IsTrue( b.IsEnqueued &&  b.IsActive && !b.IsStarted);
            Assert.IsTrue(a.countUpdate == 1);
            Assert.IsTrue(b.countUpdate == 0);

            seq.OnUpdate();
            Assert.IsTrue(b.IsEnqueued && b.IsActive && b.IsStarted);
            Assert.IsTrue(b.countUpdate == 1);

            // stop b. this will activate c, which will stop itself before first update
            b.Stop(true);
            Assert.IsTrue(c.IsEnqueued && c.IsActive && !c.IsStarted);
            Assert.IsTrue(c.countUpdate == 0);
            seq.OnUpdate();
            Assert.IsTrue(!c.IsEnqueued && !c.IsActive && !c.IsStarted);
            Assert.IsTrue(c.countUpdate == 0); // this update never got a chance to run
        }
コード例 #43
0
ファイル: ActionsTest.cs プロジェクト: rzubek/UnityGameTools
        public void TestScriptsInQueue()
        {
            // make some scripts

            var a = new TestAction("a");
            var b = new TestAction("b");
            var c = new TestAction("c");
            var abc = new TestScript("abc", a, b, c);
            var empty = new TestScript("empty");
            var d = new TestAction("d");
            var e = new TestAction("e");
            var f = new TestAction("f");
            var def = new TestScript("def", d, e, f );

            var q = new ScriptQueue();
            q.Enqueue(new List<Script>() { abc, empty, def });

            // verify the first script and action are active
            Assert.IsTrue(!q.IsEmpty && q.Head == abc && q.Head.Head == a);
            Assert.IsTrue(  abc.IsEnqueued &&  abc.IsActive);
            Assert.IsTrue(empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(  def.IsEnqueued && !def.IsActive);

            // stop the first action, keeps the same script active
            a.Stop(true);
            Assert.IsTrue(!q.IsEmpty && q.Head == abc && q.Head.Head == b);

            // finish off actions. this will remove ABC from the queue
            b.Stop(true);
            c.Stop(true);
            Assert.IsTrue(!q.IsEmpty && q.Head != abc);
            Assert.IsTrue(abc.countActivate == 1 && abc.countDeactivate == 1);

            // the Empty script was activated but then immediately removed, because it's empty
            Assert.IsTrue(!empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(empty.countActivate == 1 && empty.countDeactivate == 1);

            // and let's make sure that DEF is the active one now
            Assert.IsTrue(!q.IsEmpty && q.Head == def && q.Head.Head == d);
            Assert.IsTrue(  !abc.IsEnqueued &&   !abc.IsActive);
            Assert.IsTrue(!empty.IsEnqueued && !empty.IsActive);
            Assert.IsTrue(   def.IsEnqueued &&    def.IsActive);
            Assert.IsTrue(def.countActivate == 1 && def.countDeactivate == 0);

            // then if we force-stop DEF, it should clean out of the queue completely
            def.StopScript(true, null);
            Assert.IsTrue(q.IsEmpty && q.Head == null);
            Assert.IsTrue(!def.IsEnqueued && !def.IsActive);
            Assert.IsTrue(def.countActivate == 1 && def.countDeactivate == 1);
        }
コード例 #44
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestIncludesDefaultDebuggerStatementByDefault()
        {
            var cscriptCommand = new FakeCScriptCommand();
            var script = new TestScript(cscriptCommand);

            script.RunTest("return true;");

            Assert.True(cscriptCommand.ScriptContainedDebuggerStatement);
        }
コード例 #45
0
ファイル: IOTA.Designer.cs プロジェクト: nipuna/MvsAPI
 public static TestScript CreateTestScript(int id)
 {
     TestScript testScript = new TestScript();
     testScript.ID = id;
     return testScript;
 }
コード例 #46
0
ファイル: IOTA.Designer.cs プロジェクト: nipuna/MvsAPI
 public void AddToTestScripts(TestScript testScript)
 {
     base.AddObject("TestScripts", testScript);
 }
コード例 #47
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestIncludesDefaultDebuggerStatementIfRequested()
        {
            var cscriptCommand = new FakeCScriptCommand();
            var script = new TestScript(cscriptCommand) { IncludeDefaultBreakpoint = true };

            script.RunTest("return true;");

            Assert.True(cscriptCommand.ScriptContainedDebuggerStatement);
        }
コード例 #48
0
ファイル: TestScript.cs プロジェクト: SonGit/NailGame
	void Awake()
	{
		instance = this;
	}
コード例 #49
0
ファイル: ActionsTest.cs プロジェクト: rzubek/UnityGameTools
        public void TestQueueUpdate()
        {
            // make some scripts

            var a = new TestAction("a");
            var b = new TestAction("b");
            var c = new TestAction("c");
            var abc = new TestScript("abc", a, b, c);
            var d = new TestAction("d");
            var e = new TestAction("e");
            var f = new TestAction("f");
            var def = new TestScript("def", d, e, f);

            var q = new ScriptQueue();
            q.Enqueue(new List<Script>() { abc, def });

            Assert.IsTrue(a.IsEnqueued && a.IsActive && !a.IsStarted);

            // fake a queue update
            q.OnUpdate();

            Assert.IsTrue(a.IsEnqueued && a.IsActive && a.IsStarted);

            // stop the script. the first action in the next script
            // will be activated, but won't be started until another update
            q.StopCurrentScript(true, null);
            Assert.IsTrue(!abc.IsEnqueued && !abc.IsActive && !a.IsActive && !a.IsStarted);
            Assert.IsTrue(def.IsEnqueued && def.IsActive && d.IsActive && !d.IsStarted);

            q.OnUpdate();
            Assert.IsTrue(def.IsEnqueued && def.IsActive && d.IsActive && d.IsStarted);

            // clear everything. no more updates
            q.StopAllScripts(true, null);
            Assert.IsTrue(!def.IsEnqueued && !def.IsActive && !d.IsActive && !d.IsStarted);
            Assert.IsTrue(q.IsEmpty);
        }
コード例 #50
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestReturnsValueWhenExplicitReturnSpecified()
        {
            var script = new TestScript();

            Assert.Equal("\"Success!\"", script.RunTest("return 'Success!';"));
        }
コード例 #51
0
 private void Awake()
 {
     Instance = this;
     controller = GetComponent<CharacterController>();
 }
コード例 #52
0
ファイル: ActionsTest.cs プロジェクト: rzubek/UnityGameTools
        public void TestStopOnFailure()
        {
            // make some scripts

            var a = new TestAction("a");
            var b = new TestAction("b");
            var c = new TestAction("c");
            var abc = new TestScript("abc", a, b, c);
            var d = new TestAction("d");
            var e = new TestAction("e");
            var f = new TestAction("f");
            var def = new TestScript("def", d, e, f);

            var q = new ScriptQueue();
            q.Enqueue(new List<Script>() { abc, def });

            q.OnUpdate();
            Assert.IsTrue(a.IsEnqueued && a.IsActive && a.IsStarted);

            // if we stop just action a with the failure flag set, it should stop the entire script
            // and advance to the next one
            abc.StopCurrentAction(false, null);

            Assert.IsTrue(!a.IsEnqueued && !a.IsActive);
            Assert.IsTrue(!abc.IsEnqueued && !abc.IsActive);
            Assert.IsTrue(def.IsActive && d.IsActive);

            // similary stopping the script will just remove it
            def.StopScript(false, null);
            Assert.IsTrue(!def.IsActive && !d.IsActive);
        }
コード例 #53
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestDoesNotIncludeDefaultDebuggerStatementIfSuppressed()
        {
            var cscriptCommand = new FakeCScriptCommand();
            var script = new TestScript(cscriptCommand) { IncludeDefaultBreakpoint = false };

            script.RunTest("return true;");

            Assert.False(cscriptCommand.ScriptContainedDebuggerStatement);
        }
コード例 #54
0
 protected JavaScriptTestBase(Boolean includeDefaultBreakpoint)
 {
     Script = new TestScript { IncludeDefaultBreakpoint = includeDefaultBreakpoint };
 }
コード例 #55
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
     pMove = player.GetComponent<TestScript>();
 }
コード例 #56
0
ファイル: TestScriptTests.cs プロジェクト: cbaxter/JSTest.NET
        public void RunTestReturnsNullWhenNoReturnSpecified()
        {
            var script = new TestScript();

            Assert.Equal("null", script.RunTest("var result = 'Success!';"));
        }