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_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_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_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);
		}