예제 #1
0
 public void SetUp()
 {
     this.stream = new MemoryStream();
     this.reader = new StreamReader(this.stream);
     this.luaStoreWriter = new LuaStoreWriter(this.stream);
     this.luaStore = new LuaStore();
 }
예제 #2
0
        public void ShouldBeAbleToAddFunctionToStore()
        {
            var luaStore = new LuaStore();
            luaStore.AddFunction(null, "FindWindowByName", new string[0]);

            var libraries = luaStore.GetAllChildren();
            var luaObject = libraries.First();
            Assert.That(luaObject.Name, Is.EqualTo("FindWindowByName"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaFunction)));
        }
예제 #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)));
        }
예제 #4
0
        public void ShouldBeAbleToAddLibraryToStore()
        {
            var luaStore = new LuaStore();
            luaStore.AddLibrary("Apollo");

            var libraries = luaStore.GetAllChildren();

            var luaObject = libraries.First();
            Assert.That(luaObject.Name, Is.EqualTo("Apollo"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaLibrary)));
        }
예제 #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"));
        }
예제 #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));
        }
예제 #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));
        }
예제 #8
0
        public void ShouldBeAbleToAddObjectToStore()
        {
            var luaStore = new LuaStore();
            luaStore.AddObject("Challenges");

            var libraries = luaStore.GetAllChildren();

            var luaObject = libraries.First();
            Assert.That(luaObject.Name, Is.EqualTo("Challenges"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaObject)));
        }
예제 #9
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)));
        }
예제 #10
0
        public void ShouldBeAbleToIndexLuaObject()
        {
            var luaStore = new LuaStore();
            luaStore.AddLibrary("Apollo");

            var luaObject = luaStore["Apollo"];
            Assert.That(luaObject.Name, Is.EqualTo("Apollo"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaLibrary)));
        }
예제 #11
0
        public void ShouldBeAbleToAddWindowControlToStore()
        {
            var luaStore = new LuaStore();
            luaStore.AddWindowControl("Window");

            var libraries = luaStore.GetAllChildren();

            var luaObject = libraries.First();
            Assert.That(luaObject.Name, Is.EqualTo("Window"));
            Assert.That(luaObject.GetType(), Is.EqualTo(typeof(LuaWindowControl)));
        }
예제 #12
0
 public void SetUp()
 {
     this.store = new LuaStore();
     this.apolloGen = new ApolloAPIReader(this.store);
 }
예제 #13
0
 public void SetUp()
 {
     this.store     = new LuaStore();
     this.apolloGen = new ApolloAPIReader(this.store);
 }