MVC and TDD

by Lord Cod3n 23. September 2008 01:53

Trying to better my understanding of the MVC framework from Microsoft   I begin stepping through the test cases.  This perspective is one of the reasons I love TDD it is a good way to figure out what the code is supposed to do.

 

I believe that some of the test cases are not valid.  Here is an example:

 

        [TestMethod]
        public void FindActionMethodDoesNotMatchProperty() {
            // FindActionMethod() shouldn't match special-named methods like property getters.
            // Arrange
            var controller = new FindMethodController();
            ControllerContext context = GetControllerContext(controller);
            ControllerActionInvokerHelper helper = new ControllerActionInvokerHelper(context);
            // Act
            MethodInfo mi = helper.PublicFindActionMethod("get_Property");
            // Assert
            Assert.IsNull(mi);
        }

This is an example of testing the framework.  When they do reflection to get the methods they do not ask for the properties. Is this a valid test ? 

Right now I am going to go with no.  It could be argued that they are making sure their code works as expected, but when you write code and ask for something specific i.e. (methods)  how would you get back a property?

 

Have a good day

Bill

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

William Moore is the lead Software Architect and Technologist for Coden Enterprises. He has more than a decade of software development experience primarily Microsoft Platforms.  William enjoys the full gamit of coding everything from the UI down to the database.

Most comments

Page List