/// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetupTestList()
        {
            m_list     = new List <ICheckGridRowObject>();
            m_cgSorter = new CheckGridListSorter(m_list);

            DummyListItem item = new DummyListItem();

            item.StrProp  = "item1";
            item.IntProp  = 500;
            item.DateProp = new DateTime(2008, 1, 21);
            item.EnumProp = dummyEnum.One;
            m_list.Add(item);

            item          = new DummyListItem();
            item.StrProp  = "item3";
            item.IntProp  = 100;
            item.DateProp = new DateTime(2008, 1, 23);
            item.EnumProp = dummyEnum.Three;
            m_list.Add(item);

            item          = new DummyListItem();
            item.StrProp  = "item4";
            item.IntProp  = 200;
            item.DateProp = new DateTime(2008, 1, 24);
            item.EnumProp = dummyEnum.One;
            m_list.Add(item);

            item          = new DummyListItem();
            item.StrProp  = "item2";
            item.IntProp  = 800;
            item.DateProp = new DateTime(2008, 1, 24);
            item.EnumProp = dummyEnum.Two;
            m_list.Add(item);

            m_cgSorter.AddComparer("StrProp", StringComparer.Ordinal);
            m_cgSorter.AddComparer("IntProp", m_genericComparer);
            m_cgSorter.AddComparer("DateProp", m_genericComparer);
            m_cgSorter.AddComparer("EnumProp", new DummyEnumComparer());
        }
        public void TestSetFirstSortPropNameMethod()
        {
            m_cgSorter = new CheckGridListSorter(new List <ICheckGridRowObject>());

            List <StableSortInfo> ssOrders =
                ReflectionHelper.GetField(m_cgSorter, "m_stableOrder") as List <StableSortInfo>;

            Assert.AreEqual(0, ssOrders.Count);

            m_cgSorter.SetFirstSortPropName("prop3", false);
            m_cgSorter.SetFirstSortPropName("prop2", false);
            m_cgSorter.SetFirstSortPropName("prop1", false);

            Assert.AreEqual(3, ssOrders.Count);
            Assert.AreEqual("prop1", ssOrders[0].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[0].SortDirection);
            Assert.AreEqual("prop2", ssOrders[1].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection);
            Assert.AreEqual("prop3", ssOrders[2].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);

            m_cgSorter.SetFirstSortPropName("prop2", true);
            Assert.AreEqual("prop2", ssOrders[0].PropName);
            Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection);
            Assert.AreEqual("prop1", ssOrders[1].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection);
            Assert.AreEqual("prop3", ssOrders[2].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);

            m_cgSorter.SetFirstSortPropName("prop3", true);
            Assert.AreEqual("prop3", ssOrders[0].PropName);
            Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection);
            Assert.AreEqual("prop2", ssOrders[1].PropName);
            Assert.AreEqual(SortOrder.Descending, ssOrders[1].SortDirection);
            Assert.AreEqual("prop1", ssOrders[2].PropName);
            Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:KeyTermRenderingsControl"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="mainWnd">the FwMainWnd that owns this control.</param>
		/// ------------------------------------------------------------------------------------
		public KeyTermRenderingsControl(FdoCache cache,	FwMainWnd mainWnd) : base(cache, mainWnd)
		{
			InitializeComponent();
			DataGridView = m_dataGridView;

			// Setup columns
			m_Rendering.Cache = m_cache;
			m_Rendering.WritingSystemCode = m_cache.DefaultVernWs;
			m_OriginalTerm.Cache = m_cache;

			ILgWritingSystemFactory wsf = m_cache.LanguageWritingSystemFactoryAccessor;
			m_wsGreek = wsf.GetWsFromStr("grc");
			if (m_wsGreek <= 0)
				throw new Exception("The Greek writing system is not defined.");
			m_wsHebrew = wsf.GetWsFromStr("hbo");
			if (m_wsHebrew <= 0)
				throw new Exception("The Hebrew writing system is not defined.");

			if (mainWnd != null)
			{
				Parent = mainWnd;
				m_stylesheet = mainWnd.StyleSheet;
				m_Rendering.Font = new Font(
					m_stylesheet.GetNormalFontFaceName(cache, cache.DefaultVernWs),
					FontInfo.kDefaultFontSize / 1000);
			}

			m_list = new List<ICheckGridRowObject>();
			m_gridSorter = new CheckGridListSorter(m_list);
			m_gridSorter.AddComparer(m_Rendering.DataPropertyName, m_tsStrComparer);
			m_gridSorter.AddComparer(m_OriginalTerm.DataPropertyName, m_tsStrComparer);
			m_gridSorter.AddComparer(m_Status.DataPropertyName, new RenderingStatusComparer());
			m_gridSorter.AddComparer(m_Reference.DataPropertyName,
				new ScriptureReferenceComparer((Scripture)m_cache.LangProject.TranslatedScriptureOA));

			m_dataGridView.Cache = m_cache;
			m_dataGridView.ColumnHeaderMouseClick += m_dataGridView_ColumnHeaderMouseClick;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:EditorialChecksRenderingsControl"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="bookFilter">The book filter.</param>
		/// <param name="mainWnd">The FwMainWnd that owns this control.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// ------------------------------------------------------------------------------------
		public EditorialChecksRenderingsControl(FdoCache cache, FilteredScrBooks bookFilter,
			FwMainWnd mainWnd, IHelpTopicProvider helpTopicProvider) : base(cache, mainWnd)
		{
			InitializeComponent();
			DataGridView = m_dataGridView;
			m_BookFilter = bookFilter;
			m_helpTopicProvider = helpTopicProvider;

			if (m_cache == null)
				return;

			m_Details.Cache = m_cache;
			m_Details.WritingSystemCode = m_cache.DefaultVernWs;

			if (mainWnd != null)
			{
				m_Details.Font = mainWnd.StyleSheet.GetUiFontForWritingSystem(m_cache.DefaultVernWs,
					FontInfo.kDefaultFontSize);
			}

			m_list = new List<ICheckGridRowObject>();
			m_gridSorter = new CheckGridListSorter(m_list);
			m_gridSorter.AddComparer(m_TypeOfCheck.DataPropertyName, StringComparer.CurrentCulture);
			m_gridSorter.AddComparer(m_Message.DataPropertyName, StringComparer.CurrentCulture);
			m_gridSorter.AddComparer(m_Details.DataPropertyName, m_tsStrComparer);
			m_gridSorter.AddComparer(m_Status.DataPropertyName, new CheckingStatusComparer());
			m_gridSorter.AddComparer(m_Reference.DataPropertyName,
				new ScrReferencePositionComparer(m_cache.LangProject.TranslatedScriptureOA.ScrProjMetaDataProvider, false));

			m_dataGridView.Cache = m_cache;
		}
		public void TestSetFirstSortPropNameMethod()
		{
			m_cgSorter = new CheckGridListSorter(new List<ICheckGridRowObject>());

			List<StableSortInfo> ssOrders =
				ReflectionHelper.GetField(m_cgSorter, "m_stableOrder") as List<StableSortInfo>;

			Assert.AreEqual(0, ssOrders.Count);

			m_cgSorter.SetFirstSortPropName("prop3", false);
			m_cgSorter.SetFirstSortPropName("prop2", false);
			m_cgSorter.SetFirstSortPropName("prop1", false);

			Assert.AreEqual(3, ssOrders.Count);
			Assert.AreEqual("prop1", ssOrders[0].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[0].SortDirection);
			Assert.AreEqual("prop2", ssOrders[1].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection);
			Assert.AreEqual("prop3", ssOrders[2].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);

			m_cgSorter.SetFirstSortPropName("prop2", true);
			Assert.AreEqual("prop2", ssOrders[0].PropName);
			Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection);
			Assert.AreEqual("prop1", ssOrders[1].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection);
			Assert.AreEqual("prop3", ssOrders[2].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);

			m_cgSorter.SetFirstSortPropName("prop3", true);
			Assert.AreEqual("prop3", ssOrders[0].PropName);
			Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection);
			Assert.AreEqual("prop2", ssOrders[1].PropName);
			Assert.AreEqual(SortOrder.Descending, ssOrders[1].SortDirection);
			Assert.AreEqual("prop1", ssOrders[2].PropName);
			Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void SetupTestList()
		{
			m_list = new List<ICheckGridRowObject>();
			m_cgSorter = new CheckGridListSorter(m_list);

			DummyListItem item = new DummyListItem();
			item.StrProp = "item1";
			item.IntProp = 500;
			item.DateProp = new DateTime(2008, 1, 21);
			item.EnumProp = dummyEnum.One;
			m_list.Add(item);

			item = new DummyListItem();
			item.StrProp = "item3";
			item.IntProp = 100;
			item.DateProp = new DateTime(2008, 1, 23);
			item.EnumProp = dummyEnum.Three;
			m_list.Add(item);

			item = new DummyListItem();
			item.StrProp = "item4";
			item.IntProp = 200;
			item.DateProp = new DateTime(2008, 1, 24);
			item.EnumProp = dummyEnum.One;
			m_list.Add(item);

			item = new DummyListItem();
			item.StrProp = "item2";
			item.IntProp = 800;
			item.DateProp = new DateTime(2008, 1, 24);
			item.EnumProp = dummyEnum.Two;
			m_list.Add(item);

			m_cgSorter.AddComparer("StrProp", StringComparer.Ordinal);
			m_cgSorter.AddComparer("IntProp", m_genericComparer);
			m_cgSorter.AddComparer("DateProp", m_genericComparer);
			m_cgSorter.AddComparer("EnumProp", new DummyEnumComparer());
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:KeyTermRenderingsControl"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="mainWnd">the FwMainWnd that owns this control.</param>
		/// ------------------------------------------------------------------------------------
		public KeyTermRenderingsControl(FdoCache cache, FwMainWnd mainWnd) : base(cache, mainWnd)
		{
			InitializeComponent();
			AccessibleName = Name;
			DataGridView = m_dataGridView;

			// Setup columns
			m_Rendering.Cache = m_cache;
			m_Rendering.WritingSystemCode = m_cache.DefaultVernWs;
			m_OriginalTerm.Cache = m_cache;

			IWritingSystem ws;
			m_cache.ServiceLocator.WritingSystemManager.GetOrSet("grc", out ws);
			m_wsGreek = ws.Handle;
			if (m_wsGreek <= 0)
				throw new Exception("The Greek writing system is not defined.");
			m_cache.ServiceLocator.WritingSystemManager.GetOrSet("hbo", out ws);
			m_wsHebrew = ws.Handle;
			if (m_wsHebrew <= 0)
				throw new Exception("The Hebrew writing system is not defined.");

			if (mainWnd != null)
			{
				Parent = mainWnd;
				m_stylesheet = mainWnd.StyleSheet;
				m_Rendering.Font = m_stylesheet.GetUiFontForWritingSystem(cache.DefaultVernWs,
					FontInfo.kDefaultFontSize);
			}

			m_list = new List<ICheckGridRowObject>();
			m_gridSorter = new CheckGridListSorter(m_list);
			m_gridSorter.AddComparer(m_Rendering.DataPropertyName, m_tsStrComparer);
			m_gridSorter.AddComparer(m_OriginalTerm.DataPropertyName, m_tsStrComparer);
			m_gridSorter.AddComparer(m_Status.DataPropertyName, new RenderingStatusComparer());
			m_gridSorter.AddComparer(m_Reference.DataPropertyName,
				new ScriptureReferenceComparer(m_cache.LanguageProject.TranslatedScriptureOA.ScrProjMetaDataProvider));

			m_dataGridView.Cache = m_cache;
			m_dataGridView.ColumnHeaderMouseClick += m_dataGridView_ColumnHeaderMouseClick;
		}