示例#1
0
 public void BeginTestCase_CallsApi()
 {
     Expect.Once.MethodCall(() => apiBridge.BeginTestCase("SimpleHarness", "Mutagen.LuaFrontend.Test.dll"));
     Expect.Once.MethodCall(() => apiBridge.TestHarness()).Returns(new SimpleHarness());
     ReadScript("./LuaScripts/BeginTestCase.lua");
     LuaUtil.PublishObjectMethods(api, luaEnv);
     luaEnv.DoChunk(scriptChunk);
     AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
 }
示例#2
0
        public void CallTo_AddFacette_CallsApi()
        {
            Expect.Once.MethodCall(() => apiBridge.AddFacette("fnord", 1, 7));

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

            AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
        }
示例#3
0
        public void CallTo_CreateFacette_CallsApi()
        {
            Expect.Once.MethodCall(() => apiBridge.CreateFacette("facName", Any <System.Collections.Generic.List <object> > .Value));

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

            AssertInvocationsWasMade.MatchingExpectationsFor(apiBridge);
        }
示例#4
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);
        }
示例#5
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");
        }
示例#6
0
        public void Execute_CanCallToOtherObject()
        {
            AssertWidget w = new AssertWidget();

            ReadScript("./LuaScripts/Assertable_CallOtherObject.lua");
            var ass = new LuaAssertable(luaEnv);

            LuaUtil.PublishObjectMethods(w, luaEnv);
            var res = ass.Execute();

            Assert.AreEqual(2, res.Count);
            Assert.AreEqual(false, res[0].result);
            Assert.AreEqual(true, res[1].result);
        }