TaconiteResult IPluginCommandWithContentOrArgumentSyntax.WithNoArguments()
        {
            var command = new NonElementCommand(_plugin, _selector);
              Result.AddCommand(command);

              return Result;
        }
        TaconiteResult IPluginCommandWithContentOrArgumentSyntax.WithArguments(params object[] arguments)
        {
            var command = new NonElementCommand(_plugin, _selector, arguments);
              Result.AddCommand(command);

              return Result;
        }
Esempio n. 3
0
        public void Equals_OtherNonElementCommandIsSameObject_ReturnsTrue()
        {
            var nonElementCommand = new NonElementCommand("command", "#selector");

            var result = nonElementCommand.Equals(nonElementCommand);

            result.Should().BeTrue();
        }
Esempio n. 4
0
        public void CreateCommandXElement_NullActionResultExecutor_ThrowsArgumentNullException()
        {
            var nonElementCommand = new NonElementCommand("command", "#selector");

            Action action = () => nonElementCommand.CreateCommandXElement(null);

            action.ShouldThrow <ArgumentNullException>();
        }
        TaconiteResult IPluginCommandWithContentOrArgumentSyntax.WithNoArguments()
        {
            var command = new NonElementCommand(_plugin, _selector);

            Result.AddCommand(command);

            return(Result);
        }
        TaconiteResult IPluginCommandWithContentOrArgumentSyntax.WithArguments(params object[] arguments)
        {
            var command = new NonElementCommand(_plugin, _selector, arguments);

            Result.AddCommand(command);

            return(Result);
        }
Esempio n. 7
0
        public void Equals_OtherObjectIsNotANonElementCommand_ReturnsFalse()
        {
            var other          = new object();
            var elementCommand = new NonElementCommand("command", "#selector");

            var result = elementCommand.Equals(other);

            result.Should().BeFalse();
        }
Esempio n. 8
0
        public void Equals_OtherNonElementCommandIsNull_ReturnsFalse()
        {
            var            nonElementCommand = new NonElementCommand("command", "#selector");
            ElementCommand other             = null;

            var result = nonElementCommand.Equals(other);

            result.Should().BeFalse();
        }
Esempio n. 9
0
        public void Equals_OtherNonElementCommandHasDifferentProperties_ReturnsFalse(
            string command0, string selector0, object[] args0,
            string command1, string selector1, object[] args1)
        {
            var nonElementCommand0 = new NonElementCommand(command0, selector0, args0);
            var nonElementCommand1 = new NonElementCommand(command1, selector1, args1);

            var result = nonElementCommand0.Equals(nonElementCommand1);

            result.Should().BeFalse();
        }
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult IAddClassToTargetSyntax.To(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            throw new ArgumentNullException("selector");

              var classes = String.Join(" ", _classNames);
              var command = new NonElementCommand("addClass", selector, classes);

              Result.AddCommand(command);

              return Result;
        }
Esempio n. 11
0
        public void GetHashCode_OtherNonElementCommandHasDifferentProperties_ReturnsDifferentHashCode(
            string command0, string selector0, object[] args0,
            string command1, string selector1, object[] args1)
        {
            var nonElementCommand0 = new NonElementCommand(command0, selector0, args0);
            var nonElementCommand1 = new NonElementCommand(command1, selector1, args1);

            var result0 = nonElementCommand0.GetHashCode();
            var result1 = nonElementCommand1.GetHashCode();

            result0.Should().NotBe(result1);
        }
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult IRemoveClassCommandFromTargetSyntax.From(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            throw new ArgumentNullException("selector");

              foreach (var attribute in _classNames)
              {
            var command = new NonElementCommand("removeClass", selector, attribute);
            Result.AddCommand(command);
              }

              return Result;
        }
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult ISetAttributeCommandForTargetSyntax.For(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            throw new ArgumentNullException("selector");

              foreach (var attribute in _attributes)
              {
            var command = new NonElementCommand("attr", selector, attribute.Key, attribute.Value);
            Result.AddCommand(command);
              }

              return Result;
        }
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult IAddClassToTargetSyntax.To(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            {
                throw new ArgumentNullException("selector");
            }

            var classes = String.Join(" ", _classNames);
            var command = new NonElementCommand("addClass", selector, classes);

            Result.AddCommand(command);

            return(Result);
        }
Esempio n. 15
0
        public void CreateCommandXElement_NoArguments_ReturnsCorrectXElement()
        {
            var command              = "command";
            var selector             = "#selector";
            var nonElementCommand    = new NonElementCommand(command, selector);
            var controllerContext    = Substitute.For <ControllerContext>();
            var actionResultExecutor = Substitute.For <ActionResultExecutor>(controllerContext);

            var result = nonElementCommand.CreateCommandXElement(actionResultExecutor);

            result.Name.Should().Be((XName)command);
            result.Should().HaveAttribute("select", selector);
            result.Nodes().Should().BeEmpty();
        }
Esempio n. 16
0
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult IRemoveClassCommandFromTargetSyntax.From(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            {
                throw new ArgumentNullException("selector");
            }

            foreach (var attribute in _classNames)
            {
                var command = new NonElementCommand("removeClass", selector, attribute);
                Result.AddCommand(command);
            }

            return(Result);
        }
        /// <summary>
        /// Specifies the jQuery selector for the target element(s).
        /// </summary>
        /// <param name="selector">The jQuery selector for the target element(s).</param>
        TaconiteResult ISetAttributeCommandForTargetSyntax.For(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            {
                throw new ArgumentNullException("selector");
            }

            foreach (var attribute in _attributes)
            {
                var command = new NonElementCommand("attr", selector, attribute.Key, attribute.Value);
                Result.AddCommand(command);
            }

            return(Result);
        }