public void ContainsCommentOnEmptyCommentsShouldThrow()
 {
     var cm = new CodeMemberMethod();
     Assert.Throws<AssertionException>(() => cm.ContainsComment("Bla").Compile().Invoke());
 }
        public void ContainsCommentTest()
        {
            var cm = new CodeMemberMethod();
            cm.AddComment("You Foo");
            Assert.IsTrue(cm.ContainsComment("You Foo").Compile().Invoke());

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

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

            Assert.IsFalse(cm.ContainsComment(" aBC").Compile().Invoke());
        }
示例#3
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)));
 }