Why does PostDL have static funcs?

Coordinator
Sep 21, 2008 at 9:39 AM
Edited Sep 21, 2008 at 9:57 AM
Why does PostDL have static funcs? it makes it difficult to unit test it?$0i couldnt mock out, any suggestiongs? $0$0$0$0$0
Coordinator
Sep 21, 2008 at 2:28 PM
To be honest, I haven't used mock objects that much.  If having static functions makes it more difficult to unit test I am happy to change it. 
Volkanuzun, I will add you as a developer to this project.  It would be great if you could check your changes to the PostDL and any unit tests you make
using mock objects. 

Otherwise, I will look into this issue and modify the DL.  What are you using for your mock objects?
Coordinator
Sep 23, 2008 at 2:52 AM
Hi Jeff,$0i dont know how to checkin code, i work with svn at work, so i guess i have to figure it codeplex versioning syste.$0$0i use rhino.mocks ( newbie ). i start writing units test for the routes, also changed the routing table a little bit as i discussed at the issues section.$0$0an example of how i unit test the routing table:$0$0=====$0$0$0[TestMethod]$0$0        public void PostControllerShouldRoute_Posts_List_5()$0$0        {$0$0            MockRepository mock = new MockRepository();$0$0            RouteCollection routes = new RouteCollection();$0$0            GlobalApplication.RegisterRoutes(routes);$0$0            HttpContextBase httpContextBase;$0$0$0$0$0            using (mock.Record())$0$0            {$0$0                httpContextBase = mock.HttpContextFactory("/Posts/List/5");$0$0            }$0$0            RouteData routeData = routes.GetRouteData(httpContextBase);$0$0            Assert.IsNotNull(routeData, "No route is found");$0$0            Assert.AreEqual("Posts", routeData.Values["controller"].ToString());$0$0            Assert.AreEqual("List", routeData.Values["action"].ToString());$0$0            Assert.AreEqual("5", routeData.Values["id"].ToString());$0$0        }$0$0$0====$0$0$0$0$0i dont see much benefit unit testing all the actionmethods as they simply return views accept post/list which reverses the post. that's where i use interface and mock out the db. $0
Coordinator
Sep 23, 2008 at 5:06 PM
Thanks for adding the mock stuff.  I have made a bunch of bug fixes related to adding posts and editing posts.  In addition to enhancing the admin interface with an Ajax based interface for managing posts.  I will merge that with the changes you made.