Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


Unit Testing with SqlException in .NET: Only with help from Reflection

If you are writing you code to be able to easily unit test each method, and you would like to unit test situations where a SqlException exception is thrown, then you’ll definitely run into the issue of the SqlException objects constructor being marked “internal.” Members marked “internal” can be a nightmare for unit testing, and they are found all over the place in the .NET Framework. Basically you can’t call “internal” methods, constructors, fields, etc from you own code because it doesn’t resi... [More]

Simple JavaScript Object Reflection API (.NET Style)

I was thinking about how JavaScript JSON serializers go about serializing objects. But how does the serializer know about each of the objects properties? I figured JavaScript must have some method of object reflection (similar to .NET Reflection) and it does. Here's a simple Reflection namespace that allows you to more easily reflect through an objects methods and properties: [code:js] if (typeof PietschSoft == "undefined") var PietschSoft = {}; if (typeof Pietsc... [More]