Example #1
0
        public void Classes_ShouldSetClassAttribute()
        {
            var node = new TagNode(_tagName);
            node.Classes = _classValue;

            Assert.AreEqual(_classValue, node.Classes);
        }
Example #2
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
 /// <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;
 }
Example #7
0
        public void Constructor_WithTagName_ShouldSetTagName()
        {
            var node = new TagNode(_tagName);

            Assert.AreEqual(_tagName, node.TagName);
        }
Example #8
0
 public void AddAttribute_WithNullKey_ShouldThrowArgumentException()
 {
     var node = new TagNode(_tagName);
     node.AddAttribute(null, _classValue);
 }
Example #9
0
 public void AddAttribute_WithEmptyStringKey_ShouldThrowArgumentException()
 {
     var node = new TagNode(_tagName);
     node.AddAttribute(string.Empty, _classValue);
 }
Example #10
0
        private static TagNode GetTagNodeWithAttributes()
        {
            var attributes = GetAttributes(_classKey, _classValue);
            var node = new TagNode(_tagName);
            node.SetAttributes(attributes);

            return node;
        }
Example #11
0
        public void Id_ShouldSetIdAttribute()
        {
            const string value = "unique";
            var node = new TagNode(_tagName);
            node.Id = value;

            Assert.AreEqual(value, node.Id);
        }
Example #12
0
        public void Id_ShouldReturnIdAttribute()
        {
            const string value = "unique";
            var node = new TagNode(_tagName);
            node.AddAttribute(_idKey, value);

            Assert.AreEqual(value, node.Id);
        }
Example #13
0
        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();
 }