Esempio n. 1
0
        public void AddAndRemoveRenderings()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            Assert.IsFalse(m_testFileAccessor.Exists(DataFileAccessor.DataFileId.KeyTermRenderingInfo));
            kt.AddRendering("wunkyboo");
            Assert.IsTrue(m_testFileAccessor.Exists(DataFileAccessor.DataFileId.KeyTermRenderingInfo));
            Assert.AreEqual(3, kt.Renderings.Count());
            Assert.IsTrue(kt.Renderings.Contains("wunkyboo"));
            Assert.IsTrue(kt.CanRenderingBeDeleted("wunkyboo"));
            Assert.IsFalse(kt.CanRenderingBeDeleted("abc"));
            kt.DeleteRendering("wunkyboo");
            Assert.IsFalse(kt.Renderings.Contains("wunkyboo"));
        }
Esempio n. 2
0
        public void CanRenderingBeDeleted_ImplicitDefaultRendering_ReturnsTrue()
        {
            m_renderings["GreekWord"] = new string[0];
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            kt.AddRendering("bestest");
            Assert.IsTrue(kt.CanRenderingBeDeleted("bestest"));
        }
Esempio n. 3
0
        public void CanRenderingBeDeleted_NotUserAdded_ReturnsFalse()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            Assert.IsFalse(kt.CanRenderingBeDeleted("xyz"));
        }
Esempio n. 4
0
        public void CanRenderingBeDeleted_ExplicitDefaultRendering_ReturnsFalse()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            kt.AddRendering("bestest");
            kt.BestRendering = "bestest";
            Assert.IsFalse(kt.CanRenderingBeDeleted("bestest"));
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Handles the Opening event of the contextMenuStrip control.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
 {
     mnuDeleteRendering.Enabled = m_lbRenderings.SelectedItem != null &&
                                  m_term.CanRenderingBeDeleted(m_lbRenderings.SelectedItem.ToString());
     mnuSetAsDefault.Enabled = m_lbRenderings.SelectedItem != null;
 }