diff --git a/ICSharpCode.TextEditor.Sample/ICSharpCode.TextEditor.Sample.csproj b/ICSharpCode.TextEditor.Sample/ICSharpCode.TextEditor.Sample.csproj index 791afc3..817b0ab 100644 --- a/ICSharpCode.TextEditor.Sample/ICSharpCode.TextEditor.Sample.csproj +++ b/ICSharpCode.TextEditor.Sample/ICSharpCode.TextEditor.Sample.csproj @@ -8,10 +8,11 @@ WinExe ICSharpCode.TextEditor.Sample ICSharpCode.TextEditor.Sample - v4.6 + v4.6.1 win 512 true + AnyCPU @@ -57,5 +58,8 @@ ICSharpCode.TextEditor + + + \ No newline at end of file diff --git a/ICSharpCode.TextEditor.Sample/app.config b/ICSharpCode.TextEditor.Sample/app.config new file mode 100644 index 0000000..3dbff35 --- /dev/null +++ b/ICSharpCode.TextEditor.Sample/app.config @@ -0,0 +1,3 @@ + + + diff --git a/Project/Resources/VBNET.xshd b/Project/Resources/VB.NET.xshd similarity index 100% rename from Project/Resources/VBNET.xshd rename to Project/Resources/VB.NET.xshd diff --git a/Test/HighlightingManagerTests.cs b/Test/HighlightingManagerTests.cs index 2e16a96..f78f165 100644 --- a/Test/HighlightingManagerTests.cs +++ b/Test/HighlightingManagerTests.cs @@ -1,5 +1,8 @@ using ICSharpCode.TextEditor.Document; using NUnit.Framework; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; namespace ICSharpCode.TextEditor.Tests { @@ -23,5 +26,29 @@ namespace ICSharpCode.TextEditor.Tests IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile("test.unkown"); Assert.AreEqual("Default", highlightingStrategy.Name); } + + [Test] + public void ResourceStreamNamesMatchSyntaxNodes() + { + Assembly assembly = typeof(ICSharpCode.TextEditor.Document.ResourceSyntaxModeProvider).Assembly; + var resources = assembly.GetManifestResourceNames(); + var syntaxNodesResource = resources.First(r => r.Contains("SyntaxModes")); + var xmlModes = XElement.Load(assembly.GetManifestResourceStream(syntaxNodesResource)).Elements("Mode"); + var resourcesToCheck = resources.Where(r => r.EndsWith("xshd")); + + var matched = from xml in xmlModes + join res in resourcesToCheck on xml.Attribute("file").Value equals + res.Replace("ICSharpCode.TextEditor.Resources.", "") + select new { ResourceName = res, XMLModeFile = xml.Attribute("file").Value }; + + var missingInXML = resourcesToCheck.Except(matched.Select(m => m.ResourceName)); + + var missingInResources = from nd in xmlModes + where !matched.Select(m => m.XMLModeFile).Contains(nd.Attribute("file").Value) + select nd.Attribute("file").Value; + + Assert.That(!missingInXML.Any(), "The SyntaxNodes.xml file is out of sync with the actual resources. Check the following resource names that don't exist in xml file. {0}", string.Join(",", missingInXML)); + Assert.That(!missingInResources.Any(), "The SyntaxNodes.xml file is out of sync with the actual resources. Check the following resource names that don't exist in embedded resources. {0}", string.Join(",", missingInResources)); + } } -} \ No newline at end of file +} diff --git a/Test/ICSharpCode.TextEditor.Tests.csproj b/Test/ICSharpCode.TextEditor.Tests.csproj index 17bc7bb..90f943d 100644 --- a/Test/ICSharpCode.TextEditor.Tests.csproj +++ b/Test/ICSharpCode.TextEditor.Tests.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -21,18 +21,21 @@ False False True - v4.0 + v4.6.1 win 2.0 - Client + + false DEBUG bin\UnitTests\ + false true + false @@ -52,6 +55,8 @@ ..\packages\NUnit.2.6.1\lib\nunit.framework.dll + + diff --git a/Test/packages.config b/Test/packages.config index c0c5f5a..2cbd09d 100644 --- a/Test/packages.config +++ b/Test/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file