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 CommitTestCaseCode()
        {
            // Build IAssertable from TCFunc
            var luaAssertable = new LuaAssertable(LuaEnv);

            bridge.CommitTestCaseCode(luaAssertable);
        }
Ejemplo n.º 3
0
        public void CallTo_EndTestCase_CallsApi()
        {
            Expect.Once.MethodCall(() => apiBridge.CommitTestCaseCode(Any <IAssertable> .Value.Matching(x => x != null).AsInterface));

            api.LuaEnv = luaEnv;
            ReadScript("./LuaScripts/EndTestCase.lua");
            LuaUtil.PublishObjectMethods(api, luaEnv);
            luaEnv.DoChunk(scriptChunk);

            AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
        }