Dispose() защищенный Метод

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
Результат void
Пример #1
0
        public void ErrorListIsUpdatedWhenBookFilterChanges()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book1    = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
            IScrSection section1 = m_scrInMemoryCache.AddSectionToMockedBook(book1.Hvo);
            StTxtPara   para1    = m_scrInMemoryCache.AddParaToMockedSectionContent(section1.Hvo,
                                                                                    ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            IScrBook    book2    = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus");
            IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book2.Hvo);
            StTxtPara   para2    = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo,
                                                                                    ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            // Add both books to the book filter
            m_bookFilter.UpdateFilter(book1.Hvo, book2.Hvo);

            EditorialChecksRenderingsControl renderingCtl =
                new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

            // Add some checking errors for each book
            m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
            renderingCtl.LoadCheckingErrors();

            SortableBindingList <CheckingError> checkingErrors =
                ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
                SortableBindingList <CheckingError>;

            Assert.AreEqual(4, checkingErrors.Count);

            m_bookFilter.UpdateFilter(book1.Hvo);             // Should update the error list

            Assert.AreEqual(2, checkingErrors.Count,
                            "The error list should have been updated when the book filter changed");

#if DEBUG
            // For some very strange reason, without this dispose call in debug mode,
            // there is an assertion in the c++ code when nunit is shut down. With the
            // dispose call in release mode there is a different assertion in c++ code
            // (something about calling a pure virtual method) when nunit is shut down.
            // So, it seems we can't win either way unless making this line conditional
            // on the build config. Argh!!!! - DDO: 16-Jul-2008
            renderingCtl.Dispose();
#endif
        }
Пример #2
0
        public void ReRunChecksWithNoBooks()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book    = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);
            StTxtPara   para    = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
                                                                                   ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para,
                                                  "some text for an annotation", ScrStyleNames.Normal);

            EditorialChecksRenderingsControl renderingCtl =
                new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

            // Add a checking error annotation.
            m_scrInMemoryCache.AddAnnotation(para, 1001001, NoteType.CheckingError);
            // Now delete the book so that there are not any in the project.
            m_inMemoryCache.Cache.DeleteObject(book.Hvo);
            Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
                            "There should not be books for this test.");

            // Now attempt to load the checking error annotations.
            renderingCtl.LoadCheckingErrors();

            List <ICheckGridRowObject> checkingErrors = ReflectionHelper.GetField(
                renderingCtl, "m_list") as List <ICheckGridRowObject>;

            // We expect that no annotations would be added to the EditorialRenderingsControl
            // and that we won't crash trying to load checking error annotations.
            Assert.AreEqual(0, checkingErrors.Count,
                            "Since there are no books, the error annotation should not be added to the rendering control");

#if DEBUG
            // For some very strange reason, without this dispose call in debug mode,
            // there is an assertion in the c++ code when nunit is shut down. With the
            // dispose call in release mode there is a different assertion in c++ code
            // (something about calling a pure virtual method) when nunit is shut down.
            // So, it seems we can't win either way unless making this line conditional
            // on the build config. Argh!!!! - DDO: 16-Jul-2008
            renderingCtl.Dispose();
#endif
        }
Пример #3
0
		public void ReRunChecksWithNoBooks()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);

			m_scrInMemoryCache.AddRunToMockedPara(para,
				"some text for an annotation", ScrStyleNames.Normal);

			EditorialChecksRenderingsControl renderingCtl =
				new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

			// Add a checking error annotation.
			m_scrInMemoryCache.AddAnnotation(para, 1001001, NoteType.CheckingError);
			// Now delete the book so that there are not any in the project.
			m_inMemoryCache.Cache.DeleteObject(book.Hvo);
			Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
				"There should not be books for this test.");

			// Now attempt to load the checking error annotations.
			renderingCtl.LoadCheckingErrors();

			List<ICheckGridRowObject> checkingErrors = ReflectionHelper.GetField(
				renderingCtl, "m_list") as List<ICheckGridRowObject>;

			// We expect that no annotations would be added to the EditorialRenderingsControl
			// and that we won't crash trying to load checking error annotations.
			Assert.AreEqual(0, checkingErrors.Count,
				"Since there are no books, the error annotation should not be added to the rendering control");

#if DEBUG
			// For some very strange reason, without this dispose call in debug mode,
			// there is an assertion in the c++ code when nunit is shut down. With the
			// dispose call in release mode there is a different assertion in c++ code
			// (something about calling a pure virtual method) when nunit is shut down.
			// So, it seems we can't win either way unless making this line conditional
			// on the build config. Argh!!!! - DDO: 16-Jul-2008
			renderingCtl.Dispose();
#endif
		}
Пример #4
0
		public void ErrorListIsUpdatedWhenBookFilterChanges()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book1 = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			IScrSection section1 = m_scrInMemoryCache.AddSectionToMockedBook(book1.Hvo);
			StTxtPara para1 = m_scrInMemoryCache.AddParaToMockedSectionContent(section1.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			IScrBook book2 = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus");
			IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book2.Hvo);
			StTxtPara para2 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			// Add both books to the book filter
			m_bookFilter.UpdateFilter(book1.Hvo, book2.Hvo);

			EditorialChecksRenderingsControl renderingCtl =
				new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

			// Add some checking errors for each book
			m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
			renderingCtl.LoadCheckingErrors();

			SortableBindingList<CheckingError> checkingErrors =
				ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
				SortableBindingList<CheckingError>;

			Assert.AreEqual(4, checkingErrors.Count);

			m_bookFilter.UpdateFilter(book1.Hvo); // Should update the error list

			Assert.AreEqual(2, checkingErrors.Count,
				"The error list should have been updated when the book filter changed");

#if DEBUG
			// For some very strange reason, without this dispose call in debug mode,
			// there is an assertion in the c++ code when nunit is shut down. With the
			// dispose call in release mode there is a different assertion in c++ code
			// (something about calling a pure virtual method) when nunit is shut down.
			// So, it seems we can't win either way unless making this line conditional
			// on the build config. Argh!!!! - DDO: 16-Jul-2008
			renderingCtl.Dispose();
#endif
		}