Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 public void CreateTestStubForMethodTest()
 {
     var method = new CodeMemberMethod();
     method.Name = "TheMethodName";
     CodeMethodComposer.CreateTestStubForMethod(method);
     var expectedComment = "TODO: Implement unit test for TheMethodName";
     AssertEx.That(
         method.ContainsComment(expectedComment),
         "Comment '{0}' not found in: {1}",
         expectedComment,
         method.ContainsCommentMsg());
     AssertEx.That(
         method.ContainsAttribute("Test"), "Attribute 'Test' not found in: {0}", method.ContainsAttributeMsg());
     AssertEx.That(method.HasReturnTypeOf(typeof(void)));
 }