Beispiel #1
0
        public void LuaCreateArea_AddRoom_Test()
        {
            var result = LuaAreaFunctions.LuaProcessArea(GetAreaLuaScript());

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Rooms.Count(), Is.EqualTo(1));
            Assert.That(result.Rooms.First().ID, Is.EqualTo(801));
        }
Beispiel #2
0
        public void LuaCreateAreaTest()
        {
            var result = LuaAreaFunctions.LuaProcessArea(GetAreaLuaScript());

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ID, Is.EqualTo(1));
            Assert.That(result.Name, Is.EqualTo("The Astral"));
            Assert.That(result.Author, Is.EqualTo("Andi"));
            Assert.That(result.HighEconomy, Is.EqualTo(2064393));
            Assert.That(result.HighHardRange, Is.EqualTo(60));
            Assert.That(result.ResetMessage, Is.EqualTo("The astral field glitters with a thousand points of light for a moment..."));
        }
Beispiel #3
0
        public void OnSetup()
        {
            LuaManager luaMgr = new LuaManager(new Mock <IKernel>().Object, new Mock <ILogWrapper>().Object);

            RepositoryManager dbMgr = new RepositoryManager(new Mock <IKernel>().Object, new Mock <ILogManager>().Object);

            LogManager logMgr = new LogManager(new Mock <ILogWrapper>().Object, new Mock <IKernel>().Object,
                                               new Mock <ITimer>().Object, new Mock <ISmaugDbContext>().Object, 0);

            LuaAreaFunctions.InitializeReferences(luaMgr, dbMgr, logMgr);
            LuaRoomFunctions.InitializeReferences(luaMgr, dbMgr, logMgr);

            dbMgr.AREAS.Clear();
            dbMgr.ROOMS.CastAs <Repository <long, RoomTemplate> >().Clear();

            var luaProxy = new LuaInterfaceProxy();

            var luaFuncRepo = LuaHelper.Register(typeof(LuaAreaFunctions), null);

            luaFuncRepo = LuaHelper.Register(typeof(LuaRoomFunctions), luaFuncRepo);
            luaProxy.RegisterFunctions(luaFuncRepo);

            luaMgr.InitializeLuaProxy(luaProxy);
        }