public void CreateCommandXElement_NullActionResultExecutor_ThrowsArgumentNullException() { var evalCommand = new EvalCommand("script"); Action action = () => evalCommand.CreateCommandXElement(null); action.ShouldThrow<ArgumentNullException>(); }
public TaconiteResult Execute(string script) { if (String.IsNullOrEmpty(script)) throw new ArgumentNullException("script"); var command = new EvalCommand(script); AddCommand(command); return this; }
public TaconiteResult Execute(JavaScriptResult javaScriptResult) { if (javaScriptResult == null) throw new ArgumentNullException("javaScriptResult"); var command = new EvalCommand(javaScriptResult); AddCommand(command); return this; }
public void Equals_OneEvalCommandHasScriptAndOtherHasJavaScriptResult_ReturnsFalse() { var script = "console.log('weeeeeee')"; var javaScriptResult = new JavaScriptResult(); var evalCommand0 = new EvalCommand(script); var evalCommand1 = new EvalCommand(javaScriptResult); var result = evalCommand0.Equals(evalCommand1); result.Should().BeFalse(); }
public void Equals_OtherEvalCommandHasDifferentJavaScriptResult_ReturnsFalse() { var javaScriptResult0 = new JavaScriptResult(); var javaScriptResult1 = new JavaScriptResult(); var evalCommand0 = new EvalCommand(javaScriptResult0); var evalCommand1 = new EvalCommand(javaScriptResult1); var result = evalCommand0.Equals(evalCommand1); result.Should().BeFalse(); }
/// <summary> /// Determines whether the given <see cref="EvalCommand"/> equals this <see cref="EvalCommand"/>. /// </summary> /// <param name="other">The other <see cref="EvalCommand"/>.</param> /// <returns>Whether the given <see cref="EvalCommand"/> equals this <see cref="EvalCommand"/>.</returns> public bool Equals(EvalCommand other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return (_script != null && other._script != null && _script.Equals(other._script, StringComparison.InvariantCulture)) || (_javaScriptResult != null && other._javaScriptResult != null && _javaScriptResult.Equals(other._javaScriptResult)); }
public void CreateCommandXElement_RawScript_ReturnsCorrectXElement() { var script = "console.log('weeeeeee')"; var evalCommand = new EvalCommand(script); var controllerContext = Substitute.For<ControllerContext>(); var actionResultExecutor = Substitute.For<ActionResultExecutor>(controllerContext); var result = evalCommand.CreateCommandXElement(actionResultExecutor); result.Name.Should().Be((XName) "eval"); result.Value.Should().Be(script); }
public TaconiteResult Execute(JavaScriptResult javaScriptResult) { if (javaScriptResult == null) { throw new ArgumentNullException("javaScriptResult"); } var command = new EvalCommand(javaScriptResult); AddCommand(command); return(this); }
public TaconiteResult Execute(string script) { if (String.IsNullOrEmpty(script)) { throw new ArgumentNullException("script"); } var command = new EvalCommand(script); AddCommand(command); return(this); }
/// <summary> /// Determines whether the given <see cref="EvalCommand"/> equals this <see cref="EvalCommand"/>. /// </summary> /// <param name="other">The other <see cref="EvalCommand"/>.</param> /// <returns>Whether the given <see cref="EvalCommand"/> equals this <see cref="EvalCommand"/>.</returns> public bool Equals(EvalCommand other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return((_script != null && other._script != null && _script.Equals(other._script, StringComparison.InvariantCulture)) || (_javaScriptResult != null && other._javaScriptResult != null && _javaScriptResult.Equals(other._javaScriptResult))); }
public void Equals_OtherEvalCommandHasSameScript_ReturnsTrue() { var script = "console.log('weeeeeee')"; var evalCommand0 = new EvalCommand(script); var evalCommand1 = new EvalCommand(script); var result = evalCommand0.Equals(evalCommand1); result.Should().BeTrue(); }
public void GetHashCode_EvalCommandsHaveSameScript_ReturnsSameHashCode() { var script = "console.log('weeeeeee')"; var evalCommand0 = new EvalCommand(script); var evalCommand1 = new EvalCommand(script); var result0 = evalCommand0.GetHashCode(); var result1 = evalCommand1.GetHashCode(); result0.Should().Be(result1); }
public void Equals_OtherEvalCommandIsSameObject_ReturnsTrue() { var script = "console.log('weeeeeee')"; var evalCommand = new EvalCommand(script); var result = evalCommand.Equals(evalCommand); result.Should().BeTrue(); }
public void Equals_OtherEvalCommandIsNull_ReturnsFalse() { var script = "console.log('weeeeeee')"; var evalCommand0 = new EvalCommand(script); EvalCommand evalCommand1 = null; var result = evalCommand0.Equals(evalCommand1); result.Should().BeFalse(); }
public void Equals_OtherEvalCommandHasDifferentScript_ReturnsFalse() { var script0 = "console.log('weeeeeee')"; var script1 = "console.log('no.')"; var evalCommand0 = new EvalCommand(script0); var evalCommand1 = new EvalCommand(script1); var result = evalCommand0.Equals(evalCommand1); result.Should().BeFalse(); }
public void Equals_OtherEvalCommandHasSameJavaScriptResult_ReturnsTrue() { var javaScriptResult = new JavaScriptResult(); var evalCommand0 = new EvalCommand(javaScriptResult); var evalCommand1 = new EvalCommand(javaScriptResult); var result = evalCommand0.Equals(evalCommand1); result.Should().BeTrue(); }
public void Equals_OtherObjectIsNotAnEvalCommand_ReturnsFalse() { var other = new object(); var evalCommand = new EvalCommand("script"); var result = evalCommand.Equals(other); result.Should().BeFalse(); }
public void GetHashCode_EvalCommandHasScriptAndOtherHasJavaScriptResult_ReturnsDifferentHashCodes() { var script = "console.log('weeeeeee')"; var javaScriptResult = new JavaScriptResult(); var evalCommand0 = new EvalCommand(script); var evalCommand1 = new EvalCommand(javaScriptResult); var result0 = evalCommand0.GetHashCode(); var result1 = evalCommand1.GetHashCode(); result0.Should().NotBe(result1); }
public void GetHashCode_EvalCommandsHaveDifferentJavaScriptResults_ReturnsDifferentHashCodes() { var javaScriptResult0 = new JavaScriptResult(); var javaScriptResult1 = new JavaScriptResult(); var evalCommand0 = new EvalCommand(javaScriptResult0); var evalCommand1 = new EvalCommand(javaScriptResult1); var result0 = evalCommand0.GetHashCode(); var result1 = evalCommand1.GetHashCode(); result0.Should().NotBe(result1); }
public void GetHashCode_EvalCommandsHaveDifferentScripts_ReturnsDifferentHashCodes() { var script0 = "console.log('weeeeeee')"; var script1 = "console.log('no.')"; var evalCommand0 = new EvalCommand(script0); var evalCommand1 = new EvalCommand(script1); var result0 = evalCommand0.GetHashCode(); var result1 = evalCommand1.GetHashCode(); result0.Should().NotBe(result1); }
public void GetHashCode_EvalCommandsHaveSameJavaScriptResult_ReturnsSameHashCode() { var javaScriptResult = new JavaScriptResult(); var evalCommand0 = new EvalCommand(javaScriptResult); var evalCommand1 = new EvalCommand(javaScriptResult); var result0 = evalCommand0.GetHashCode(); var result1 = evalCommand1.GetHashCode(); result0.Should().Be(result1); }