Friday, July 31, 2009

Configuring TeamCity with SQL Server 2008 Express

I tried to configure TeamCity with SQL Server 2005 (both Express & none Express versions), but I haven't ever try with SQL Server 2008 Express. So when I install Windows 7 RTM, I think it's the time to update to SQL Server 2008 Express. Based on David's post, I update the configuration process as I did.

  • Install SQL Server Express 2008
  • Configure SQL Server Express 2008 to use a static port (default port for SQL Server is 1433) 'cause it uses dynamic port by default.
  • Create an empty database for TeamCity, example "TeamCity", with _CI_AI collation as mentioned here
  • Install TeamCity (you can grap the latest EAP of TeamCity here)
  • Download Microsoft's JDBC driver from here, extract it then copy sqljdbc.jar, but not sqljdbc4.jar, to [TeamCity installation folder]\webapps\ROOT\WEB-INF\lib (I'm not sure why David mentioned that we need to copy auth/x64/sqljdbc_auth.dll to that folder, but even I didn't copy it, seems TeamCity still works well on Windows 7 RTM x64)
  • Create/replace in [TeamCity Build Server folder]\config with this content


    validationQuery=select 1
    I don't know why connectionProperties.user and connectionProperties.password don't work and I need to add the user name and password to connection string
  • Start TeamCity Web Server service, TeamCity should use SQL Server 2008 Express as back-end data storage from now on

Monday, July 13, 2009

How to check exception message in NUnit 2.5

In previous post, I mentioned how to check for expected exceptions in NUnit 2.5 to run with ReSharper and my prefered way but it lacks of how to check for exception messages. In this post, I will address it.

To check exception messages, I cannot use Assert.That(), my prefered way, because it returns nothing. The only way I can use is Assert.Throws(). Assert.Throws() returns an instance of the exception, and using it, I can check the message.

ArgumentException ex = Assert.Throws<ArgumentException>(delegate { clz.Divide(3, 0); });
Assert.AreEqual("Hey man, you need to learn elementary school again!", ex.Message);

Happy testing! :-)

Tuesday, July 07, 2009

Theory, the boring part. Or the second partial (and the last) review of Pro ASP.NET MVC Framework

After having the exciting knowing how to work with ASP.NET MVC in pratice, I move to the boring part, theory, of Pro ASP.NET MVC Framework. This part is broken up to 9 chapters.

Chapter 7, "Overview of ASP.NET MVC Projects", gives me the understand about ASP.NET MVC project structure, how to debug a project, and detail about the request processing pipeline which teaches you what each components in ASP.NET MVC does.

Chapter 8, "URLs and Routing", teaches me how to configure the routing in details, gives me some best practices for URL schemas, and how to test URL routing.

Chapter 9, "Controllers and Actions", explains how a controller receives input, produces output, do filter. It also mentions about controller factory, and again, testing for controller.

Chapter 10, "Views", lets me know how to use inline code, HTML Helper, partial views, Html.RenderAction to produce views. It also gives me some basic about how to create a custom view engine, and introduces some third-party view engine (NVelocity, Spark, Brail, NHaml).

Chapter 11, "Data Entry", you got controllers, you got views, but what makes users use your applications, it's data. This chapter teaches me how to bind data from model and how to validate data.

Chapter 12, "Ajax and Client Scripting", explains me how to get support from ASP.NET MVC's Ajax Helpers and jQuery to make the web application more attractive.

Chatper 13, "Security and Vulnerability", mentions about the most important thing for web appplications, security, and gives me some insights to address it.

Chapter 14, "Deployment", you finish a web application and you need to put it to work in the real world, so what do you need to care about, this chapter will help you.

Chapter 15, "ASP.NET Platform Features", ASP.NET MVC is not just it, it was based on ASP.NET platform, and there are some features you need to know to use them (Windows authentication, forms authentication, data caching, i18n, adressing performance,...)

Chapter 16, "Combining MVC and WebForms", gives you a mixed salad with ASP.NET MVC and ASP.NET WebForms.

At the end, I recommend this book is a MUST READ for developers who need to know and UNDERSTAND about ASP.NET MVC. You will have no regret to read it.

Enjoy reading :-)