public void CreateCommandXElement_NullActionResultExecutor_ThrowsArgumentNullException() { var elementCommand = new ElementCommand("command", "#selector", "<div>Some HTML!</div>"); Action action = () => elementCommand.CreateCommandXElement(null); action.ShouldThrow <ArgumentNullException>(); }
public void CreateCommandXElement_RawHtml_ReturnsCorrectXElement() { var command = "command"; var selector = "#selector"; var html = "<div>Some HTML!</div>"; var elementCommand = new ElementCommand(command, selector, html); var controllerContext = Substitute.For <ControllerContext>(); var actionResultExecutor = Substitute.For <ActionResultExecutor>(controllerContext); var result = elementCommand.CreateCommandXElement(actionResultExecutor); result.Name.Should().Be((XName)command); result.Should().HaveAttribute("select", selector); result.FirstNode.NodeType.Should().Be(XmlNodeType.CDATA); result.Value.Should().Be(html); }