Пример #1
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"));
        }
Пример #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"));
        }
Пример #3
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));
        }
Пример #4
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));
        }