public void AddElement()
        {
            _testElement.AddElement(TEST_LABEL, TEST_VALUE);
            HbmlElement child = _testElement.GetChildElement(TEST_LABEL);

            Assert.IsNotNull(child);
        }
        public void AddElement_Constructed()
        {
            HbmlElement childAdded = new HbmlElement(TEST_LABEL, TEST_VALUE);

            _testElement.AddElement(childAdded);
            HbmlElement childReceived = _testElement.GetChildElement(childAdded.Label);

            Assert.AreEqual(childAdded, childReceived);
        }
        public void CreateElement_WithLabelAndValue()
        {
            HbmlElement element = new HbmlElement(TEST_LABEL, TEST_VALUE);

            Assert.AreEqual(TEST_LABEL, element.Label);
            Assert.AreEqual(TEST_VALUE, element.Value);
            Assert.IsFalse(element.HasAttributes);
            Assert.IsFalse(element.HasChildren);
        }
        /// <summary>
        /// Generates a formatted message for HergBot Markup Language logging
        /// </summary>
        /// <param name="timestamp">The logs timestamp</param>
        /// <param name="threadName">The name of the thread the message is logged from</param>
        /// <param name="methodName">The name of the method logging the message</param>
        /// <param name="type">The label for the type of log message</param>
        /// <param name="message">The log message</param>
        /// <returns>A formatted HBML element string for logging</returns>
        public string GenerateLogMessage(string timestamp, string threadName, string methodName, string type, string message)
        {
            // Build the element for the log entry
            HbmlElement logElement = new HbmlElement(LOG_ELEMENT_LABEL);

            logElement.AddElement(LOG_DATE_LABEL, timestamp);
            logElement.AddElement(LOG_TYPE_LABEL, type);
            logElement.AddElement(LOG_THREAD_NAME_LABEL, threadName);
            logElement.AddElement(LOG_METHOD_NAME_LABEL, methodName);
            logElement.AddElement(LOG_MESSAGE_LABEL, message);
            return(logElement.ToString());
        }
        public void ToString_MultiLayered()
        {
            HbmlElement childElement = new HbmlElement(TEST_LABEL, TEST_VALUE);

            childElement.AddElement(TEST_LABEL, TEST_VALUE);
            _testElement.Value = TEST_VALUE;
            _testElement.AddAttribute(TEST_ATTRIBUTE_NAME, TEST_ATTRIBUTE_VALUE);
            _testElement.AddElement(childElement);
            string expected = $"<{TEST_LABEL} {TEST_ATTRIBUTE_NAME}=\"{TEST_ATTRIBUTE_VALUE}\">\n    {TEST_VALUE}\n    <{TEST_LABEL}>\n        {TEST_VALUE}\n        <{TEST_LABEL}>{TEST_VALUE}</{TEST_LABEL}>\n    </{TEST_LABEL}>\n</{TEST_LABEL}>";

            Assert.AreEqual(expected, _testElement.ToString());
        }
 protected void SetUp()
 {
     _testElement = new HbmlElement(TEST_LABEL);
 }
        public void GetChildElement_DoesNotExist()
        {
            HbmlElement child = _testElement.GetChildElement(TEST_LABEL);

            Assert.IsNull(child);
        }