Ejemplo n.º 1
0
        public void Run_CallsApi()
        {
            var tc   = NUnit.Framework.TestContext.CurrentContext.TestDirectory;
            var strm = System.IO.File.OpenRead(tc + "./LuaScripts/SimpleTestCase.lua");
            var hr   = new SimpleHarness();

            runner = new ScriptRunner();

            IOC.ResolveImports(runner);

            Expect.MethodCall(() => apiBridge.Init());

            runner.Load(strm);

            Expect.MethodCall(() => apiBridge.BeginTestCase("SimpleHarness", "Mutagen.FrontEnd.Test.dll"));
            Expect.Once.MethodCall(() => apiBridge.TestResults()).Returns(new List <TestResult>());
            Expect.Once.MethodCall(() => apiBridge.TestHarness()).Returns(hr);

            Expect.Once.MethodCall(() => apiBridge.CommitTestCaseCode(Any <IAssertable> .Value.Matching(x => x != null).AsInterface));
            Expect.Once.MethodCall(() => apiBridge.ExecTestCase());

            runner.Run();

            AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
        }
Ejemplo n.º 2
0
        public void BeginTestCase_MakesTestharnessAvailableToScript()
        {
            var myHarness = new SimpleHarness();

            Expect.Once.MethodCall(() => apiBridge.BeginTestCase("SimpleHarness", "Mutagen.LuaFrontend.Test.dll"));
            Expect.Once.MethodCall(() => apiBridge.TestHarness()).Returns(myHarness);
            ReadScript("./LuaScripts/BeginTestCase_UseHarness.lua");
            LuaUtil.PublishObjectMethods(api, luaEnv);
            luaEnv.DoChunk(scriptChunk);
            AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
            Assert.AreEqual(myHarness.lastPrint, "Test");
        }