Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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"));
        }
Esempio n. 5
0
        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"));
        }