Exemplo n.º 1
0
        public void ShouldBeAbleToAddFunctionToLibrary()
        {
            var luaStore = new LuaStore();
            luaStore.AddLibrary("Apollo");
            luaStore.AddFunction("Apollo", "FindWindowByName", new string[0]);

            var luaObject = luaStore.GetChild("Apollo").GetChild("FindWindowByName");
            Assert.That(luaObject.Name, Is.EqualTo("FindWindowByName"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaFunction)));
        }
Exemplo n.º 2
0
        public void ShouldBeAbleToAddEnumToLibrary()
        {
            var luaStore = new LuaStore();
            luaStore.AddLibrary("Apollo");
            luaStore.AddEnum("Apollo", "Enum", null);

            var luaObject = luaStore.GetChild("Apollo").GetChild("Enum");
            var val = luaObject as LuaEnum;
            Assert.That(val, Is.Not.Null);
            Assert.That(val.Name, Is.EqualTo("Enum"));
        }
Exemplo n.º 3
0
        public void ShouldBeAbleToAddFunctionToLibrary()
        {
            var luaStore = new LuaStore();

            luaStore.AddLibrary("Apollo");
            luaStore.AddFunction("Apollo", "FindWindowByName", new string[0]);

            var luaObject = luaStore.GetChild("Apollo").GetChild("FindWindowByName");

            Assert.That(luaObject.Name, Is.EqualTo("FindWindowByName"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaFunction)));
        }
Exemplo n.º 4
0
        public void ShouldBeAbleToAddMethodToStore()
        {
            var luaStore = new LuaStore();

            luaStore.AddObject("Challenges");
            luaStore.AddMethod("Challenges", "GetId", new string[0]);

            var luaObject = luaStore.GetChild("Challenges").GetChild("GetId");

            Assert.That(luaObject.Name, Is.EqualTo("GetId"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaMethod)));
        }
Exemplo n.º 5
0
        public void ShouldBeAbleToAddEnumToLibrary()
        {
            var luaStore = new LuaStore();

            luaStore.AddLibrary("Apollo");
            luaStore.AddEnum("Apollo", "Enum", null);

            var luaObject = luaStore.GetChild("Apollo").GetChild("Enum");
            var val       = luaObject as LuaEnum;

            Assert.That(val, Is.Not.Null);
            Assert.That(val.Name, Is.EqualTo("Enum"));
        }
Exemplo n.º 6
0
        public void ShouldBeAbleToAddEnumWithValuesToLibrary()
        {
            var luaStore = new LuaStore();
            luaStore.AddLibrary("Apollo");
            luaStore.AddEnum(
                "Apollo",
                "Enum",
                new[]
                {
                    new KeyValuePair<string, int>("Test1", 1), new KeyValuePair<string, int>("Test2", 2),
                    new KeyValuePair<string, int>("Test3", 3)
                });

            var luaObject = luaStore.GetChild("Apollo").GetChild("Enum");
            var val = luaObject as LuaEnum;

            var values = val.GetValues();
            Assert.That(values["Test1"], Is.EqualTo(1));
            Assert.That(values["Test2"], Is.EqualTo(2));
            Assert.That(values["Test3"], Is.EqualTo(3));
        }
Exemplo n.º 7
0
        public void ShouldBeAbleToAddEnumWithValuesToLibrary()
        {
            var luaStore = new LuaStore();

            luaStore.AddLibrary("Apollo");
            luaStore.AddEnum(
                "Apollo",
                "Enum",
                new[]
            {
                new KeyValuePair <string, int>("Test1", 1), new KeyValuePair <string, int>("Test2", 2),
                new KeyValuePair <string, int>("Test3", 3)
            });

            var luaObject = luaStore.GetChild("Apollo").GetChild("Enum");
            var val       = luaObject as LuaEnum;

            var values = val.GetValues();

            Assert.That(values["Test1"], Is.EqualTo(1));
            Assert.That(values["Test2"], Is.EqualTo(2));
            Assert.That(values["Test3"], Is.EqualTo(3));
        }
Exemplo n.º 8
0
        public void ShouldBeAbleToAddMethodToStore()
        {
            var luaStore = new LuaStore();
            luaStore.AddObject("Challenges");
            luaStore.AddMethod("Challenges", "GetId", new string[0]);

            var luaObject = luaStore.GetChild("Challenges").GetChild("GetId");
            Assert.That(luaObject.Name, Is.EqualTo("GetId"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaMethod)));
        }