/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Exposes the CreateScrStyles method
		/// </summary>
		/// ------------------------------------------------------------------------------------
		static public void CallCreateScrStyles(IScripture scr, XmlNode teStyles)

		{
			using (ProgressDialogWithTask progressDlg = new ProgressDialogWithTask(Form.ActiveForm))
			{
				DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(scr, teStyles);
				acc.InitLoading(progressDlg, scr, teStyles);
			}
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Exposes the LoadTeStylesDoc method
		/// </summary>
		/// <returns>An XmlNode representing the Styles in TeStyles.xml
		/// </returns>
		/// ------------------------------------------------------------------------------------
		static public XmlNode CallLoadTeStylesDoc(IScripture scr)
		{
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(scr);
			return acc.LoadDoc();
		}
		public void CreateScrStylesTest_UpdateDB()
		{
			// PART 1: Setup a new Scripture with a simple stylesheet
			Cache.LangProject.TranslatedScriptureOA = null;
			IScripture scr = Cache.LanguageProject.TranslatedScriptureOA =
				Cache.ServiceLocator.GetInstance<IScriptureFactory>().Create();
			Assert.AreEqual(0, scr.StylesOC.Count, "For this test, we want to start with an empty list");

			// Create an xml style document with some styles
			XmlDocument doc = new XmlDocument();
			doc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + Environment.NewLine +
				"<Styles>" + Environment.NewLine +
				"<markup version=\"2D065FD9-0F30-4104-8246-52F7103AC78F\">" + Environment.NewLine +
				// Chapter Number
				"<tag guid=\"0f4ee4e0-6954-4e1d-8a9a-b36346e6fa33\" userlevel=\"0\" id=\"Chapter_Number\" structure=\"body\" use=\"chapter\" context=\"text\" type=\"character\">" + Environment.NewLine +
				"<sfm>\\c</sfm>" + Environment.NewLine +
				"<usage wsId=\"en\">Start of chapter</usage>" + Environment.NewLine +
				"<font type=\"heading\" size=\"20 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\" dropCap=\"2 lines\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Hebrew Title
				"<tag guid=\"d8a64396-aa10-4662-9348-5fa4f9e725e8\" userlevel=\"0\" id=\"Hebrew_Title\" structure=\"heading\" context=\"text\" type=\"paragraph\">" + Environment.NewLine +
				"<sfm>\\d</sfm>" + Environment.NewLine +
				"<usage wsId=\"es\">Título hebreo</usage>" + Environment.NewLine +
				"<font size=\"10 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\" dropCap=\"false\"/>" + Environment.NewLine +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\" alignment=\"center\" background=\"white\" indentLeft=\"0\" indentRight=\"0\" firstLine=\"8 pt\" spaceBefore=\"0\" spaceAfter=\"0\" border=\"top\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Unused Replaced Style
				"<tag guid=\"5c246da3-8e17-4e80-832a-e43576802dd0\" userlevel=\"2\" id=\"Unused_Replaced_Style\" context=\"text\" type=\"paragraph\">" + Environment.NewLine +
				"<usage wsId=\"en\">This unused style shouldn't show up in replacement list</usage>" + Environment.NewLine +
				"<font/>" + Environment.NewLine +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Unused Deleted Style
				"<tag guid=\"1808b50f-5ad7-43c1-bdbf-9fc1fe3c1d5c\" userlevel=\"1\" id=\"Unused_Deleted_Style\" context=\"text\" type=\"paragraph\">" + Environment.NewLine +
				"<usage wsId=\"en\">This unused style shouldn't show up in deleted list</usage>" + Environment.NewLine +
				"<font/>" + Environment.NewLine +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Paragraph
				"<tag guid=\"45193615-3eac-4c57-980a-2bba7fe4dd08\" userlevel=\"0\" id=\"Paragraph\" structure=\"body\" use=\"prose\" context=\"text\" type=\"paragraph\">" + Environment.NewLine +
				"<usage wsId=\"en\">Generic prose paragraph</usage>" + Environment.NewLine +
				"<usage wsId=\"es\">Un párrafo general</usage>" + Environment.NewLine +
				"<sfm>\\p</sfm>" + Environment.NewLine +
				"<font size=\"10 pt\"/>" + Environment.NewLine +
				"<paragraph next=\"Paragraph\" firstLine=\"8 pt\" basedOn=\"Normal\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Delete Me
				"<tag guid=\"12640d9e-6cea-492c-a97b-daa83a6b75d8\" userlevel=\"0\" id=\"Delete_Me\" context=\"general\" type=\"character\">" + Environment.NewLine +
				"<usage wsId=\"en\">Junk</usage>" + Environment.NewLine +
				"<font/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				// Normal
				"<tag guid=\"914dcc30-e2ca-4042-ae91-a5d30e3ca13e\" userlevel=\"0\" id=\"Normal\" context=\"internal\" type=\"paragraph\">" + Environment.NewLine +
				"<font size=\"10 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\"/>" + Environment.NewLine +
				"<paragraph next=\"Paragraph\" alignment=\"left\" background=\"white\" indentLeft=\"0\" indentRight=\"0\" firstLine=\"0 pt\" spaceBefore=\"0\" spaceAfter=\"0\"/>" + Environment.NewLine +
				"</tag>" + Environment.NewLine +
				"</markup>" + Environment.NewLine +
				"</Styles>");

			// Run CreateScrStyles() the first time
			XmlNode teStyles = doc.SelectSingleNode("Styles");
			DummyTeStylesXmlAccessor.CallCreateScrStyles(scr, teStyles);

			// PART 2: Update the xml style document with 2 new styles, 1 updated style, and 2 deleted styles

			// Select a node in the existing stylesheet to change (and to insert a new style before)
			XmlNode markup = StylesXmlAccessor.GetMarkupNode(teStyles);

			// Change the version number
			XmlNode version = markup.Attributes.GetNamedItem("version");
			version.Value = "60250A17-9B56-466b-8E7B-E27A0EB03D3E";

			// Add a new character style
			XmlNode styleNode = doc.CreateNode(XmlNodeType.Element, "tag", null);
			styleNode.Attributes.Append(NewAttribute(doc, "guid", "ac9282df-3426-43c6-a2c7-0fbdfb323a82"));
			styleNode.Attributes.Append(NewAttribute(doc, "userlevel", "2"));
			styleNode.Attributes.Append(NewAttribute(doc, "id", "MyNewCharStyle"));
			styleNode.Attributes.Append(NewAttribute(doc, "structure", "body"));
			styleNode.Attributes.Append(NewAttribute(doc, "use", "prose"));
			styleNode.Attributes.Append(NewAttribute(doc, "context", "text"));
			styleNode.Attributes.Append(NewAttribute(doc, "type", "character"));
			styleNode.InnerXml = "<usage wsId=\"en\">Use this for fun</usage>" + Environment.NewLine +
				"<font size=\"23 pt\" bold=\"true\" italic=\"true\" color=\"green\" superscript=\"false\"/>";
			markup.ReplaceChild(styleNode, markup.SelectSingleNode("tag[@id='Delete_Me']"));

			// Replace a paragraph style with a new one
			styleNode = doc.CreateNode(XmlNodeType.Element, "tag", null);
			styleNode.Attributes.Append(NewAttribute(doc, "guid", "797d2f7d-576f-49ee-b7fd-ab5bfcf251a3"));
			styleNode.Attributes.Append(NewAttribute(doc, "userlevel", "1"));
			styleNode.Attributes.Append(NewAttribute(doc, "id", "MyNewParaStyle"));
			styleNode.Attributes.Append(NewAttribute(doc, "context", "text"));
			styleNode.Attributes.Append(NewAttribute(doc, "type", "paragraph"));
			styleNode.InnerXml = "<usage wsId=\"en\">Replaces Hebrew Title</usage>" + Environment.NewLine +
				"<font size=\"13 pt\" bold=\"false\" italic=\"true\" superscript=\"false\"/>" + Environment.NewLine +
				"<paragraph next=\"Paragraph\" basedOn=\"Paragraph\" alignment=\"center\"/>";
			markup.ReplaceChild(styleNode, markup.SelectSingleNode("tag[@id='Hebrew_Title']"));

			// Modify the Paragraph style
			styleNode = markup.SelectSingleNode("tag[@id='Paragraph']");
			styleNode.SelectSingleNode("font").Attributes.GetNamedItem("size").Value = "96 pt";
			styleNode.SelectSingleNode("paragraph").Attributes.GetNamedItem("next").Value = "MyNewParaStyle";

			// Remove the two unused styles
			styleNode = markup.SelectSingleNode("tag[@id='Unused_Replaced_Style']");
			markup.RemoveChild(styleNode);
			styleNode = markup.SelectSingleNode("tag[@id='Unused_Deleted_Style']");
			markup.RemoveChild(styleNode);

			XmlNode replacements = doc.CreateNode(XmlNodeType.Element, "replacements", null);
			replacements.InnerXml = "<change old=\"Hebrew_Title\" new=\"MyNewParaStyle\"/>" +
				"<change old=\"Unused_Replaced_Style\" new=\"Paragraph\"/>";
			teStyles.AppendChild(replacements);


			// Run CreateScrStyles() the second time
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(scr, teStyles);
			IThreadedProgress progressDlg = new DummyProgressDlg();
			acc.InitLoading(progressDlg, scr, teStyles);

			//Verify the styles
			ICmResource styleSheetResource = (from res in scr.ResourcesOC
											  where res.Name.Equals("TeStyles")
											  select res).FirstOrDefault();
			Debug.Assert(styleSheetResource != null, "Style sheet resource not in database.");
			Assert.AreEqual(new Guid("60250A17-9B56-466b-8E7B-E27A0EB03D3E"),
				styleSheetResource.Version);
			Assert.AreEqual(DummyTeStylesXmlAccessor.ReservedStyleCount + 2, scr.StylesOC.Count,
				"Should have added all the reserved styles (including the 3 in the test XML), plus 4 additional ones in the original stylesheet (but then they all get deleted, so don't count them), plus 2 new ones in the updated stylesheet.");
			ITsTextProps tts;
			int nVar;
			foreach (IStStyle style in scr.StylesOC)
			{
				tts = style.Rules;
				switch(style.Name)
				{
					case "MyNewCharStyle":
						Assert.AreEqual(2, style.UserLevel);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(23000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual(0x8000,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual("Use this for fun",
							style.Usage.get_String(m_wsEn).Text);
						break;
					case "MyNewParaStyle":
						Assert.AreEqual(1, style.UserLevel);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(13000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual((int)FwTextAlign.ktalCenter,
							tts.GetIntPropValues((int)FwTextPropType.ktptAlign,
							out nVar));
						Assert.AreEqual("Paragraph", style.BasedOnRA.Name);
						Assert.AreEqual("Paragraph", style.NextRA.Name);
						Assert.AreEqual("Replaces Hebrew Title",
							style.Usage.get_String(m_wsEn).Text);
						break;
					case "Chapter Number":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(FunctionValues.Chapter, style.Function);
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(20000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual(0,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual("Start of chapter",
							style.Usage.get_String(m_wsEn).Text);
						break;
					case "Paragraph":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(ContextValues.Text, style.Context);
						Assert.AreEqual(StructureValues.Body, style.Structure);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual(96000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual(8000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFirstIndent,
							out nVar));
						Assert.AreEqual("Normal", style.BasedOnRA.Name);
						Assert.AreEqual("Paragraph", style.NextRA.Name,
							"This value is fixed. Can't be changed by modifying stylesheet.");
						Assert.AreEqual("Generic prose paragraph",
							style.Usage.get_String(m_wsEn).Text);
						Assert.AreEqual("Un pa\u0301rrafo general",
							style.Usage.get_String(m_wsEs).Text);
						break;
					case "Normal":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(ContextValues.Internal, style.Context);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(10000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual(0,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual((int)FwTextAlign.ktalLeading,
							tts.GetIntPropValues((int)FwTextPropType.ktptAlign,
							out nVar));
						Assert.IsNull(style.BasedOnRA);
						Assert.AreEqual("Paragraph", style.NextRA.Name);
						break;
					case ScrStyleNames.SectionHead:
					case ScrStyleNames.IntroParagraph:
					case ScrStyleNames.IntroSectionHead:
					case ScrStyleNames.Remark:
					case ScrStyleNames.MainBookTitle:
					case ScrStyleNames.NormalFootnoteParagraph:
					case ScrStyleNames.CrossRefFootnoteParagraph:
					case ScrStyleNames.Figure:
					case ScrStyleNames.Header:
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						break;
					case ScrStyleNames.CanonicalRef:
					case ScrStyleNames.FootnoteMarker:
					case ScrStyleNames.FootnoteTargetRef:
					case ScrStyleNames.UntranslatedWord:
					case ScrStyleNames.VerseNumber:
					case ScrStyleNames.NotationTag:
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						break;
					default:
						Assert.Fail("Got an unexpected style: " + style.Name);
						break;
				}
			}
			Assert.AreEqual(2, acc.StyleReplacements.Count);
			Assert.AreEqual("MyNewParaStyle", acc.StyleReplacements["Hebrew Title"]);
			Assert.AreEqual(String.Empty, acc.StyleReplacements["Delete Me"]);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Exposes the CreateScrStyles method
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public static void CallCreateScrStyles(IScripture scr, XmlNode teStyles)
		{
			IThreadedProgress progressDlg = new DummyProgressDlg();
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(scr, teStyles);
			acc.InitLoading(progressDlg, scr, teStyles);
		}
		public void TestUpgradingToIncompatibleStyles()
		{
			m_styleReplace.Context = ContextValues.Text;

			// Create an xml style document with some styles
			XmlDocument doc = new XmlDocument();
			doc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + Environment.NewLine +
				"<Styles>" + Environment.NewLine +
				"<markup version=\"78A16A60-5644-48e8-9B77-A1F65A9EA253\"/>" + Environment.NewLine +
				"<replacements>" + Environment.NewLine +
				"<change old=\"Cool_style\" new=\"Cooler_style\"/>" + Environment.NewLine +
				"</replacements>" + Environment.NewLine +
				"</Styles>");

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr,
				doc.SelectSingleNode("Styles"));

			acc.OriginalStyles.Add("Cool style", m_styleOrig);
			acc.UpdatedStyles.Add("Cooler style", m_styleReplace);
			acc.CallDeleteDeprecatedStylesAndDetermineReplacements();
		}
		public void TestReplaceFormerStyles()
		{
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);

			string headingStyleNameToDelete = null;
			string bodyStyleNameToDelete = null;
			foreach (IStStyle style in m_scr.StylesOC)
			{
				if (style.Context == ContextValues.Text)
				{
					if (style.Structure == StructureValues.Heading &&
						style.Type == StyleType.kstParagraph &&
						style.Name != ScrStyleNames.SectionHead)
						headingStyleNameToDelete = style.Name;
					else if (style.Structure == StructureValues.Body &&
						style.Type == StyleType.kstParagraph &&
						style.Name != ScrStyleNames.NormalParagraph)
						bodyStyleNameToDelete = style.Name;
				}
				if (headingStyleNameToDelete != null && bodyStyleNameToDelete != null)
					break;
			}
			Assert.IsNotNull(headingStyleNameToDelete, "Couldn't find a real style for test -- need to create a bogus heading para style");
			Assert.IsNotNull(bodyStyleNameToDelete, "Couldn't find a real style for test -- need to create a bogus body para style");
			IStStyle styDeleteThisTitleStyle = Cache.ServiceLocator.GetInstance<IStStyleFactory>().Create();
			m_scr.StylesOC.Add(styDeleteThisTitleStyle);
			styDeleteThisTitleStyle.Name = "Auf wiedersehen";
			styDeleteThisTitleStyle.Context = ContextValues.Title;
			styDeleteThisTitleStyle.Type = StyleType.kstParagraph;

			// Create a few paragraphs using some fake styles
			IScrBook book = m_scr.ScriptureBooksOS[0];
			IScrSection sect = book.SectionsOS[0];
			IStTxtPara hPara0 = (IStTxtPara)sect.HeadingOA.ParagraphsOS[0];
			IStTxtPara cPara0 = (IStTxtPara)sect.ContentOA.ParagraphsOS[0];
			IStTxtPara tPara0 = (IStTxtPara)book.TitleOA.ParagraphsOS[0];
			book = m_scr.ScriptureBooksOS[1];
			IFdoOwningSequence<IScrSection> sections = book.SectionsOS;
			sect = sections[sections.Count - 1];
			IStTxtPara hPara1 = (IStTxtPara)sect.HeadingOA.ParagraphsOS[0];
			IFdoOwningSequence<IStPara> paras = sect.ContentOA.ParagraphsOS;
			IStTxtPara cPara1 = (IStTxtPara)paras[paras.Count - 1];
			IStTxtPara tPara1 = (IStTxtPara)book.TitleOA.ParagraphsOS[0];

			// Change the paragraph style to something bogus
			ITsPropsBldr bldr = TsPropsBldrClass.Create();
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "To Be Replaced");
			ITsTextProps props = bldr.GetTextProps();
			hPara0.StyleRules = props;
			cPara0.StyleRules = props;
			tPara0.StyleRules = props;
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, headingStyleNameToDelete);
			hPara1.StyleRules = bldr.GetTextProps();
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, bodyStyleNameToDelete);
			cPara1.StyleRules = bldr.GetTextProps();
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, styDeleteThisTitleStyle.Name);
			tPara1.StyleRules = bldr.GetTextProps();

			// Add some runs using a bogus character style
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Wacky Char Style");
			props = bldr.GetTextProps();

			ITsStrBldr strBldr = hPara0.Contents.GetBldr();
			strBldr.Replace(0, 0, "glub", props);
			hPara0.Contents = strBldr.GetString();

			strBldr = cPara0.Contents.GetBldr();
			strBldr.Replace(3, 3, "glub", props);
			cPara0.Contents = strBldr.GetString();

			strBldr = tPara0.Contents.GetBldr();
			strBldr.Replace(3, 3, "glub", props);
			tPara0.Contents = strBldr.GetString();

			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Be Gone");
			props = bldr.GetTextProps();

			strBldr = hPara1.Contents.GetBldr();
			strBldr.Replace(3, 3, "glub", props);
			hPara1.Contents = strBldr.GetString();

			strBldr = cPara1.Contents.GetBldr();
			strBldr.Replace(3, 3, "glub", props);
			cPara1.Contents = strBldr.GetString();

			// Simulate a paragraph style replacement
			acc.StyleReplacements["To Be Replaced"] = "With This";
			acc.StyleReplacements["Wacky Char Style"] = "Sane Char Style";
			//acc.DeletedStyles.Add(headingStyleNameToDelete);
			//acc.DeletedStyles.Add(bodyStyleNameToDelete);
			//acc.DeletedStyles.Add(styDeleteThisTitleStyle.Name);
			//acc.DeletedStyles.Add("Be Gone");
			acc.CallReplaceFormerStyles();

			// Check replaced paragraph style
			string styleName = hPara0.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("With This", styleName);
			styleName = cPara0.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("With This", styleName);
			styleName = tPara0.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("With This", styleName);
			// Check deleted paragraph styles
			styleName = hPara1.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(ScrStyleNames.SectionHead, styleName);
			styleName = cPara1.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(ScrStyleNames.NormalParagraph, styleName);
			styleName = tPara1.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(ScrStyleNames.MainBookTitle, styleName);

			//Check replaced character style
			props = hPara0.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("Sane Char Style", styleName);
			props = cPara0.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("Sane Char Style", styleName);
			props = tPara0.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual("Sane Char Style", styleName);
			// Check deleted character styles
			props = hPara1.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(null, styleName);
			props = cPara1.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(null, styleName);
			props = tPara1.Contents.get_PropertiesAt(4);
			styleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			Assert.AreEqual(null, styleName);
		}
		public void TestEnsureCompatibleFactoryStyle_RedefineUserStyle()
		{
			IFdoOwningCollection<IStStyle> styles = m_scr.StylesOC;
			int countOfStylesOrig = styles.Count;
			// For this test, make Paragraph be a user-defined style
			IStStyle userDefStyle = m_scr.FindStyle("Paragraph");
			userDefStyle.IsBuiltIn = false;

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);
			acc.EnsureCompatibleFactoryStyle(userDefStyle,
				StyleType.kstParagraph, ContextValues.Title, StructureValues.Undefined,
				FunctionValues.Prose);
			Assert.IsNull(m_scr.FindStyle("Paragraph"),
				"New factory style should be created but not yet named. Old Paragraph style should be renamed.");
			Assert.AreEqual(countOfStylesOrig + 1, m_scr.StylesOC.Count, "A new style should have been created");
			Assert.AreEqual("Paragraph_User", userDefStyle.Name);
			Assert.AreEqual(ContextValues.Text, (ContextValues)userDefStyle.Context);
			Assert.AreEqual(StructureValues.Body, (StructureValues)userDefStyle.Structure);
			Assert.AreEqual(FunctionValues.Prose, (FunctionValues)userDefStyle.Function);
			Assert.IsFalse(userDefStyle.IsBuiltIn);

			Assert.AreEqual(1, acc.StyleReplacements.Count);
			Assert.AreEqual("Paragraph_User", acc.StyleReplacements["Paragraph"]);
		}
		public void TestEnsureCompatibleFactoryStyle_FactoryStyleToInternal()
		{
			IFdoOwningCollection<IStStyle> styles = m_scr.StylesOC;
			int countOfStylesOrig = styles.Count;
			IStStyle origStyle = m_scr.FindStyle("Normal");
			origStyle.Context = ContextValues.Text;

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);
			IStStyle newFactoryStyle = acc.EnsureCompatibleFactoryStyle(origStyle,
				StyleType.kstParagraph, ContextValues.Internal, StructureValues.Undefined,
				FunctionValues.Prose);
			Assert.AreEqual(origStyle, newFactoryStyle);
			Assert.AreEqual("Normal", origStyle.Name);
			Assert.AreEqual(countOfStylesOrig, styles.Count);
			Assert.IsTrue(origStyle.IsBuiltIn);
		}
		public void TestEnsureCompatibleFactoryStyle_InvalidStyleType()
		{
			IStStyle paraStyle = m_scr.FindStyle("Paragraph");

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);
			acc.EnsureCompatibleFactoryStyle(paraStyle, StyleType.kstCharacter,
				ContextValues.Text, StructureValues.Body, FunctionValues.Prose);
		}
		public void TestEnsureCompatibleFactoryStyle_InvalidContextStructureFunction()
		{
			IStStyle paraStyle = m_scr.FindStyle("Paragraph");

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);
			acc.EnsureCompatibleFactoryStyle(paraStyle,
				StyleType.kstParagraph, ContextValues.InternalMappable,
				StructureValues.Heading, FunctionValues.Verse);
		}
		public void TestEnsureCompatibleFactoryStyle_Easy()
		{
			IStStyle paraStyle = m_scr.FindStyle("Paragraph");

			int hvoParaStyle = paraStyle.Hvo;
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr, null);
			IStStyle style = acc.EnsureCompatibleFactoryStyle(paraStyle,
				StyleType.kstParagraph, ContextValues.Text, StructureValues.Body,
				FunctionValues.Prose);
			Assert.AreEqual(hvoParaStyle, style.Hvo);
			Assert.AreEqual(ContextValues.Text, (ContextValues)style.Context);
			Assert.AreEqual(StructureValues.Body, (StructureValues)style.Structure);
			Assert.AreEqual(FunctionValues.Prose, (FunctionValues)style.Function);
			Assert.AreEqual(0, acc.StyleReplacements.Count);
		}
		public void CreateScrStylesTest_UpdateDB()
		{
			CheckDisposed();

			// PART 1: Setup a new Scripture with a simple stylesheet
			IScripture scr = m_fdoCache.LangProject.TranslatedScriptureOA = new Scripture();
			Assert.AreEqual(0, scr.StylesOC.Count, "For this test, we want to start with an empty list");

			// Create an xml style document with some styles
			XmlDocument doc = new XmlDocument();
			doc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
				"<Styles>" + "\n" +
				"<markup version=\"2D065FD9-0F30-4104-8246-52F7103AC78F\">" + "\n" +
				// Chapter Number
				"<tag userlevel=\"0\" id=\"Chapter_Number\" structure=\"body\" use=\"chapter\" context=\"text\" type=\"character\">" + "\n" +
				"<sfm>\\c</sfm>" + "\n" +
				"<usage iculocale=\"en\">Start of chapter</usage>" + "\n" +
				"<font type=\"heading\" size=\"20 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\" dropCap=\"2 lines\"/>" + "\n" +
				"</tag>" + "\n" +
				// Hebrew Title
				"<tag userlevel=\"0\" id=\"Hebrew_Title\" structure=\"heading\" context=\"text\" type=\"paragraph\">" + "\n" +
				"<sfm>\\d</sfm>" + "\n" +
				"<usage iculocale=\"es\">Título hebreo</usage>" + "\n" +
				"<font type=\"default\" size=\"10 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\" dropCap=\"false\"/>" + "\n" +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\" alignment=\"center\" background=\"white\" indentLeft=\"0\" indentRight=\"0\" firstLine=\"8 pt\" spaceBefore=\"0\" spaceAfter=\"0\" border=\"top\"/>" + "\n" +
				"</tag>" + "\n" +
				// Unused Replaced Style
				"<tag userlevel=\"2\" id=\"Unused_Replaced_Style\" context=\"text\" type=\"paragraph\">" + "\n" +
				"<usage iculocale=\"en\">This unused style shouldn't show up in replacement list</usage>" + "\n" +
				"<font/>" + "\n" +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\"/>" + "\n" +
				"</tag>" + "\n" +
				// Unused Deleted Style
				"<tag userlevel=\"1\" id=\"Unused_Deleted_Style\" context=\"text\" type=\"paragraph\">" + "\n" +
				"<usage iculocale=\"en\">This unused style shouldn't show up in deleted list</usage>" + "\n" +
				"<font/>" + "\n" +
				"<paragraph basedOn=\"Paragraph\" next=\"Paragraph\"/>" + "\n" +
				"</tag>" + "\n" +
				// Paragraph
				"<tag userlevel=\"0\" id=\"Paragraph\" structure=\"body\" use=\"prose\" context=\"text\" type=\"paragraph\">" + "\n" +
				"<usage iculocale=\"en\">Generic prose paragraph</usage>" + "\n" +
				"<usage iculocale=\"es\">Un párrafo general</usage>" + "\n" +
				"<sfm>\\p</sfm>" + "\n" +
				"<font type=\"default\" size=\"10 pt\"/>" + "\n" +
				"<paragraph next=\"Paragraph\" firstLine=\"8 pt\" basedOn=\"Normal\"/>" + "\n" +
				"</tag>" + "\n" +
				// Delete Me
				"<tag userlevel=\"0\" id=\"Delete_Me\" structure=\"body\" use=\"prose\" context=\"text\" type=\"character\">" + "\n" +
				"<usage iculocale=\"en\">Junk</usage>" + "\n" +
				"<font/>" + "\n" +
				"</tag>" + "\n" +
				// Normal
				"<tag userlevel=\"0\" id=\"Normal\" context=\"internal\" type=\"paragraph\">" + "\n" +
				"<font type=\"publication\" size=\"10 pt\" bold=\"false\" italic=\"false\" color=\"black\" superscript=\"false\"/>" + "\n" +
				"<paragraph next=\"Paragraph\" alignment=\"left\" background=\"white\" indentLeft=\"0\" indentRight=\"0\" firstLine=\"0 pt\" spaceBefore=\"0\" spaceAfter=\"0\"/>" + "\n" +
				"</tag>" + "\n" +
				"</markup>" + "\n" +
				"</Styles>");

			// Run CreateScrStyles() the first time
			XmlNode teStyles = doc.SelectSingleNode("Styles");
			DummyTeStylesXmlAccessor.CallCreateScrStyles(scr, teStyles);

			// PART 2: Update the xml style document with 2 new styles, 1 updated style, and 2 deleted styles

			// Select a node in the existing stylesheet to change (and to insert a new style before)
			XmlNode markup = StylesXmlAccessor.GetMarkupNode(teStyles);

			// Change the version number
			XmlNode version = markup.Attributes.GetNamedItem("version");
			version.Value = "60250A17-9B56-466b-8E7B-E27A0EB03D3E";

			// Add a new character style
			XmlNode styleNode = doc.CreateNode(XmlNodeType.Element, "tag", null);
			styleNode.Attributes.Append(NewAttribute(doc, "userlevel", "2"));
			styleNode.Attributes.Append(NewAttribute(doc, "id", "MyNewCharStyle"));
			styleNode.Attributes.Append(NewAttribute(doc, "structure", "body"));
			styleNode.Attributes.Append(NewAttribute(doc, "use", "prose"));
			styleNode.Attributes.Append(NewAttribute(doc, "context", "text"));
			styleNode.Attributes.Append(NewAttribute(doc, "type", "character"));
			styleNode.InnerXml = "<usage iculocale=\"en\">Use this for fun</usage>" + "\n" +
				"<font type=\"heading\" size=\"23 pt\" bold=\"true\" italic=\"true\" color=\"green\" superscript=\"false\"/>";
			markup.ReplaceChild(styleNode, markup.SelectSingleNode("tag[@id='Delete_Me']"));

			// Replace a paragraph style with a new one
			styleNode = doc.CreateNode(XmlNodeType.Element, "tag", null);
			styleNode.Attributes.Append(NewAttribute(doc, "userlevel", "1"));
			styleNode.Attributes.Append(NewAttribute(doc, "id", "MyNewParaStyle"));
			styleNode.Attributes.Append(NewAttribute(doc, "context", "text"));
			styleNode.Attributes.Append(NewAttribute(doc, "type", "paragraph"));
			styleNode.InnerXml = "<usage iculocale=\"en\">Replaces Hebrew Title</usage>" + "\n" +
				"<font type=\"default\" size=\"13 pt\" bold=\"false\" italic=\"true\" superscript=\"false\"/>" + "\n" +
				"<paragraph next=\"Paragraph\" basedOn=\"Paragraph\" alignment=\"center\"/>";
			markup.ReplaceChild(styleNode, markup.SelectSingleNode("tag[@id='Hebrew_Title']"));

			// Modify the Paragraph style
			styleNode = markup.SelectSingleNode("tag[@id='Paragraph']");
			styleNode.SelectSingleNode("font").Attributes.GetNamedItem("size").Value = "96 pt";
			styleNode.SelectSingleNode("paragraph").Attributes.GetNamedItem("next").Value = "MyNewParaStyle";

			// Remove the two unused styles
			styleNode = markup.SelectSingleNode("tag[@id='Unused_Replaced_Style']");
			markup.RemoveChild(styleNode);
			styleNode = markup.SelectSingleNode("tag[@id='Unused_Deleted_Style']");
			markup.RemoveChild(styleNode);

			XmlNode replacements = doc.CreateNode(XmlNodeType.Element, "replacements", null);
			replacements.InnerXml = "<change old=\"Hebrew_Title\" new=\"MyNewParaStyle\"/>" +
				"<change old=\"Unused_Replaced_Style\" new=\"Paragraph\"/>";
			teStyles.AppendChild(replacements);


			// Run CreateScrStyles() the second time
			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(scr, teStyles);
			using (ProgressDialogWithTask progressDlg = new ProgressDialogWithTask(Form.ActiveForm))
			{
				acc.InitLoading(progressDlg, scr, teStyles);
			}

			//Verify the styles
			CmResource styleSheetResource = CmResource.GetResource(m_fdoCache, scr.Hvo,
				(int)Scripture.ScriptureTags.kflidResources, "TeStyles");
			Debug.Assert(styleSheetResource != null, "Style sheet resource not in database.");
			Assert.AreEqual(new Guid("60250A17-9B56-466b-8E7B-E27A0EB03D3E"),
				styleSheetResource.Version);
			Assert.AreEqual(DummyTeStylesXmlAccessor.ReservedStyleCount + 2, scr.StylesOC.Count,
				"Should have added all the reserved styles (including the 3 in the test XML), plus 4 additional ones in the original stylesheet (but then they all get deleted, so don't count them), plus 2 new ones in the updated stylesheet.");
			ITsTextProps tts;
			int nVar;
			foreach (IStStyle style in scr.StylesOC)
			{
				tts = style.Rules;
				switch(style.Name)
				{
					case "MyNewCharStyle":
						Assert.AreEqual(2, style.UserLevel);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(23000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual("<default sans serif>",
							tts.GetStrPropValue((int)FwTextPropType.ktptFontFamily));
						Assert.AreEqual(0x8000,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual("Use this for fun",
							style.Usage.GetAlternative(m_fdoCache.LanguageEncodings.GetWsFromIcuLocale("en")));
						break;
					case "MyNewParaStyle":
						Assert.AreEqual(1, style.UserLevel);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvInvert,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(13000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual("<default serif>",
							tts.GetStrPropValue((int)FwTextPropType.ktptFontFamily));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual((int)FwTextAlign.ktalCenter,
							tts.GetIntPropValues((int)FwTextPropType.ktptAlign,
							out nVar));
						Assert.AreEqual("Paragraph", style.BasedOnRA.Name);
						Assert.AreEqual("Paragraph", style.NextRA.Name);
						Assert.AreEqual("Replaces Hebrew Title",
							style.Usage.GetAlternative(m_fdoCache.LanguageEncodings.GetWsFromIcuLocale("en")));
						break;
					case "Chapter Number":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(FunctionValues.Chapter, style.Function);
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(20000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual("<default sans serif>",
							tts.GetStrPropValue((int)FwTextPropType.ktptFontFamily));
						Assert.AreEqual(0,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual("Start of chapter",
							style.Usage.GetAlternative(m_fdoCache.LanguageEncodings.GetWsFromIcuLocale("en")));
						break;
					case "Paragraph":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(ContextValues.Text, style.Context);
						Assert.AreEqual(StructureValues.Body, style.Structure);
						Assert.AreEqual(FunctionValues.Prose, style.Function);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual(96000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual("<default serif>",
							tts.GetStrPropValue((int)FwTextPropType.ktptFontFamily));
						Assert.AreEqual(8000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFirstIndent,
							out nVar));
						Assert.AreEqual("Normal", style.BasedOnRA.Name);
						Assert.AreEqual("Paragraph", style.NextRA.Name,
							"This value is fixed. Can't be changed by modifying stylesheet.");
						Assert.AreEqual("Generic prose paragraph",
							style.Usage.GetAlternative(m_fdoCache.LanguageEncodings.GetWsFromIcuLocale("en")));
						Assert.AreEqual("Un pa\u0301rrafo general",
							style.Usage.GetAlternative(m_fdoCache.LanguageEncodings.GetWsFromIcuLocale("es")));
						break;
					case "Normal":
						Assert.AreEqual(0, style.UserLevel);
						Assert.AreEqual(ContextValues.Internal, style.Context);
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptItalic,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptBold,
							out nVar));
						Assert.AreEqual(10000,
							tts.GetIntPropValues((int)FwTextPropType.ktptFontSize,
							out nVar));
						Assert.AreEqual("<default pub font>",
							tts.GetStrPropValue((int)FwTextPropType.ktptFontFamily));
						Assert.AreEqual(0,
							tts.GetIntPropValues((int)FwTextPropType.ktptForeColor,
							out nVar));
						Assert.AreEqual((int)FwTextToggleVal.kttvOff,
							tts.GetIntPropValues((int)FwTextPropType.ktptSuperscript,
							out nVar));
						Assert.AreEqual((int)FwTextAlign.ktalLeading,
							tts.GetIntPropValues((int)FwTextPropType.ktptAlign,
							out nVar));
						Assert.IsNull(style.BasedOnRA);
						Assert.AreEqual("Paragraph", style.NextRA.Name);
						break;
					case ScrStyleNames.SectionHead:
					case ScrStyleNames.IntroParagraph:
					case ScrStyleNames.IntroSectionHead:
					case ScrStyleNames.Remark:
					case ScrStyleNames.MainBookTitle:
					case ScrStyleNames.NormalFootnoteParagraph:
					case ScrStyleNames.CrossRefFootnoteParagraph:
					case ScrStyleNames.Figure:
					case ScrStyleNames.Header:
						Assert.AreEqual(StyleType.kstParagraph, style.Type);
						break;
					case ScrStyleNames.CanonicalRef:
					case ScrStyleNames.FootnoteMarker:
					case ScrStyleNames.FootnoteTargetRef:
					case ScrStyleNames.UntranslatedWord:
					case ScrStyleNames.VerseNumber:
					case ScrStyleNames.NotationTag:
						Assert.AreEqual(StyleType.kstCharacter, style.Type);
						break;
					default:
						Assert.Fail("Got an unexpected style: " + style.Name);
						break;
				}
			}
			Assert.AreEqual(1, acc.ReplacedStyles.Count);
			Assert.AreEqual(1, acc.DeletedStyles.Count);
			StyleReplacement repl = (StyleReplacement)acc.ReplacedStyles[0];
			Assert.AreEqual("Hebrew Title", repl.oldStyle);
			Assert.AreEqual("MyNewParaStyle", repl.newStyle);
			Assert.AreEqual("Delete Me", (string)acc.DeletedStyles[0]);
		}
		public void TestUpgradingToCompatibleStyles()
		{
			CheckDisposed();

			m_styleReplace.Context = ContextValues.Intro;

			// Create an xml style document with some styles
			XmlDocument doc = new XmlDocument();
			doc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
				"<Styles>" + "\n" +
				"<markup version=\"78A16A60-5644-48e8-9B77-A1F65A9EA253\"/>" + "\n" +
				"<replacements>" + "\n" +
				"<change old=\"Cool_style\" new=\"Cooler_style\"/>" + "\n" +
				"</replacements>" + "\n" +
				"</Styles>");

			DummyTeStylesXmlAccessor acc = new DummyTeStylesXmlAccessor(m_scr,
				doc.SelectSingleNode("Styles"));

			acc.OriginalStyles.Add("Cool style", m_styleOrig);
			acc.UpdatedStyles.Add("Cooler style", m_styleReplace);
			acc.CallDeleteDeprecatedStylesAndDetermineReplacements();

			Assert.AreEqual(1, acc.ReplacedStyles.Count);
			StyleReplacement styRepl = (StyleReplacement)acc.ReplacedStyles[0];
			Assert.AreEqual("Cool style", styRepl.oldStyle);
			Assert.AreEqual("Cooler style", styRepl.newStyle);
		}