public void CategoryPath_Level1()
        {
            ILgWritingSystemFactory wsf          = Cache.WritingSystemFactory;
            XmlNoteCategory         noteCategory = new XmlNoteCategory(m_possList.PossibilitiesOS[0], wsf);

            Assert.AreEqual("Level 1a", noteCategory.CategoryPath);
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// create test data
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();

			m_xmlNote = new XmlNoteCategory();

			// Initialize the annotation category possibility list.
			m_possList = CreateCategories(Cache, m_wsSpanish);
		}
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// create test data
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void CreateTestData()
        {
            base.CreateTestData();

            m_xmlNote = new XmlNoteCategory();

            // Initialize the annotation category possibility list.
            m_possList = CreateCategories(Cache, m_wsSpanish);
        }
        public void CategoryPath_Level3()
        {
            ILgWritingSystemFactory wsf          = Cache.WritingSystemFactory;
            XmlNoteCategory         noteCategory = new XmlNoteCategory(
                m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);

            Assert.AreEqual("Level 1b" + StringUtils.kChObject + "Level 2b, parent is 1b" +
                            StringUtils.kChObject + "Level 3, parent is 2b", noteCategory.CategoryPath);
        }
        public void XmlNoteCategory_TopLevel()
        {
            ILgWritingSystemFactory wsf          = Cache.WritingSystemFactory;
            XmlNoteCategory         noteCategory = new XmlNoteCategory(m_possList.PossibilitiesOS[0], wsf);

            Assert.AreEqual("Level 1a", noteCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.IcuLocale);
            Assert.IsNull(noteCategory.SubCategory);
        }
        public void GetCategoryHierarchyFromXml()
        {
            ILgWritingSystemFactory wsf          = Cache.WritingSystemFactory;
            XmlNoteCategory         noteCategory = new XmlNoteCategory(
                m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);

            string xmlCategoryPath = (string)ReflectionHelper.GetResult(noteCategory,
                                                                        "GetCategoryHierarchyFromXml", noteCategory);

            Assert.AreEqual("Level 1b" + StringUtils.kChObject + "Level 2b, parent is 1b" +
                            StringUtils.kChObject + "Level 3, parent is 2b", xmlCategoryPath);
        }
        public void XmlNoteCategory_SecondLevel()
        {
            ILgWritingSystemFactory wsf          = Cache.WritingSystemFactory;
            XmlNoteCategory         noteCategory = new XmlNoteCategory(
                m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1], wsf);

            Assert.AreEqual("Level 1b", noteCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.IcuLocale);
            Assert.IsNotNull(noteCategory.SubCategory);

            Assert.AreEqual("Level 2b, parent is 1b", noteCategory.SubCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.SubCategory.IcuLocale);
            Assert.IsNull(noteCategory.SubCategory.SubCategory);
        }
示例#8
0
        public override void Initialize()
        {
            CheckDisposed();
            base.Initialize();

            m_xmlNote = new XmlNoteCategory();

            m_scrInMemoryCache.InitializeWritingSystemEncodings();
            m_scrInMemoryCache.InitializeScripture();
            m_scrInMemoryCache.SetupScriptureAnnotationCategories();

            // Initialize the annotation category possibility list.
            m_wsSpanish = InMemoryFdoCache.s_wsHvos.Es;
            m_possList  = CreateCategories(m_scrInMemoryCache.Cache, m_possList, m_wsSpanish);
        }
示例#9
0
        public void XmlNoteCategory_ThirdLevel()
        {
            ILgWritingSystemFactory wsf          = LgWritingSystemFactoryClass.Create();
            XmlNoteCategory         noteCategory = new XmlNoteCategory(
                m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);

            Assert.AreEqual("Level 1b", noteCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.IcuLocale);
            Assert.IsNotNull(noteCategory.SubCategory);

            Assert.AreEqual("Level 2b, parent is 1b", noteCategory.SubCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.SubCategory.IcuLocale);
            Assert.IsNotNull(noteCategory.SubCategory.SubCategory);

            Assert.AreEqual("Level 3, parent is 2b", noteCategory.SubCategory.SubCategory.CategoryName);
            Assert.AreEqual("es", noteCategory.SubCategory.SubCategory.IcuLocale);
        }
示例#10
0
		public void GetCategoryHierarchyFromXml()
		{
			ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;
			XmlNoteCategory noteCategory = new XmlNoteCategory(
				m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);

			string xmlCategoryPath = (string)ReflectionHelper.GetResult(noteCategory,
				"GetCategoryHierarchyFromXml", noteCategory);

			Assert.AreEqual("Level 1b" + StringUtils.kChObject + "Level 2b, parent is 1b" +
				StringUtils.kChObject + "Level 3, parent is 2b", xmlCategoryPath);
		}
示例#11
0
		public void CategoryPath_Level3()
		{
			ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;
			XmlNoteCategory noteCategory = new XmlNoteCategory(
				m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);
			Assert.AreEqual("Level 1b" + StringUtils.kChObject + "Level 2b, parent is 1b" +
				StringUtils.kChObject + "Level 3, parent is 2b", noteCategory.CategoryPath);
		}
示例#12
0
		public void CategoryPath_Level1()
		{
			ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;
			XmlNoteCategory noteCategory = new XmlNoteCategory(m_possList.PossibilitiesOS[0], wsf);
			Assert.AreEqual("Level 1a", noteCategory.CategoryPath);
		}
示例#13
0
		public void XmlNoteCategory_ThirdLevel()
		{
			ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;
			XmlNoteCategory noteCategory = new XmlNoteCategory(
				m_possList.PossibilitiesOS[1].SubPossibilitiesOS[1].SubPossibilitiesOS[0], wsf);

			Assert.AreEqual("Level 1b", noteCategory.CategoryName);
			Assert.AreEqual("es", noteCategory.IcuLocale);
			Assert.IsNotNull(noteCategory.SubCategory);

			Assert.AreEqual("Level 2b, parent is 1b", noteCategory.SubCategory.CategoryName);
			Assert.AreEqual("es", noteCategory.SubCategory.IcuLocale);
			Assert.IsNotNull(noteCategory.SubCategory.SubCategory);

			Assert.AreEqual("Level 3, parent is 2b", noteCategory.SubCategory.SubCategory.CategoryName);
			Assert.AreEqual("es", noteCategory.SubCategory.SubCategory.IcuLocale);
		}
示例#14
0
		public void XmlNoteCategory_TopLevel()
		{
			ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;
			XmlNoteCategory noteCategory = new XmlNoteCategory(m_possList.PossibilitiesOS[0], wsf);

			Assert.AreEqual("Level 1a", noteCategory.CategoryName);
			Assert.AreEqual("es", noteCategory.IcuLocale);
			Assert.IsNull(noteCategory.SubCategory);
		}
示例#15
0
        public void SavingDeserializedAnnotationsToCache_WithCategories()
        {
            DateTime now    = DateTime.Now;
            DateTime utcNow = now.ToUniversalTime();

            XmlScrNote ann = CreateNote();

            ann.BeginScrRef        = "LEV 2:8";
            ann.ResolutionStatus   = NoteStatus.Open;
            ann.AnnotationTypeGuid = CmAnnotationDefnTags.kguidAnnTranslatorNote.ToString();
            ann.DateTimeCreated    = utcNow.ToString(CultureInfo.InvariantCulture);
            ann.DateTimeModified   = utcNow.AddDays(1).ToString(CultureInfo.InvariantCulture);
            AddParasTo(ann.Discussion, "This is my discussion");
            AddParasTo(ann.Resolution, "This is my resolution for the note");
            AddParasTo(ann.Quote, "This is the quoted text");
            AddParasTo(ann.Suggestion, "This is my suggestion");
            XmlNoteCategory category1 = new XmlNoteCategory();

            category1.CategoryName = "Monkey";
            category1.IcuLocale    = "en";
            ann.Categories.Add(category1);
            XmlNoteCategory category2 = new XmlNoteCategory();

            category2.CategoryName = "Discourse";
            category2.IcuLocale    = "en";
            ann.Categories.Add(category2);

            DummyXmlScrAnnotationsList list = new DummyXmlScrAnnotationsList();

            list.Annotations.Add(ann);

            // Make sure 'Monkey' is not in the DB yet
            int wsEn = Cache.ServiceLocator.WritingSystemManager.GetWsFromStr("en");

            foreach (ICmPossibility poss in m_scr.NoteCategoriesOA.PossibilitiesOS)
            {
                Assert.AreNotEqual("Monkey", poss.Name.get_String(wsEn));
            }

            list.CallWriteToCache(Cache, m_stylesheet);

            IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[2];

            Assert.AreEqual(1, annotations.NotesOS.Count);

            IScrScriptureNote note = annotations.NotesOS[0];

            Assert.AreEqual(NoteType.Translator, note.AnnotationType);
            Assert.IsTrue(AreDateTimesClose(now, note.DateCreated));
            Assert.IsTrue(AreDatesClose(now.AddDays(1), note.DateModified));
            Assert.AreEqual(DateTime.MinValue, note.DateResolved);

            TestAnnotationField(note.QuoteOA, "This is the quoted text");
            TestAnnotationField(note.DiscussionOA, "This is my discussion");
            TestAnnotationField(note.ResolutionOA, "This is my resolution for the note");
            TestAnnotationField(note.RecommendationOA, "This is my suggestion");

            Assert.AreEqual(0, note.ResponsesOS.Count);

            bool foundMonkey = false;

            foreach (ICmPossibility poss in m_scr.NoteCategoriesOA.PossibilitiesOS)
            {
                foundMonkey |= (poss.Name.get_String(wsEn).Text == "Monkey");
            }
            Assert.IsTrue(foundMonkey, "Monkey should have been added to the DB");

            Assert.AreEqual(2, note.CategoriesRS.Count);
            Assert.AreEqual("Monkey", note.CategoriesRS[0].Name.get_String(wsEn).Text);
            Assert.AreEqual("Discourse", note.CategoriesRS[1].Name.get_String(wsEn).Text);
        }
		public void SavingDeserializedAnnotationsToCache_WithCategories()
		{
			DateTime now = DateTime.Now;
			DateTime utcNow = now.ToUniversalTime();

			XmlScrNote ann = CreateNote();
			ann.BeginScrRef = "LEV 2:8";
			ann.ResolutionStatus = NoteStatus.Open;
			ann.AnnotationTypeGuid = CmAnnotationDefnTags.kguidAnnTranslatorNote.ToString();
			ann.DateTimeCreated = utcNow.ToString(CultureInfo.InvariantCulture);
			ann.DateTimeModified = utcNow.AddDays(1).ToString(CultureInfo.InvariantCulture);
			AddParasTo(ann.Discussion, "This is my discussion");
			AddParasTo(ann.Resolution, "This is my resolution for the note");
			AddParasTo(ann.Quote, "This is the quoted text");
			AddParasTo(ann.Suggestion, "This is my suggestion");
			XmlNoteCategory category1 = new XmlNoteCategory();
			category1.CategoryName = "Monkey";
			category1.IcuLocale = "en";
			ann.Categories.Add(category1);
			XmlNoteCategory category2 = new XmlNoteCategory();
			category2.CategoryName = "Discourse";
			category2.IcuLocale = "en";
			ann.Categories.Add(category2);

			DummyXmlScrAnnotationsList list = new DummyXmlScrAnnotationsList();
			list.Annotations.Add(ann);

			// Make sure 'Monkey' is not in the DB yet
			int wsEn = Cache.ServiceLocator.WritingSystemManager.GetWsFromStr("en");
			foreach (ICmPossibility poss in m_scr.NoteCategoriesOA.PossibilitiesOS)
				Assert.AreNotEqual("Monkey", poss.Name.get_String(wsEn));

			list.CallWriteToCache(Cache, m_stylesheet);

			IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[2];
			Assert.AreEqual(1, annotations.NotesOS.Count);

			IScrScriptureNote note = annotations.NotesOS[0];
			Assert.AreEqual(NoteType.Translator, note.AnnotationType);
			Assert.IsTrue(AreDateTimesClose(now, note.DateCreated));
			Assert.IsTrue(AreDatesClose(now.AddDays(1), note.DateModified));
			Assert.AreEqual(DateTime.MinValue, note.DateResolved);

			TestAnnotationField(note.QuoteOA, "This is the quoted text");
			TestAnnotationField(note.DiscussionOA, "This is my discussion");
			TestAnnotationField(note.ResolutionOA, "This is my resolution for the note");
			TestAnnotationField(note.RecommendationOA, "This is my suggestion");

			Assert.AreEqual(0, note.ResponsesOS.Count);

			bool foundMonkey = false;
			foreach (ICmPossibility poss in m_scr.NoteCategoriesOA.PossibilitiesOS)
				foundMonkey |= (poss.Name.get_String(wsEn).Text == "Monkey");
			Assert.IsTrue(foundMonkey, "Monkey should have been added to the DB");

			Assert.AreEqual(2, note.CategoriesRS.Count);
			Assert.AreEqual("Monkey", note.CategoriesRS[0].Name.get_String(wsEn).Text);
			Assert.AreEqual("Discourse", note.CategoriesRS[1].Name.get_String(wsEn).Text);
		}