Ejemplo n.º 1
0
        public void ContainsAttributeTest()
        {
            var cm = new CodeMemberMethod();
            cm.AddMethodAttribute("You Foo");
            Assert.IsTrue(cm.ContainsAttribute("You Foo").Compile().Invoke());

            cm.AddMethodAttribute(" ABC");
            cm.AddMethodAttribute(" CDE ");
            cm.AddMethodAttribute("E F G");

            Assert.IsTrue(cm.ContainsAttribute("E F G").Compile().Invoke());
            Assert.IsTrue(cm.ContainsAttribute(" CDE ").Compile().Invoke());
            Assert.IsTrue(cm.ContainsAttribute(" ABC").Compile().Invoke());
            Assert.IsTrue(cm.ContainsAttribute("You Foo").Compile().Invoke());

            Assert.IsFalse(cm.ContainsAttribute(" aBC").Compile().Invoke());
        }
Ejemplo n.º 2
0
        public void ContainsAttributeMessageTest()
        {
            var cm = new CodeMemberMethod();
            var expected = string.Empty;
            var actual = cm.ContainsAttributeMsg();
            Assert.AreEqual(expected, actual);

            cm.AddMethodAttribute("You Foo");
            expected = "[{You Foo}]";
            actual = cm.ContainsAttributeMsg();
            Assert.AreEqual(expected, actual);

            cm.AddMethodAttribute(" ABC");
            cm.AddMethodAttribute(" CDE ");
            cm.AddMethodAttribute("E F G");
            expected = "[{You Foo}, { ABC}, { CDE }, {E F G}]";
            actual = cm.ContainsAttributeMsg();
            Assert.AreEqual(expected, actual);
        }