net-nugget

.NN#9: Simple but Handy

This weeks .Net Nugget is very straight forward and perhaps many of you already know about this little gem: System.IO.Path. How many times have you seen code like this? string fullFilePath = string.Empty; if (filePath.EndsWith("\")) { fullFilePath = string.Concat(filePath, fileName); } else { fullFilePath = string.Concat(filePath, “\”, fileName); } This code is determining if a string that represents a file path ends with a trailing backslash. If it does then it simply populates the fullFilePath variable with the string concatenation of the file path and file name.

.NN #8: Embedding Test Documents in Your Assemblies

On the current project I’m wrapping up we used the Visual Studio Team Test (VSTS) framework and Rhino Mocks to do our unit testing. Mike Levy brought the idea of Rhino Mocks on board the project with him and it was the first I had been exposed to it. I’ve been pretty impressed with it and I know we’ve just scratched the surface of what it can be used for. We are moving our project to test now and it does so with over 1,000 unit tests from the UI (testing presenters since we used the MVP pattern with CAB), mid-tier and even database (we used Visual Studio Team Suite for Database Professionals which included unit tests for databases).

.NN #7: Creating Data Access Contracts with XML

Since SQL Server 2000 the database developers have enjoyed some cool ways to work with XML in the database. Jason Follas is even doing a talk on using XML in the database at the upcoming Cincinnati SQL Server Users Group meeting (Sept 25th, 2007). The story of XML with SQL 2005 is even better than it was with SQL 2000. This ability to parse and deal with XML in the database has opened up a new way for the data access code to communicate with the database.