public void Applying_operation_should_equal_expected_output(DomElementFixture f)
        {
            var doc            = new DomDocument();
            var input          = doc.CreateDocumentFragment();
            var expectedOutput = doc.CreateDocumentFragment();

            input.LoadXml(f.Input);
            expectedOutput.LoadXml(f.Output);

            var op = FindOperation(f);

            op((DomElement)input.Select("target").First());

            // Compress whitespace to simplify comparison
            input.CollapseWS();
            expectedOutput.CollapseWS();

            Assert.Equal(expectedOutput.InnerXml.Trim(), input.InnerXml.Trim());
        }
        private Action <DomElement> FindOperation(DomElementFixture f)
        {
            switch (f.Operation.ToLowerInvariant())
            {
            case "unwrap":
                return(e => e.Unwrap());

            case "removeattributes":
                return(e => e.RemoveAttributes());

            case "prependtext":
                return(e => e.PrependText("#text"));

            case "appendtext":
                return(e => e.AppendText("#text"));

            default:
                Assert.Pending("Operation not defined: " + f.Operation);
                return(null);
            }
        }