public void DataMigration7000009Test()
		{
			var dtos = new HashSet<DomainObjectDTO>();
			var sb = new StringBuilder();
			// 1. Add barebones LP.
			sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
			sb.Append("<LangProject>");
			sb.Append("<Texts>");
			var lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal");
			sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Texts>");
			sb.Append("<TranslatedScripture>");
			sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
			sb.Append("</TranslatedScripture>");
			sb.Append("</LangProject>");
			sb.Append("</rt>");
			var expectedLp = sb.ToString();
			var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
											"LangProject",
											expectedLp);
			dtos.Add(lpDto);

			// 2. Add Scripture
			sb = new StringBuilder();
			sb.Append(
				"<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\"");
			int index = sb.Length;
			sb.Append(">");
			sb.Append("<Scripture>");
			sb.Append("<Books>");
			sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
			sb.Append("</Books>");
			sb.Append("</Scripture>");
			sb.Append("</rt>");
			string expected = sb.ToString();
			sb.Insert(index, " owningflid=\"6001040\" owningord=\"0\"");

			var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
											 "Scripture",
											 sb.ToString());
			dtos.Add(scrDto);
			// Set up mock MDC.
			var mockMDC = new MockMDCForDataMigration();
			mockMDC.AddClass(1, "CmObject", null, new List<string> { "LangProject", "Scripture" });
			mockMDC.AddClass(2, "LangProject", "CmObject", new List<string>());
			mockMDC.AddClass(4, "Scripture", "CmObject", new List<string>());
			IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000008, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

			m_dataMigrationManager.PerformMigration(dtoRepos, 7000009, new DummyProgressDlg());

			Assert.AreEqual(expected, scrDto.Xml);
			Assert.AreEqual(expectedLp, lpDto.Xml);

			Assert.AreEqual(7000009, dtoRepos.CurrentModelVersion, "Wrong updated version.");

		}
        public void DataMigration7000002Test()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            var sb   = new StringBuilder();

            // 1. Add barebones LP.
            sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
            sb.Append("<LangProject>");
            sb.Append("<Texts>");
            StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal");

            sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Texts>");
            sb.Append("<TranslatedScripture>");
            sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
            sb.Append("</TranslatedScripture>");
            sb.Append("</LangProject>");
            sb.Append("</rt>");
            var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
                                            "LangProject",
                                            sb.ToString());

            dtos.Add(lpDto);

            // Add text dto.
            var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(),
                                             "StText",
                                             lpTextsGuids.textXml);

            dtos.Add(txtDto);
            // Add text para dto.
            var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(),
                                                 "StTxtPara",
                                                 lpTextsGuids.paraXml);

            dtos.Add(txtParaDto);

            // 2. Add Scripture
            sb = new StringBuilder();
            sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
            sb.Append("<Scripture>");
            sb.Append("<Books>");
            sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
            sb.Append("</Books>");
            sb.Append("</Scripture>");
            sb.Append("</rt>");
            var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
                                             "Scripture",
                                             sb.ToString());

            dtos.Add(scrDto);

            // 3. Add a ScrBook
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
            sb.Append("<ScrBook>");
            sb.Append("<Name>");
            sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
            sb.Append("</Name>");
            sb.Append("<Title>");
            StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");

            sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Title>");
            sb.Append("<Sections>");
            sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
            sb.Append("</Sections>");
            sb.Append("<Footnotes>");
            StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("StFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");

            sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Footnotes>");
            sb.Append("</ScrBook>");
            sb.Append("</rt>");
            var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca",
                                              "ScrBook",
                                              sb.ToString());

            dtos.Add(bookDto);

            // Add title
            var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(),
                                               "StText",
                                               titleTextGuids.textXml);

            dtos.Add(titleDto);
            // Title para
            var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(),
                                                   "StTxtPara",
                                                   titleTextGuids.paraXml);

            dtos.Add(titleParaDto);

            // Add footnote
            var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(),
                                                  "StFootnote",
                                                  footnoteGuids.textXml);

            dtos.Add(footnoteDto);
            // Footnote para
            var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(),
                                                      "StTxtPara",
                                                      footnoteGuids.paraXml);

            dtos.Add(footnoteParaDto);

            // 4. Add a section to the book
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
            sb.Append("<CmObject />");
            sb.Append("<ScrSection>");
            sb.Append("<Content>");
            StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph");

            sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Content>");
            sb.Append("<Heading>");
            StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head");

            sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Heading>");
            sb.Append("</ScrSection>");
            sb.Append("</rt>");
            var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815",
                                                 "ScrSection",
                                                 sb.ToString());

            dtos.Add(sectionDto);

            // Add the contents
            var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(),
                                                  "StText",
                                                  contentsTextGuids.textXml);

            dtos.Add(contentsDto);
            // Contents para
            var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(),
                                                      "StTxtPara",
                                                      contentsTextGuids.paraXml);

            dtos.Add(contentsParaDto);

            // Add the heading to the xml
            var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(),
                                                 "StText",
                                                 headingTextGuids.textXml);

            dtos.Add(headingDto);
            // heading para
            var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(),
                                                     "StTxtPara",
                                                     headingTextGuids.paraXml);

            dtos.Add(headingParaDto);

            // Set up mock MDC.
            var mockMDC = new MockMDCForDataMigration();

            mockMDC.AddClass(1, "CmObject", null, new List <string> {
                "LangProject", "StText",
                "Scripture", "ScrBook", "StFootnote", "ScrSection", "StPara"
            });
            mockMDC.AddClass(2, "LangProject", "CmObject", new List <string>());
            mockMDC.AddClass(3, "StText", "CmObject", new List <string>());
            mockMDC.AddClass(4, "Scripture", "CmObject", new List <string>());
            mockMDC.AddClass(5, "ScrBook", "CmObject", new List <string>());
            mockMDC.AddClass(6, "StFootnote", "CmObject", new List <string> {
                "ScrFootnote"
            });
            mockMDC.AddClass(7, "ScrSection", "CmObject", new List <string>());
            mockMDC.AddClass(8, "StTxtPara", "CmObject", new List <string> {
                "ScrTxtPara"
            });
            mockMDC.AddClass(9, "ScrFootnote", "CmObject", new List <string>());
            mockMDC.AddClass(10, "ScrTxtPara", "CmObject", new List <string>());
            mockMDC.AddClass(11, "StPara", "CmObject", new List <string> {
                "StTxtPara"
            });
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000001, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

            m_dataMigrationManager.PerformMigration(dtoRepos, 7000002, new DummyProgressDlg());
            Assert.AreEqual(7000002, dtoRepos.CurrentModelVersion, "Wrong updated version.");
            // Check the paragraphs to make sure they are the correct class
            Assert.AreEqual("StTxtPara", txtParaDto.Classname, "Oops. Class was changed.");
            XElement paraElement = XElement.Parse(txtParaDto.Xml);

            Assert.AreEqual("StTxtPara", paraElement.Attribute("class").Value, "Oops. Class was changed.");

            paraElement = XElement.Parse(titleParaDto.Xml);
            Assert.AreEqual("ScrTxtPara", titleParaDto.Classname, "Oops. Class was not changed.");
            Assert.AreEqual("ScrTxtPara", paraElement.Attribute("class").Value, "Oops. Class was not changed.");
            Assert.IsNotNull(paraElement.Element("ScrTxtPara"));
            Assert.IsTrue(paraElement.Element("ScrTxtPara").IsEmpty);
            Assert.AreEqual("ScrTxtPara", contentsParaDto.Classname, "Oops. Class was not changed.");
            Assert.AreEqual("ScrTxtPara", headingParaDto.Classname, "Oops. Class was not changed.");
            Assert.AreEqual("ScrTxtPara", footnoteParaDto.Classname, "Oops. Class was not changed.");
        }
		public void DataMigration7000036Test()
		{
			var dtos = new HashSet<DomainObjectDTO>();
			var sb = new StringBuilder();
			// 1. Add barebones LP.
			sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
			sb.Append("<Texts>");
			StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal", false, false);
			sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Texts>");
			sb.Append("<TranslatedScripture>");
			sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
			sb.Append("</TranslatedScripture>");
			sb.Append("</rt>");
			var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
				"LangProject", sb.ToString());
			dtos.Add(lpDto);

			// Add text dto.
			var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(),  "StText",
				lpTextsGuids.textXml);
			dtos.Add(txtDto);
			// Add text para dto.
			var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(), "ScrTxtPara",
				lpTextsGuids.paraXml);
			dtos.Add(txtParaDto);

			// 2. Add Scripture
			sb = new StringBuilder();
			sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
			sb.Append("<Books>");
			sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
			sb.Append("</Books>");
			sb.Append("</rt>");
			var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef", "Scripture",
				sb.ToString());
			dtos.Add(scrDto);

			// 3. Add a ScrBook
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
			sb.Append("<Name>");
			sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
			sb.Append("</Name>");
			sb.Append("<Title>");
			StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main", true, false);
			sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Title>");
			sb.Append("<Sections>");
			sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
			sb.Append("</Sections>");
			sb.Append("<Footnotes>");
			// This footnote should also have its ParaContainingOrc property set, but this test really doesn't care.
			StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("ScrFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Note General Paragraph", null, true, false);
			sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Footnotes>");
			sb.Append("</rt>");
			var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca", "ScrBook", sb.ToString());
			dtos.Add(bookDto);

			// Add title
			var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(), "StText",
				titleTextGuids.textXml);
			dtos.Add(titleDto);
			// Title para
			var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(), "ScrTxtPara",
				titleTextGuids.paraXml);
			dtos.Add(titleParaDto);

			// Add footnote
			var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(), "ScrFootnote",
				footnoteGuids.textXml);
			dtos.Add(footnoteDto);
			// Footnote para
			var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(), "ScrTxtPara",
				footnoteGuids.paraXml);
			dtos.Add(footnoteParaDto);

			// 4. Add a section to the book
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
			sb.Append("<Content>");
			StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("StText", "834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph",
				"<Run ws=\"fr\" link=\"" + footnoteGuids.textGuid + "\"></Run>", true, false,
				"<Run ws=\"en\" link=\"" + footnoteGuids.textGuid + "\"></Run>");
			sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Content>");
			sb.Append("<Heading>");
			StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head", true, false);
			sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Heading>");
			sb.Append("</rt>");
			var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815", "ScrSection",
				sb.ToString());
			dtos.Add(sectionDto);

			sb.Length = 0;
			sb.Append("<rt class=\"StJournalText\" guid=\"c1ecd177-e382-11de-8a39-0800200c9a66\">");
			sb.Append("<DateCreated val=\"2009-12-31 23:59:59.000\" />");
			sb.Append("<DateModified val=\"2010-01-01 23:59:59.000\" />");
			sb.Append("</rt>");
			var journalTextDto = new DomainObjectDTO("c1ecd177-e382-11de-8a39-0800200c9a66", "StJounalText",
				sb.ToString());
			dtos.Add(journalTextDto);

			// Add the contents
			var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(), "StText",
				contentsTextGuids.textXml);
			dtos.Add(contentsDto);
			// Contents para
			var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(), "ScrTxtPara",
				contentsTextGuids.paraXml);
			dtos.Add(contentsParaDto);
			// BT of para
			var btDto = new DomainObjectDTO(contentsTextGuids.btGuid.ToString(), "CmTranslation",
				contentsTextGuids.btXml);
			dtos.Add(btDto);

			// Add the heading to the xml
			var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(), "StText",
				headingTextGuids.textXml);
			dtos.Add(headingDto);
			// heading para
			var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(), "ScrTxtPara",
				headingTextGuids.paraXml);
			dtos.Add(headingParaDto);

			// Set up mock MDC.
			var mockMDC = new MockMDCForDataMigration();
			mockMDC.AddClass(1, "CmObject", null, new List<string> { "LangProject", "StText", "Scripture",
				"ScrBook", "StFootnote", "ScrSection", "StPara" });
			mockMDC.AddClass(2, "LangProject", "CmObject", new List<string>());
			mockMDC.AddClass(3, "StText", "CmObject", new List<string> { "StFootnote", "StJounalText" });
			mockMDC.AddClass(4, "Scripture", "CmObject", new List<string>());
			mockMDC.AddClass(5, "ScrBook", "CmObject", new List<string>());
			mockMDC.AddClass(6, "StFootnote", "StText", new List<string> { "ScrFootnote" });
			mockMDC.AddClass(7, "ScrSection", "CmObject", new List<string>());
			mockMDC.AddClass(8, "StTxtPara", "StPara", new List<string> { "ScrTxtPara" });
			mockMDC.AddClass(9, "ScrFootnote", "StFootnote", new List<string>());
			mockMDC.AddClass(10, "ScrTxtPara", "StTxtPara", new List<string>());
			mockMDC.AddClass(11, "StPara", "CmObject", new List<string> { "StTxtPara" });
			mockMDC.AddClass(12, "StJounalText", "StText", new List<string>());
			IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000035, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

			DateTime beforeMigration = DateTime.Now.AddSeconds(-1); // avoid tick problem

			m_dataMigrationManager.PerformMigration(dtoRepos, 7000036, new DummyProgressDlg());
			Assert.AreEqual(7000036, dtoRepos.CurrentModelVersion, "Wrong updated version.");

			int cJournalTexts = 0;
			foreach (DomainObjectDTO stTextDTO in dtoRepos.AllInstancesWithSubclasses("StText"))
			{
				XElement stText = XElement.Parse(stTextDTO.Xml);
				Assert.AreEqual(1, stText.Elements("DateModified").Count());
				XElement dateModified = stText.Element("DateModified");
				Assert.IsNotNull(dateModified);
				if (stTextDTO.Classname == "StJounalText")
				{
					Assert.AreEqual(new DateTime(2010, 1, 1, 23, 59, 59).ToLocalTime(), ReadWriteServices.LoadDateTime(dateModified));
					cJournalTexts++;
				}
				else
					Assert.GreaterOrEqual(ReadWriteServices.LoadDateTime(dateModified), beforeMigration);
			}
			Assert.AreEqual(1, cJournalTexts);
		}
		public void DataMigration7000002Test()
		{
			var dtos = new HashSet<DomainObjectDTO>();
			var sb = new StringBuilder();
			// 1. Add barebones LP.
			sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
			sb.Append("<LangProject>");
			sb.Append("<Texts>");
			StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal");
			sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Texts>");
			sb.Append("<TranslatedScripture>");
			sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
			sb.Append("</TranslatedScripture>");
			sb.Append("</LangProject>");
			sb.Append("</rt>");
			var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
											"LangProject",
											sb.ToString());
			dtos.Add(lpDto);

			// Add text dto.
			var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(),
											 "StText",
											 lpTextsGuids.textXml);
			dtos.Add(txtDto);
			// Add text para dto.
			var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(),
												 "StTxtPara",
												 lpTextsGuids.paraXml);
			dtos.Add(txtParaDto);

			// 2. Add Scripture
			sb = new StringBuilder();
			sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
			sb.Append("<Scripture>");
			sb.Append("<Books>");
			sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
			sb.Append("</Books>");
			sb.Append("</Scripture>");
			sb.Append("</rt>");
			var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
											 "Scripture",
											 sb.ToString());
			dtos.Add(scrDto);

			// 3. Add a ScrBook
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
			sb.Append("<ScrBook>");
			sb.Append("<Name>");
			sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
			sb.Append("</Name>");
			sb.Append("<Title>");
			StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");
			sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Title>");
			sb.Append("<Sections>");
			sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
			sb.Append("</Sections>");
			sb.Append("<Footnotes>");
			StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("StFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");
			sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Footnotes>");
			sb.Append("</ScrBook>");
			sb.Append("</rt>");
			var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca",
											  "ScrBook",
											  sb.ToString());
			dtos.Add(bookDto);

			// Add title
			var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(),
											   "StText",
											   titleTextGuids.textXml);
			dtos.Add(titleDto);
			// Title para
			var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(),
												   "StTxtPara",
												   titleTextGuids.paraXml);
			dtos.Add(titleParaDto);

			// Add footnote
			var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(),
												  "StFootnote",
												  footnoteGuids.textXml);
			dtos.Add(footnoteDto);
			// Footnote para
			var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(),
													  "StTxtPara",
													  footnoteGuids.paraXml);
			dtos.Add(footnoteParaDto);

			// 4. Add a section to the book
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
			sb.Append("<CmObject />");
			sb.Append("<ScrSection>");
			sb.Append("<Content>");
			StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph");
			sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Content>");
			sb.Append("<Heading>");
			StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head");
			sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Heading>");
			sb.Append("</ScrSection>");
			sb.Append("</rt>");
			var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815",
												 "ScrSection",
												 sb.ToString());
			dtos.Add(sectionDto);

			// Add the contents
			var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(),
												  "StText",
												  contentsTextGuids.textXml);
			dtos.Add(contentsDto);
			// Contents para
			var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(),
													  "StTxtPara",
													  contentsTextGuids.paraXml);
			dtos.Add(contentsParaDto);

			// Add the heading to the xml
			var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(),
												 "StText",
												 headingTextGuids.textXml);
			dtos.Add(headingDto);
			// heading para
			var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(),
													 "StTxtPara",
													 headingTextGuids.paraXml);
			dtos.Add(headingParaDto);

			// Set up mock MDC.
			var mockMDC = new MockMDCForDataMigration();
			mockMDC.AddClass(1, "CmObject", null, new List<string> { "LangProject", "StText",
																	 "Scripture", "ScrBook", "StFootnote", "ScrSection", "StPara" });
			mockMDC.AddClass(2, "LangProject", "CmObject", new List<string>());
			mockMDC.AddClass(3, "StText", "CmObject", new List<string>());
			mockMDC.AddClass(4, "Scripture", "CmObject", new List<string>());
			mockMDC.AddClass(5, "ScrBook", "CmObject", new List<string>());
			mockMDC.AddClass(6, "StFootnote", "CmObject", new List<string> { "ScrFootnote" });
			mockMDC.AddClass(7, "ScrSection", "CmObject", new List<string>());
			mockMDC.AddClass(8, "StTxtPara", "CmObject", new List<string> { "ScrTxtPara" });
			mockMDC.AddClass(9, "ScrFootnote", "CmObject", new List<string>());
			mockMDC.AddClass(10, "ScrTxtPara", "CmObject", new List<string>());
			mockMDC.AddClass(11, "StPara", "CmObject", new List<string> { "StTxtPara" });
			IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000001, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

			m_dataMigrationManager.PerformMigration(dtoRepos, 7000002, new DummyProgressDlg());
			Assert.AreEqual(7000002, dtoRepos.CurrentModelVersion, "Wrong updated version.");
			// Check the paragraphs to make sure they are the correct class
			Assert.AreEqual("StTxtPara", txtParaDto.Classname, "Oops. Class was changed.");
			XElement paraElement = XElement.Parse(txtParaDto.Xml);
			Assert.AreEqual("StTxtPara", paraElement.Attribute("class").Value, "Oops. Class was changed.");

			paraElement = XElement.Parse(titleParaDto.Xml);
			Assert.AreEqual("ScrTxtPara", titleParaDto.Classname, "Oops. Class was not changed.");
			Assert.AreEqual("ScrTxtPara", paraElement.Attribute("class").Value, "Oops. Class was not changed.");
			Assert.IsNotNull(paraElement.Element("ScrTxtPara"));
			Assert.IsTrue(paraElement.Element("ScrTxtPara").IsEmpty);
			Assert.AreEqual("ScrTxtPara", contentsParaDto.Classname, "Oops. Class was not changed.");
			Assert.AreEqual("ScrTxtPara", headingParaDto.Classname, "Oops. Class was not changed.");
			Assert.AreEqual("ScrTxtPara", footnoteParaDto.Classname, "Oops. Class was not changed.");
		}
Exemple #5
0
        public void DataMigration7000036Test()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            var sb   = new StringBuilder();

            // 1. Add barebones LP.
            sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
            sb.Append("<Texts>");
            StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal", false, false);

            sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Texts>");
            sb.Append("<TranslatedScripture>");
            sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
            sb.Append("</TranslatedScripture>");
            sb.Append("</rt>");
            var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
                                            "LangProject", sb.ToString());

            dtos.Add(lpDto);

            // Add text dto.
            var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(), "StText",
                                             lpTextsGuids.textXml);

            dtos.Add(txtDto);
            // Add text para dto.
            var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(), "ScrTxtPara",
                                                 lpTextsGuids.paraXml);

            dtos.Add(txtParaDto);

            // 2. Add Scripture
            sb = new StringBuilder();
            sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
            sb.Append("<Books>");
            sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
            sb.Append("</Books>");
            sb.Append("</rt>");
            var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef", "Scripture",
                                             sb.ToString());

            dtos.Add(scrDto);

            // 3. Add a ScrBook
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
            sb.Append("<Name>");
            sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
            sb.Append("</Name>");
            sb.Append("<Title>");
            StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main", true, false);

            sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Title>");
            sb.Append("<Sections>");
            sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
            sb.Append("</Sections>");
            sb.Append("<Footnotes>");
            // This footnote should also have its ParaContainingOrc property set, but this test really doesn't care.
            StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("ScrFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Note General Paragraph", null, true, false);

            sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Footnotes>");
            sb.Append("</rt>");
            var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca", "ScrBook", sb.ToString());

            dtos.Add(bookDto);

            // Add title
            var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(), "StText",
                                               titleTextGuids.textXml);

            dtos.Add(titleDto);
            // Title para
            var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                   titleTextGuids.paraXml);

            dtos.Add(titleParaDto);

            // Add footnote
            var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(), "ScrFootnote",
                                                  footnoteGuids.textXml);

            dtos.Add(footnoteDto);
            // Footnote para
            var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(), "ScrTxtPara",
                                                      footnoteGuids.paraXml);

            dtos.Add(footnoteParaDto);

            // 4. Add a section to the book
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
            sb.Append("<Content>");
            StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("StText", "834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph",
                                                                        "<Run ws=\"fr\" link=\"" + footnoteGuids.textGuid + "\"></Run>", true, false,
                                                                        "<Run ws=\"en\" link=\"" + footnoteGuids.textGuid + "\"></Run>");

            sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Content>");
            sb.Append("<Heading>");
            StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head", true, false);

            sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Heading>");
            sb.Append("</rt>");
            var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815", "ScrSection",
                                                 sb.ToString());

            dtos.Add(sectionDto);

            sb.Length = 0;
            sb.Append("<rt class=\"StJournalText\" guid=\"c1ecd177-e382-11de-8a39-0800200c9a66\">");
            sb.Append("<DateCreated val=\"2009-12-31 23:59:59.000\" />");
            sb.Append("<DateModified val=\"2010-01-01 23:59:59.000\" />");
            sb.Append("</rt>");
            var journalTextDto = new DomainObjectDTO("c1ecd177-e382-11de-8a39-0800200c9a66", "StJounalText",
                                                     sb.ToString());

            dtos.Add(journalTextDto);

            // Add the contents
            var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(), "StText",
                                                  contentsTextGuids.textXml);

            dtos.Add(contentsDto);
            // Contents para
            var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                      contentsTextGuids.paraXml);

            dtos.Add(contentsParaDto);
            // BT of para
            var btDto = new DomainObjectDTO(contentsTextGuids.btGuid.ToString(), "CmTranslation",
                                            contentsTextGuids.btXml);

            dtos.Add(btDto);

            // Add the heading to the xml
            var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(), "StText",
                                                 headingTextGuids.textXml);

            dtos.Add(headingDto);
            // heading para
            var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                     headingTextGuids.paraXml);

            dtos.Add(headingParaDto);

            // Set up mock MDC.
            var mockMDC = new MockMDCForDataMigration();

            mockMDC.AddClass(1, "CmObject", null, new List <string> {
                "LangProject", "StText", "Scripture",
                "ScrBook", "StFootnote", "ScrSection", "StPara"
            });
            mockMDC.AddClass(2, "LangProject", "CmObject", new List <string>());
            mockMDC.AddClass(3, "StText", "CmObject", new List <string> {
                "StFootnote", "StJounalText"
            });
            mockMDC.AddClass(4, "Scripture", "CmObject", new List <string>());
            mockMDC.AddClass(5, "ScrBook", "CmObject", new List <string>());
            mockMDC.AddClass(6, "StFootnote", "StText", new List <string> {
                "ScrFootnote"
            });
            mockMDC.AddClass(7, "ScrSection", "CmObject", new List <string>());
            mockMDC.AddClass(8, "StTxtPara", "StPara", new List <string> {
                "ScrTxtPara"
            });
            mockMDC.AddClass(9, "ScrFootnote", "StFootnote", new List <string>());
            mockMDC.AddClass(10, "ScrTxtPara", "StTxtPara", new List <string>());
            mockMDC.AddClass(11, "StPara", "CmObject", new List <string> {
                "StTxtPara"
            });
            mockMDC.AddClass(12, "StJounalText", "StText", new List <string>());
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000035, dtos, mockMDC, null);

            DateTime beforeMigration = DateTime.Now.AddSeconds(-1);             // avoid tick problem

            m_dataMigrationManager.PerformMigration(dtoRepos, 7000036, new DummyProgressDlg());
            Assert.AreEqual(7000036, dtoRepos.CurrentModelVersion, "Wrong updated version.");

            int cJournalTexts = 0;

            foreach (DomainObjectDTO stTextDTO in dtoRepos.AllInstancesWithSubclasses("StText"))
            {
                XElement stText = XElement.Parse(stTextDTO.Xml);
                Assert.AreEqual(1, stText.Elements("DateModified").Count());
                XElement dateModified = stText.Element("DateModified");
                Assert.IsNotNull(dateModified);
                if (stTextDTO.Classname == "StJounalText")
                {
                    Assert.AreEqual(new DateTime(2010, 1, 1, 23, 59, 59).ToLocalTime(), ReadWriteServices.LoadDateTime(dateModified));
                    cJournalTexts++;
                }
                else
                {
                    Assert.GreaterOrEqual(ReadWriteServices.LoadDateTime(dateModified), beforeMigration);
                }
            }
            Assert.AreEqual(1, cJournalTexts);
        }
        public void DataMigration7000003Test()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            var sb   = new StringBuilder();

            // 1. Add barebones LP.
            sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
            sb.Append("<LangProject>");
            sb.Append("<TranslatedScripture>");
            sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
            sb.Append("</TranslatedScripture>");
            sb.Append("</LangProject>");
            sb.Append("</rt>");
            var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
                                            "LangProject",
                                            sb.ToString());

            dtos.Add(lpDto);

            // 2. Add Scripture
            sb = new StringBuilder();
            sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
            sb.Append("<Scripture>");
            sb.Append("<Books>");
            sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
            sb.Append("</Books>");
            sb.Append("</Scripture>");
            sb.Append("</rt>");
            var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
                                             "Scripture",
                                             sb.ToString());

            dtos.Add(scrDto);

            // 3. Add a ScrBook
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
            sb.Append("<ScrBook>");
            sb.Append("<Name>");
            sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
            sb.Append("</Name>");
            sb.Append("<Footnotes>");
            var footnoteGuids = new StTextAndParaInfo("StFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");

            sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Footnotes>");
            sb.Append("</ScrBook>");
            sb.Append("</rt>");
            var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca",
                                              "ScrBook",
                                              sb.ToString());

            dtos.Add(bookDto);
            // Add footnote
            var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(),
                                                  "StFootnote",
                                                  footnoteGuids.textXml);

            dtos.Add(footnoteDto);
            // Footnote para
            var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(),
                                                      "StTxtPara",
                                                      footnoteGuids.paraXml);

            dtos.Add(footnoteParaDto);

            // Set up mock MDC.
            var mockMDC = new MockMDCForDataMigration();

            mockMDC.AddClass(1, "CmObject", null, new List <string> {
                "LangProject", "StText",
                "Scripture", "ScrBook", "StPara"
            });
            mockMDC.AddClass(2, "LangProject", "CmObject", new List <string>());
            mockMDC.AddClass(3, "StText", "CmObject", new List <string> {
                "StFootnote"
            });
            mockMDC.AddClass(4, "Scripture", "CmObject", new List <string>());
            mockMDC.AddClass(5, "ScrBook", "CmObject", new List <string>());
            mockMDC.AddClass(6, "StFootnote", "CmObject", new List <string> {
                "ScrFootnote"
            });
            mockMDC.AddClass(8, "StTxtPara", "CmObject", new List <string> {
                "ScrTxtPara"
            });
            mockMDC.AddClass(9, "ScrFootnote", "CmObject", new List <string>());
            mockMDC.AddClass(10, "ScrTxtPara", "CmObject", new List <string>());
            mockMDC.AddClass(11, "StPara", "CmObject", new List <string> {
                "StTxtPara"
            });
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000002, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

            m_dataMigrationManager.PerformMigration(dtoRepos, 7000003, new DummyProgressDlg());
            Assert.AreEqual(7000003, dtoRepos.CurrentModelVersion, "Wrong updated version.");

            // Check the footnote to make sure it is the correct class
            XElement footnoteElement = XElement.Parse(footnoteDto.Xml);

            Assert.AreEqual("ScrFootnote", footnoteDto.Classname, "Oops. Class was not changed.");
            Assert.AreEqual("ScrFootnote", footnoteElement.Attribute("class").Value, "Oops. Class was not changed.");
            Assert.IsNotNull(footnoteElement.Element("ScrFootnote"));
            Assert.IsTrue(footnoteElement.Element("ScrFootnote").IsEmpty);
        }
Exemple #7
0
        public void DataMigration7000035Test()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            var sb   = new StringBuilder();

            // 1. Add barebones LP.
            sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
            sb.Append("<Texts>");
            StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal", false, false);

            sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Texts>");
            sb.Append("<TranslatedScripture>");
            sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
            sb.Append("</TranslatedScripture>");
            sb.Append("</rt>");
            var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
                                            "LangProject", sb.ToString());

            dtos.Add(lpDto);

            // Add text dto.
            var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(), "StText",
                                             lpTextsGuids.textXml);

            dtos.Add(txtDto);
            // Add text para dto.
            var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(), "ScrTxtPara",
                                                 lpTextsGuids.paraXml);

            dtos.Add(txtParaDto);

            // 2. Add Scripture
            sb = new StringBuilder();
            sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
            sb.Append("<Books>");
            sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
            sb.Append("</Books>");
            sb.Append("</rt>");
            var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef", "Scripture",
                                             sb.ToString());

            dtos.Add(scrDto);

            // 3. Add a ScrBook
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
            sb.Append("<Name>");
            sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
            sb.Append("</Name>");
            sb.Append("<Title>");
            StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main", true, false);

            sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Title>");
            sb.Append("<Sections>");
            sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
            sb.Append("</Sections>");
            sb.Append("<Footnotes>");
            // This footnote should also have its ParaContainingOrc property set, but this test really doesn't care.
            StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("ScrFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Note General Paragraph", null, true, false);

            sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Footnotes>");
            sb.Append("</rt>");
            var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca", "ScrBook", sb.ToString());

            dtos.Add(bookDto);

            // Add title
            var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(), "StText",
                                               titleTextGuids.textXml);

            dtos.Add(titleDto);
            // Title para
            var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                   titleTextGuids.paraXml);

            dtos.Add(titleParaDto);

            // Add footnote
            var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(), "ScrFootnote",
                                                  footnoteGuids.textXml);

            dtos.Add(footnoteDto);
            // Footnote para
            var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(), "ScrTxtPara",
                                                      footnoteGuids.paraXml);

            dtos.Add(footnoteParaDto);

            // 4. Add a section to the book
            sb = new StringBuilder();
            sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
            sb.Append("<Content>");
            StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("StText", "834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph",
                                                                        "<Run ws=\"fr\" link=\"" + footnoteGuids.textGuid + "\"></Run>", true, false,
                                                                        "<Run ws=\"en\" link=\"" + footnoteGuids.textGuid + "\"></Run>");

            sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Content>");
            sb.Append("<Heading>");
            StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head", true, false);

            sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Heading>");
            sb.Append("</rt>");
            var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815", "ScrSection",
                                                 sb.ToString());

            dtos.Add(sectionDto);

            // Add the contents
            var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(), "StText",
                                                  contentsTextGuids.textXml);

            dtos.Add(contentsDto);
            // Contents para
            var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                      contentsTextGuids.paraXml);

            dtos.Add(contentsParaDto);
            // BT of para
            var btDto = new DomainObjectDTO(contentsTextGuids.btGuid.ToString(), "CmTranslation",
                                            contentsTextGuids.btXml);

            dtos.Add(btDto);

            // Add the heading to the xml
            var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(), "StText",
                                                 headingTextGuids.textXml);

            dtos.Add(headingDto);
            // heading para
            var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(), "ScrTxtPara",
                                                     headingTextGuids.paraXml);

            dtos.Add(headingParaDto);

            // Set up mock MDC.
            var mockMDC = new MockMDCForDataMigration();

            mockMDC.AddClass(1, "CmObject", null, new List <string> {
                "LangProject", "StText", "Scripture",
                "ScrBook", "StFootnote", "ScrSection", "StPara"
            });
            mockMDC.AddClass(2, "LangProject", "CmObject", new List <string>());
            mockMDC.AddClass(3, "StText", "CmObject", new List <string> {
                "StFootnote"
            });
            mockMDC.AddClass(4, "Scripture", "CmObject", new List <string>());
            mockMDC.AddClass(5, "ScrBook", "CmObject", new List <string>());
            mockMDC.AddClass(6, "StFootnote", "StText", new List <string> {
                "ScrFootnote"
            });
            mockMDC.AddClass(7, "ScrSection", "CmObject", new List <string>());
            mockMDC.AddClass(8, "StTxtPara", "StPara", new List <string> {
                "ScrTxtPara"
            });
            mockMDC.AddClass(9, "ScrFootnote", "StFootnote", new List <string>());
            mockMDC.AddClass(10, "ScrTxtPara", "StTxtPara", new List <string>());
            mockMDC.AddClass(11, "StPara", "CmObject", new List <string> {
                "StTxtPara"
            });
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000034, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

            m_dataMigrationManager.PerformMigration(dtoRepos, 7000035, new DummyProgressDlg());
            Assert.AreEqual(7000035, dtoRepos.CurrentModelVersion, "Wrong updated version.");

            // Check that the link to the footnote has been changed to an owniing link
            DomainObjectDTO paraDTO  = dtoRepos.GetDTO(contentsTextGuids.paraGuid.ToString());
            XElement        para     = XElement.Parse(paraDTO.Xml);
            XElement        contents = para.Element("Contents");
            XElement        str      = contents.Element("Str");
            XElement        run      = str.Element("Run");

            Assert.IsNull(run.Attribute("link"));
            XAttribute linkAttr = run.Attribute("ownlink");

            Assert.IsNotNull(linkAttr);
            Assert.AreEqual(footnoteGuids.textGuid.ToString(), linkAttr.Value);
            Assert.AreEqual(contentsTextGuids.btGuid.ToString(), para.Element("Translations").Element("objsur").Attribute("guid").Value);
            DomainObjectDTO btDTO = dtoRepos.GetDTO(contentsTextGuids.btGuid.ToString());
            XElement        bt    = XElement.Parse(btDTO.Xml);
            XElement        btStr = bt.Element("Translation").Element("AStr");
            XElement        btRun = btStr.Element("Run");

            Assert.IsNull(btRun.Attribute("ownlink"));
            XAttribute btLinkAttr = btRun.Attribute("link");

            Assert.IsNotNull(btLinkAttr);
            Assert.AreEqual(footnoteGuids.textGuid.ToString(), btLinkAttr.Value);
        }
		public void DataMigration7000035Test()
		{
			var dtos = new HashSet<DomainObjectDTO>();
			var sb = new StringBuilder();
			// 1. Add barebones LP.
			sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
			sb.Append("<Texts>");
			StTextAndParaInfo lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal", false, false);
			sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Texts>");
			sb.Append("<TranslatedScripture>");
			sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
			sb.Append("</TranslatedScripture>");
			sb.Append("</rt>");
			var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
				"LangProject", sb.ToString());
			dtos.Add(lpDto);

			// Add text dto.
			var txtDto = new DomainObjectDTO(lpTextsGuids.textGuid.ToString(),  "StText",
				lpTextsGuids.textXml);
			dtos.Add(txtDto);
			// Add text para dto.
			var txtParaDto = new DomainObjectDTO(lpTextsGuids.paraGuid.ToString(), "ScrTxtPara",
				lpTextsGuids.paraXml);
			dtos.Add(txtParaDto);

			// 2. Add Scripture
			sb = new StringBuilder();
			sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
			sb.Append("<Books>");
			sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
			sb.Append("</Books>");
			sb.Append("</rt>");
			var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef", "Scripture",
				sb.ToString());
			dtos.Add(scrDto);

			// 3. Add a ScrBook
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
			sb.Append("<Name>");
			sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
			sb.Append("</Name>");
			sb.Append("<Title>");
			StTextAndParaInfo titleTextGuids = new StTextAndParaInfo("f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main", true, false);
			sb.Append("<objsur guid=\"" + titleTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Title>");
			sb.Append("<Sections>");
			sb.Append("<objsur guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" t=\"o\" />");
			sb.Append("</Sections>");
			sb.Append("<Footnotes>");
			// This footnote should also have its ParaContainingOrc property set, but this test really doesn't care.
			StTextAndParaInfo footnoteGuids = new StTextAndParaInfo("ScrFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Note General Paragraph", null, true, false);
			sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Footnotes>");
			sb.Append("</rt>");
			var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca", "ScrBook", sb.ToString());
			dtos.Add(bookDto);

			// Add title
			var titleDto = new DomainObjectDTO(titleTextGuids.textGuid.ToString(), "StText",
				titleTextGuids.textXml);
			dtos.Add(titleDto);
			// Title para
			var titleParaDto = new DomainObjectDTO(titleTextGuids.paraGuid.ToString(), "ScrTxtPara",
				titleTextGuids.paraXml);
			dtos.Add(titleParaDto);

			// Add footnote
			var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(), "ScrFootnote",
				footnoteGuids.textXml);
			dtos.Add(footnoteDto);
			// Footnote para
			var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(), "ScrTxtPara",
				footnoteGuids.paraXml);
			dtos.Add(footnoteParaDto);

			// 4. Add a section to the book
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrSection\" guid=\"834e1bf8-3a25-47d6-9f92-806b38b5f815\" ownerguid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" owningflid=\"3002001\" owningord=\"0\">");
			sb.Append("<Content>");
			StTextAndParaInfo contentsTextGuids = new StTextAndParaInfo("StText", "834e1bf8-3a25-47d6-9f92-806b38b5f815", "Paragraph",
				"<Run ws=\"fr\" link=\"" + footnoteGuids.textGuid + "\"></Run>", true, false,
				"<Run ws=\"en\" link=\"" + footnoteGuids.textGuid + "\"></Run>");
			sb.Append("<objsur guid=\"" + contentsTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Content>");
			sb.Append("<Heading>");
			StTextAndParaInfo headingTextGuids = new StTextAndParaInfo("834e1bf8-3a25-47d6-9f92-806b38b5f815", "Section Head", true, false);
			sb.Append("<objsur guid=\"" + headingTextGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Heading>");
			sb.Append("</rt>");
			var sectionDto = new DomainObjectDTO("834e1bf8-3a25-47d6-9f92-806b38b5f815", "ScrSection",
				sb.ToString());
			dtos.Add(sectionDto);

			// Add the contents
			var contentsDto = new DomainObjectDTO(contentsTextGuids.textGuid.ToString(), "StText",
				contentsTextGuids.textXml);
			dtos.Add(contentsDto);
			// Contents para
			var contentsParaDto = new DomainObjectDTO(contentsTextGuids.paraGuid.ToString(), "ScrTxtPara",
				contentsTextGuids.paraXml);
			dtos.Add(contentsParaDto);
			// BT of para
			var btDto = new DomainObjectDTO(contentsTextGuids.btGuid.ToString(), "CmTranslation",
				contentsTextGuids.btXml);
			dtos.Add(btDto);

			// Add the heading to the xml
			var headingDto = new DomainObjectDTO(headingTextGuids.textGuid.ToString(), "StText",
				headingTextGuids.textXml);
			dtos.Add(headingDto);
			// heading para
			var headingParaDto = new DomainObjectDTO(headingTextGuids.paraGuid.ToString(), "ScrTxtPara",
				headingTextGuids.paraXml);
			dtos.Add(headingParaDto);

			// Set up mock MDC.
			var mockMDC = new MockMDCForDataMigration();
			mockMDC.AddClass(1, "CmObject", null, new List<string> { "LangProject", "StText", "Scripture",
				"ScrBook", "StFootnote", "ScrSection", "StPara" });
			mockMDC.AddClass(2, "LangProject", "CmObject", new List<string>());
			mockMDC.AddClass(3, "StText", "CmObject", new List<string> { "StFootnote" });
			mockMDC.AddClass(4, "Scripture", "CmObject", new List<string>());
			mockMDC.AddClass(5, "ScrBook", "CmObject", new List<string>());
			mockMDC.AddClass(6, "StFootnote", "StText", new List<string> { "ScrFootnote" });
			mockMDC.AddClass(7, "ScrSection", "CmObject", new List<string>());
			mockMDC.AddClass(8, "StTxtPara", "StPara", new List<string> { "ScrTxtPara" });
			mockMDC.AddClass(9, "ScrFootnote", "StFootnote", new List<string>());
			mockMDC.AddClass(10, "ScrTxtPara", "StTxtPara", new List<string>());
			mockMDC.AddClass(11, "StPara", "CmObject", new List<string> { "StTxtPara" });
			IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000034, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);

			m_dataMigrationManager.PerformMigration(dtoRepos, 7000035, new DummyProgressDlg());
			Assert.AreEqual(7000035, dtoRepos.CurrentModelVersion, "Wrong updated version.");

			// Check that the link to the footnote has been changed to an owniing link
			DomainObjectDTO paraDTO = dtoRepos.GetDTO(contentsTextGuids.paraGuid.ToString());
			XElement para = XElement.Parse(paraDTO.Xml);
			XElement contents = para.Element("Contents");
			XElement str = contents.Element("Str");
			XElement run = str.Element("Run");
			Assert.IsNull(run.Attribute("link"));
			XAttribute linkAttr = run.Attribute("ownlink");
			Assert.IsNotNull(linkAttr);
			Assert.AreEqual(footnoteGuids.textGuid.ToString(), linkAttr.Value);
			Assert.AreEqual(contentsTextGuids.btGuid.ToString(), para.Element("Translations").Element("objsur").Attribute("guid").Value);
			DomainObjectDTO btDTO = dtoRepos.GetDTO(contentsTextGuids.btGuid.ToString());
			XElement bt = XElement.Parse(btDTO.Xml);
			XElement btStr = bt.Element("Translation").Element("AStr");
			XElement btRun = btStr.Element("Run");
			Assert.IsNull(btRun.Attribute("ownlink"));
			XAttribute btLinkAttr = btRun.Attribute("link");
			Assert.IsNotNull(btLinkAttr);
			Assert.AreEqual(footnoteGuids.textGuid.ToString(), btLinkAttr.Value);
		}
Exemple #9
0
        public void DataMigration7000009Test()
        {
            var dtos = new HashSet <DomainObjectDTO>();
            var sb   = new StringBuilder();

            // 1. Add barebones LP.
            sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
            sb.Append("<LangProject>");
            sb.Append("<Texts>");
            var lpTextsGuids = new StTextAndParaInfo("9719A466-2240-4DEA-9722-9FE0746A30A6", "Normal");

            sb.Append("<objsur guid=\"" + lpTextsGuids.textGuid + "\" t=\"o\" />");
            sb.Append("</Texts>");
            sb.Append("<TranslatedScripture>");
            sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
            sb.Append("</TranslatedScripture>");
            sb.Append("</LangProject>");
            sb.Append("</rt>");
            var expectedLp = sb.ToString();
            var lpDto      = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
                                                 "LangProject",
                                                 expectedLp);

            dtos.Add(lpDto);

            // 2. Add Scripture
            sb = new StringBuilder();
            sb.Append(
                "<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\"");
            int index = sb.Length;

            sb.Append(">");
            sb.Append("<Scripture>");
            sb.Append("<Books>");
            sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
            sb.Append("</Books>");
            sb.Append("</Scripture>");
            sb.Append("</rt>");
            string expected = sb.ToString();

            sb.Insert(index, " owningflid=\"6001040\" owningord=\"0\"");

            var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
                                             "Scripture",
                                             sb.ToString());

            dtos.Add(scrDto);
            // Set up mock MDC.
            var mockMDC = new MockMDCForDataMigration();

            mockMDC.AddClass(1, "CmObject", null, new List <string> {
                "LangProject", "Scripture"
            });
            mockMDC.AddClass(2, "LangProject", "CmObject", new List <string>());
            mockMDC.AddClass(4, "Scripture", "CmObject", new List <string>());
            IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000008, dtos, mockMDC, null);

            m_dataMigrationManager.PerformMigration(dtoRepos, 7000009, new DummyProgressDlg());

            Assert.AreEqual(expected, scrDto.Xml);
            Assert.AreEqual(expectedLp, lpDto.Xml);

            Assert.AreEqual(7000009, dtoRepos.CurrentModelVersion, "Wrong updated version.");
        }
		public void DataMigration7000003Test()
		{
			var dtos = new HashSet<DomainObjectDTO>();
			var sb = new StringBuilder();
			// 1. Add barebones LP.
			sb.Append("<rt class=\"LangProject\" guid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\">");
			sb.Append("<LangProject>");
			sb.Append("<TranslatedScripture>");
			sb.Append("<objsur guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" t=\"o\" />");
			sb.Append("</TranslatedScripture>");
			sb.Append("</LangProject>");
			sb.Append("</rt>");
			var lpDto = new DomainObjectDTO("9719A466-2240-4DEA-9722-9FE0746A30A6",
											"LangProject",
											sb.ToString());
			dtos.Add(lpDto);

			// 2. Add Scripture
			sb = new StringBuilder();
			sb.Append("<rt class=\"Scripture\" guid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" ownerguid=\"9719A466-2240-4DEA-9722-9FE0746A30A6\" owningflid=\"6001040\" owningord=\"0\">");
			sb.Append("<Scripture>");
			sb.Append("<Books>");
			sb.Append("<objsur guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" t=\"o\" />");
			sb.Append("</Books>");
			sb.Append("</Scripture>");
			sb.Append("</rt>");
			var scrDto = new DomainObjectDTO("2c5c1f5f-1f08-41d7-99fe-23893ee4ceef",
											 "Scripture",
											 sb.ToString());
			dtos.Add(scrDto);

			// 3. Add a ScrBook
			sb = new StringBuilder();
			sb.Append("<rt class=\"ScrBook\" guid=\"f213db11-7007-4a2f-9b94-06d6c96014ca\" ownerguid=\"2c5c1f5f-1f08-41d7-99fe-23893ee4ceef\" owningflid=\"3001001\" owningord=\"0\">");
			sb.Append("<ScrBook>");
			sb.Append("<Name>");
			sb.Append("<AUni ws=\"fr\">Genesis</AUni>");
			sb.Append("</Name>");
			sb.Append("<Footnotes>");
			var footnoteGuids = new StTextAndParaInfo("StFootnote", "f213db11-7007-4a2f-9b94-06d6c96014ca", "Title Main");
			sb.Append("<objsur guid=\"" + footnoteGuids.textGuid + "\" t=\"o\" />");
			sb.Append("</Footnotes>");
			sb.Append("</ScrBook>");
			sb.Append("</rt>");
			var bookDto = new DomainObjectDTO("f213db11-7007-4a2f-9b94-06d6c96014ca",
											  "ScrBook",
											  sb.ToString());
			dtos.Add(bookDto);
			// Add footnote
			var footnoteDto = new DomainObjectDTO(footnoteGuids.textGuid.ToString(),
												  "StFootnote",
												  footnoteGuids.textXml);
			dtos.Add(footnoteDto);
			// Footnote para
			var footnoteParaDto = new DomainObjectDTO(footnoteGuids.paraGuid.ToString(),
													  "StTxtPara",
													  footnoteGuids.paraXml);
			dtos.Add(footnoteParaDto);

			// Set up mock MDC.
			var mockMDC = new MockMDCForDataMigration();
			mockMDC.AddClass(1, "CmObject", null, new List<string> { "LangProject", "StText",
																	 "Scripture", "ScrBook", "StPara" });
			mockMDC.AddClass(2, "LangProject", "CmObject", new List<string>());
			mockMDC.AddClass(3, "StText", "CmObject", new List<string> { "StFootnote" });
			mockMDC.AddClass(4, "Scripture", "CmObject", new List<string>());
			mockMDC.AddClass(5, "ScrBook", "CmObject", new List<string>());
			mockMDC.AddClass(6, "StFootnote", "CmObject", new List<string> { "ScrFootnote" });
			mockMDC.AddClass(8, "StTxtPara", "CmObject", new List<string> { "ScrTxtPara" });
			mockMDC.AddClass(9, "ScrFootnote", "CmObject", new List<string>());
			mockMDC.AddClass(10, "ScrTxtPara", "CmObject", new List<string>());
			mockMDC.AddClass(11, "StPara", "CmObject", new List<string> { "StTxtPara" });
			IDomainObjectDTORepository dtoRepos = new DomainObjectDtoRepository(7000002, dtos, mockMDC, null, FwDirectoryFinder.FdoDirectories);
			m_dataMigrationManager.PerformMigration(dtoRepos, 7000003, new DummyProgressDlg());
			Assert.AreEqual(7000003, dtoRepos.CurrentModelVersion, "Wrong updated version.");

			// Check the footnote to make sure it is the correct class
			XElement footnoteElement = XElement.Parse(footnoteDto.Xml);
			Assert.AreEqual("ScrFootnote", footnoteDto.Classname, "Oops. Class was not changed.");
			Assert.AreEqual("ScrFootnote", footnoteElement.Attribute("class").Value, "Oops. Class was not changed.");
			Assert.IsNotNull(footnoteElement.Element("ScrFootnote"));
			Assert.IsTrue(footnoteElement.Element("ScrFootnote").IsEmpty);
		}