public void TestAllColumnCaptionsAreLocalized() { var documentContainer = new MemoryDocumentContainer(); Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document)); SkylineDataSchema skylineDataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer()); var missingCaptions = new HashSet <ColumnCaption>(); foreach (var columnDescriptor in EnumerateAllColumnDescriptors(skylineDataSchema, STARTING_TYPES)) { var invariantCaption = skylineDataSchema.GetColumnCaption(columnDescriptor); if (!skylineDataSchema.DataSchemaLocalizer.HasEntry(invariantCaption)) { missingCaptions.Add(invariantCaption); } } if (missingCaptions.Count == 0) { return; } StringWriter message = new StringWriter(); WriteResXFile(message, missingCaptions); Assert.Fail("Missing localized column captions {0}", message); }
public void TestCheckForUnusedColumnCaptions() { var documentContainer = new MemoryDocumentContainer(); Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document)); SkylineDataSchema dataSchema = new SkylineDataSchema(documentContainer, DataSchemaLocalizer.INVARIANT); var columnCaptions = new HashSet <string>(); foreach ( var resourceManager in SkylineDataSchema.GetLocalizedSchemaLocalizer().ColumnCaptionResourceManagers) { var resourceSet = resourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, true); var enumerator = resourceSet.GetEnumerator(); while (enumerator.MoveNext()) { string key = enumerator.Key as string; if (null != key) { columnCaptions.Add(key); } } } foreach (var columnDescriptor in EnumerateAllColumnDescriptors(dataSchema, STARTING_TYPES) ) { var invariantCaption = dataSchema.GetColumnCaption(columnDescriptor); columnCaptions.Remove(invariantCaption.InvariantCaption); } var unusedCaptions = columnCaptions.ToArray(); Assert.AreEqual(0, unusedCaptions.Length, "Unused entries found in ColumnCaptions.resx: {0}", string.Join(",", unusedCaptions)); }
public void TestAllColumnToolTipsAreLocalized() { var documentContainer = new MemoryDocumentContainer(); Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document)); SkylineDataSchema skylineDataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer()); var missingCaptions = new HashSet <ColumnCaption>(); foreach (var columnDescriptor in EnumerateAllColumnDescriptors(skylineDataSchema, STARTING_TYPES)) { var invariantDescription = skylineDataSchema.GetColumnDescription(columnDescriptor); if (string.IsNullOrEmpty(invariantDescription)) { var invariantCaption = skylineDataSchema.GetColumnCaption(columnDescriptor) as ColumnCaption; if (invariantCaption != null) { missingCaptions.Add(invariantCaption); } } } if (missingCaptions.Count == 0) { return; } StringWriter message = new StringWriter(); WriteResXFile(message, missingCaptions); Assert.Fail("Missing localized tooltips for column captions: {0}", message.ToString().Replace("<data", "\r\n<data")); }