public void ScoreHolderArgument_ParseShouldSucceeds_WithAllPlayersSelector_WhenLimitedToOneEntity_WhenLimitedToOneTarget()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"limit\":{\"predicate\":\"set_limit\"}}");
            ScoreHolderArgument argument = new ScoreHolderArgument(false);
            IStringReader       reader   = new StringReader("@a[limit=1]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }
        public void EntityArgument_ParseShouldFail_WithSelector_WithArguments_BecauseInvalidArgument()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"foo\":{\"contents\":{\"type\":\"argument\",\"parser\":\"string\",\"properties\":{\"type\":\"word\"}}}, \"baz\":{\"contents\":{\"type\":\"argument\",\"parser\":\"integer\"}}}");
            EntityArgument argument = new EntityArgument();
            IStringReader  reader   = new StringReader("@a[hello=false]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsFalse(readResults.Successful);
        }
        public void EntityArgument_ParseShouldSucceed_WithSelector_WithArguments()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"foo\":{\"contents\":{\"type\":\"argument\",\"parser\":\"string\",\"properties\":{\"type\":\"word\"}}}, \"baz\":{\"contents\":{\"type\":\"argument\",\"parser\":\"integer\"}}}");
            EntityArgument argument = new EntityArgument();
            IStringReader  reader   = new StringReader("@a[foo=bar, baz=3]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }
        public void EntityArgument_ParseShouldFail_WithDuplicateArguments_IfReapplicationIsAllowedButOnlyIfInverted_AndIsNotInverted()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"foo\":{\"reapplication_type\":\"only_if_inverted\",\"allow_inverse\":true,\"contents\":{\"type\":\"argument\",\"parser\":\"string\",\"properties\":{\"type\":\"word\"}}}}");
            EntityArgument argument = new EntityArgument();
            IStringReader  reader   = new StringReader("@a[foo=bar, foo=!baz]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsFalse(readResults.Successful);
        }
        public void EntityArgument_ParseShouldSucceed_WithDuplicateArguments_IfReapplicationIsAllowed()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"foo\":{\"reapplication_type\":\"always\",\"contents\":{\"type\":\"argument\",\"parser\":\"string\",\"properties\":{\"type\":\"word\"}}}}");
            EntityArgument argument = new EntityArgument();
            IStringReader  reader   = new StringReader("@a[foo=bar, foo=baz]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }
        public void EntityArgument_ParseShouldSucceed_WithAllEntitiesSelector_WithLimit_WhenLimitedToOneEntity()
        {
            // Arrange
            EntitySelectorOptions.Set("{\"limit\":{\"predicate\":\"set_limit\"}}");
            EntityArgument argument = new EntityArgument(true, false);
            IStringReader  reader   = new StringReader("@e[limit=1]");

            // Act
            ReadResults readResults = argument.Parse(reader, out _);

            // Assert
            Assert.IsTrue(readResults.Successful);
        }