public ImmutableOptions(DeclarationHandling declarationHandling, TextNodeHandling textNodeHandling, AttributeHandling attributeHandling, CommentHandling commentHandling, ProcessingInstructionHandling processingInstructionHandling)
 {
     DeclarationHandling           = declarationHandling;
     TextNodeHandling              = textNodeHandling;
     AttributeHandling             = attributeHandling;
     CommentHandling               = commentHandling;
     ProcessingInstructionHandling = processingInstructionHandling;
 }
        private static void CompareTexts(IEnumerator <XNode> aNodes, IEnumerator <XNode> bNodes, TextNodeHandling textNodeHandling)
        {
            var a = aNodes.Current as XText;
            var b = bNodes.Current as XText;

            switch (textNodeHandling)
            {
            case TextNodeHandling.Strict:
                if (a.GetType() != b.GetType())
                {
                    throw new UnequalityException(new UnequalityReason($"A CData is treated different than a text node. A is a {a.GetType()} and B is a {b.GetType()}.", a, b));
                }

                if (a.Value != b.Value)
                {
                    throw new UnequalityException(new UnequalityReason($"Text contained texts ('{a.Value}' and '{b.Value}') differs.", a, b));
                }
                return;

            case TextNodeHandling.CDataAsText:
                if (a.Value != b.Value)
                {
                    throw new UnequalityException(new UnequalityReason($"Text contained texts ('{a.Value}' and '{b.Value}') differs.", a, b));
                }
                return;

            case TextNodeHandling.Concatenated:
                if (a.PreviousNode != null && a.PreviousNode as XText != null)
                {
                    return;
                }

                if (b.PreviousNode != null && b.PreviousNode as XText != null)
                {
                    return;
                }

                var aText = GetConcatenatedText(aNodes);
                var bText = GetConcatenatedText(bNodes);
                if (aText != bText)
                {
                    throw new UnequalityException(new UnequalityReason($"Text contained texts ('{a.Value}' and '{b.Value}') differs.", a, b));
                }

                return;

            default:
                throw new Exception("Reached unexpected point in code.");
            }
        }