Ejemplo n.º 1
0
        public void TestRoundTripWithDefaultExtension(string sourceFileName, bool useCompression)
        {
            var sourceFilePath = Path.Combine(TestInputPath, sourceFileName);
            var destFilePath   = Path.Combine(TestInputPath, DefaultInputName);

            LibSrcMLRunner runner = new LibSrcMLRunner();

            runner.GenerateSrcMLFromFile(sourceFilePath, destFilePath + ".cpp", Language.CPlusPlus, new Collection <UInt32>()
            {
                LibSrcMLRunner.SrcMLOptions.SRCML_OPTION_POSITION
            }, new Dictionary <string, Language>()
            {
            });
            Assert.That(File.Exists(destFilePath + ".cpp0.xml"));

            var fileUnit      = SrcMLElement.Load(destFilePath + ".cpp0.xml");
            var dataGenerator = new DataGenerator();
            var nsd           = dataGenerator.Parse(fileUnit.Element(SRC.Unit)) as NamespaceDefinition;

            string outputFileName = Path.ChangeExtension(DefaultOutputName, useCompression ? XmlSerialization.DEFAULT_COMPRESSED_EXTENSION : XmlSerialization.DEFAULT_EXTENSION);

            XmlSerialization.WriteElement(nsd, outputFileName);
            var nsdFromFile = XmlSerialization.Load(outputFileName) as NamespaceDefinition;

            DataAssert.StatementsAreEqual(nsd, nsdFromFile);
        }
Ejemplo n.º 2
0
        private void MenuItemLanguage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var menuItem = (sender as MenuItem);

                if (null != menuItem && menuItem.IsChecked)
                {
                    menuItem.IsCheckable = false;
                    var otherMenuItems = from MenuItem item in MenuItemLanguage.Items.SourceCollection
                                         where item != menuItem
                                         select item;
                    foreach (var item in otherMenuItems)
                    {
                        item.IsChecked   = false;
                        item.IsCheckable = true;
                    }

                    this._language = SrcMLElement.GetLanguageFromString(menuItem.Header.ToString());
                    sourceBox_TextChanged(sender, null);
                }
            }
            catch (SrcMLException error)
            {
                PrintErrorInSrcmlBox(error.Message);
            }
        }
Ejemplo n.º 3
0
        public void SingleFileTest()
        {
            generator.GenerateSrcMLFromFile("srcmltest\\foo.c", "srcml_xml\\singlefile.xml");
            var unit = SrcMLElement.Load("srcml_xml\\singlefile.xml");

            Assert.IsNotNull(unit);
            Assert.AreEqual("srcmltest\\foo.c", unit.Attribute("filename").Value);
        }
Ejemplo n.º 4
0
 private void AddSourceFiles()
 {
     Console.WriteLine("Thread 2: adding file: " + @"TestFiles\small_json_reader.cpp.xml");
     manager.AddSrcMLFile(SrcMLElement.Load(@"TestFiles\small_json_reader.cpp.xml"));
     Console.WriteLine("Thread 2: adding file: " + @"TestFiles\function_def.cpp.xml");
     manager.AddSrcMLFile(SrcMLElement.Load(@"TestFiles\function_def.cpp.xml"));
     Console.WriteLine("Thread 2: adding file: " + @"TestFiles\function_def2.cpp");
     manager.AddSourceFile(@"TestFiles\function_def2.cpp");
 }
Ejemplo n.º 5
0
 private static IEnumerable <ExtensionLanguagePair> ParseLanguageMap(string languageMapping)
 {
     foreach (var segment in languageMapping.Split(';'))
     {
         var      parts     = segment.Split('=');
         var      extension = parts[0];
         Language language  = SrcMLElement.GetLanguageFromString(parts[1]);
         yield return(new ExtensionLanguagePair(extension, language));
     }
 }
Ejemplo n.º 6
0
        public void TestGetLanguageForUnit_ValidLanguage()
        {
            string testXml = @"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>
<unit xmlns=""http://www.sdml.info/srcML/src"" language=""C++"" filename=""test.cpp""><expr_stmt><expr></expr></expr_stmt>
</unit>";

            XElement fileUnit = XElement.Parse(testXml);

            Assert.AreEqual(Language.CPlusPlus, SrcMLElement.GetLanguageForUnit(fileUnit));
        }
Ejemplo n.º 7
0
        public void TestGetLanguageForUnit_InvalidLanguage()
        {
            string testXml = String.Format(@"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>
<unit xmlns=""{0}"" language=""C+"" filename=""test.cpp""><expr_stmt><expr></expr></expr_stmt>
</unit>", SRC.NS);

            XElement fileUnit = XElement.Parse(testXml);

            Assert.Throws <SrcMLException>(() => SrcMLElement.GetLanguageForUnit(fileUnit));
        }
Ejemplo n.º 8
0
        public void TestGetLanguageForUnit_NoLanguage()
        {
            string testXml = @"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>
<unit xmlns=""http://www.sdml.info/srcML/src"" filename=""test.cpp""><expr_stmt><expr></expr></expr_stmt>
</unit>";

            XElement fileUnit = XElement.Parse(testXml);

            Assert.Throws <SrcMLException>(() => SrcMLElement.GetLanguageForUnit(fileUnit));
        }
Ejemplo n.º 9
0
        private void UpdateSupportedLanguages()
        {
            HashSet <Language> supportedLanguages = new HashSet <Language>(this.XmlGenerator.SupportedLanguages);

            foreach (var item in this.MenuItemLanguage.Items)
            {
                var menuItem = item as MenuItem;
                var language = SrcMLElement.GetLanguageFromString(menuItem.Header.ToString());
                menuItem.IsEnabled = supportedLanguages.Contains(language);
            }
        }
Ejemplo n.º 10
0
        public void TestGetLanguageForUnit_InvalidArgument()
        {
            string testXml = @"<function><type><name>int</name></type> <name>main</name><parameter_list>()</parameter_list> <block>{ }</block></function>";

            XElement fileUnit = XElement.Parse(testXml);

            Assert.Throws <ArgumentException>(() => SrcMLElement.GetLanguageForUnit(fileUnit));

            fileUnit = null;
            Assert.Throws <ArgumentNullException>(() => SrcMLElement.GetLanguageForUnit(fileUnit));
        }
Ejemplo n.º 11
0
        public void TestCSharpExpressionWithDefaultKeyword()
        {
            var generator = new SrcMLGenerator(TestConstants.SrcmlPath);

            generator.GenerateSrcMLFromFile("external\\TestCSharpExpressionWithDefaultKeyword.cs", "external_xml\\TestCSharpExpressionWithDefaultKeyword.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpExpressionWithDefaultKeyword.cs.xml");
            var classB   = fileUnit.Element(SRC.Class);

            Assert.IsNotNull(classB);
            Assert.AreEqual(2, classB.Descendants(SRC.Function).Count());
        }
Ejemplo n.º 12
0
        public void TestCSharpExpressionWithDefaultKeyword()
        {
            var generator = new SrcMLGenerator(Path.Combine(SrcMLHelper.GetSrcMLRootDirectory(), SrcMLHelper.srcMLExecutableLocation));

            generator.GenerateSrcMLFromFile("external\\TestCSharpExpressionWithDefaultKeyword.cs", "external_xml\\TestCSharpExpressionWithDefaultKeyword.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpExpressionWithDefaultKeyword.cs.xml");
            var classB   = fileUnit.Element(SRC.Class);

            Assert.IsNotNull(classB);
            Assert.AreEqual(2, classB.Descendants(SRC.Function).Count());
        }
Ejemplo n.º 13
0
        public void TestCacheRoundTrip()
        {
            manager.AddSrcMLFile(SrcMLElement.Load(@"TestFiles\json_reader.cpp.xml"));
            int beforeCount = manager.GetSwumData().Count;
            //string tempFile = Path.GetTempFileName();
            string tempFile = "swum_cache.txt";

            manager.PrintSwumCache(tempFile);
            manager.ReadSwumCache(tempFile);
            Assert.AreEqual(beforeCount, manager.GetSwumData().Count);
            //TODO: add assertions that verify contents of SWUM
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Generates SWUMs for the method definitions within the given source file.
        /// </summary>
        /// <param name="sourcePath">The path to the source file.</param>
        public void AddSourceFile(string sourcePath)
        {
            //Don't try to process files that SrcML can't handle
            if (Archive != null && !Archive.IsValidFileExtension(sourcePath))
            {
                return;
            }
            var fileExt = Path.GetExtension(sourcePath);

            if (fileExt == null || (Generator != null && !Generator.ExtensionMapping.ContainsKey(fileExt)))
            {
                return;
            }

            sourcePath = Path.GetFullPath(sourcePath);
            XElement fileElement;

            if (Archive != null)
            {
                fileElement = Archive.GetXElementForSourceFile(sourcePath);
                if (fileElement == null)
                {
                    LogEvents.SwumFileNotFoundInArchive(this, sourcePath);
                }
            }
            else if (Generator != null)
            {
                string outFile = Path.GetTempFileName();
                try {
                    Generator.GenerateSrcMLFromFile(sourcePath, outFile);
                    fileElement = SrcMLElement.Load(outFile);
                    if (fileElement == null)
                    {
                        LogEvents.SwumErrorGeneratingSrcML(this, sourcePath);
                    }
                } finally {
                    File.Delete(outFile);
                }
            }
            else
            {
                throw new InvalidOperationException("SwumManager - Archive and Generator are both null");
            }

            try {
                if (fileElement != null)
                {
                    AddSwumForMethodDefinitions(fileElement, sourcePath);
                }
            } catch (Exception e) {
                LogEvents.SwumErrorCreatingSwum(this, sourcePath, e);
            }
        }
Ejemplo n.º 15
0
        public void TestBooleanArgument()
        {
            var xml  = @"<function><type><name>boolean</name></type> <name><name>Automobile</name><op:operator>::</op:operator><name>HasEmptyGasTank</name></name><parameter_list>(<param><decl><type><name>boolean</name></type> <name>gasTank</name></decl></param>)</parameter_list> <block>{
	<return>return <expr><lit:literal type=""boolean"">false</lit:literal></expr>;</return>
}</block></function>";
            var unit = fileUnitSetup.GetFileUnitForXmlSnippet(xml, "test.cpp");

            var func = unit.Descendants(SRC.Function).First();
            var mdn  = new MethodDeclarationNode(SrcMLElement.GetNameForMethod(func).Value, ContextBuilder.BuildMethodContext(func));

            builder.ApplyRules(mdn);
        }
Ejemplo n.º 16
0
 public void AddManyFiles()
 {
     for (int i = 0; i < 100; i++)
     {
         foreach (XElement methodElement in functions)
         {
             string                funcName = SrcMLElement.GetNameForMethod(methodElement).Value;
             MethodContext         mc       = ContextBuilder.BuildMethodContext(methodElement);
             MethodDeclarationNode mdn      = new MethodDeclarationNode(funcName, mc);
             builder.ApplyRules(mdn);
         }
     }
 }
Ejemplo n.º 17
0
        public List <ProgramElement> Parse(string fileName)
        {
            var      programElements = new List <ProgramElement>();
            XElement sourceElements;

            if (SrcMLService != null)
            {
                sourceElements = SrcMLService.GetXElementForSourceFile(fileName);
                if (sourceElements != null)
                {
                    programElements = Parse(fileName, sourceElements);
                }
                else
                {
                    FileLogger.DefaultLogger.ErrorFormat("SrcMLCppParser: File not found in SrcMLService: {0}", fileName);
                }
            }
            else if (Archive != null)
            {
                sourceElements = Archive.GetXElementForSourceFile(fileName);
                if (sourceElements != null)
                {
                    programElements = Parse(fileName, sourceElements);
                }
                else
                {
                    LogEvents.ParserFileNotFoundInArchiveError(this, fileName);
                }
            }
            else if (Generator != null)
            {
                string outFile = Path.GetTempFileName();
                try {
                    //This is a C++ parser, so we'll convert the input file as C++ no matter what the file extension is
                    Generator.GenerateSrcMLFromFile(fileName, outFile, Language.CPlusPlus);
                    sourceElements = SrcMLElement.Load(outFile);
                    if (sourceElements != null)
                    {
                        programElements = Parse(fileName, sourceElements);
                    }
                } finally {
                    File.Delete(outFile);
                }
            }
            else
            {
                throw new InvalidOperationException("SrcMLCppParser - Archive and Generator are both null");
            }

            return(programElements);
        }
Ejemplo n.º 18
0
        public void TestCppStaticTypeModifier()
        {
            var generator = new SrcMLGenerator(TestConstants.SrcmlPath);

            generator.GenerateSrcMLFromFile("external\\TestCppTypeModifiers.cpp", "external_xml\\TestCppStaticModifier.cpp.xml");
            var fileUnit       = SrcMLElement.Load("external_xml\\TestCppStaticModifier.cpp.xml");
            var typeWithStatic = fileUnit.Descendants(SRC.Type).LastOrDefault();

            Assert.IsNotNull(typeWithStatic);
            var staticModifier = typeWithStatic.Elements(SRC.Specifier).FirstOrDefault();

            Assert.IsNotNull(staticModifier);
            Assert.AreEqual("static", staticModifier.Value);
        }
Ejemplo n.º 19
0
        public void TestCSharpUsingStatement()
        {
            var generator = new SrcMLGenerator(Path.Combine(SrcMLHelper.GetSrcMLRootDirectory(), SrcMLHelper.srcMLExecutableLocation));

            generator.GenerateSrcMLFromFile("external\\TestCSharpUsingStatement.cs", "external_xml\\TestCSharpUsingStatement.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpUsingStatement.cs.xml");

            var usingBlock = fileUnit.Elements(SRC.Using_Stmt).FirstOrDefault();

            Assert.IsNotNull(usingBlock);

            Assert.AreEqual(1, usingBlock.Elements(SRC.Init).Count());
            Assert.AreEqual(1, usingBlock.Elements(SRC.Block).Count());
        }
Ejemplo n.º 20
0
        public void TestCSharpUsingStatement()
        {
            var generator = new SrcMLGenerator(TestConstants.SrcmlPath);

            generator.GenerateSrcMLFromFile("external\\TestCSharpUsingStatement.cs", "external_xml\\TestCSharpUsingStatement.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpUsingStatement.cs.xml");

            var usingBlock = fileUnit.Elements(SRC.Using).FirstOrDefault();

            Assert.IsNotNull(usingBlock);

            Assert.AreEqual(1, usingBlock.Elements(SRC.Declaration).Count());
            Assert.AreEqual(1, usingBlock.Elements(SRC.Block).Count());
        }
Ejemplo n.º 21
0
        public void TestCppStaticTypeModifier()
        {
            var generator = new SrcMLGenerator(Path.Combine(SrcMLHelper.GetSrcMLRootDirectory(), SrcMLHelper.srcMLExecutableLocation));

            generator.GenerateSrcMLFromFile("external\\TestCppTypeModifiers.cpp", "external_xml\\TestCppStaticModifier.cpp.xml");
            var fileUnit       = SrcMLElement.Load("external_xml\\TestCppStaticModifier.cpp.xml");
            var typeWithStatic = fileUnit.Descendants(SRC.Declaration).LastOrDefault();

            Assert.IsNotNull(typeWithStatic);
            var staticModifier = typeWithStatic.Elements(SRC.Specifier).FirstOrDefault();

            Assert.IsNotNull(staticModifier);
            Assert.AreEqual("static", staticModifier.Value);
        }
Ejemplo n.º 22
0
        public void TestCSharpExpressionWithRemove()
        {
            var generator = new SrcMLGenerator(Path.Combine(SrcMLHelper.GetSrcMLRootDirectory(), SrcMLHelper.srcMLExecutableLocation));

            generator.GenerateSrcMLFromFile("external\\TestCSharpExpressionWithRemove.cs", "external_xml\\TestCSharpExpressionWithRemove.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpExpressionWithRemove.cs.xml");

            var method = fileUnit.Descendants(SRC.Function).FirstOrDefault();

            Assert.IsNotNull(method);
            var methodBlock = method.Element(SRC.Block);

            Assert.IsNotNull(methodBlock);
            Assert.AreEqual(1, methodBlock.Elements(SRC.ExpressionStatement).Count());
        }
Ejemplo n.º 23
0
        public void TestCSharpExpressionWithRemove()
        {
            var generator = new SrcMLGenerator(TestConstants.SrcmlPath);

            generator.GenerateSrcMLFromFile("external\\TestCSharpExpressionWithRemove.cs", "external_xml\\TestCSharpExpressionWithRemove.cs.xml");
            var fileUnit = SrcMLElement.Load("external_xml\\TestCSharpExpressionWithRemove.cs.xml");

            var method = fileUnit.Descendants(SRC.Function).FirstOrDefault();

            Assert.IsNotNull(method);
            var methodBlock = method.Element(SRC.Block);

            Assert.IsNotNull(methodBlock);
            Assert.AreEqual(1, methodBlock.Elements(SRC.ExpressionStatement).Count());
        }
Ejemplo n.º 24
0
        public void TestGetMethodSignature_InitializerList()
        {
            string   testSrcML = @"<constructor><name><name>MyClass</name><op:operator>::</op:operator><name>MyClass</name></name><parameter_list>(<param><decl><type><name>int</name></type> <name>bar</name></decl></param>)</parameter_list> <member_list>: <call><name>_capacity</name><argument_list>(<argument><expr><lit:literal type=""number"">15</lit:literal></expr></argument>)</argument_list></call>, <call><name>_len</name><argument_list>(<argument><expr><lit:literal type=""number"">0</lit:literal></expr></argument>)</argument_list></call> </member_list><block>{
    <if>if<condition>(<expr><name>bar</name> <op:operator>&gt;</op:operator> <call><name>GetNumber</name><argument_list>()</argument_list></call></expr>)</condition><then> <block>{
        <return>return <expr><lit:literal type=""string"">""Hello, world!""</lit:literal></expr>;</return>
    }</block></then> <else>else <block>{
        <return>return <expr><lit:literal type=""string"">""Goodbye cruel world!""</lit:literal></expr>;</return>
    }</block></else></if>
}</block></constructor>";
            XElement xml       = XElement.Parse(string.Format(srcMLFormat, testSrcML), LoadOptions.PreserveWhitespace);

            string actual   = SrcMLElement.GetMethodSignature(xml.Element(SRC.Constructor));
            string expected = "MyClass::MyClass(int bar)";

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 25
0
        public void TestGetMethodSignature_Normal()
        {
            string   testSrcML = @"<function><type><name>char</name><type:modifier>*</type:modifier></type> <name><name>MyClass</name><op:operator>::</op:operator><name>foo</name></name><parameter_list>(<param><decl><type><name>int</name></type> <name>bar</name></decl></param>)</parameter_list> <block>{
    <if>if<condition>(<expr><name>bar</name> <op:operator>&gt;</op:operator> <call><name>GetNumber</name><argument_list>()</argument_list></call></expr>)</condition><then> <block>{
        <return>return <expr><lit:literal type=""string"">""Hello, world!""</lit:literal></expr>;</return>
    }</block></then> <else>else <block>{
        <return>return <expr><lit:literal type=""string"">""Goodbye cruel world!""</lit:literal></expr>;</return>
    }</block></else></if>
}</block></function>";
            XElement xml       = XElement.Parse(string.Format(srcMLFormat, testSrcML), LoadOptions.PreserveWhitespace);

            string actual   = SrcMLElement.GetMethodSignature(xml.Element(SRC.Function));
            string expected = "char* MyClass::foo(int bar)";

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 26
0
        private IScope ParseFileUnit(XElement fileUnit)
        {
            var         language = SrcMLElement.GetLanguageForUnit(fileUnit);
            IScope      scope    = null;
            ICodeParser parser;

            if (parsers.TryGetValue(language, out parser))
            {
                try {
                    scope = parser.ParseFileUnit(fileUnit);
                } catch (ParseException e) {
                    OnErrorRaised(new ErrorRaisedArgs(e));
                }
            }
            return(scope);
        }
        public void TestRoundTrip(string sourceFileName, bool compressOutput)
        {
            var sourceFilePath = Path.Combine(TestInputPath, sourceFileName);

            var srcMLGenerator = new SrcMLGenerator("SrcML");
            var dataGenerator  = new DataGenerator();

            Assert.That(srcMLGenerator.Generate(sourceFilePath, DefaultInputName));
            var fileUnit = SrcMLElement.Load(DefaultInputName);
            var nsd      = dataGenerator.Parse(fileUnit) as NamespaceDefinition;

            XmlSerialization.WriteElement(nsd, DefaultOutputName, compressOutput);
            var nsdFromFile = XmlSerialization.Load(DefaultOutputName, compressOutput) as NamespaceDefinition;

            DataAssert.StatementsAreEqual(nsd, nsdFromFile);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Creates a new srcML location object
 /// </summary>
 /// <param name="element">The srcML element that this location refers to</param>
 /// <param name="fileUnit">The file unit that contains
 /// <paramref name="element"/></param>
 /// <param name="isReferenceLocation">true if this is a reference location; false
 /// otherwise</param>
 public SrcMLLocation(XElement element, XElement fileUnit, bool isReferenceLocation)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (fileUnit == null)
     {
         throw new ArgumentNullException("fileUnit");
     }
     this.SourceFileName       = SrcMLElement.GetFileNameForUnit(fileUnit);
     this.StartingLineNumber   = element.GetSrcLineNumber();
     this.StartingColumnNumber = element.GetSrcLinePosition();
     this.XPath       = element.GetXPath();
     this.IsReference = isReferenceLocation;
     SetEndingLocation(element);
 }
        public void TestRoundTripWithDefaultExtension(string sourceFileName, bool useCompression)
        {
            var sourceFilePath = Path.Combine(TestInputPath, sourceFileName);

            var srcMLGenerator = new SrcMLGenerator("SrcML");
            var dataGenerator  = new DataGenerator();

            Assert.That(srcMLGenerator.Generate(sourceFilePath, DefaultInputName));
            var fileUnit = SrcMLElement.Load(DefaultInputName);
            var nsd      = dataGenerator.Parse(fileUnit) as NamespaceDefinition;

            string outputFileName = Path.ChangeExtension(DefaultOutputName, useCompression ? XmlSerialization.DEFAULT_COMPRESSED_EXTENSION : XmlSerialization.DEFAULT_EXTENSION);

            XmlSerialization.WriteElement(nsd, outputFileName);
            var nsdFromFile = XmlSerialization.Load(outputFileName) as NamespaceDefinition;

            DataAssert.StatementsAreEqual(nsd, nsdFromFile);
        }
Ejemplo n.º 30
0
        public void TestNounPhraseRule_KeyFileExists()
        {
            var xml  = @"<function><type><name>bool</name></type> <name><name>COptionsPageConnectionSFTP</name><op:operator>::</op:operator><name>KeyFileExists</name></name><parameter_list>(<param><decl><type><name>const</name> <name>wxString</name><type:modifier>&amp;</type:modifier></type> <name>keyFile</name></decl></param>)</parameter_list> <block>{
	<return>return <expr><lit:literal type=""boolean"">true</lit:literal></expr>;</return>
}</block></function>";
            var unit = fileUnitSetup.GetFileUnitForXmlSnippet(xml, "test.cpp");

            var func = unit.Descendants(SRC.Function).First();
            var mdn  = new MethodDeclarationNode(SrcMLElement.GetNameForMethod(func).Value, ContextBuilder.BuildMethodContext(func));

            builder.ApplyRules(mdn);

            Assert.AreEqual(typeof(NounPhraseRule), mdn.SwumRuleUsed.GetType());
            var expected = @"get(Verb) | Key(NounModifier) File(NounModifier) Exists(Noun)
	 ++ [wx(NounModifier) String(NounIgnorable) - key(Unknown) File(Unknown)] ++ C(NounModifier) Options(NounModifier) Page(NounModifier) Connection(NounModifier) SFTP(Noun)"    ;

            Assert.AreEqual(expected, mdn.ToString());
        }