Esempio n. 1
0
        public void EntityInfoTest(EntityType type, int count, int label)
        {
            // encode & decode
            var entityInfo = new EntityInfo(type, count, label);

            entityInfo = new EntityInfo(type, entityInfo.Encode());

            // make sure nothing's changed
            Assert.Equal(type, entityInfo.Type);
            Assert.Equal(count, entityInfo.ScriptCount);
            Assert.Equal(label, entityInfo.Label);
        }
Esempio n. 2
0
        public void EntityTest(int label, EntityType type)
        {
            // construct a simple entity
            var labelInstr = new FieldScriptInstruction(5, label);
            var script     = new Script(new List <FieldScriptInstruction>()
            {
                labelInstr
            }, false);
            var entity = new Entity(type, new List <Script>()
            {
                script
            });

            // extract info, then encode & decode
            var entityInfo = new EntityInfo(entity);

            entityInfo = new EntityInfo(entity.Type, entityInfo.Encode());

            // info reflects the original entity
            Assert.Equal(label, entityInfo.Label);
            Assert.Equal(type, entityInfo.Type);
            Assert.Equal(0, entityInfo.ScriptCount);
        }