public void CreateCommandXElement_NullActionResultExecutor_ThrowsArgumentNullException()
        {
            var nonElementCommand = new NonElementCommand("command", "#selector");

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

              action.ShouldThrow<ArgumentNullException>();
        }
        public TaconiteResult FadeOut(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            throw new ArgumentNullException("selector");

              var command = new NonElementCommand("fadeOut", selector);
              AddCommand(command);

              return this;
        }
        public TaconiteResult Remove(string selector)
        {
            if (String.IsNullOrEmpty(selector))
            {
                throw new ArgumentNullException("selector");
            }

            var command = new NonElementCommand("remove", selector);

            AddCommand(command);

            return(this);
        }
예제 #4
0
        /// <summary>
        /// Determines whether the given <see cref="NonElementCommand"/> equals this <see cref="NonElementCommand"/>.
        /// </summary>
        /// <param name="other">The other <see cref="NonElementCommand"/>.</param>
        /// <returns>Whether the given <see cref="NonElementCommand"/> equals this <see cref="NonElementCommand"/>.</returns>
        public bool Equals(NonElementCommand other)
        {
            if (ReferenceEquals(null, other))
            return false;

              if (ReferenceEquals(this, other))
            return true;

              return _command.Equals(other._command, StringComparison.OrdinalIgnoreCase)
             && _selector.Equals(other._selector, StringComparison.Ordinal)
             && _arguments.Length == other._arguments.Length
             && _arguments.Zip(other._arguments, (x, y) => new { A = x, B = y }).All((x => (x.A == null && x.B == null) || (x.A != null && x.B != null && x.A.Equals(x.B))));
        }
        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();
        }
예제 #6
0
        /// <summary>
        /// Determines whether the given <see cref="NonElementCommand"/> equals this <see cref="NonElementCommand"/>.
        /// </summary>
        /// <param name="other">The other <see cref="NonElementCommand"/>.</param>
        /// <returns>Whether the given <see cref="NonElementCommand"/> equals this <see cref="NonElementCommand"/>.</returns>
        public bool Equals(NonElementCommand other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(_command.Equals(other._command, StringComparison.OrdinalIgnoreCase) &&
                   _selector.Equals(other._selector, StringComparison.Ordinal) &&
                   _arguments.Length == other._arguments.Length &&
                   _arguments.Zip(other._arguments, (x, y) => new { A = x, B = y }).All((x => (x.A == null && x.B == null) || (x.A != null && x.B != null && x.A.Equals(x.B)))));
        }
        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();
        }
        public void GetHashCode_OtherNonElementCommandPropertiesSame_ReturnsSameHashCode(
      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().Be(result1);
        }
        public void Equals_OtherObjectIsNotANonElementCommand_ReturnsFalse()
        {
            var other = new object();
              var elementCommand = new NonElementCommand("command", "#selector");

              var result = elementCommand.Equals(other);

              result.Should().BeFalse();
        }
        public void Equals_OtherNonElementCommandIsSameObject_ReturnsTrue()
        {
            var nonElementCommand = new NonElementCommand("command", "#selector");

              var result = nonElementCommand.Equals(nonElementCommand);

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

              var result = nonElementCommand.Equals(other);

              result.Should().BeFalse();
        }