public void WhenClassWasCreated_ThenExpectedValuesHasToBeSet() { // ToDo: check for xaml file var result = new XAMLFileInfo(@"D:\GitHub\SolutionAndProjects\SolutionAndProjects\SolutionAndProjectstest\SpecificFileInfos\CSharpFileInfoTest.xaml"); Assert.AreEqual(@"D:\GitHub\SolutionAndProjects\SolutionAndProjects\SolutionAndProjectstest\SpecificFileInfos\CSharpFileInfoTest.xaml", result.Value.FullName); }
public static XAMLFile Parse(XAMLFileInfo xamlFileInfo) { if (xamlFileInfo == null) { throw new ArgumentNullException(nameof(xamlFileInfo)); } var document = XDocument.Load(xamlFileInfo.Value.FullName); var staticResourceUsages = from descdant in document.Descendants() from attribute in descdant.Attributes() where attribute.Value.StartsWith("{StaticResource ", StringComparison.Ordinal) select new StaticResourceUsages(ExtractStaticResourceName(attribute)); var staticResourceDeclarations = from descdant in document.Descendants() from attribute in descdant.Attributes() where attribute.Name.LocalName.Equals("Key") select attribute; var result = new XAMLFile(xamlFileInfo, staticResourceUsages, staticResourceDeclarations); return(result); }
internal XAMLFile(XAMLFileInfo xamlFileInfo, IEnumerable <StaticResourceUsages> staticResourceUsages, IEnumerable <XAttribute> staticResourceDeclarations) { XAMLFileInfo = xamlFileInfo; StaticResourceUsages = staticResourceUsages; StaticResourceDeclarations = staticResourceDeclarations; }