public void Classes_ShouldSetClassAttribute() { var node = new TagNode(_tagName); node.Classes = _classValue; Assert.AreEqual(_classValue, node.Classes); }
public void AddAttribute_WithValidNewKeyAndValue_ShouldAddKeyValueToAttributes() { var node = new TagNode(_tagName); node.AddAttribute(_classKey, _classValue); Assert.AreEqual(_classValue, node.GetAttribute(_classKey)); }
public void AsTagNode_WithTagNode_ShouldBeCastToTagNode() { Node node = new TagNode(_tagName); var castNode = node.AsTagNode(); Assert.IsInstanceOfType(castNode, typeof(TagNode)); }
public void AddAttribute_WithValidKeyAndValue_ShouldAddValueToCurrenetAttribute() { const string value2 = "second"; var node = new TagNode(_tagName); node.AddAttribute(_classKey, _classValue); node.AddAttribute(_classKey, value2); Assert.AreEqual(_classValue + " " + value2, node.GetAttribute(_classKey)); }
public void AddData_ShouldAddDataAttribute() { const string key = "keys"; const string value = "[1,5,23]"; var node = new TagNode(_tagName); node.AddData(key, value); Assert.AreEqual(value, node.GetData(key)); }
/// <summary> /// /// </summary> /// <param name="tokens"></param> /// <returns></returns> private static Node CreateNode(SelectorTokens tokens) { var node = new TagNode(tokens.Tag); node.SetAttributes(tokens.Attributes); return node; }
public void Constructor_WithTagName_ShouldSetTagName() { var node = new TagNode(_tagName); Assert.AreEqual(_tagName, node.TagName); }
public void AddAttribute_WithNullKey_ShouldThrowArgumentException() { var node = new TagNode(_tagName); node.AddAttribute(null, _classValue); }
public void AddAttribute_WithEmptyStringKey_ShouldThrowArgumentException() { var node = new TagNode(_tagName); node.AddAttribute(string.Empty, _classValue); }
private static TagNode GetTagNodeWithAttributes() { var attributes = GetAttributes(_classKey, _classValue); var node = new TagNode(_tagName); node.SetAttributes(attributes); return node; }
public void Id_ShouldSetIdAttribute() { const string value = "unique"; var node = new TagNode(_tagName); node.Id = value; Assert.AreEqual(value, node.Id); }
public void Id_ShouldReturnIdAttribute() { const string value = "unique"; var node = new TagNode(_tagName); node.AddAttribute(_idKey, value); Assert.AreEqual(value, node.Id); }
public void GetAttribute_WithNonExistantKey_ShouldReturnEmptyString() { var node = new TagNode(_tagName); Assert.AreEqual(string.Empty, node.GetAttribute(_classKey)); }
public void AsTextNode_WithNonTextNode_ShouldThrowInvalidCastException() { Node node = new TagNode(_tagName); node.AsTextNode(); }