public void Delete() { ScrMappingList list = new ScrMappingList(MappingSet.Main, null); list.Add(new ImportMappingInfo(@"\aa", null, false, MappingTargetType.TEStyle, MarkerDomain.Default, ScrStyleNames.Remark, null)); list.Add(new ImportMappingInfo(@"\bb", null, false, MappingTargetType.TEStyle, MarkerDomain.Default, ScrStyleNames.Remark, null)); list.Add(new ImportMappingInfo(@"\cc", null, false, MappingTargetType.TEStyle, MarkerDomain.BackTrans, ScrStyleNames.Remark, null)); Assert.AreEqual(3, list.Count); list.Delete(list[1]); Assert.AreEqual(2, list.Count); Assert.AreEqual(@"\aa", list[0].BeginMarker); Assert.AreEqual(@"\cc", list[1].BeginMarker); }
public void HasChanged() { ScrMappingList list = new ScrMappingList(MappingSet.Main, null); list.Add(new ImportMappingInfo(@"\aa", null, false, MappingTargetType.TEStyle, MarkerDomain.Default, ScrStyleNames.Remark, null)); list.Add(new ImportMappingInfo(@"\bb", null, false, MappingTargetType.TEStyle, MarkerDomain.Default, ScrStyleNames.Remark, null)); list.Add(new ImportMappingInfo(@"\cc", null, false, MappingTargetType.TEStyle, MarkerDomain.BackTrans, ScrStyleNames.Remark, null)); Assert.IsTrue((bool)ReflectionHelper.GetProperty(list, "HasChanged")); Assert.AreEqual(3, list.Count); ReflectionHelper.SetProperty(list[0], "HasChanged", false); ReflectionHelper.SetProperty(list[1], "HasChanged", false); ReflectionHelper.SetProperty(list[2], "HasChanged", false); Assert.IsFalse((bool)ReflectionHelper.GetProperty(list, "HasChanged")); list.Delete(list[1]); Assert.AreEqual(2, list.Count); Assert.IsTrue((bool)ReflectionHelper.GetProperty(list, "HasChanged")); }