public void DumpAndVerifyVisualTree(UIElement root, string masterFilePrefix, string messageOnError = null)
            {
                VisualTreeLog.LogDebugInfo("DumpVisualTreeAndCompareWithMaster with masterFilePrefix " + masterFilePrefix);

                string expectedContent = "";
                string content         = DumpVisualTree(root, _translator, _filter, _logger);

                MasterFileStorage storage = new MasterFileStorage(!_shouldLogMasterFile, masterFilePrefix);
                string            bestMatchedMasterFileName = storage.BestMatchedMasterFileName;
                string            expectedMasterFileName    = storage.ExpectedMasterFileName;

                VisualTreeLog.LogDebugInfo("Target master file: " + expectedMasterFileName);
                VisualTreeLog.LogDebugInfo("Best matched master file: " + bestMatchedMasterFileName);

                if (!string.IsNullOrEmpty(bestMatchedMasterFileName))
                {
                    expectedContent = MasterFileStorage.GetMasterFileContent(bestMatchedMasterFileName);
                }

                string result = new VisualTreeOutputCompare(content, expectedContent).ToString();

                if (!string.IsNullOrEmpty(result))
                {
                    storage.LogMasterFile(expectedMasterFileName, content);
                    storage.LogMasterFile(expectedMasterFileName + ".orig", expectedContent);

                    if (!string.IsNullOrEmpty(messageOnError))
                    {
                        _testResult.AppendLine(messageOnError);
                        _testResult.AppendLine(string.Format("{0}.xml and {0}.orig.xaml is logged", expectedMasterFileName));
                    }
                    _testResult.AppendLine(result);
                }
            }
 private string SearchBestMatchedMasterFileName(string fileNamePrefix)
 {
     for (ushort version = PlatformConfiguration.GetCurrentAPIVersion(); version >= 2; version--)
     {
         string fileName = string.Format("{0}-{1}.xml", fileNamePrefix, version);
         if (MasterFileStorage.IsMasterFilePresent(fileName))
         {
             return(fileName);
         }
     }
     {
         string fileName = fileNamePrefix + ".xml";
         if (MasterFileStorage.IsMasterFilePresent(fileName))
         {
             return(fileName);
         }
     }
     return(null);
 }