public void ConditionalIndexSelector()
        {
            var command = ParseCommand("set the \"batteries\" whose ratio < 0.5 @0 to recharge");

            Assert.IsTrue(command is BlockCommand);
            BlockCommand bc = (BlockCommand)command;

            Assert.IsTrue(bc.entityProvider is IndexEntityProvider);
            IndexEntityProvider iep = (IndexEntityProvider)bc.entityProvider;

            Assert.IsTrue(iep.provider is ConditionalEntityProvider);
        }
        public void MySelectorWithBlockType()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("set my display @0 text to \"hello world\"");

            Assert.IsTrue(command is BlockCommand);
            BlockCommand bc = (BlockCommand)command;

            Assert.IsTrue(bc.entityProvider is IndexEntityProvider);
            IndexEntityProvider iep = (IndexEntityProvider)bc.entityProvider;

            Assert.IsTrue(iep.provider is SelfEntityProvider);
            Assert.AreEqual(Block.DISPLAY, iep.provider.GetBlockType());
        }
        public void AssignListIndexSelectorValuePlusList()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("set my display[0] to \"Offset: \" + [offset]");

            Assert.IsTrue(command is BlockCommand);
            BlockCommand bc = (BlockCommand)command;

            Assert.IsTrue(bc.entityProvider is IndexEntityProvider);
            IndexEntityProvider iep         = (IndexEntityProvider)bc.entityProvider;
            List <Variable>     listIndexes = CastList(iep.index.GetValue()).GetTypedValue().GetValues();

            Assert.AreEqual(1, listIndexes.Count);
            Assert.AreEqual(0f, listIndexes[0].GetValue().GetValue());
        }
        public void ListIndexSelector()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("turn on \"batteries\"[0]");

            Assert.IsTrue(command is BlockCommand);
            BlockCommand bc = (BlockCommand)command;

            Assert.IsTrue(bc.entityProvider is IndexEntityProvider);
            IndexEntityProvider iep         = (IndexEntityProvider)bc.entityProvider;
            List <Variable>     listIndexes = CastList(iep.index.GetValue()).GetTypedValue().GetValues();

            Assert.AreEqual(1, listIndexes.Count);
            Assert.AreEqual(0f, listIndexes[0].GetValue().GetValue());
        }
        public void VariableSelectorWithIndex()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("turn on the $mySirens[0]");

            Assert.IsTrue(command is BlockCommand);
            BlockCommand bc = (BlockCommand)command;

            Assert.IsTrue(bc.entityProvider is IndexEntityProvider);
            IndexEntityProvider iep         = (IndexEntityProvider)bc.entityProvider;
            List <Variable>     listIndexes = CastList(iep.index.GetValue()).GetTypedValue().GetValues();

            Assert.AreEqual(1, listIndexes.Count);
            Assert.AreEqual(0f, listIndexes[0].GetValue().GetValue());
            Assert.IsTrue(iep.provider is SelectorEntityProvider);
            SelectorEntityProvider variableSelector = (SelectorEntityProvider)iep.provider;

            Assert.IsTrue(variableSelector.selector is InMemoryVariable);
            InMemoryVariable variable = (InMemoryVariable)variableSelector.selector;
        }