public void CanRenderingBeDeleted_NonExistentRendering()
        {
            IKeyTerm ktFun = KeyTermMatchBuilderTests.AddMockedKeyTerm("having a blast");

            ktFun.Stub(kt => kt.Renderings).Return(new[] { "abc" });
            KeyTermMatchBuilder bldr     = new KeyTermMatchBuilder(ktFun);
            KeyTermMatch        matchFun = bldr.Matches.First();

            Assert.IsFalse(matchFun.CanRenderingBeDeleted("xyz"));
        }
        public void AddRenderingFailsToAddDuplicate()
        {
            IKeyTerm ktFun = KeyTermMatchBuilderTests.AddMockedKeyTerm("good times");

            ktFun.Stub(kt => kt.Renderings).Return(new[] { "abc", "xyz" });
            KeyTermMatchBuilder bldr     = new KeyTermMatchBuilder(ktFun);
            KeyTermMatch        matchFun = bldr.Matches.First();

            Assert.Throws(typeof(ArgumentException), () => matchFun.AddRendering("abc"));
        }
        public void GetNormalRenderings()
        {
            IKeyTerm ktFun = KeyTermMatchBuilderTests.AddMockedKeyTerm("diversion");

            ktFun.Stub(kt => kt.Renderings).Return(new [] { "abc", "xyz" });
            KeyTermMatchBuilder bldr     = new KeyTermMatchBuilder(ktFun);
            KeyTermMatch        matchFun = bldr.Matches.First();

            Assert.IsTrue(matchFun.Renderings.SequenceEqual(ktFun.Renderings));
        }
        public void CanRenderingBeDeleted_DefaultRendering()
        {
            IKeyTerm ktFun = KeyTermMatchBuilderTests.AddMockedKeyTerm("time of my life");

            ktFun.Stub(kt => kt.Renderings).Return(new[] { "abc" });
            KeyTermMatchBuilder bldr     = new KeyTermMatchBuilder(ktFun);
            KeyTermMatch        matchFun = bldr.Matches.First();

            matchFun.AddRendering("bestest");
            matchFun.BestRendering = "bestest";
            Assert.IsFalse(matchFun.CanRenderingBeDeleted("bestest"));
        }
        public void AddAndRemoveRenderings()
        {
            IKeyTerm ktFun = KeyTermMatchBuilderTests.AddMockedKeyTerm("fun");

            ktFun.Stub(kt => kt.Renderings).Return(new [] { "abc", "xyz" });
            KeyTermMatchBuilder bldr     = new KeyTermMatchBuilder(ktFun);
            KeyTermMatch        matchFun = bldr.Matches.First();

            matchFun.AddRendering("wunkyboo");
            Assert.AreEqual(3, matchFun.Renderings.Count());
            Assert.IsTrue(matchFun.Renderings.Contains("wunkyboo"));
            Assert.IsTrue(matchFun.CanRenderingBeDeleted("wunkyboo"));
            Assert.IsFalse(matchFun.CanRenderingBeDeleted("abc"));
            matchFun.DeleteRendering("wunkyboo");
            Assert.IsFalse(matchFun.Renderings.Contains("wunkyboo"));
        }