public void ResXFile2ResourceSetTest() { var actual = new ResourceSet(ResourceSet.NeutralCulture); ResXResourceBundleAdapter_Accessor.Resx2ResourceSet(actual, "ResXResourceBundleAdapterTest.Sample.resx", null); Assert.AreEqual(15, actual.Values.Count); Assert.IsTrue(actual.ContainsKey("Ampersands")); Assert.IsTrue(actual.ContainsKey("MaxLengthString")); Assert.IsTrue(actual.ContainsKey("ReadOnlyString")); Assert.IsTrue(actual.ContainsKey("Set1_Placeholder1")); Assert.IsTrue(actual.ContainsKey("Set1_Placeholder2")); Assert.IsTrue(actual.ContainsKey("Set2")); Assert.IsTrue(actual.ContainsKey("Set2_SubString1")); Assert.IsTrue(actual.ContainsKey("Set2_SubString2")); Assert.IsTrue(actual.ContainsKey("String2Multiline")); Assert.IsTrue(actual.ContainsKey(">>FrameworkLocked")); Assert.IsTrue(actual.ContainsKey("Exclude1")); Assert.IsTrue(actual.ContainsKey("StringWithExclusions")); Assert.IsTrue(actual.ContainsKey("ItemWithoutValue")); Assert.AreEqual(4, actual.CountLocked()); Assert.AreEqual(13, actual.CountStringItems(false)); Assert.AreEqual(14, actual.CountStringItems(true)); Assert.AreEqual(52, actual.CountWords()); Assert.IsInstanceOfType(actual["MaxLengthString"], typeof(ResourceStringItem)); var item = (ResourceStringItem)actual["MaxLengthString"]; Assert.AreEqual(10, item.MaxLength); Assert.IsTrue(actual["ReadOnlyString"].Locked); Assert.AreEqual(LockedReason.DeveloperLock, actual["ReadOnlyString"].LockedReason); Assert.IsTrue(actual[">>FrameworkLocked"].Locked); Assert.AreEqual(LockedReason.FrameworkLock, actual[">>FrameworkLocked"].LockedReason); Assert.IsTrue(actual["Exclude1"].Locked); Assert.AreEqual(LockedReason.ResexMetadata, actual["Exclude1"].LockedReason); // exclusions var exclusions = actual.Exclusions; Assert.AreEqual(3, exclusions.Count); Assert.AreEqual(@"\{.*}", exclusions[1].Pattern); Assert.AreEqual(@"{Text}", exclusions[1].Sample); Assert.AreEqual(@"Windows", exclusions[2].Pattern); }
public void ResXFile2ResourceSetTest() { var actual = new ResourceSet(ResourceSet.NeutralCulture); ResXResourceBundleAdapter_Accessor.Resx2ResourceSet(actual, "ResXResourceBundleAdapterTest.Sample.resx", null); Assert.AreEqual(15, actual.Values.Count); Assert.IsTrue(actual.ContainsKey("Ampersands")); Assert.IsTrue(actual.ContainsKey("MaxLengthString")); Assert.IsTrue(actual.ContainsKey("ReadOnlyString")); Assert.IsTrue(actual.ContainsKey("Set1_Placeholder1")); Assert.IsTrue(actual.ContainsKey("Set1_Placeholder2")); Assert.IsTrue(actual.ContainsKey("Set2")); Assert.IsTrue(actual.ContainsKey("Set2_SubString1")); Assert.IsTrue(actual.ContainsKey("Set2_SubString2")); Assert.IsTrue(actual.ContainsKey("String2Multiline")); Assert.IsTrue(actual.ContainsKey(">>FrameworkLocked")); Assert.IsTrue(actual.ContainsKey("Exclude1")); Assert.IsTrue(actual.ContainsKey("StringWithExclusions")); Assert.IsTrue(actual.ContainsKey("ItemWithoutValue")); Assert.AreEqual(4, actual.CountLocked()); Assert.AreEqual(13, actual.CountStringItems(false)); Assert.AreEqual(14, actual.CountStringItems(true)); Assert.AreEqual(52, actual.CountWords()); Assert.IsInstanceOfType(actual["MaxLengthString"], typeof(ResourceStringItem)); var item = (ResourceStringItem)actual["MaxLengthString"]; Assert.AreEqual(10, item.MaxLength); Assert.IsTrue(actual["ReadOnlyString"].Locked); Assert.AreEqual(LockedReason.DeveloperLock, actual["ReadOnlyString"].LockedReason); Assert.IsTrue(actual[">>FrameworkLocked"].Locked); Assert.AreEqual(LockedReason.FrameworkLock, actual[">>FrameworkLocked"].LockedReason); Assert.IsTrue(actual["Exclude1"].Locked); Assert.AreEqual(LockedReason.ResexMetadata, actual["Exclude1"].LockedReason); // exclusions var exclusions = actual.Exclusions; Assert.AreEqual(3, exclusions.Count); Assert.AreEqual(@"\{.*}", exclusions[1].Pattern); Assert.AreEqual(@"{Text}", exclusions[1].Sample); Assert.AreEqual(@"Windows", exclusions[2].Pattern); }